@charset "UTF-8";

:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  font-synthesis: none;
  color: #1e293b;
  background: #f6f8fc;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-light: #eff5ff;
  --ink: #172033;
  --muted: #64748b;
  --line: #e6ebf2;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
button:disabled { cursor: wait; opacity: .55; }
:focus-visible { outline: 3px solid #93b4fb; outline-offset: 3px; }
input, select, textarea { accent-color: var(--blue); }
svg { display: inline-block; flex-shrink: 0; vertical-align: middle; }
button svg, a svg { pointer-events: none; }
[hidden] { display: none !important; }
::selection { background: #dbeafe; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; flex-direction: column; width: 216px; padding: 27px 16px 20px; background: #fff; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; margin: 0 4px 45px; }
.brand-mark { display: grid; place-items: center; flex-shrink: 0; width: 42px; height: 42px; border-radius: 11px; background: var(--blue); color: #fff; }
.brand-name { display: flex; align-items: center; gap: 7px; color: var(--ink); font-size: 23px; font-weight: 750; letter-spacing: 1px; }
.nav-list { display: flex; flex-direction: column; gap: 7px; }
.nav-link { display: flex; align-items: center; gap: 11px; min-height: 46px; padding: 12px 14px; border-radius: 7px; color: #526078; font-size: 14px; font-weight: 500; transition: background .15s; }
.nav-link:hover { background: #f5f7fb; }
.nav-link > svg { width: 20px; height: 20px; color: #77859c; }
.nav-link.active { background: #edf3ff; color: #2259d3; font-weight: 650; }
.nav-link.active > svg { color: var(--blue); }
.nav-count { display: grid; place-items: center; margin-left: auto; min-width: 22px; height: 21px; padding: 0 5px; border-radius: 5px; background: #dfeaff; color: #3965c4; font-size: 12px; font-weight: 500; }
.sidebar-overlay { display: none; }
.workspace { flex: 1; min-width: 0; margin-left: 216px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; height: 70px; padding: 0 34px; border-bottom: 1px solid var(--line); background: #fff; }
.breadcrumbs { display: flex; align-items: center; gap: 12px; color: #8490a3; font-size: 13px; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 13px; }
.topbar-date { margin-right: 6px; color: #748196; font-size: 12px; }
.button.mobile-menu { display: none; }
.main-content { max-width: 1660px; margin: 0 auto; padding: 32px 34px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 27px; }
.page-heading h1 { margin: 0; color: var(--ink); font-size: 28px; font-weight: 700; letter-spacing: -.5px; line-height: 1.4; }
.heading-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 9px 16px; border: 1px solid transparent; border-radius: 7px; color: #42516a; background: transparent; font-size: 14px; line-height: 1.4; font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s; }
.button.primary { color: #fff; border-color: var(--blue); background: var(--blue); box-shadow: 0 2px 3px #2563eb12; }
.button.primary:hover:not(:disabled) { background: var(--blue-dark); border-color: var(--blue-dark); }
.button.secondary { border-color: #dce3ed; color: #41506a; background: #fff; }
.button.secondary:hover:not(:disabled) { border-color: #a8bce2; background: #f8faff; }
.button.ghost { color: var(--muted); }
.button.ghost:hover:not(:disabled) { background: #f0f3f8; color: #334155; }
.button.link { color: var(--blue); }
.button.link:hover:not(:disabled) { background: var(--blue-light); }
.button.danger { color: #fff; border-color: #dc3545; background: #dc3545; }
.button.danger:hover:not(:disabled) { background: #bd2534; }
.button.small { min-height: 32px; padding: 6px 10px; font-size: 13px; }
.button:active:not(:disabled) { transform: translateY(1px); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 26px; }
.stat-card { min-width: 0; padding: 21px 22px 19px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 2px 4px #1e3a5f02; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #607089; font-size: 13px; }
.stat-icon { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 8px; color: #5681d6; background: #f0f5ff; }
.stat-icon > svg { width: 19px; height: 19px; }
.stat-value { margin: 7px 0 9px; color: var(--ink); font-size: 31px; font-weight: 700; line-height: 1.35; letter-spacing: -.6px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-value small { margin-left: 5px; color: #8490a4; font-size: 13px; font-weight: 400; letter-spacing: 0; }
.stat-value .text-muted { font-size: 17px; }
.stat-card.warning .stat-icon { background: #fff7e9; color: #d29631; }
.stat-card.warning .stat-value { color: #bd7d19; }
.panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 3px 10px #17345602; }
.panel-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 76px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; align-items: stretch; align-self: stretch; gap: 22px; }
.button.tab { position: relative; min-height: 52px; padding: 12px 1px; border: 0; border-radius: 0; color: #728097; font-size: 14px; background: transparent; }
.button.tab.active { color: #245cdb; font-weight: 650; }
.button.tab.active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--blue); content: ""; }
.tab-count { min-width: 23px; padding: 2px 6px; border-radius: 5px; color: #7b8aa2; background: #f1f4f9; font-size: 11px; font-weight: 500; }
.tab.active .tab-count { color: #396be0; background: #eaf1ff; }
.table-wrap { overflow-x: auto; width: 100%; scrollbar-width: thin; scrollbar-color: #c5d3e8 transparent; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; font-size: 14px; }
.data-table th { height: 47px; padding: 12px 22px; border-bottom: 1px solid var(--line); background: #f8fafd; color: #68788f; font-size: 12px; font-weight: 550; }
.data-table td { height: 80px; padding: 16px 22px; border-bottom: 1px solid #edf0f5; color: #475569; line-height: 1.6; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fafcff; }
.data-table td:last-child, .data-table th:last-child { text-align: right; }
.data-table td:last-child .row-actions { justify-content: flex-end; }
.product-cell { display: flex; align-items: center; gap: 12px; }
.product-icon { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid #e6edf9; border-radius: 8px; color: #6c8ecb; background: #f4f7fd; }
.product-icon > svg { width: 19px; height: 19px; }
.table-primary { color: #27354a; font-size: 14px; font-weight: 550; }
.table-secondary { margin-top: 4px; color: #8793a6; font-size: 12px; }
.record-number { font-size: 11px; letter-spacing: .2px; }
.numeric { font-variant-numeric: tabular-nums; }
.stock-count, .quantity-change { font-size: 18px; font-weight: 650; }
.unit { color: #8894a6; font-size: 12px; font-weight: 400; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border: 1px solid transparent; border-radius: 5px; font-size: 12px; line-height: 1.7; white-space: nowrap; }
.badge.green { border-color: #dceee5; color: #38896b; background: #eff9f4; }
.badge.orange { border-color: #f4e4c7; color: #b57b22; background: #fffaee; }
.badge.blue { border-color: #dfe9fc; color: #4778ca; background: #f0f6ff; }
.badge.gray { border-color: #e8ecf2; color: #8b97a9; background: #f5f7fa; }
.badge-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.text-muted { color: #8491a6 !important; }
.text-orange { color: #bd7d19 !important; }
.text-green { color: #278267 !important; }
.text-blue { color: #3069ce !important; }
.row-actions { display: flex; align-items: center; gap: 2px; }
.amount { color: #253b61; font-weight: 650; }
.seller-name { color: #334155; font-weight: 550; }
.note-cell { max-width: 250px; white-space: normal; overflow-wrap: anywhere; text-align: left !important; font-size: 13px; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; padding: 14px 22px; border-top: 1px solid var(--line); color: #8693a6; font-size: 12px; line-height: 1.7; }
.table-footer > span { display: inline-flex; align-items: center; gap: 5px; }
.table-footer strong { color: #526580; font-weight: 550; }
.filter-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.filters { display: flex; gap: 10px; }
.filter-row > .select, .filters > .select { width: auto; min-width: 132px; }
.search-field { position: relative; width: 295px; max-width: 100%; }
.search-field > svg { position: absolute; top: 50%; left: 13px; width: 17px; height: 17px; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.search-field .input { height: 37px; min-height: 37px; padding-left: 39px; background: #fafbfd; font-size: 13px; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 310px; padding: 42px 24px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 18px; border: 1px solid #e5edf9; border-radius: 16px; color: #7b9bcc; background: #f3f7fe; }
.empty-state h3 { margin: 0; color: #40526e; font-size: 17px; font-weight: 600; }
.empty-state > .button { margin-top: 20px; }
.empty-state p { max-width: 380px; margin: 10px 0 21px; color: #8592a6; font-size: 13px; line-height: 1.8; }
.demo-banner, .notice { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 1px solid #dbe6fa; border-radius: 7px; background: #f0f5ff; color: #5b76a6; font-size: 13px; line-height: 1.7; }
.demo-banner { margin-bottom: 23px; }
.demo-banner .button { margin-left: auto; }
.notice { margin-bottom: 20px; }

.modal-dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; overflow: auto; border: 1px solid #dce4f0; border-radius: 13px; background: #fff; color: #334155; box-shadow: 0 25px 90px #122e5c30; }
.modal-dialog.wide { width: min(980px, calc(100vw - 32px)); }
.modal-dialog::backdrop { background: #20304a60; backdrop-filter: blur(2px); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 25px 28px 21px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; color: #172b48; font-size: 22px; font-weight: 650; }
.modal-description { margin: 9px 0 0; color: #7c8a9f; font-size: 13px; line-height: 1.8; }
.modal-close { display: grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; padding: 5px; border: 0; border-radius: 6px; color: #8c99ad; background: transparent; }
.modal-close:hover { color: #4f6486; background: #f0f4fa; }
.modal-body { padding: 25px 28px 28px; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 18px 28px; border-top: 1px solid var(--line); background: #fafbfd; }
.modal-footer .button { min-width: 86px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 20px; }
.form-full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.field-label { color: #4e5e77; font-size: 14px; font-weight: 500; }
.required-mark { margin-left: 2px; color: #e27676; }
.input, .select, .textarea { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid #dce3ee; border-radius: 6px; background: #fff; color: #334155; font-size: 14px; line-height: 1.5; transition: border-color .15s, box-shadow .15s; }
.input::placeholder, .textarea::placeholder { color: #a0acc0; }
.input:focus, .select:focus, .textarea:focus { border-color: #6d9cf4; outline: none; box-shadow: 0 0 0 3px #2563eb12; }
.textarea { min-height: 86px; resize: vertical; }
.form-error, .form-summary { margin-top: 20px; padding: 13px 15px; border: 1px solid #dfe9fc; border-radius: 7px; background: #f5f8ff; color: #5873a3; font-size: 13px; line-height: 1.8; }
.form-error { border-color: #f4d6db; background: #fff4f5; color: #b44f60; }
.form-error:empty { display: none; }
.confirmation-summary > p { margin: 0 0 11px; }
.checkbox-field { display: flex; align-items: center; gap: 9px; font-size: 13px; color: #4f668d; }
.checkbox-field input { width: 16px; height: 16px; margin: 0; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin: 0; }
.detail-grid > div { min-width: 0; }
.detail-grid dt { margin-bottom: 7px; color: #8996aa; font-size: 12px; }
.detail-grid dd { margin: 0; color: #394f70; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.toast { position: fixed; z-index: 100; left: calc(50% + 108px); bottom: 28px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); padding: 13px 21px; border: 1px solid #d7e3f8; border-radius: 9px; background: #fff; color: #42648f; font-size: 14px; line-height: 1.7; box-shadow: 0 8px 40px #1c355b18; }
.toast.error { border-color: #f4d6db; color: #b44f60; }
.loading-screen { display: grid; place-items: center; min-height: 100vh; color: #6c83a7; }
.startup-error { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 90vh; padding: 30px; text-align: center; }
.startup-error h1 { margin: 25px 0 10px; font-size: 24px; }
.startup-error p { color: #7c8aa0; line-height: 1.8; }
.startup-error .button { margin-top: 20px; }

@media (max-width: 1180px) {
  .topbar { padding: 0 26px; }
  .main-content { padding: 28px 26px; }
  .topbar-date { display: none; }
  .stat-card { padding: 18px; }
  .stat-value { font-size: 27px; }
  .stats-grid { gap: 14px; }
  .data-table th, .data-table td { padding-left: 18px; padding-right: 18px; }
}

@media (max-width: 980px) {
  .sidebar { width: 196px; padding-right: 12px; padding-left: 12px; }
  .workspace { margin-left: 196px; }
  .brand-name { font-size: 21px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-heading { align-items: flex-start; flex-wrap: wrap; gap: 18px; }
  .heading-actions { margin-left: auto; }
  .panel-toolbar { flex-wrap: wrap; gap: 14px; padding: 0 18px 16px; }
  .panel-toolbar > .search-field { width: 100%; }
  .tabs { min-height: 60px; }
  .filter-row { flex-wrap: wrap; }
  .filter-row .search-field { width: 100%; }
  .filters { flex: 1; }
  .filters .select { flex: 1; }
}

@media (max-width: 760px) {
  .sidebar { width: 220px; transform: translateX(-100%); transition: transform .18s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 12px 0 40px #25385b18; }
  body.sidebar-open .sidebar-overlay { display: block; position: fixed; inset: 0; z-index: 25; border: 0; background: #26385b4a; }
  .workspace { margin-left: 0; }
  .button.mobile-menu { display: inline-flex; padding: 5px; margin-right: 1px; }
  .topbar { height: 64px; padding: 0 18px; gap: 10px; }
  .breadcrumbs { gap: 7px; font-size: 12px; }
  .topbar-actions { gap: 5px; }
  .topbar-actions .button { padding: 6px 8px; font-size: 12px; }
  .main-content { padding: 25px 20px; }
  .page-heading h1 { font-size: 25px; }
  .page-heading { margin-bottom: 22px; }
  .stat-value { font-size: 28px; }
  .toast { left: 50%; }
  .table-footer { flex-wrap: wrap; gap: 8px; }
  .demo-banner { flex-wrap: wrap; font-size: 12px; gap: 7px; padding: 11px 13px; }
  .demo-banner .button { margin-left: 23px; padding-left: 0; }
}

@media (max-width: 480px) {
  .topbar { padding-right: 14px; padding-left: 12px; }
  .main-content { padding: 24px 16px; }
  .heading-actions { width: 100%; justify-content: flex-start; gap: 8px; }
  .heading-actions .button { padding: 9px 12px; font-size: 13px; }
  .stats-grid { gap: 11px; margin-bottom: 20px; }
  .stat-card { padding: 16px 14px; }
  .stat-top { font-size: 12px; gap: 8px; }
  .stat-icon { width: 28px; height: 28px; }
  .stat-icon > svg { width: 16px; height: 16px; }
  .stat-value { font-size: 25px; }
  .panel-toolbar { padding-right: 16px; padding-left: 16px; }
  .tabs { gap: 20px; }
  .filter-row { padding: 16px; }
  .filter-row > .select, .filters > .select { min-width: 0; }
  .data-table th, .data-table td { padding-right: 16px; padding-left: 16px; }
  .data-table td { height: 76px; font-size: 13px; }
  .data-table th { font-size: 12px; }
  .product-cell { gap: 10px; }
  .product-icon { width: 32px; height: 32px; }
  .table-primary { font-size: 13px; }
  .empty-state { min-height: 285px; padding: 32px 20px; }
  .empty-state h3 { font-size: 16px; }
  .table-footer { padding: 13px 16px; font-size: 11px; }
  .table-footer > span { flex-wrap: wrap; }
  .modal-dialog { max-height: calc(100dvh - 24px); width: calc(100vw - 24px); }
  .modal-header, .modal-body { padding: 21px; }
  .modal-footer { padding: 17px 21px; }
  .modal-header h2 { font-size: 20px; }
  .form-grid { grid-template-columns: 1fr; gap: 20px; }
  .form-full { grid-column: auto; }
  .detail-grid { gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

.login-page { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 24px; background: #f6f8fc; }
.login-card { width: min(100%, 400px); padding: 36px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 8px 32px #1e3a5f06; }
.login-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 22px; border-radius: 12px; color: var(--blue); background: var(--blue-light); }
.login-card h1 { margin: 0 0 28px; color: var(--ink); font-size: 25px; font-weight: 700; }
.login-card .field + .field { margin-top: 20px; }
.login-card .input { min-height: 46px; }
.login-status { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.login-submit { width: 100%; min-height: 44px; margin-top: 26px; }
.login-card .form-error { overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .login-page { padding: 20px; }
  .login-card { padding: 28px 24px; }
}
