:root {
  --ink: #17233c;
  --muted: #66728a;
  --line: #dfe5ef;
  --surface: #ffffff;
  --surface-soft: #f4f7fb;
  --navy: #17315d;
  --blue: #2366d1;
  --blue-dark: #174ca2;
  --teal: #0f8c83;
  --shadow: 0 16px 48px rgba(28, 49, 87, 0.1);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--surface-soft);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: linear-gradient(145deg, #eef4fc 0%, #f8fafc 52%, #eef7f6 100%); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(20px, 5vw, 72px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(210, 219, 233, 0.9);
}
.header-leading { display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--navy); font-weight: 700; letter-spacing: .02em; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, var(--blue), var(--teal)); }
.top-nav { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 14px; }
.top-nav form { margin: 0; }
.link-button { border: 0; padding: 0; color: var(--blue); background: transparent; font: inherit; cursor: pointer; }
.menu-toggle, .sidebar-close { display: none; border: 0; color: var(--navy); background: transparent; font: inherit; cursor: pointer; }

.app-layout { width: min(1480px, calc(100% - 40px)); margin: 0 auto; display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 28px; align-items: start; }
.app-layout .page-shell { width: 100%; margin: 0; }
.side-nav { position: sticky; top: 92px; display: flex; flex-direction: column; min-height: calc(100vh - 116px); margin-top: 24px; padding: 16px; border: 1px solid rgba(216, 224, 236, .94); border-radius: 16px; background: rgba(255, 255, 255, .94); box-shadow: var(--shadow); }
.side-nav-mobile-head { display: none; }
.side-nav-links { display: flex; flex-direction: column; gap: 7px; }
.side-nav-link { min-height: 48px; display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 11px; color: #41506b; font-size: 14px; font-weight: 700; }
.side-nav-link:hover { text-decoration: none; color: var(--navy); background: #eef4fc; }
.side-nav-link.is-active { color: #fff; background: linear-gradient(135deg, var(--navy), var(--blue)); box-shadow: 0 10px 24px rgba(35, 102, 209, .2); }
.side-nav-icon { width: 29px; height: 29px; display: grid; place-items: center; flex: 0 0 29px; border-radius: 8px; color: var(--blue); background: #e8f0fc; font-size: 12px; }
.side-nav-link.is-active .side-nav-icon { color: #fff; background: rgba(255, 255, 255, .18); }
.side-nav-note { margin-top: auto; display: flex; flex-direction: column; gap: 7px; padding: 14px; border-radius: 11px; color: var(--muted); background: #f2f6fb; font-size: 12px; line-height: 1.6; }
.side-nav-note strong { color: var(--navy); font-size: 13px; }
.sidebar-backdrop { display: none; }

.page-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 48px 0 72px; }
.page-heading, .section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(30px, 4vw, 44px); line-height: 1.16; letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 23px; }
.page-heading > div > p:last-child, .login-copy p { color: var(--muted); line-height: 1.75; }
.eyebrow { margin-bottom: 8px; color: var(--teal); font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }

.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 10px; padding: 10px 18px; font-weight: 700; cursor: pointer; }
.primary-button { border: 1px solid var(--blue); color: #fff; background: var(--blue); }
.primary-button:hover { background: var(--blue-dark); }
.secondary-button { border: 1px solid var(--line); color: var(--navy); background: var(--surface); box-shadow: 0 8px 24px rgba(29, 55, 98, .06); }
.secondary-button:hover { text-decoration: none; border-color: #bac8dd; }

.metric-grid { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 16px; margin: 32px 0; }
.metric-card, .content-card { border: 1px solid rgba(216, 224, 236, .9); border-radius: 16px; background: rgba(255, 255, 255, .92); box-shadow: var(--shadow); }
.metric-card { min-height: 155px; padding: 24px; display: flex; flex-direction: column; align-items: flex-start; }
.metric-card span { color: var(--muted); font-size: 14px; }
.metric-card strong { margin: 14px 0 8px; color: var(--navy); font-size: 36px; line-height: 1; }
.metric-card strong.status-text { font-size: 27px; }
.metric-card small { margin-top: auto; color: var(--muted); }
.content-card { padding: 28px; }

.page-actions { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.run-selector { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.run-selector select { min-width: 230px; min-height: 42px; border: 1px solid #c9d4e4; border-radius: 9px; padding: 8px 34px 8px 11px; color: var(--ink); background: #fff; font: inherit; }
.notice-card { margin: 24px 0; padding: 16px 18px; border: 1px solid #f0d39a; border-radius: 12px; color: #704d08; background: #fff8e9; line-height: 1.65; }
.notice-card strong { color: #5b3d05; }
.muted { color: var(--muted); }
.table-link { color: var(--navy); font-weight: 700; }
.dimension-details { min-width: 250px; }
.dimension-details summary { color: var(--blue); cursor: pointer; font-weight: 700; }
.product-breakdown { margin: 10px 0 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 10px; background: #f9fbfd; }
.product-breakdown li { display: grid; grid-template-columns: minmax(150px, 1fr) auto; gap: 16px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: normal; }
.product-breakdown li:last-child { border-bottom: 0; }
.product-breakdown small { display: block; margin-top: 3px; color: var(--muted); }
.product-breakdown.finance-breakdown li { grid-template-columns: minmax(170px, 1.5fr) minmax(125px, .8fr) minmax(145px, 1fr) minmax(125px, .8fr); align-items: center; }
.product-breakdown.finance-breakdown strong { display: block; }
.amount-strong { color: var(--navy); font-weight: 700; font-variant-numeric: tabular-nums; }
.status-warning { color: #8a5b00; background: #fff3d8; }

.table-wrap { margin-top: 22px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 15px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 12px; letter-spacing: .04em; }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.status-pill { display: inline-flex; border-radius: 999px; padding: 5px 10px; color: #16645f; background: #e4f5f2; font-size: 12px; font-weight: 700; }
.empty-state { margin-top: 22px; padding: 38px; border: 1px dashed #c7d1e2; border-radius: 13px; text-align: center; color: var(--muted); background: #f9fbfd; }
.empty-state strong { display: block; margin-bottom: 8px; color: var(--navy); }
.empty-state p { margin-bottom: 0; }

.login-panel { width: min(900px, 100%); margin: 7vh auto 0; display: grid; grid-template-columns: 1.1fr .9fr; overflow: hidden; border: 1px solid rgba(214, 224, 236, .9); border-radius: 20px; background: var(--surface); box-shadow: 0 24px 70px rgba(23, 49, 93, .15); }
.login-copy { min-height: 420px; display: flex; flex-direction: column; justify-content: center; padding: 52px; color: #fff; background: linear-gradient(145deg, #17315d, #245fac 64%, #1c8d87); }
.login-copy .eyebrow, .login-copy p { color: rgba(255, 255, 255, .78); }
.login-copy h1 { font-size: 38px; }
.login-form { display: flex; flex-direction: column; justify-content: center; gap: 20px; padding: 48px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { color: var(--navy); font-size: 14px; font-weight: 700; }
.field input { width: 100%; min-height: 46px; border: 1px solid #c9d4e4; border-radius: 9px; padding: 10px 12px; color: var(--ink); background: #fff; font: inherit; }
.field input:focus { outline: 3px solid rgba(35, 102, 209, .17); border-color: var(--blue); }
.form-error, .message { border-radius: 9px; padding: 11px 13px; color: #8d2733; background: #fff0f1; font-size: 14px; }
.messages { margin-bottom: 20px; }

@media (max-width: 900px) {
  .menu-toggle { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 20px; }
  .app-layout { width: min(100% - 28px, 1180px); display: block; }
  .app-layout .page-shell { width: 100%; }
  .side-nav { position: fixed; z-index: 60; top: 0; left: 0; width: min(320px, 88vw); height: 100vh; min-height: 0; margin: 0; border-radius: 0 18px 18px 0; padding: 18px; transform: translateX(-105%); transition: transform .2s ease; }
  .sidebar-open .side-nav { transform: translateX(0); }
  .side-nav-mobile-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding: 4px 3px 13px; border-bottom: 1px solid var(--line); color: var(--navy); }
  .sidebar-close { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: #eef3fa; font-size: 25px; }
  .sidebar-backdrop { position: fixed; z-index: 50; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(16, 31, 57, .45); }
  .sidebar-open .sidebar-backdrop { display: block; }
  body.sidebar-open { overflow: hidden; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card-wide { grid-column: 1 / -1; }
  .login-panel { grid-template-columns: 1fr; }
  .login-copy { min-height: auto; padding: 36px; }
  .login-form { padding: 36px; }
}

@media (max-width: 560px) {
  .site-header, .page-heading { align-items: flex-start; }
  .site-header, .page-heading, .top-nav { flex-wrap: wrap; }
  .page-shell { width: min(100% - 28px, 1180px); padding-top: 30px; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card-wide { grid-column: auto; }
  .content-card { padding: 20px; }
  .user-name { display: none; }
  .run-selector, .run-selector select, .page-actions .primary-button { width: 100%; }
  .product-breakdown li, .product-breakdown.finance-breakdown li { grid-template-columns: 1fr; gap: 9px; }
}
