:root {
  --text-primary: #1d2129;
  --text-secondary: #4e5969;
  --text-placeholder: #86909c;
  --border-color: #dcdfe6;
  --bg-base: #f5f7fa;
  --card-bg: #ffffff;
  --color-success: #00b42a;
  --color-warning: #ff7d00;
  --color-danger: #f53f3f;
  --color-info: #86909c;
  --color-primary: #165dff;
  --color-primary-light: #4080ff;
  --color-primary-bg: #e8f3ff;
  --color-primary-dark: #0e42d2;
  --sidebar-bg: #172940;
  --sidebar-text: #c0ceda;
  --sidebar-active: #165dff;
  --ink: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border-color);
  --soft-line: #edf0f5;
  --paper: var(--card-bg);
  --canvas: var(--bg-base);
  --shadow: 0 10px 30px rgba(29, 33, 41, .10);
  --shadow-soft: 0 3px 12px rgba(29, 33, 41, .06);
  --input: var(--card-bg);
  --subtle: #f7f8fa;
  --table-head: #f7f8fa;
  --row-hover: var(--color-primary-bg);
  --topbar: rgba(255, 255, 255, .96);
  --sidebar: 248px;
}

html[data-theme="indigo"] {
  --color-primary: #5856d6;
  --color-primary-light: #7b79e3;
  --color-primary-bg: #f0f0ff;
  --color-primary-dark: #4543b8;
  --sidebar-bg: #1e1e3a;
  --sidebar-text: #c7c6e2;
  --sidebar-active: #5856d6;
}

* { box-sizing: border-box; }
html { min-width: 320px; overflow-x: hidden; background: var(--canvas); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--canvas); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif; font-size: 14px; line-height: 1.5; letter-spacing: 0; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4, strong { font-weight: 700; }
h1, h2, h3, h4 { line-height: 1.3; }
a, button, input, select, textarea { transition: border-color .16s ease, background-color .16s ease, color .16s ease, box-shadow .16s ease, opacity .16s ease; }
button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--color-primary) 25%, transparent); outline-offset: 2px; }
.hidden { display: none !important; }
.mobile-only { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 5px; color: var(--text-placeholder); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; }
.nowrap { white-space: nowrap; }

