
    :root {
      --bg: #091018; --surface: #101a24; --surface-2: #152230; --surface-3: #1a2a39;
      --line: #273746; --line-soft: #1c2a37; --text: #f2f5f7; --muted: #91a0ad;
      --amber: #ffb02e; --amber-soft: #3a2b13; --green: #42d392; --green-soft: #123429;
      --red: #ff6b68; --red-soft: #3c1c20; --blue: #65b8ff; --blue-soft: #142f48;
      --shadow: 0 18px 48px rgb(0 0 0 / 24%);
      font-family: Inter, "Segoe UI", "Microsoft YaHei UI", system-ui, sans-serif;
    }
    * { box-sizing: border-box; }
    html { min-width: 320px; background: var(--bg); }
    body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.5; }
    button, input, select { font: inherit; }
    button { color: inherit; }
    button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgb(255 176 46 / 30%); outline-offset: 2px; }
    .app { min-height: 100vh; }
    .brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 24px; }
    .brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: #171006; background: var(--amber); font-weight: 900; letter-spacing: -.05em; box-shadow: 0 8px 24px rgb(255 176 46 / 18%); }
    .brand strong { display: block; font-size: 16px; }
    .brand small, .muted { color: var(--muted); }
    .nav { display: grid; gap: 6px; }
    .nav-button { width: 100%; border: 0; border-radius: 10px; padding: 11px 12px; text-align: left; background: transparent; color: var(--muted); cursor: pointer; transition: .15s ease; display: flex; align-items: center; gap: 11px; }
    .nav-button:hover { color: var(--text); background: #ffffff08; }
    .nav-button[aria-current="page"] { color: var(--text); background: var(--surface-3); box-shadow: inset 3px 0 var(--amber); }
    .nav-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; border: 1px solid currentColor; font-size: 11px; font-weight: 800; }
    .content { min-width: 0; }
    .topbar { min-height: 74px; padding: 12px clamp(18px, 3vw, 36px); border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 18px; background: rgb(9 16 24 / 88%); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 8; }
    .station-title h1 { margin: 0; font-size: clamp(18px, 2vw, 23px); letter-spacing: .01em; }
    .station-title p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
    .top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
    .clock { min-width: 156px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
    .clock strong { display: block; color: var(--text); font-size: 15px; }
    .main { padding: 28px clamp(18px, 3vw, 36px) 48px; max-width: 1660px; margin: 0 auto; }
    .view[hidden] { display: none; }
    .view-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
    .view-head h2 { margin: 0; font-size: 23px; }
    .view-head p { margin: 4px 0 0; color: var(--muted); }
    .button { min-height: 38px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; transition: .15s ease; white-space: nowrap; }
    .button:hover { background: var(--surface-3); border-color: #3d5062; transform: translateY(-1px); }
    .button.primary { color: #1a1105; background: var(--amber); border-color: var(--amber); font-weight: 750; }
    .button.primary:hover { background: #ffc159; }
    .button.small { min-height: 30px; padding: 4px 9px; font-size: 12px; }
    .button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
    .button.system-handover-action { background: #ba2934; border-color: #ba2934; color: #fff; font-weight: 700; }
    .button.system-handover-action:hover:not(:disabled) { background: #a6202a; border-color: #a6202a; }
    .order-action { display:flex; align-items:center; gap:6px; flex-wrap:wrap; min-width:220px; }
    .order-action-buttons { display:inline-flex; align-items:center; gap:5px; flex-wrap:wrap; }
    .button.receipt-action { color:#276fa7; border-color:#a9d0eb; background:#eef7fd; }
    .button.invoice-action { color:#087f64; border-color:#96d9c8; background:#ecf8f4; }
    .button.invoice-action.is-pending { color:#a16408; border-color:#eccb86; background:#fff8e8; }
    .button.invoice-action.is-summary { color:#6d4c00; border-color:#d7b65d; background:#fff1c7; font-weight:700; }
    .button.invoice-action.is-abnormal { color:#b54708; border-color:#ee9b62; background:#fff0e6; font-weight:700; }
    .invoice-table-actions { display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
    tr.is-highlighted td { background:#fff4cf; transition:background .25s ease; }
    .metrics { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 13px; margin-bottom: 16px; }
    .metric { padding: 17px 18px; border: 1px solid var(--line-soft); border-radius: 13px; background: linear-gradient(145deg, var(--surface), #0d1720); box-shadow: var(--shadow); }
    .metric-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
    .metric-value { display: block; margin-top: 8px; font-size: 25px; line-height: 1.2; font-weight: 760; font-variant-numeric: tabular-nums; }
    .metric-note { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
    .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--amber); box-shadow: 0 0 10px currentColor; }
    .dot.ok { background: var(--green); }
    .dot.bad { background: var(--red); }
    .layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 16px; }
    .stack { display: grid; gap: 16px; align-content: start; }
    .panel { min-width: 0; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
    .panel-head { min-height: 58px; padding: 14px 17px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line-soft); }
    .panel-head h3 { margin: 0; font-size: 16px; }
    .panel-head p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
    .panel-body { padding: 16px; }
    .panel-body.flush { padding: 0; }
    .guns { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 10px; }
    .gun { min-height: 144px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: linear-gradient(150deg, var(--surface-2), #111e29); position: relative; overflow: hidden; }
    .gun::after { content: ""; position: absolute; inset: auto -30px -42px auto; width: 90px; height: 90px; border-radius: 50%; background: rgb(255 255 255 / 2.5%); }
    .gun.is-active { border-color: #4c926f; box-shadow: inset 0 0 0 1px rgb(66 211 146 / 15%); }
    .gun.is-unpaid { border-color: #937026; box-shadow: inset 0 0 0 1px rgb(255 176 46 / 18%); }
    .gun-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
    .gun-number { font-size: 18px; font-weight: 800; }
    .status-pill, .badge { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; background: #ffffff07; color: var(--muted); font-size: 11px; white-space: nowrap; }
    .status-pill.active, .badge.green { color: var(--green); border-color: #2b684e; background: var(--green-soft); }
    .status-pill.warning, .badge.amber { color: var(--amber); border-color: #70531c; background: var(--amber-soft); }
    .badge.red { color: var(--red); border-color: #663034; background: var(--red-soft); }
    .badge.blue { color: var(--blue); border-color: #2d5879; background: var(--blue-soft); }
    .gun-amount { margin-top: 14px; font-size: 22px; font-weight: 780; font-variant-numeric: tabular-nums; }
    .gun-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 2px; color: var(--muted); font-size: 12px; }
    .table-wrap { overflow: auto; max-height: 430px; }
    table { width: 100%; border-collapse: collapse; }
    th, td { padding: 11px 13px; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: nowrap; }
    th { position: sticky; top: 0; z-index: 1; background: #111d28; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .02em; }
    tbody tr { transition: background .12s ease; }
    tbody tr:hover { background: #ffffff05; }
    tbody tr:last-child td { border-bottom: 0; }
    .numeric { text-align: right; font-variant-numeric: tabular-nums; }
    .empty { height: 110px; text-align: center; color: var(--muted); }
    .filter-bar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
    .field { display: grid; gap: 6px; }
    .field label { color: var(--muted); font-size: 12px; }
    .input, .select { min-height: 40px; width: 100%; padding: 8px 11px; color: var(--text); border: 1px solid var(--line); border-radius: 9px; background: #0c1720; }
    .input::placeholder { color: #657582; }
    .filter-bar .input { width: min(280px, 100%); }
    .notice { display: flex; gap: 11px; align-items: flex-start; padding: 13px 14px; border: 1px solid #6c501e; border-radius: 11px; background: var(--amber-soft); color: #f6d699; }
    .notice strong { display: block; color: var(--amber); }
    .notice p { margin: 2px 0 0; font-size: 12px; }
    .status-list { display: grid; gap: 1px; border: 1px solid var(--line-soft); border-radius: 11px; overflow: hidden; }
    .status-item { display: grid; grid-template-columns: minmax(150px, 1.2fr) 1fr 1.3fr; gap: 12px; align-items: center; padding: 13px 14px; background: var(--surface-2); }
    .status-item + .status-item { border-top: 1px solid var(--line-soft); }
    .status-name { display: flex; align-items: center; gap: 9px; font-weight: 650; }
    .status-detail { color: var(--muted); font-size: 12px; }
    .activity { display: grid; gap: 10px; max-height: 300px; overflow: auto; }
    .activity-item { display: grid; grid-template-columns: 68px 1fr; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
    .activity-item:last-child { border: 0; padding-bottom: 0; }
    .activity-time { color: var(--muted); font-variant-numeric: tabular-nums; }
    .activity-text { overflow-wrap: anywhere; }
    .auth-card { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(180px, .7fr) auto; gap: 10px; align-items: end; }
    .auth-state { margin-top: 8px; color: var(--muted); font-size: 12px; }
    .auth-state.ok { color: var(--green); }
    .footer-note { margin-top: 22px; color: var(--muted); font-size: 11px; text-align: center; }
    dialog { width: min(520px, calc(100% - 28px)); padding: 0; border: 1px solid var(--line); border-radius: 15px; color: var(--text); background: var(--surface); box-shadow: 0 30px 90px #000a; }
    dialog::backdrop { background: rgb(1 7 12 / 78%); backdrop-filter: blur(4px); }
    .dialog-head { padding: 17px 19px; display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--line-soft); }
    .dialog-head h3 { margin: 0; font-size: 18px; }
    .icon-button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 20px; }
    .icon-button:hover { color: var(--text); background: #ffffff0b; }
    .dialog-body { padding: 18px 19px; display: grid; gap: 14px; }
    .dialog-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
    .dialog-summary div { padding: 10px; border: 1px solid var(--line-soft); border-radius: 9px; background: #0c1720; }
    .dialog-summary small { display: block; color: var(--muted); }
    .dialog-summary strong { display: block; margin-top: 2px; font-size: 15px; }
    .dialog-actions { padding: 14px 19px 18px; display: flex; justify-content: flex-end; gap: 9px; }
    .toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 50; display: grid; gap: 9px; width: min(380px, calc(100% - 36px)); }
    dialog > .toast-region { z-index: 2147483647; }
    .toast { padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: #172431; box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
    .toast.error { border-color: #74383b; background: var(--red-soft); }
    .toast.success { border-color: #2b684e; background: var(--green-soft); }
    .toast strong { display: block; }
    .toast small { color: var(--muted); }
    .login-shell { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 30% 20%, #27445d 0, #101d29 38%, #081017 100%); }
    .login-shell[hidden] { display: none; }
    .login-card { width: min(430px, 100%); padding: 34px; border: 1px solid #40586b; border-radius: 16px; color: #f2f5f7; background: rgb(15 28 39 / 96%); box-shadow: 0 30px 90px rgb(0 0 0 / 42%); }
    .login-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 26px; }
    .login-brand .brand-mark { flex: 0 0 auto; }
    .login-brand h1 { margin: 0; font-size: 22px; }
    .login-brand p { margin: 3px 0 0; color: #9fb0bd; font-size: 12px; }
    .login-form { display: grid; gap: 16px; }
    .login-form .input { color: #f2f5f7; border-color: #405465; background: #0a151e; }
    .login-error { min-height: 21px; margin: 2px 0 0; color: #ff8b88; font-size: 12px; }
    .login-note { margin: 18px 0 0; color: #92a4b2; font-size: 11px; text-align: center; }
    .app[hidden] { display: none; }
    .user-session { display: flex; align-items: center; gap: 8px; }
    .user-session-copy { display: grid; line-height: 1.2; text-align: right; }
    .user-session-copy strong { color: #fff; font-size: 12px; }
    .user-session-copy small { color: #adbbc6; font-size: 10px; }
    .permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; max-height: 360px; overflow: auto; }
    .permission-section { grid-column: 1 / -1; display:grid; grid-template-columns:repeat(auto-fit,minmax(min(210px,100%),1fr)); gap:9px; }
    .permission-section[hidden], .permission-option[hidden] { display:none; }
    .permission-group { grid-column: 1 / -1; margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
    .permission-option { display: flex; align-items: flex-start; gap: 8px; padding: 9px; border: 1px solid var(--line-soft); border-radius: 5px; background: var(--surface-2); }
    .permission-option input { margin-top: 3px; }
    .permission-option span { display: grid; }
    .permission-option small { color: var(--muted); }
    .role-permissions { max-width: 520px; white-space: normal; color: var(--muted); font-size: 11px; }
    @keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
    @media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
    .order-history-controls { display:grid; grid-template-columns:150px 150px minmax(220px,1fr) 150px minmax(260px,1.25fr) auto; gap:12px; padding:16px; align-items:end; }
    .order-history-controls:has(#history-invoice-field[hidden]) { grid-template-columns:150px 150px minmax(220px,1fr) minmax(260px,1.25fr) auto; }
    .order-history-controls .field { margin:0; min-width:0; }
    .order-history-controls .input,.order-history-controls .select { width:100%; min-width:0; }
    .order-history-note { margin:0; padding:0 16px 14px; font-size:12px; color:var(--muted); overflow-wrap:anywhere; }
    .order-history-pagination { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:13px 16px; flex-wrap:wrap; border-top:1px solid var(--line); }
    .order-history-pagination .actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
    .order-history-pagination .select { min-width:82px; width:auto; }
    .order-history-panel .table-wrap { max-height:none; }
    .order-history-table { min-width:1400px; }
    .order-history-table td { vertical-align:top; }
    .history-invoice-state { margin-top:4px; }
    @media(max-width:1450px) { .order-history-controls,.order-history-controls:has(#history-invoice-field[hidden]) { grid-template-columns:150px 150px minmax(220px,1fr) auto; } .history-search-field { grid-column:1 / 4; } }
    @media(max-width:800px) { .order-history-controls,.order-history-controls:has(#history-invoice-field[hidden]) { grid-template-columns:minmax(0,1fr) minmax(0,1fr); } .history-window-field,.history-search-field { grid-column:1 / -1; } }
    .invoice-summary-panel { margin-top:14px; }
    .invoice-summary-filters { display:grid; grid-template-columns:minmax(130px,1fr) minmax(150px,1fr) minmax(150px,1fr) minmax(390px,1.8fr); gap:12px; padding:16px; align-items:end; }
    .invoice-summary-filters .field { margin:0; min-width:0; }
    .invoice-summary-filters .input,.invoice-summary-filters .select { width:100%; min-width:0; }
    .invoice-summary-filters .actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
    .invoice-summary-search-controls { display:flex; gap:8px; flex-wrap:wrap; }
    .invoice-summary-search-controls .input { flex:1 1 160px; width:auto; }
    .invoice-summary-search-controls .button { flex-shrink:0; }
    .invoice-summary-payment-field { grid-column:1 / -1; border:1px solid var(--line); border-radius:4px; padding:10px 12px; min-width:0; margin:0; }
    .invoice-summary-payment-field legend { font-size:12px; color:var(--muted); padding:0 5px; }
    .invoice-summary-payment-toolbar { display:flex; align-items:center; gap:12px; margin-bottom:4px; }
    .invoice-summary-payment-group { display:grid; grid-template-columns:95px minmax(0,1fr); align-items:start; gap:8px; padding:7px 0; }
    .invoice-summary-payment-group strong { font-size:12px; padding-top:2px; }
    .invoice-summary-payment-choices { display:flex; flex-wrap:wrap; gap:8px 18px; }
    .invoice-summary-payment-choice { display:inline-flex; align-items:center; gap:6px; cursor:pointer; font-size:12px; }
    @media(max-width:560px){.invoice-summary-payment-group{grid-template-columns:1fr}}
    .summary-selection-bar { display:flex; gap:16px; align-items:center; justify-content:space-between; flex-wrap:wrap; padding:12px 16px; background:#f3f8fc; border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
    .summary-selection-bar strong { color:var(--brand); font-size:17px; }
    .summary-selection-actions { display:flex; flex-wrap:wrap; gap:8px; }
    #shift-summary-dialog { width:min(860px,96vw); max-height:94vh; padding:0; }
    #shift-summary-dialog .dialog-body { max-height:70vh; overflow:auto; }
    #shift-summary-dialog [hidden] { display:none !important; }
    #shift-summary-generate { align-self:end; height:38px; }
    .shift-summary-paper { width:300px; max-width:100%; padding:18px; margin:16px auto; background:#fff; color:#111; border:1px solid #d8dee5; }
    .shift-summary-paper pre { margin:0; font:14px/1.5 "SimSun",monospace; white-space:pre-wrap; overflow-wrap:anywhere; }
    #summary-issue-dialog { width:min(820px,96vw); }
    #summary-issue-dialog form { display:flex; flex-direction:column; max-height:92vh; }
    #summary-issue-dialog .dialog-head,#summary-issue-dialog .dialog-actions { flex-shrink:0; }
    #summary-issue-dialog .dialog-body { min-height:0; overflow:auto; }
    .summary-issue-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
    .summary-issue-grid .field { min-width:0; margin:0; }
    .summary-issue-grid .input,.summary-issue-grid .select { width:100%; }
    .buyer-catalog-layout { display:grid; grid-template-columns:minmax(320px,1fr) minmax(420px,1.25fr); gap:14px; align-items:start; }
    .buyer-catalog-form { padding:14px; }
    .buyer-catalog-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
    .buyer-catalog-fields .input,.buyer-catalog-fields .select { width:100%; }
    .buyer-catalog-message { margin:12px 0; overflow-wrap:anywhere; }
    @media(max-width:1050px){.buyer-catalog-layout{grid-template-columns:1fr}}
    @media(max-width:600px){.buyer-catalog-fields{grid-template-columns:1fr}}
    .summary-buyer-profiles { margin:14px 0; padding:12px; background:#f5f8fb; border:1px solid var(--line); border-radius:5px; }
    .summary-buyer-profiles-grid { display:grid; grid-template-columns:minmax(180px,1fr) minmax(260px,1.6fr); gap:10px; }
    .summary-buyer-profiles .input,.summary-buyer-profiles .select { width:100%; }
    .summary-buyer-profile-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-top:10px; }
    #summary-buyer-profile-message { margin:8px 0 0; font-size:12px; }
    @media(max-width:650px){.summary-buyer-profiles-grid{grid-template-columns:1fr}}
    #summary-issue-selected-list { max-height:80px; overflow:auto; overflow-wrap:anywhere; font-size:12px; }
    @media(max-width:560px){.summary-issue-grid{grid-template-columns:1fr}}

    .invoice-summary-note { font-size:12px; margin-bottom:0; }
    .invoice-summary-table { min-width:1450px; }
    .invoice-summary-table td { vertical-align:top; }
    .invoice-summary-table td:nth-child(5),.invoice-summary-table td:nth-child(7) { max-width:240px; white-space:normal; overflow-wrap:anywhere; }
    .invoice-summary-panel .table-wrap { max-height:none; }
    .invoice-summary-panel .pagination { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
    .invoice-summary-panel .pagination .select { width:auto; min-width:82px; }
    @media(max-width:1000px){.invoice-summary-filters{grid-template-columns:repeat(2,minmax(0,1fr))}}
    @media(max-width:560px){.invoice-summary-filters{grid-template-columns:minmax(0,1fr)}.invoice-summary-search-field{grid-column:auto}}
