:root {
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  color: #17223b;
  background: #f4f6fb;
  --accent: #3737c6;
  --accent-dark: #2929aa;
  --surface: #fff;
  --line: #e3e7f1;
  --muted: #596780;
  --ink: #17223b;
  --radius: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; min-height: 100vh; }
button, input { font: inherit; }
button:not(:disabled) { cursor: pointer; }
button:disabled { opacity: .68; cursor: progress; }
:focus-visible { outline: 3px solid #726dff; outline-offset: 3px; }
h1, h2, p { margin: 0; }
.shell { width: min(1160px, 100% - 64px); margin-inline: auto; }
.muted { color: var(--muted); line-height: 1.65; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 10px; }
.brand { display: flex; align-items: center; gap: 11px; white-space: nowrap; }
.brand-mark { position: relative; display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; background: var(--accent); color: #fff; }
.brand-mark span { width: 12px; height: 13px; border: solid currentColor; border-width: 0 0 3px 3px; border-radius: 0 1px 1px 3px; transform: translate(0, -1px); }
.brand-word { font-size: 21px; font-weight: 750; letter-spacing: -.055em; }
.brand-label { color: var(--muted); font-size: 13px; padding-left: 12px; border-left: 1px solid var(--line); }
.main { padding-block: 42px 72px; }
.center-panel { text-align: center; padding-block: 60px; }
.auth-card { width: min(100%, 444px); margin: 35px auto 0; padding: 36px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 12px 45px #2935720a; }
.auth-mark { position: relative; width: 48px; height: 48px; margin-bottom: 22px; border-radius: 14px; background: #ececff; }
.auth-mark::before { content: ""; position: absolute; inset: 15px 12px; border: 2px solid var(--accent); border-radius: 4px; }
.auth-mark::after { content: ""; position: absolute; left: 18px; top: 13px; width: 12px; height: 12px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(45deg); border-radius: 1px; }
.auth-card h1 { margin-bottom: 10px; font-size: 26px; line-height: 1.35; font-weight: 720; }
.auth-description { font-size: 14px; margin-bottom: 23px; }
.auth-form { display: grid; gap: 10px; }
.auth-form label { font-size: 14px; font-weight: 650; }
.auth-form .button-primary { margin-top: 7px; }
.onboarding { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; }
.onboarding a { color: var(--accent); font-weight: 650; text-underline-offset: 3px; }
input:not([type=file]) { width: 100%; min-height: 44px; padding: 10px 12px; color: var(--ink); background: var(--surface); border: 1px solid #cdd4e5; border-radius: 9px; }
input::placeholder { color: #69768e; opacity: 1; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 15px; border: 1px solid transparent; border-radius: 9px; font-size: 14px; font-weight: 650; line-height: 1.45; text-align: center; transition: background-color .15s, border-color .15s; }
.button-primary { color: #fff; background: var(--accent); }
.button-primary:not(:disabled):hover { background: var(--accent-dark); }
.button-quiet { color: var(--ink); background: transparent; }
.button-quiet:not(:disabled):hover { background: #eef1f8; }
.button-outline { color: var(--accent); border-color: #d7d9f8; background: #fff; }
.button-outline:not(:disabled):hover { background: #f1f1ff; border-color: #aeadf0; }
.button-wide { width: 100%; }
.button-wide + .button-wide { margin-top: 8px; }
.button-plus { font-size: 20px; line-height: .75; font-weight: 500; }
.notice { width: min(100%, 444px); margin: 14px auto 0; padding: 13px 15px; border: 1px solid #bbc7fb; border-radius: 10px; color: #222b68; background: #edf0ff; font-size: 14px; line-height: 1.6; }
.notice[data-kind="error"], .inline-error { color: #922227; border-color: #f8c8cb; background: #fff1f2; }
.notice[data-kind="success"] { color: #166345; border-color: #addec5; background: #e9f8ef; }
.notice[data-wide="true"] { width: auto; margin: 0 0 18px; }

.dashboard-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 23px; }
.dashboard-heading h1 { font-size: clamp(28px, 5vw, 40px); font-weight: 750; line-height: 1.2; letter-spacing: -.025em; }
.supplier-name { margin-bottom: 6px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.summary-card { min-height: 103px; display: flex; flex-direction: column; gap: 3px; justify-content: center; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.summary-label { color: var(--muted); font-size: 13px; font-weight: 610; }
.summary-number { font-size: 29px; font-weight: 720; font-variant-numeric: tabular-nums; line-height: 1.2; }
.data-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.tabs { display: flex; gap: 21px; padding-inline: 22px; border-bottom: 1px solid var(--line); }
.tab { min-height: 51px; padding: 9px 2px 6px; border: 0; border-bottom: 3px solid transparent; color: var(--muted); background: transparent; font-size: 14px; font-weight: 650; white-space: nowrap; }
.tab:hover { color: var(--accent); }
.tab[aria-current] { border-bottom-color: var(--accent); color: var(--accent); }
.panel-heading { padding: 22px 22px 17px; display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.panel-heading h2, .dialog-head h2 { font-size: 19px; font-weight: 700; }
.panel-heading p { margin-top: 5px; font-size: 13px; }
.search-field { display: block; width: min(100%, 245px); }
.search-field input { min-height: 39px; font-size: 13px; }
.table-wrap { padding: 0 22px 15px; }
.table-wrap table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
th, td { text-align: left; vertical-align: middle; overflow-wrap: anywhere; }
th { padding: 11px 9px; color: #526078; background: #f5f7fb; font-size: 12px; font-weight: 680; }
td { padding: 13px 9px; border-bottom: 1px solid #edf0f6; line-height: 1.5; }
tbody tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { padding-left: 12px; }
th:last-child, td:last-child { padding-right: 12px; }
.orders-table th:first-child { width: 27%; }
.orders-table th:nth-child(2) { width: 14%; }
.orders-table th:nth-child(3) { width: 13%; }
.orders-table th:nth-child(4) { width: 15%; }
.orders-table th:nth-child(5) { width: 16%; }
.orders-table th:last-child { width: 15%; }
.invoices-table th:first-child { width: 37%; }
.invoices-table th:nth-child(2) { width: 20%; }
.invoices-table th:nth-child(3) { width: 21%; }
.invoices-table th:nth-child(4) { width: 22%; }
.table-button { min-height: 34px; padding: 5px 9px; font-size: 12px; }
.primary-cell { display: block; font-weight: 690; }
.cell-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 400; }
.amount { font-variant-numeric: tabular-nums; }
.status { display: inline-block; max-width: 100%; padding: 3px 7px; color: #415171; background: #eef1f8; border-radius: 6px; font-weight: 610; }
.status.good { color: #176344; background: #e9f8ef; }
.status.pending { color: #7d4511; background: #fff1d9; }
.status.active { color: #3936a8; background: #eeedff; }
.status.closed { color: #6b344e; background: #f7edf3; }
.empty-state { padding: 35px 12px; border-top: 1px solid var(--line); text-align: center; }
.empty-state strong { display: block; margin-bottom: 5px; font-size: 15px; }
.empty-state p { font-size: 13px; }

.upload-dialog { width: min(calc(100% - 30px), 445px); max-height: calc(100% - 30px); padding: 24px; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); background: var(--surface); box-shadow: 0 16px 54px #12172f3d; }
.upload-dialog::backdrop { background: #1c274b83; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dialog-close { min-width: 35px; min-height: 35px; padding: 0; font-size: 25px; font-weight: 400; line-height: 1; }
.upload-dialog .auth-description { margin-bottom: 15px; overflow-wrap: anywhere; }
input[type=file] { width: 100%; padding: 10px; color: var(--muted); background: #f6f7fc; border: 1px solid var(--line); border-radius: 9px; font-size: 13px; }
input[type=file]::file-selector-button { margin-right: 9px; padding: 7px 10px; border: 1px solid #cfd4eb; border-radius: 7px; color: var(--ink); background: #fff; cursor: pointer; }
.file-help { font-size: 12px; }
.inline-error { padding: 9px 11px; border: 1px solid #f8c8cb; border-radius: 8px; font-size: 13px; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 4px; }
.dialog-actions .button-primary { margin-top: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 780px) {
  .shell { width: calc(100% - 32px); }
  .main { padding-top: 28px; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  .table-wrap tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 13px; margin-bottom: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
  .table-wrap td { border: 0; padding: 0; }
  .table-wrap td:first-child { grid-column: span 2; padding: 0 0 8px; border-bottom: 1px solid var(--line); }
  .table-wrap td:last-child { padding-right: 0; }
  .table-wrap td:not(:first-child)::before { content: attr(data-label); display: block; color: var(--muted); margin-bottom: 2px; font-size: 12px; }
}

@media (max-width: 455px) {
  .header-inner { min-height: 61px; }
  .brand { gap: 8px; }
  .brand-label { padding-left: 8px; font-size: 12px; }
  .brand-word { font-size: 18px; }
  .header-inner .button { padding-inline: 5px; font-size: 12px; }
  .auth-card { margin-top: 15px; padding: 25px 22px; }
  .dashboard-heading { align-items: start; flex-direction: column; gap: 11px; margin-bottom: 16px; }
  .summary-grid { gap: 6px; margin-bottom: 15px; }
  .summary-card { min-height: 86px; padding: 9px; border-radius: 11px; }
  .summary-label { font-size: 11px; }
  .summary-number { font-size: 24px; }
  .tabs, .panel-heading, .table-wrap { padding-inline: 12px; }
  .tabs { gap: 15px; }
  .tab { font-size: 13px; }
  .panel-heading { align-items: start; flex-direction: column; gap: 7px; }
  .search-field { width: 100%; }
}

@media (prefers-reduced-motion: reduce) { .button { transition: none; } }