.login-screen { position: relative; min-height: 100vh; overflow: hidden; display: grid; grid-template-columns: minmax(520px, 1.15fr) minmax(420px, .85fr); background: #071b4a url("/assets/jifeng-login-background.webp?v=3") center / cover no-repeat; isolation: isolate; }
.login-screen::before { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg, rgba(4, 22, 66, .34), rgba(4, 35, 92, .08) 52%, rgba(7, 34, 78, .26)); }
.login-brand { min-height: 600px; padding: clamp(34px, 4.5vw, 76px); display: flex; color: #fff; }
.login-brand-content { width: 100%; display: flex; flex-direction: column; }
.login-brand-lockup { position: relative; z-index: 1; width: max-content; display: flex; align-items: center; gap: 12px; isolation: isolate; }
.login-brand-lockup::before { content: ""; position: absolute; z-index: -1; left: -80px; top: -34px; width: 340px; height: 112px; background: linear-gradient(90deg, rgba(7, 27, 74, .98) 0 74%, rgba(7, 27, 74, 0)); }
.login-brand-lockup img { width: 58px; height: 48px; object-fit: contain; }
.login-brand-lockup strong, .login-brand-lockup small { display: block; }
.login-brand-lockup strong { font-size: 24px; }
.login-brand-lockup small { margin-top: 3px; color: #cfe8ff; font-size: 10px; font-weight: 700; }
.login-brand-copy { max-width: 690px; margin-top: clamp(86px, 16vh, 168px); text-shadow: 0 3px 18px rgba(0, 20, 64, .35); }
.brand-kicker { margin: 0 0 16px; color: #b8e8ff; font-size: 12px; font-weight: 800; }
.login-brand h1 { width: max-content; max-width: 100%; margin: 0; color: #fff; font-size: 72px; font-weight: 900; line-height: 1.12; background: linear-gradient(105deg, #fff 3%, #9eefff 38%, #55b8ff 68%, #b7a8ff 100%); background-clip: text; filter: drop-shadow(0 10px 24px rgba(0, 52, 135, .38)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.login-brand-copy > p:last-child { max-width: 650px; margin: 22px 0 0; color: #effaff; font-size: 21px; font-weight: 600; line-height: 1.6; }
.brand-mark { display: block; object-fit: contain; }
.brand-mark.small { width: 46px; height: 38px; margin: 0; flex: 0 0 46px; }
.login-benefits { width: min(690px, 100%); margin-top: 46px; padding-top: 28px; position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 30px; }
.login-benefits::before { content: ""; position: absolute; top: 0; left: 0; width: 112px; height: 3px; background: linear-gradient(90deg, #52ddff, rgba(82, 221, 255, 0)); }
.login-benefit { min-width: 0; display: grid; grid-template-columns: 50px minmax(0, 1fr); align-items: center; gap: 14px; color: #fff; }
.login-benefit-icon { width: 50px; height: 50px; display: grid; place-items: center; border: 1px solid rgba(174, 235, 255, .65); border-radius: 50%; color: #fff; background: linear-gradient(145deg, #1fc8ff, #176bff 68%, #654cff); box-shadow: 0 8px 22px rgba(0, 115, 255, .32), inset 0 1px 0 rgba(255, 255, 255, .38); }
.login-benefit-icon svg { width: 24px; height: 24px; stroke-width: 2.2; }
.login-benefit > span:last-child, .login-benefit strong, .login-benefit small { min-width: 0; display: block; }
.login-benefit strong { font-size: 16px; line-height: 1.35; }
.login-benefit small { margin-top: 5px; color: #cfe8ff; font-size: 13px; font-weight: 600; line-height: 1.35; }
.login-panel { position: relative; display: grid; place-items: center; padding: 48px clamp(34px, 5vw, 78px); background: transparent; isolation: isolate; }
.login-panel::before { content: ""; position: absolute; z-index: -1; inset: 0; background: rgba(4, 26, 72, .58); backdrop-filter: blur(3px); }
.login-theme-control { z-index: 3; }
.login-panel > .theme-control > .icon-btn { border-color: rgba(255, 255, 255, .55); color: #fff; background: rgba(8, 42, 99, .46); backdrop-filter: blur(12px); }
.login-form { width: min(430px, 100%); padding: 34px 38px; border: 1px solid rgba(255, 255, 255, .86); border-radius: 8px; display: grid; gap: 18px; background: rgba(255, 255, 255, .96); box-shadow: 0 22px 70px rgba(0, 30, 94, .28); backdrop-filter: blur(16px); }
.login-form-logo { width: 145px; max-height: 138px; margin: -6px auto -10px; object-fit: contain; }
.login-form h2 { margin: 0; font-size: 23px; text-align: center; }
.login-title-group { text-align: center; }
.login-title-group > .muted { margin: 8px 0 0; }
label { display: grid; gap: 7px; color: var(--ink); font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 5px; padding: 9px 11px; color: var(--ink); background: var(--input); outline: none; }
input:hover, select:hover, textarea:hover { border-color: #b8bec9; }
textarea { min-height: 88px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text-placeholder); }
input:focus, select:focus, textarea:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 14%, transparent); }
.demo-accounts { padding-top: 6px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); }
.demo-accounts button { padding: 5px 8px; border: 0; border-bottom: 1px solid var(--border-color); color: var(--color-primary); background: transparent; }
.demo-accounts small { flex-basis: 100%; }

.btn { min-height: 38px; border: 1px solid transparent; border-radius: 5px; padding: 8px 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; color: var(--ink); background: var(--paper); font-weight: 700; line-height: 1.2; text-decoration: none; white-space: nowrap; }
.btn svg, .icon-btn svg, .nav-link svg, .user-button svg { width: 17px; height: 17px; stroke-width: 2; }
.btn:hover:not(:disabled) { border-color: var(--text-placeholder); box-shadow: var(--shadow-soft); }
.btn.primary { color: #fff; background: var(--color-primary); border-color: var(--color-primary); }
.btn.primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }
.btn.secondary { color: #fff; background: var(--color-primary-light); border-color: var(--color-primary-light); }
.btn.quiet { border-color: var(--line); background: var(--paper); }
.btn.danger { color: var(--color-danger); border-color: #ffd5d2; background: #fff2f0; }
.btn.small { min-height: 32px; padding: 5px 9px; font-size: 12px; }
.login-submit { min-height: 46px; }
.icon-btn { width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 5px; display: inline-grid; place-items: center; color: var(--ink); background: var(--paper); }
.icon-btn:hover:not(:disabled) { border-color: var(--color-primary-light); color: var(--color-primary); background: var(--color-primary-bg); }
.theme-control { position: relative; }
.theme-control.login-theme-control { position: absolute; top: 34px; right: 34px; }
.theme-menu { position: absolute; z-index: 80; top: calc(100% + 8px); right: 0; width: 210px; padding: 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow); }
.theme-menu p { margin: 3px 7px 7px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.theme-menu button { width: 100%; min-height: 39px; padding: 6px 7px; border: 0; border-radius: 4px; display: grid; grid-template-columns: 32px 1fr 18px; align-items: center; gap: 9px; color: var(--ink); background: transparent; text-align: left; font-weight: 700; }
.theme-menu button:hover, .theme-menu button.active { background: var(--subtle); }
.theme-menu button svg { width: 16px; opacity: 0; color: var(--color-primary); }
.theme-menu button.active svg { opacity: 1; }
.theme-swatch { width: 30px; height: 20px; border: 1px solid rgba(128, 140, 134, .45); border-radius: 3px; }
.theme-swatch.business { background: linear-gradient(135deg, #172940 0 52%, #165dff 53% 76%, #e8f3ff 77%); }
.theme-swatch.indigo { background: linear-gradient(135deg, #1e1e3a 0 52%, #5856d6 53% 76%, #f0f0ff 77%); }
.language-control { height: 38px; padding: 3px; border: 1px solid var(--line); border-radius: 5px; display: inline-flex; align-items: center; background: var(--paper); }
.language-control button { min-width: 34px; height: 30px; padding: 0 7px; border: 0; border-radius: 3px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 800; }
.language-control button.active { color: #fff; background: var(--color-primary); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); grid-template-rows: 72px minmax(0, 1fr); }
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: var(--sidebar); padding: 18px 12px 12px; display: flex; flex-direction: column; overflow: hidden; color: var(--sidebar-text); background: var(--sidebar-bg); }
.sidebar-backdrop { display: none; }
.app-brand { height: 52px; margin: 0 8px 25px; display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.app-brand strong, .app-brand small { display: block; }
.app-brand strong { font-size: 18px; }
.app-brand small { margin-top: 2px; color: var(--sidebar-text); font-size: 10px; }
.main-nav { min-height: 0; padding-right: 2px; display: grid; align-content: start; gap: 3px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.22) transparent; }
.nav-section { margin: 15px 12px 6px; color: var(--text-placeholder); font-size: 10px; font-weight: 800; }
.nav-link { width: 100%; min-height: 42px; padding: 9px 12px; border: 0; border-radius: 6px; display: flex; align-items: center; gap: 11px; color: var(--sidebar-text); background: transparent; text-align: left; font-weight: 700; line-height: 1.25; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-link.active { color: #fff; background: var(--sidebar-active); box-shadow: 0 6px 16px rgba(0, 0, 0, .14); }
.nav-link .nav-count { min-width: 22px; margin-left: auto; padding: 2px 6px; border-radius: 10px; color: #fff; background: var(--color-warning); font-size: 10px; text-align: center; }
.sidebar-foot { flex: 0 0 auto; margin-top: auto; padding-top: 12px; }
.service-dot { margin: 0 12px 12px; color: var(--sidebar-text); font-size: 10px; }
.service-dot > span:first-child { width: 7px; height: 7px; margin-right: 6px; display: inline-block; border-radius: 50%; background: var(--color-success); }
.user-button { width: 100%; min-height: 58px; padding: 8px; border: 1px solid rgba(255,255,255,.08); border-radius: 6px; display: grid; grid-template-columns: 34px 1fr 20px; align-items: center; gap: 9px; color: #fff; background: rgba(0,0,0,.12); text-align: left; }
.user-button .avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--color-primary-light); font-weight: 800; }
.user-button strong, .user-button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-button strong { font-size: 12px; }
.user-button small { margin-top: 3px; color: var(--sidebar-text); font-size: 10px; }
.sidebar-logout { width: 100%; min-height: 34px; margin-top: 7px; padding: 6px 9px; border: 1px solid rgba(255,255,255,.08); border-radius: 5px; display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--sidebar-text); background: transparent; font-size: 11px; font-weight: 700; }
.sidebar-logout:hover { color: #fff; border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.07); }
.sidebar-logout svg { width: 15px; height: 15px; }

.topbar { position: sticky; z-index: 20; top: 0; grid-column: 2; grid-row: 1; min-width: 0; height: 72px; padding: 0 clamp(20px, 2.4vw, 36px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--topbar); backdrop-filter: blur(12px); }
.topbar h1 { margin: 0; font-size: 20px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.main-content { grid-column: 2; grid-row: 2; min-width: 0; padding: 24px clamp(20px, 2.4vw, 36px) 56px; }
.main-content:focus { outline: none; }
.page { width: 100%; max-width: 1560px; margin: 0 auto; }
.page-head { min-height: 46px; margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.page-head h2 { margin: 0; font-size: 19px; }
.page-head p { max-width: 760px; margin: 6px 0 0; color: var(--muted); line-height: 1.55; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)); gap: 14px; }
.stat-card { min-height: 112px; padding: 17px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); box-shadow: var(--shadow-soft); }
.stat-card-button { width: 100%; color: var(--ink); text-align: left; cursor: pointer; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.stat-card-button:hover { border-color: var(--color-primary-light); box-shadow: 0 8px 20px rgba(22, 93, 255, .12); transform: translateY(-1px); }
.stat-card-button:focus-visible { outline: 3px solid color-mix(in srgb, var(--color-primary) 28%, transparent); outline-offset: 2px; }
.stat-top { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-top span:last-child { width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; color: var(--color-primary); background: var(--color-primary-bg); }
.stat-top svg { width: 15px; }
.stat-card strong { margin-top: 10px; display: block; font-size: 28px; line-height: 1; }
.stat-card.urgent { border-top: 3px solid var(--color-danger); }
.dashboard-hero { position: relative; width: 100%; min-height: 176px; overflow: hidden; margin-bottom: 16px; padding: 26px 28px; border: 1px solid rgba(22, 93, 255, .1); border-radius: 24px; display: flex; align-items: center; color: var(--text-primary); background: linear-gradient(115deg, #F8FAFF 0%, #EAF4FF 52%, #D7ECFF 100%); box-shadow: 0 14px 34px rgba(22, 93, 255, .12); isolation: isolate; }
.dashboard-hero::before { content: ""; position: absolute; z-index: 0; inset: 0; background: linear-gradient(rgba(22, 93, 255, .075) 1px, transparent 1px), linear-gradient(90deg, rgba(22, 93, 255, .075) 1px, transparent 1px), linear-gradient(rgba(64, 128, 255, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(64, 128, 255, .04) 1px, transparent 1px); background-size: 28px 28px, 28px 28px, 112px 112px, 112px 112px; opacity: .6; mask-image: linear-gradient(90deg, rgba(0, 0, 0, .38), rgba(0, 0, 0, .8)); pointer-events: none; }
.dashboard-hero-content { position: relative; z-index: 3; flex: 0 1 60%; max-width: 620px; }
.dashboard-hero h2 { max-width: 580px; margin: 0; color: #1D2129; font-size: 24px; line-height: 1.3; }
.dashboard-hero-content > p { max-width: 520px; margin: 10px 0 0; color: #4E5969; font-size: 13px; line-height: 1.6; }
.dashboard-hero .page-actions { margin-top: 18px; justify-content: flex-start; }
.dashboard-hero .btn.primary { min-height: 42px; padding: 0 18px; color: #fff; background: #165DFF; border-color: #165DFF; box-shadow: 0 8px 20px rgba(22, 93, 255, .2); }
.dashboard-hero .btn.primary:hover { color: #fff; background: #4080FF; border-color: #4080FF; }
.dashboard-hero-visual { position: absolute; z-index: 1; inset: 0 0 0 auto; width: 40%; pointer-events: none; }
.dashboard-hero-glow { position: absolute; top: -8%; right: -10%; width: 62%; height: 116%; background: linear-gradient(270deg, rgba(22, 93, 255, .28) 0%, rgba(64, 128, 255, .13) 38%, rgba(123, 185, 255, 0) 100%); filter: blur(32px); opacity: .72; transform: scale(1.08); }
.dashboard-trend { position: absolute; right: -1px; bottom: 0; width: 112%; height: 88%; overflow: visible; }
.dashboard-trend-area { fill: url(#dashboard-trend-fill); }
.dashboard-trend-shadow { fill: none; stroke: rgba(22, 93, 255, .18); stroke-width: 14; filter: blur(10px); vector-effect: non-scaling-stroke; }
.dashboard-trend-line { fill: none; stroke: url(#dashboard-trend-stroke); stroke-width: 4; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.dashboard-grid { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 16px; }
.dashboard-type-section { margin-top: 22px; }
.dashboard-section-head { min-height: 42px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dashboard-section-head > div > span { color: var(--color-primary); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.dashboard-section-head h3 { margin: 3px 0 0; font-size: 17px; }
.dashboard-section-head > strong { color: var(--text-primary); font-size: 22px; }
.dashboard-section-head > strong small { color: var(--muted); font-size: 12px; font-weight: 600; }
.dashboard-credit-section { margin-top: 28px; }
.dashboard-grid-single { grid-template-columns: minmax(0, 1fr); }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); box-shadow: var(--shadow-soft); }
.panel-head { min-height: 56px; padding: 13px 16px; border-bottom: 1px solid var(--soft-line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h3 { margin: 0; font-size: 14px; }
.panel-body { padding: 16px; }
.size-bars { display: grid; gap: 13px; }
.size-row { display: grid; grid-template-columns: 45px minmax(0, 1fr) 36px; align-items: center; gap: 10px; font-size: 12px; font-weight: 700; }
.bar-track { height: 8px; overflow: hidden; border-radius: 2px; background: var(--soft-line); }
.bar-value { height: 100%; background: var(--color-primary); }
.w-10 { width: 10%; }
.w-20 { width: 20%; }
.w-30 { width: 30%; }
.w-40 { width: 40%; }
.w-50 { width: 50%; }
.w-60 { width: 60%; }
.w-70 { width: 70%; }
.w-80 { width: 80%; }
.w-90 { width: 90%; }
.w-100 { width: 100%; }
.daily-chart { height: 220px; padding-top: 16px; display: flex; align-items: flex-end; gap: 16px; }
.day-column { flex: 1; min-width: 36px; display: grid; grid-template-rows: 1fr 18px; align-items: end; gap: 8px; color: var(--muted); font-size: 10px; text-align: center; }
.day-bar { position: relative; min-height: 4px; background: var(--color-primary-light); border-radius: 3px 3px 0 0; }
.h-10 { height: 10%; }
.h-20 { height: 20%; }
.h-30 { height: 30%; }
.h-40 { height: 40%; }
.h-50 { height: 50%; }
.h-60 { height: 60%; }
.h-70 { height: 70%; }
.h-80 { height: 80%; }
.h-90 { height: 90%; }
.h-100 { height: 100%; }
.day-bar span { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); color: var(--ink); font-weight: 800; }

.toolbar { margin-bottom: 14px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; display: flex; align-items: center; gap: 8px; background: var(--paper); box-shadow: var(--shadow-soft); }
.toolbar > label { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.search-box { position: relative; flex: 1; min-width: 190px; }
.search-box svg { position: absolute; left: 11px; top: 50%; width: 16px; transform: translateY(-50%); color: var(--text-placeholder); }
.search-box input { padding-left: 36px; }
.toolbar select { width: auto; min-width: 132px; }
.production-toolbar { flex-wrap: wrap; }
.quick-piece-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.quick-piece-actions strong { margin: 0 2px 0 4px; font-size: 11px; }
.selected-production-count { margin-left: auto; white-space: nowrap; }
.table-wrap { max-width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); box-shadow: var(--shadow-soft); scrollbar-gutter: stable; -webkit-overflow-scrolling: touch; }
.pagination { min-height: 58px; margin-top: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; display: grid; grid-template-columns: minmax(100px, 1fr) auto minmax(260px, 1fr); align-items: center; gap: 12px; background: var(--paper); box-shadow: var(--shadow-soft); }
.pagination-total { color: var(--muted); font-size: 12px; }
.pagination-total strong { color: var(--ink); }
.pagination-pages, .pagination-options { display: flex; align-items: center; gap: 5px; }
.pagination-page { min-width: 36px; height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: var(--paper); font-weight: 700; }
.pagination-page:hover, .pagination-page.active { color: #fff; border-color: var(--color-primary); background: var(--color-primary); }
.pagination-gap { min-width: 20px; color: var(--text-placeholder); text-align: center; }
.pagination-options { justify-content: flex-end; }
.pagination-options label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; font-size: 12px; font-weight: 600; }
.pagination-options select { width: 82px; min-height: 36px; padding: 6px 8px; }
.pagination-options input { width: 64px; min-height: 36px; padding: 6px 8px; text-align: center; }
table { width: 100%; border-collapse: collapse; font-size: 12px; line-height: 1.45; }
th { position: sticky; top: 0; z-index: 1; height: 44px; padding: 0 12px; border-bottom: 1px solid var(--line); color: var(--muted); background: var(--table-head); text-align: left; white-space: nowrap; font-size: 11px; font-weight: 700; }
td { min-height: 58px; padding: 11px 12px; border-top: 1px solid var(--soft-line); vertical-align: middle; word-break: keep-all; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: color-mix(in srgb, var(--color-primary) 3%, var(--paper)); }
tbody tr.clickable:hover { background: var(--row-hover); cursor: pointer; }
.order-cell { min-width: 140px; }
.order-cell strong, .order-cell small { display: block; }
.order-cell strong { white-space: nowrap; }
.order-cell small { margin-top: 4px; color: var(--muted); }
.platform-tag { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; }
.platform-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-primary); }
.platform-dot.tiktok { background: var(--ink); }
.status { padding: 4px 7px; border-radius: 3px; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; color: var(--color-info); background: #f2f3f5; font-size: 11px; font-weight: 800; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.pending_review, .status.pending_production { color: var(--color-warning); background: #fff7e8; }
.status.in_production { color: var(--color-primary); background: var(--color-primary-bg); }
.status.completed, .status.shipped { color: var(--color-success); background: #e8ffea; }
.status.exception, .status.cancelled { color: var(--color-danger); background: #fff2f0; }
.urgent-flag { padding: 3px 6px; border-radius: 3px; color: #fff; background: var(--color-danger); font-size: 10px; font-weight: 900; }
.deadline-warning { color: var(--color-danger); font-weight: 800; }
.empty-state { min-height: 260px; padding: 40px; display: grid; place-items: center; align-content: center; color: var(--muted); text-align: center; }
.empty-state svg { width: 34px; height: 34px; margin-bottom: 12px; color: var(--text-placeholder); }
.empty-state h3 { margin: 0; color: var(--ink); }
.empty-state p { max-width: 420px; margin: 7px 0 0; }

.drop-zone { min-height: 265px; padding: 34px; border: 1px dashed var(--line); border-radius: 6px; display: grid; place-items: center; align-content: center; color: var(--muted); background: var(--subtle); text-align: center; transition: .15s; }
.drop-zone.dragging { border-color: var(--color-primary); background: var(--color-primary-bg); }
.drop-icon { width: 52px; height: 52px; margin-bottom: 15px; border-radius: 50%; display: grid; place-items: center; color: var(--color-primary); background: var(--color-primary-bg); }
.drop-icon svg { width: 23px; height: 23px; }
.drop-zone h3 { margin: 0; color: var(--ink); font-size: 17px; }
.drop-zone p { margin: 7px 0 16px; }
.drop-zone.compact-drop { min-height: 190px; }
.import-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; }
.guide-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 13px; }
.guide-list li { display: grid; grid-template-columns: 25px 1fr; gap: 10px; color: var(--muted); line-height: 1.5; }
.guide-list b { width: 23px; height: 23px; border: 1px solid var(--border-color); border-radius: 50%; display: grid; place-items: center; color: var(--color-primary); font-size: 10px; }
.guide-list strong { color: var(--ink); }
.import-result { margin-top: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); box-shadow: var(--shadow-soft); }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.result-stats div { min-width: 0; padding: 12px; border: 1px solid var(--soft-line); border-radius: 5px; background: var(--subtle); }
.result-stats strong, .result-stats span { display: block; }
.result-stats strong { font-size: 20px; }
.result-stats span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.error-list { max-height: 160px; overflow: auto; margin-top: 12px; color: var(--color-danger); font-size: 12px; }
.import-preview-table { max-height: 430px; margin-top: 12px; }
.import-preview-table table { min-width: 1420px; }
.import-preview-table td { vertical-align: middle; }
.import-preview-table td small { display: block; margin-top: 5px; color: var(--muted); }
.import-preview-table select { min-width: 150px; }
.import-assignment-toolbar { margin-top: 12px; margin-bottom: 0; flex-wrap: wrap; }
.import-assignment-toolbar strong { margin-right: 4px; }
.import-assignment-toolbar .muted { margin-left: auto; }
.import-select-cell { width: 48px; text-align: center; }
.import-row-matched { background: color-mix(in srgb, var(--color-success) 5%, var(--paper)); }
.import-row-error { background: color-mix(in srgb, var(--color-danger) 7%, var(--paper)); }
.import-row-error td { border-top-color: color-mix(in srgb, var(--color-danger) 35%, var(--line)); }
.import-preview-table .input-error { border-color: var(--color-danger); box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-danger) 14%, transparent); }
.import-preview-table .field-error { color: var(--color-danger); font-weight: 700; }
.import-preview-table .preview-images { min-width: 76px; }
.import-preview-table .preview-images img { width: 42px; height: 42px; object-fit: cover; display: inline-block; margin-right: 4px; border-radius: 4px; cursor: zoom-in; }
.preview-images { width: 122px; display: grid; grid-template-columns: repeat(2, 56px); gap: 5px; }
.preview-images img { width: 56px; height: 56px; border: 1px solid var(--soft-line); border-radius: 4px; object-fit: contain; background: var(--subtle); cursor: zoom-in; }
.preview-item-lines { min-width: 160px; display: grid; gap: 8px; }
.preview-item-lines > div + div { padding-top: 8px; border-top: 1px solid var(--soft-line); }
.preview-limit { margin: 8px 0 0; font-size: 11px; }
.confirm-bar { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--soft-line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.confirm-bar > div:first-child { display: grid; gap: 4px; }
.import-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.pdf-attempt-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.success-note { margin-top: 14px; padding: 14px; border-left: 3px solid var(--color-success); display: flex; align-items: center; gap: 10px; color: var(--color-success); background: #f0fff4; }
.success-note svg { width: 22px; height: 22px; }
.success-note strong, .success-note p { display: block; }
.success-note p { margin: 4px 0 0; color: var(--muted); }
.loading-state.compact { min-height: 110px; }
.small-spinner { width: 14px; height: 14px; margin: 0; border-width: 2px; }

.factory-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.product-card { min-width: 0; display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); box-shadow: var(--shadow-soft); }
.product-card h3 { margin: 5px 0; font-size: 15px; }
.product-card p { margin: 0; color: var(--muted); font-size: 12px; }
.product-preview { width: 72px; height: 72px; display: grid; place-items: center; overflow: hidden; border-radius: 6px; background: var(--subtle); }
.product-preview img { width: 100%; height: 100%; object-fit: cover; }
.catalog-grid .empty-state { grid-column: 1 / -1; }
.catalog-card .product-preview img { cursor: zoom-in; }
.catalog-product-copy { min-width: 0; }
.catalog-product-copy h3, .catalog-product-copy p { overflow-wrap: anywhere; }
.catalog-sku-count { display: inline-block; margin-top: 6px; color: var(--muted); }
.catalog-price { align-self: stretch; align-content: center; }
.product-price { white-space: nowrap; color: var(--color-primary); }
.product-price small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 500; text-align: right; }
.management-card-side { display: grid; justify-items: end; gap: 10px; }
.management-card-actions { display: flex; align-items: center; gap: 5px; }
.management-card-actions .icon-btn { width: 32px; height: 32px; }
.icon-btn.danger-icon { color: var(--color-danger); }
.icon-btn.danger-icon:hover { color: #fff; border-color: var(--color-danger); background: var(--color-danger); }
.permission-grid { display: grid; gap: 10px; margin: 16px 0; }
.permission-factory { padding: 12px; border: 1px solid var(--line); border-radius: 6px; }
.permission-heading { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.permission-heading span { color: var(--muted); font-size: 12px; }
.permission-products { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 10px 0 0 28px; }
.permission-products label { display: inline-flex; align-items: center; gap: 6px; }
.factory-card { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); box-shadow: var(--shadow-soft); }
.factory-card-top { display: flex; justify-content: space-between; gap: 12px; }
.factory-card-controls { display: grid; justify-items: end; gap: 9px; }
.factory-card h3 { margin: 0; font-size: 15px; }
.factory-card p { margin: 7px 0 0; color: var(--muted); }
.factory-code { color: var(--color-primary); font-family: Consolas, monospace; font-weight: 800; }
.active-dot { color: var(--color-success); font-size: 11px; font-weight: 800; }
.inactive-dot { color: var(--color-info); font-size: 11px; font-weight: 800; }
.management-section { margin: 14px 0; }
.compact-form { gap: 12px; }
.compact-toolbar { flex-wrap: wrap; }
.compact-toolbar label { min-width: 145px; }
.compact-toolbar label span { color: var(--muted); font-size: 10px; }
.compact-toolbar input[type="date"] { min-width: 145px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.credit-balance { color: var(--color-primary); font-size: 15px; font-weight: 800; }
.credit-change { font-weight: 800; }
.credit-change.positive { color: var(--color-success); }
.credit-change.negative { color: var(--color-danger); }
.consumption-layout { display: grid; grid-template-columns: minmax(150px, .55fr) minmax(190px, 1fr) minmax(220px, 1fr); gap: 18px; align-items: start; }
.consumption-total { min-height: 126px; padding: 16px; border-left: 3px solid var(--color-primary); background: var(--color-primary-bg); }
.consumption-total span, .consumption-total strong, .consumption-total small { display: block; }
.consumption-total span { color: var(--muted); font-size: 11px; font-weight: 700; }
.consumption-total strong { margin-top: 13px; color: var(--color-primary); font-size: 34px; line-height: 1; }
.consumption-total small { margin-top: 6px; color: var(--muted); }
.consumption-layout h4 { margin: 2px 0 9px; font-size: 12px; }
.mini-data-list { display: grid; gap: 5px; max-height: 160px; overflow: auto; }
.mini-data-list div { padding: 7px 9px; border-bottom: 1px solid var(--soft-line); display: flex; justify-content: space-between; gap: 10px; font-size: 11px; }
.mini-data-list span { color: var(--muted); }
.mini-data-list strong { white-space: nowrap; }
.batch-list { display: grid; gap: 8px; }
.batch-row { min-height: 72px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; display: grid; grid-template-columns: minmax(150px, 1fr) minmax(130px, .9fr) minmax(200px, 1.25fr) minmax(220px, auto); align-items: center; gap: 12px; background: var(--paper); box-shadow: var(--shadow-soft); }
.batch-row strong, .batch-row small { display: block; }
.batch-row small { margin-top: 4px; color: var(--muted); }
.package-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; }
.package-status svg { width: 15px; height: 15px; }
.package-status.pending { color: var(--color-warning); }
.package-status.ready { color: var(--color-primary); }
.package-status.downloaded { color: var(--color-success); }
.batch-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }

.detail-dialog { width: min(1040px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 8px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow); }
.detail-dialog::backdrop { background: rgba(12, 24, 18, .48); backdrop-filter: blur(2px); }
.detail-dialog.stock-adjust-dialog { width: min(520px, calc(100vw - 32px)); margin: auto; }
.inventory-adjust-form { display: grid; gap: 16px; }
.inventory-adjust-form label { display: grid; gap: 7px; }
.inventory-adjust-form textarea { min-height: 92px; resize: vertical; }
.inventory-adjust-summary { padding: 14px; border-left: 3px solid var(--color-primary); background: var(--color-primary-bg); }
.inventory-adjust-summary span, .inventory-adjust-summary strong, .inventory-adjust-summary small { display: block; }
.inventory-adjust-summary span, .inventory-adjust-summary small { color: var(--muted); }
.inventory-adjust-summary span { font-size: 10px; }
.inventory-adjust-summary strong { margin-top: 5px; font-size: 14px; }
.inventory-adjust-summary small { margin-top: 6px; line-height: 1.5; }
.dialog-head { position: sticky; z-index: 3; top: 0; min-height: 70px; padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; background: var(--paper); }
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-content { padding: 20px; overflow-x: hidden; }
.detail-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; border: 1px solid var(--line); background: var(--line); }
.detail-meta div { min-height: 66px; padding: 11px; background: var(--paper); }
.detail-meta span, .detail-meta strong { display: block; }
.detail-meta span { color: var(--muted); font-size: 10px; }
.detail-meta strong { margin-top: 7px; overflow-wrap: anywhere; font-size: 12px; }
.detail-meta strong.mono { font-size: 15px; line-height: 1.35; }
.detail-actions { margin: 14px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.section-title { margin: 22px 0 10px; display: flex; align-items: center; justify-content: space-between; }
.section-title h3 { margin: 0; font-size: 14px; }
.item-list { display: grid; gap: 8px; }
.item-card { min-width: 0; min-height: 112px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; display: grid; grid-template-columns: 88px minmax(180px, 1fr) 130px 100px auto; align-items: center; gap: 13px; background: var(--paper); }
.detail-dialog .item-card { grid-template-columns: minmax(88px, 184px) minmax(180px, 1fr) 130px 100px auto; }
.item-images { display: grid; grid-template-columns: repeat(2, 88px); gap: 6px; }
.item-image-preview { min-width: 0; display: grid; gap: 4px; justify-items: center; }
.item-image-preview > span { color: var(--muted); font-size: 10px; font-weight: 700; }
.item-image { width: 88px; height: 88px; overflow: hidden; border: 1px solid var(--soft-line); border-radius: 4px; display: grid; place-items: center; background-color: #f2f3f5; background-image: linear-gradient(45deg, var(--border-color) 25%, transparent 25%), linear-gradient(-45deg, var(--border-color) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--border-color) 75%), linear-gradient(-45deg, transparent 75%, var(--border-color) 75%); background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }
.item-image img { width: 100%; height: 100%; object-fit: contain; }
.item-image img[data-image-zoom] { cursor: zoom-in; }
.item-card h4 { margin: 0; font-size: 13px; }
.item-card p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.item-card p.mono, .item-card .mono { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.item-card h4 { font-size: 15px; }
.match-key { font-size: 14px; font-weight: 700; }
.item-spec strong, .item-spec span { display: block; }
.item-spec span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.item-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.password-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.password-entry .btn { min-height: 42px; white-space: nowrap; }
.password-form-field > small { display: block; margin-top: 5px; }
.account-reset-summary { min-height: 86px; padding: 13px; border-left: 3px solid var(--color-primary); background: var(--color-primary-bg); }
.account-reset-summary span, .account-reset-summary strong, .account-reset-summary small { display: block; }
.account-reset-summary span { color: var(--muted); font-size: 10px; }
.account-reset-summary strong { margin-top: 7px; }
.account-reset-summary small { margin-top: 8px; color: var(--muted); line-height: 1.5; }
.credential-note { display: flex; align-items: flex-start; gap: 12px; padding: 14px 0 18px; border-bottom: 1px solid var(--soft-line); }
.credential-note > svg { width: 28px; height: 28px; flex: 0 0 auto; color: var(--color-success); }
.credential-note strong { font-size: 14px; }
.credential-note p { margin: 5px 0 0; color: var(--muted); line-height: 1.5; }
.credential-list { margin: 0; }
.credential-list > div { min-height: 52px; padding: 10px 0; border-bottom: 1px solid var(--soft-line); display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 12px; }
.credential-list dt { color: var(--muted); font-size: 11px; }
.credential-list dd { margin: 0; overflow-wrap: anywhere; font-weight: 750; }
.credential-password { color: var(--color-primary); font-size: 15px; user-select: all; }
.credential-actions { margin-top: 18px; }
.profile-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .75fr); gap: 14px; }
.profile-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.scan-layout { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(360px, 1.2fr); gap: 14px; }
.scan-box { min-height: 330px; padding: 18px; display: grid; align-content: start; }
.scan-input { display: flex; gap: 8px; }
.scan-input input { flex: 1; }
.scanner-ready { min-height: 220px; margin-top: 14px; border: 1px dashed var(--line); border-radius: 5px; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted); background: var(--subtle); text-align: center; }
.scanner-ready svg { width: 42px; height: 42px; color: var(--color-primary); }
.scanner-ready strong { color: var(--ink); font-size: 16px; }
.scanner-ready span { font-size: 11px; }
.scan-result { min-height: 330px; }
.scan-order-head { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.scan-order-head h3 { margin: 3px 0; font-size: 18px; }
.scan-order-head p { margin: 4px 0 0; color: var(--muted); }
.scan-data { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scan-data div { padding: 10px; border: 1px solid var(--soft-line); background: var(--subtle); }
.scan-data span, .scan-data strong { display: block; }
.scan-data span { color: var(--muted); font-size: 10px; }
.scan-data strong { margin-top: 4px; }
.scan-item-summary { margin-top: 12px; display: grid; gap: 5px; }
.scan-item-summary div { padding: 8px 10px; border-bottom: 1px solid var(--soft-line); display: flex; justify-content: space-between; gap: 12px; font-size: 11px; }
.scan-item-summary span { color: var(--muted); }
.scan-item-summary strong { text-align: right; }

.stock-value { font-size: 15px; font-weight: 800; }
.stock-value.low { color: var(--color-danger); }
.checkbox { width: 17px; min-height: 17px; accent-color: var(--color-primary); }
.loading-state { min-height: 300px; display: grid; place-items: center; align-content: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; margin-bottom: 10px; border: 3px solid var(--border-color); border-top-color: var(--color-primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast-region { position: fixed; z-index: 1000; top: 18px; left: 50%; width: min(420px, calc(100vw - 28px)); display: grid; gap: 8px; pointer-events: none; transform: translateX(-50%); }
.toast { padding: 13px 15px; border: 1px solid var(--line); border-left: 4px solid var(--color-primary); border-radius: 6px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow); font-weight: 650; line-height: 1.45; pointer-events: auto; animation: toast-in .2s ease-out; }
.toast.error { border-left-color: var(--color-danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

body.image-viewer-open { overflow: hidden; }
.image-viewer { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; border: 0; inset: 0; padding: 72px 24px 24px; place-items: center; overflow: hidden; background: rgba(7, 12, 20, .88); backdrop-filter: blur(4px); }
.image-viewer[open] { display: grid; }
.image-viewer::backdrop { background: transparent; }
.image-viewer-toolbar { position: absolute; top: 16px; right: 18px; display: flex; align-items: center; gap: 8px; }
.image-viewer-toolbar .btn, .image-viewer-toolbar .icon-btn { color: #fff; border-color: rgba(255,255,255,.38); background: rgba(20, 27, 40, .82); }
.image-viewer > img { max-width: min(1400px, 96vw); max-height: calc(100dvh - 104px); object-fit: contain; box-shadow: 0 18px 60px rgba(0,0,0,.38); }

.print-page { display: none; }
body.print-mode { background: #fff; }
body.print-mode .login-screen, body.print-mode .app-shell, body.print-mode dialog, body.print-mode .toast-region { display: none !important; }
body.print-mode .print-page { display: block; padding: 10mm; color: #111; background: #fff; }
.print-toolbar { margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.print-sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; }
.print-item { break-inside: avoid; aspect-ratio: 1 / 1.18; padding: 4mm; border: .3mm solid #222; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.print-artwork { min-height: 0; display: grid; place-items: center; }
.print-artwork img { width: 100%; height: 100%; object-fit: contain; }
.print-info { padding-top: 3mm; border-top: .3mm solid #222; display: grid; grid-template-columns: 1fr 22mm; gap: 3mm; align-items: end; }
.print-info h3 { margin: 0 0 2mm; font-size: 11pt; }
.print-info p { margin: 1mm 0; font-size: 8pt; }
.print-qr { width: 22mm; height: 22mm; }
.print-qr-block { display: grid; justify-items: center; gap: 1mm; }
.print-qr-block span { max-width: 24mm; overflow-wrap: anywhere; text-align: center; font-size: 5.5pt; line-height: 1.15; }

@media (max-width: 1280px) {
  .stat-grid { grid-template-columns: repeat(4, minmax(140px, 1fr)); }
}

@media (max-width: 1180px) {
  .dashboard-grid, .import-layout, .scan-layout, .profile-layout, .consumption-layout { grid-template-columns: 1fr; }
  .import-layout > aside .guide-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-dialog .item-card { grid-template-columns: 88px minmax(170px, 1fr) 120px auto; }
  .detail-dialog .item-card > .status { display: none; }
}

@media (max-width: 1000px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
  .item-card { grid-template-columns: 76px minmax(160px, 1fr) 110px auto; }
  .item-image { width: 76px; height: 76px; }
  .item-card > .status { display: none; }
  .batch-row { grid-template-columns: minmax(150px, 1fr) minmax(190px, 1fr) auto; }
  .batch-row > :nth-child(2) { display: none; }
  .pagination { grid-template-columns: 1fr auto; }
  .pagination-options { grid-column: 1 / -1; justify-content: center; }
}

@media (max-width: 960px) {
  .login-screen { display: block; min-height: 100vh; padding-bottom: 28px; background-position: 58% center; }
  .login-brand { min-height: 148px; padding: 24px; }
  .login-brand-lockup img { width: 50px; height: 42px; }
  .login-brand-lockup strong { font-size: 21px; }
  .login-brand-copy, .login-benefits { display: none; }
  .login-panel { padding: 0 20px 28px; place-items: start center; }
  .theme-control.login-theme-control { top: 24px; right: 22px; }
  .login-form { padding: 28px; gap: 16px; }
  .login-form-logo { width: 124px; max-height: 116px; }
}

@media (min-width: 961px) and (max-width: 1200px) {
  .login-brand-copy { max-width: 500px; margin-top: 90px; }
  .login-brand h1 { font-size: 56px; }
  .login-brand-copy > p:last-child { font-size: 18px; }
  .login-benefits { max-width: 500px; margin-top: 36px; gap: 18px; }
  .login-benefit { grid-template-columns: 44px minmax(0, 1fr); gap: 10px; }
  .login-benefit-icon { width: 44px; height: 44px; }
  .login-benefit strong { font-size: 14px; }
  .login-benefit small { font-size: 12px; }
}

@media (max-width: 900px) {
  :root { --sidebar: 264px; }
  .mobile-only { display: inline-grid !important; }
  .app-shell { display: block; }
  .app-shell.menu-open { height: 100dvh; overflow: hidden; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .app-shell.menu-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 25; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: rgba(17, 24, 39, .42); backdrop-filter: blur(2px); }
  .app-shell.menu-open .sidebar-backdrop { display: block; }
  .topbar { height: 64px; padding: 0 18px; }
  .topbar > div:nth-child(2) { min-width: 0; flex: 1; }
  .topbar h1 { overflow: hidden; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .eyebrow { display: none; }
  .main-content { padding: 20px 18px 44px; }
}

@media (max-width: 760px) {
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar h1 { font-size: 17px; }
  .topbar-actions { gap: 5px; }
  .topbar-actions .btn span { display: none; }
  #refresh-button { display: none !important; }
  #quick-scan { min-width: 38px; padding: 0 9px; }
  .language-control { height: 36px; }
  .language-control button { min-width: 31px; }
  .main-content { padding: 18px 14px 40px; }
  .dashboard-hero { min-height: 178px; padding: 22px; }
  .dashboard-hero-content { flex-basis: 72%; max-width: 430px; }
  .dashboard-hero h2 { max-width: 360px; font-size: 20px; }
  .dashboard-hero-content > p { max-width: 330px; }
  .dashboard-hero .page-actions { margin-top: 16px; }
  .dashboard-hero-visual { width: 52%; }
  .dashboard-trend { width: 118%; height: 86%; }
  .page-head { display: block; }
  .page-head h2 { font-size: 18px; }
  .page-actions { margin-top: 12px; justify-content: flex-start; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat-card { min-height: 100px; padding: 15px; }
  .stat-card strong { font-size: 24px; }
  .daily-chart { height: 190px; gap: 8px; }
  .day-column { min-width: 28px; }
  .toolbar { align-items: stretch; flex-wrap: wrap; }
  .toolbar > label { display: inline-flex; align-items: center; }
  .search-box { flex-basis: 100%; }
  .toolbar select { min-width: 120px; flex: 1; }
  .quick-piece-actions { width: 100%; }
  .selected-production-count { width: 100%; margin-left: 0; }
  .table-wrap { border-radius: 6px; }
  .table-wrap table { min-width: 760px; }
  .import-preview-table table { min-width: 1420px; }
  th { height: 42px; }
  td { padding: 10px; }
  .import-layout > aside .guide-list { grid-template-columns: 1fr; }
  .import-result { padding: 12px; }
  .import-assignment-toolbar .muted { width: 100%; margin-left: 0; }
  .permission-heading { grid-template-columns: auto 1fr; }
  .permission-heading span { grid-column: 2; }
  .result-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-dialog { width: 100vw; max-width: none; max-height: 92dvh; margin: auto 0 0; border-radius: 8px 8px 0 0; }
  .detail-dialog.stock-adjust-dialog { width: min(520px, calc(100vw - 24px)); margin: auto; border-radius: 8px; }
  .dialog-head { min-height: 62px; padding: 12px 14px; }
  .dialog-content { padding: 14px; }
  .detail-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item-card, .detail-dialog .item-card { grid-template-columns: 68px minmax(0, 1fr) auto; align-items: start; }
  .detail-dialog .item-images { grid-column: 1 / -1; }
  .item-images { grid-template-columns: repeat(2, 68px); }
  .item-image { width: 68px; height: 68px; }
  .item-card .item-spec { grid-column: 2; }
  .item-card .item-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .confirm-bar { align-items: stretch; flex-direction: column; }
  .import-actions { justify-content: flex-start; flex-wrap: wrap; }
  .batch-row { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .batch-row > :nth-child(2) { display: none; }
  .batch-actions { justify-content: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .form-actions { justify-content: stretch; }
  .form-actions .btn { flex: 1; }
  .password-entry { grid-template-columns: 1fr; }
  .credential-list > div { grid-template-columns: 88px minmax(0, 1fr); }
  .toast-region { top: 10px; }
  .pagination { grid-template-columns: 1fr; justify-items: center; }
  .pagination-options { grid-column: auto; flex-wrap: wrap; }
  .pagination-total { justify-self: start; }
  .image-viewer { padding: 68px 10px 12px; }
  .image-viewer-toolbar { top: 10px; right: 10px; }
}

@media (max-width: 420px) {
  .login-brand { min-height: 124px; padding: 18px; }
  .login-panel { padding: 0 12px 20px; }
  .login-form { padding: 22px 18px; }
  .login-form h2 { font-size: 20px; }
  .topbar { padding: 0 10px; }
  .topbar h1 { font-size: 15px; }
  .main-content { padding-right: 12px; padding-left: 12px; }
  .dashboard-hero { min-height: 170px; padding: 18px; border-radius: 18px; }
  .dashboard-hero-content { flex-basis: 100%; }
  .dashboard-hero h2 { font-size: 19px; }
  .dashboard-hero-content > p { max-width: 270px; font-size: 12px; }
  .dashboard-hero-visual { width: 58%; opacity: .76; }
  .stat-card { min-height: 96px; padding: 14px; }
  .toolbar select, .toolbar > .btn { width: 100%; }
  .compact-toolbar label { width: 100%; }
  .product-card { grid-template-columns: 64px minmax(0, 1fr); }
  .management-card-side { grid-column: 2; justify-items: start; }
  .product-price small { text-align: left; }
  .pagination-options label:first-child { width: 100%; justify-content: center; }
  .result-stats div { padding: 10px; }
  .confirm-bar .btn { flex: 1; }
}

@media print {
  @page { size: A4 portrait; margin: 7mm; }
  .print-toolbar { display: none; }
  body.print-mode .print-page { padding: 0; }
  .print-sheet { gap: 3mm; }
}

/* Local visual refinement: preserve the existing workflows while improving hierarchy and responsive density. */
:root {
  --sidebar: 260px;
  --shadow: 0 12px 32px rgba(29, 33, 41, .09);
  --shadow-soft: 0 4px 15px rgba(29, 33, 41, .055);
}
body { background: #f5f7fa; }
.app-shell { grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { padding: 20px 14px 14px; box-shadow: 6px 0 24px rgba(17, 35, 60, .08); }
.app-brand { margin-right: 10px; margin-left: 10px; }
.nav-section { margin-top: 18px; letter-spacing: .04em; }
.nav-link { min-height: 44px; padding-right: 13px; padding-left: 13px; border-radius: 7px; }
.nav-link.active { box-shadow: 0 8px 18px rgba(22, 93, 255, .24); }
.topbar { height: 74px; padding: 0 32px; background: rgba(255, 255, 255, .94); }
.topbar h1 { font-size: 21px; letter-spacing: 0; }
.topbar-actions { gap: 10px; }
.main-content { padding: 28px 32px 64px; }
.page { max-width: 1660px; }
.page-head { min-height: 50px; margin-bottom: 20px; }
.page-head h2 { font-size: 20px; letter-spacing: 0; }
.page-head p { max-width: 820px; font-size: 13px; }
.page-actions { gap: 9px; }
.btn { min-height: 40px; padding: 9px 14px; border-radius: 6px; }
.btn.small { min-height: 34px; padding: 6px 10px; }
.icon-btn { width: 40px; height: 40px; border-radius: 6px; }
.stat-grid { gap: 16px; }
.stat-card { min-height: 116px; padding: 18px; border-radius: 10px; background: #fff; }
.stat-top { font-size: 12px; }
.stat-card strong { margin-top: 11px; font-size: 30px; }
.dashboard-hero { min-height: 176px; margin-bottom: 18px; padding: 28px 30px; box-shadow: 0 16px 36px rgba(22, 93, 255, .10); }
.dashboard-hero h2 { font-size: 25px; }
.dashboard-hero-content > p { font-size: 13px; }
.dashboard-grid { margin-top: 18px; gap: 18px; }
.dashboard-type-section { margin-top: 26px; }
.dashboard-section-head { margin-bottom: 14px; }
.dashboard-section-head h3 { font-size: 18px; }
.panel { border-radius: 10px; background: #fff; box-shadow: var(--shadow-soft); }
.panel-head { min-height: 60px; padding: 14px 18px; }
.panel-head h3 { font-size: 15px; }
.panel-body { padding: 18px; }
.toolbar { margin-bottom: 16px; padding: 12px; border-radius: 8px; background: #fff; }
.toolbar > label { font-size: 12px; }
.table-wrap { border-radius: 8px; background: #fff; }
table { font-size: 12.5px; }
th { height: 46px; padding: 0 14px; background: #f7f8fa; font-size: 11px; }
td { padding: 12px 14px; }
tbody tr:hover { background: #f4f8ff; }
.status { padding: 5px 8px; border-radius: 999px; font-size: 11px; }
.pagination { margin-top: 12px; padding: 10px 13px; border-radius: 8px; background: #fff; }
.pagination-page { border-radius: 6px; }
.drop-zone { border-radius: 9px; background: #fbfcfe; }
.import-preview-table { border-radius: 8px; }
.batch-row { min-height: 78px; padding: 14px 16px; border-radius: 8px; background: #fff; }
.detail-dialog { border-radius: 12px; box-shadow: 0 24px 80px rgba(16, 31, 51, .22); }
.detail-dialog::backdrop { background: rgba(12, 24, 38, .52); backdrop-filter: blur(3px); }
.dialog-head { min-height: 72px; padding: 16px 20px; }
.dialog-head h2 { font-size: 19px; }
.dialog-content { padding: 22px; }
.item-card { border-radius: 8px; background: #fff; }
.toast-region { z-index: 4000; top: 22px; width: min(520px, calc(100vw - 32px)); }
.toast { border-radius: 8px; box-shadow: 0 14px 34px rgba(20, 35, 55, .16); }
.image-viewer { z-index: 5000; }

@media (min-width: 1440px) {
  .main-content { padding-right: 42px; padding-left: 42px; }
  .page { max-width: 1740px; }
  .stat-grid { gap: 18px; }
  .stat-card { min-height: 120px; }
}
@media (min-width: 1920px) {
  .topbar { padding-right: 52px; padding-left: 52px; }
  .main-content { padding: 34px 52px 76px; }
  .page { max-width: 1860px; }
  .dashboard-hero { min-height: 184px; padding-right: 34px; padding-left: 34px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.55fr) minmax(350px, .75fr); gap: 22px; }
  .panel-head { min-height: 62px; padding-right: 20px; padding-left: 20px; }
  .panel-body { padding: 20px; }
  th { height: 48px; padding-right: 16px; padding-left: 16px; }
  td { padding: 13px 16px; }
}
@media (min-width: 2400px) {
  .main-content { padding-right: 76px; padding-left: 76px; }
  .page { max-width: 2160px; }
}
@media (max-width: 1100px) {
  :root { --sidebar: 232px; }
  .topbar, .main-content { padding-right: 24px; padding-left: 24px; }
  .page { max-width: none; }
  .stat-grid { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
}
@media (max-width: 720px) {
  .topbar { height: 64px; padding: 0 16px; }
  .topbar h1 { font-size: 18px; }
  .main-content { padding: 20px 16px 44px; }
  .page-head { margin-bottom: 16px; }
  .page-head h2 { font-size: 19px; }
  .stat-grid { gap: 12px; }
  .stat-card { min-height: 102px; padding: 15px; border-radius: 8px; }
  .stat-card strong { font-size: 26px; }
  .dashboard-hero { min-height: 176px; padding: 22px; border-radius: 18px; }
  .dashboard-hero h2 { font-size: 21px; }
  .panel-head { padding: 13px 15px; }
  .panel-body { padding: 15px; }
  .toolbar { padding: 10px; }
  .toast-region { top: 12px; }
}
