:root {
  color-scheme: dark;
  --bg: #06101a;
  --panel: rgba(13, 30, 45, .9);
  --panel-2: #10283b;
  --panel-3: #17384f;
  --line: rgba(137, 211, 255, .14);
  --text: #eff9ff;
  --muted: #91a8b8;
  --cyan: #25d4ef;
  --cyan-2: #55f1d1;
  --orange: #ffab3d;
  --danger: #ff7777;
  --success: #56e39f;
  --shadow: 0 18px 50px rgba(0, 0, 0, .3);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.ambient { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at 72% -10%, rgba(37, 212, 239, .17), transparent 32%), radial-gradient(circle at -5% 95%, rgba(85, 241, 209, .11), transparent 30%); }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 7px; color: var(--cyan); font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.fine-print { color: var(--muted); font-size: 12px; line-height: 1.55; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
[hidden] { display: none !important; }

.auth-shell { position: relative; display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.auth-card { width: min(470px, 100%); padding: 44px; border: 1px solid var(--line); border-radius: 26px; background: linear-gradient(160deg, rgba(18, 47, 68, .98), rgba(8, 23, 35, .98)); box-shadow: var(--shadow); text-align: center; }
.auth-card h1 { margin: 12px 0; font-size: clamp(32px, 6vw, 48px); line-height: 1.02; letter-spacing: -.04em; }
.brand-mark { display: grid; place-items: center; width: 68px; height: 68px; margin: 0 auto 24px; border-radius: 22px; color: #041019; background: linear-gradient(135deg, var(--cyan), var(--cyan-2)); font-weight: 950; font-style: italic; letter-spacing: -.08em; box-shadow: 0 0 38px rgba(37, 212, 239, .28); }
.brand-mark.small { width: 42px; height: 42px; margin: 0; border-radius: 14px; font-size: 14px; }

.app-shell { position: relative; display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 22px 16px; border-right: 1px solid var(--line); background: rgba(5, 17, 27, .92); backdrop-filter: blur(20px); z-index: 20; }
.sidebar-close, .sidebar-backdrop { display: none; }
.brand { display: flex; align-items: center; gap: 12px; margin: 0 8px 26px; color: var(--text); text-decoration: none; }
.brand b, .brand small { display: block; }
.brand b { font-size: 15px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
nav { display: grid; gap: 5px; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.nav-group { margin: 15px 13px 2px; color: rgba(145, 168, 184, .72); font-size: 9px; font-weight: 850; letter-spacing: .18em; text-transform: uppercase; }
.nav-group:first-child { margin-top: 0; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 13px; border: 1px solid transparent; border-radius: 12px; color: var(--muted); background: transparent; text-align: left; cursor: pointer; }
.nav-item span { width: 20px; color: var(--cyan); text-align: center; }
.nav-item:hover, .nav-item.active { color: var(--text); border-color: var(--line); background: rgba(37, 212, 239, .08); }
.sidebar-foot { display: grid; gap: 7px; margin-top: auto; padding: 16px 8px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.text-button { width: max-content; padding: 0; border: 0; color: var(--cyan); background: none; cursor: pointer; }

.workspace { min-width: 0; padding: 0 30px 70px; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px; min-height: 92px; margin-bottom: 22px; border-bottom: 1px solid var(--line); background: rgba(6, 16, 26, .88); backdrop-filter: blur(18px); }
.topbar h2 { margin: 0; font-size: 25px; letter-spacing: -.03em; }
.location-picker { display: grid; gap: 4px; margin-left: auto; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.location-picker select { min-width: 190px; color: var(--text); }

.view { display: none; max-width: 1480px; margin: 0 auto; }
.view.active { display: block; }
.panel { border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(145deg, rgba(16, 40, 59, .93), rgba(8, 25, 38, .96)); box-shadow: 0 10px 28px rgba(0, 0, 0, .18); }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 30px; min-height: 185px; padding: 34px 38px; overflow: hidden; background: radial-gradient(circle at 86% 0%, rgba(37, 212, 239, .18), transparent 38%), linear-gradient(145deg, rgba(16, 40, 59, .95), rgba(8, 25, 38, .96)); }
.hero h3 { max-width: 700px; margin: 0 0 8px; font-size: clamp(27px, 4vw, 43px); letter-spacing: -.04em; }
.hero p:last-child { max-width: 640px; margin-bottom: 0; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 16px 0; }
.metric { min-height: 145px; padding: 22px; }
.metric span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.metric strong { display: block; margin: 11px 0 3px; color: var(--text); font-size: 32px; line-height: 1; }
.metric small { color: var(--muted); }
.metric.inset { min-height: 100px; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 18, 28, .38); box-shadow: none; }
.metric-grid.three { grid-template-columns: repeat(3, 1fr); }
.quick-panel { padding: 26px; }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.quick-grid button { display: flex; justify-content: space-between; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 18, 28, .45); cursor: pointer; }
.quick-grid button:hover { border-color: rgba(37, 212, 239, .45); transform: translateY(-1px); }
.quick-grid span { color: var(--cyan); }

.button { min-height: 42px; padding: 10px 16px; border: 1px solid transparent; border-radius: 11px; font-size: 13px; font-weight: 800; cursor: pointer; }
.button:disabled { cursor: wait; opacity: .55; }
.button.primary { color: #031218; background: linear-gradient(135deg, var(--cyan), var(--cyan-2)); box-shadow: 0 8px 24px rgba(37, 212, 239, .16); }
.button.secondary { border-color: var(--line); color: var(--text); background: rgba(37, 212, 239, .07); }
.button.danger { border-color: rgba(255, 119, 119, .35); color: #ffd1d1; background: rgba(255, 119, 119, .1); }
.button.dark { color: white; background: #030405; }
.button.full { width: 100%; margin-top: 12px; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 11px; background: rgba(37, 212, 239, .07); cursor: pointer; }
.mobile-only { display: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [role="dialog"]:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

input, select, textarea { width: 100%; border: 1px solid rgba(145, 183, 206, .22); border-radius: 10px; outline: none; color: var(--text); background: rgba(2, 14, 23, .74); }
input, select { min-height: 42px; padding: 9px 11px; }
textarea { resize: vertical; padding: 11px; }
input:focus, select:focus, textarea:focus { border-color: rgba(37, 212, 239, .68); box-shadow: 0 0 0 3px rgba(37, 212, 239, .1); }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-panel { display: grid; gap: 13px; padding: 26px; }
.form-panel.flush { padding: 0; }
.form-help { min-height: 36px; margin: -2px 0 0; font-size: 12px; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 15px; }
.filter-row { display: flex; align-items: end; gap: 9px; margin: 14px 0 18px; }
.filter-row > input { flex: 1; }
.filter-row label { flex: 1; }
.inline-status { min-height: 20px; color: var(--muted); font-size: 12px; }
.inline-status.error { color: var(--danger); }
.inline-status.success { color: var(--success); }
.notice { margin: 18px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: rgba(37, 212, 239, .06); font-size: 13px; }
.notice.error { color: #ffb3b3; border-color: rgba(255, 119, 119, .35); background: rgba(255, 119, 119, .08); }
.notice.success { color: var(--success); border-color: rgba(86, 227, 159, .3); }
.notice.global { position: fixed; right: 26px; bottom: 24px; z-index: 60; max-width: 460px; box-shadow: var(--shadow); }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.section-heading.compact { margin: 0 0 10px; }
.section-heading h3 { margin: 0; font-size: 20px; }
.heading-actions { display: flex; align-items: center; gap: 8px; }
.two-column { display: grid; grid-template-columns: minmax(340px, .8fr) minmax(520px, 1.4fr); gap: 16px; }
.two-column > .panel:not(.form-panel) { padding: 26px; }
.purchase-form { align-self: start; }
.purchase-devices-heading { margin-top: 5px; padding-top: 16px; border-top: 1px solid var(--line); }
.purchase-device-list { display: grid; gap: 12px; }
.purchase-device { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: rgba(5, 18, 28, .42); }
.purchase-device-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.purchase-device-head h4 { margin: 0; font-size: 14px; }
.purchase-device-remove { min-height: 34px; padding: 6px 10px; }
.purchase-device-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.purchase-device-grid .wide { grid-column: 1 / -1; }
.purchase-part-number-control { display: grid; align-content: start; gap: 6px; }
.purchase-part-number-actions { display: flex; align-items: center; gap: 9px; min-height: 34px; }
.purchase-part-number-assign { min-height: 32px; padding: 6px 9px; white-space: nowrap; }
.purchase-part-number-hint, .purchase-part-number-status { color: var(--muted); font-size: 11px; }
.purchase-part-number-status { min-height: 14px; }
.purchase-batch-summary { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: rgba(37, 212, 239, .05); font-size: 12px; }
.purchase-batch-summary b { color: var(--text); font-size: 18px; }
.purchase-form-actions { display: grid; grid-template-columns: .7fr 1.3fr; gap: 10px; }
.purchase-history-panel { min-width: 0; }
.purchase-queue-grid { display: grid; gap: 14px; }
.purchase-window { padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: rgba(5, 18, 28, .38); }
.pending-window { border-color: rgba(255, 171, 61, .2); }
.verified-window { border-color: rgba(86, 227, 159, .18); }
.voided-window { border-color: rgba(255, 119, 119, .18); }
.purchase-verify-action { min-height: 34px; padding: 7px 10px; white-space: nowrap; }
.purchase-voided { color: var(--danger); }
.purchase-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.purchase-row-actions .button { min-height: 34px; padding: 7px 10px; white-space: nowrap; }
.purchase-history-panel .filter-row { flex-wrap: wrap; }
.purchase-history-panel .filter-row label { min-width: 145px; }
.sales-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 16px; padding: 25px 28px; }
.sales-toolbar h3 { margin: 0 0 6px; font-size: 23px; }
.sales-toolbar p:last-child { margin: 0; }
.sales-builder-layout { display: grid; grid-template-columns: minmax(390px, .76fr) minmax(510px, 1.24fr); gap: 16px; }
.sales-form, .sales-review-panel { align-self: start; }
.sales-pricing-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.sales-upload { position: relative; min-height: 68px; padding: 10px 12px; border: 1px dashed rgba(37, 212, 239, .28); border-radius: 11px; background: rgba(37, 212, 239, .04); cursor: pointer; }
.sales-upload input { min-height: 0; padding: 0; border: 0; background: transparent; font-size: 11px; }
.sales-upload span { color: var(--muted); font-size: 10px; font-weight: 500; }
.sales-add-device { padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(5, 18, 28, .4); }
.sales-add-results { display: grid; gap: 6px; max-height: 250px; margin-top: 9px; overflow-y: auto; }
.sales-add-result { display: grid; grid-template-columns: minmax(110px, .7fr) minmax(180px, 1.3fr) auto; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: rgba(37, 212, 239, .05); text-align: left; cursor: pointer; }
.sales-add-result:hover { border-color: rgba(37, 212, 239, .45); }
.sales-add-result:disabled { cursor: default; opacity: .55; }
.sales-add-result small { color: var(--muted); }
.sales-form-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sales-form-actions #salesSubmit { grid-column: 1 / -1; }
.sales-review-panel { min-width: 0; padding: 26px; }
.sales-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 0; }
.sales-metrics .metric { min-height: 98px; padding: 16px; }
.sales-metrics .metric strong { font-size: 23px; }
.sales-order-lines { display: grid; gap: 10px; }
.sales-line { display: grid; grid-template-columns: minmax(170px, 1.3fr) minmax(120px, .8fr) minmax(150px, .9fr); align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 18, 28, .42); }
.sales-line.invalid { border-color: rgba(255, 119, 119, .36); background: rgba(255, 119, 119, .06); }
.sales-line-device b, .sales-line-device span, .sales-line-device small { display: block; }
.sales-line-device span, .sales-line-device small { margin-top: 3px; color: var(--muted); }
.sales-line-price { display: grid; gap: 5px; }
.sales-line-price small { color: var(--muted); }
.sales-line-actions { display: flex; justify-content: flex-end; gap: 6px; }
.sales-line-actions .button { min-height: 35px; padding: 7px 9px; }
.sales-records-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 16px; margin-top: 16px; }
.sales-records-panel { min-width: 0; padding: 25px; }
.sales-order-modal { width: min(1050px, 100%); }
.sales-order-totals { margin-bottom: 18px; }
.sales-order-detail-section { margin-top: 17px; padding-top: 17px; border-top: 1px solid var(--line); }
.sales-order-detail-items { display: grid; gap: 8px; }
.sales-order-item { display: grid; grid-template-columns: minmax(220px, 1fr) 150px auto; align-items: end; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(5, 18, 28, .42); }
.sales-order-item-main b, .sales-order-item-main span { display: block; }
.sales-order-item-main span { margin-top: 3px; color: var(--muted); }
.sales-money-forms { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.sales-money-form { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(5, 18, 28, .42); }
.sales-money-form h4 { margin: 0; }
.readonly-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 16px; padding: 25px 28px; }
.readonly-hero h3 { margin: 0 0 6px; font-size: 23px; }
.readonly-hero p:last-child { margin: 0; }
.readonly-panel { min-width: 0; padding: 25px; }
.readonly-filters { flex-wrap: wrap; }
.readonly-filters label { min-width: 220px; }
.readonly-filters .button { margin-bottom: 0; }
.readonly-summary { margin: 12px 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: rgba(37, 212, 239, .05); font-size: 12px; line-height: 1.5; }
.readonly-summary.success { color: var(--success); border-color: rgba(86, 227, 159, .28); background: rgba(86, 227, 159, .06); }
.readonly-summary.warn { color: #ffd39a; border-color: rgba(255, 171, 61, .3); background: rgba(255, 171, 61, .07); }
.readonly-summary.error { color: #ffb3b3; border-color: rgba(255, 119, 119, .34); background: rgba(255, 119, 119, .08); }
.good { color: var(--success); }
.bad { color: var(--danger); }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.readonly-card-list { display: grid; gap: 10px; }
.readonly-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 18, 28, .42); }
.readonly-card-head { display: grid; grid-template-columns: minmax(190px, 1fr) auto; align-items: center; gap: 15px; width: 100%; padding: 15px 17px; border: 0; color: var(--text); background: transparent; text-align: left; cursor: pointer; }
.readonly-card-head:hover { background: rgba(37, 212, 239, .05); }
.readonly-card-head b, .readonly-card-head span, .readonly-card-head small { display: block; }
.readonly-card-head small { margin-top: 4px; color: var(--muted); }
.readonly-card-totals { display: flex; align-items: center; justify-content: flex-end; gap: 16px; color: var(--muted); font-size: 12px; }
.readonly-card-totals b { margin-top: 3px; color: var(--text); }
.readonly-card-body { padding: 0 17px 17px; border-top: 1px solid var(--line); }
.readonly-order-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 18, 28, .42); }
.readonly-order-toggle { display: grid; grid-template-columns: minmax(180px, 1fr) auto minmax(260px, auto); align-items: center; gap: 14px; width: 100%; padding: 15px 17px; border: 0; color: var(--text); background: transparent; text-align: left; cursor: pointer; }
.readonly-order-toggle:hover { background: rgba(37, 212, 239, .05); }
.readonly-order-identity strong, .readonly-order-identity span { display: block; }
.readonly-order-identity span { margin-top: 4px; font-size: 11px; }
.readonly-order-totals { display: flex; justify-content: flex-end; gap: 14px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.readonly-order-body { padding: 14px 17px 17px; border-top: 1px solid var(--line); }
.readonly-order-body .button { margin-top: 10px; }
.button.compact { min-height: 34px; padding: 7px 10px; }
.table-subline { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.mono { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.readonly-table { width: 100%; }
.age-pill { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(37, 212, 239, .06); font-size: 10px; font-weight: 800; white-space: nowrap; }
.age-pill.warn { color: #ffd39a; border-color: rgba(255, 171, 61, .32); background: rgba(255, 171, 61, .08); }
.age-pill.danger { color: #ffb3b3; border-color: rgba(255, 119, 119, .34); background: rgba(255, 119, 119, .08); }
.directory-card { display: grid; grid-template-columns: minmax(220px, 1.25fr) repeat(3, minmax(100px, .55fr)); gap: 12px; align-items: center; padding: 15px 17px; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 18, 28, .42); }
.directory-card b, .directory-card span, .directory-card small { display: block; }
.directory-card small { margin-top: 4px; color: var(--muted); }
.directory-quote { padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: rgba(37, 212, 239, .04); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.directory-quote b { margin-top: 4px; color: var(--text); font-size: 14px; letter-spacing: 0; text-transform: none; }
.phone-directory-card .readonly-card-head { cursor: default; }
.phone-directory-card .readonly-card-head:hover { background: transparent; }
.phone-directory-card h4, .phone-directory-card p { margin: 0; }
.phone-directory-card p { margin-top: 4px; }
.directory-quotes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; padding: 0 17px 14px; }
.directory-quote.selected { border-color: rgba(86, 227, 159, .34); background: rgba(86, 227, 159, .08); }
.directory-decision { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 14px 17px; border-top: 1px solid var(--line); }
.directory-decision p { flex: 1 1 260px; }
.search-result { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: center; gap: 16px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 18, 28, .42); }
.search-result b, .search-result span, .search-result small { display: block; }
.search-result small { margin-top: 4px; color: var(--muted); }
.search-result-actions { display: flex; align-items: center; gap: 8px; }
.readonly-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 17px; }
.readonly-card-heading h4, .readonly-card-heading p { margin: 0; }
.readonly-card-heading .muted { margin-top: 4px; }
.readonly-field-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 0 17px 15px; }
.readonly-field { min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(37, 212, 239, .035); }
.readonly-field small { display: block; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.readonly-field b { display: block; margin-top: 4px; overflow-wrap: anywhere; font-size: 12px; }
.readonly-notes { margin: 0; padding: 0 17px 15px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.readonly-card-actions { display: flex; justify-content: flex-end; padding: 12px 17px; border-top: 1px solid var(--line); }
.story-shell { padding: 26px; }
.story-search { max-width: 760px; }
.story-result { margin-top: 16px; }
.story-card { display: grid; gap: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: rgba(5, 18, 28, .42); }
.story-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.story-heading h4 { margin: 0; font-size: 20px; }
.story-timeline { display: grid; gap: 0; margin: 0; }
.story-event { display: grid; grid-template-columns: 125px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(137, 211, 255, .08); }
.story-event dt { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.story-event dd { margin: 0; font-size: 13px; line-height: 1.45; }
.story-money-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.story-money { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(37, 212, 239, .04); }
.story-money span { display: block; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.story-money b { display: block; margin-top: 5px; font-size: 18px; }
.story-title { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.story-title h3 { margin: 0 0 5px; font-size: 23px; }
.story-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.story-fact { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(5, 18, 28, .42); }
.story-fact span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.story-fact b { display: block; margin-top: 6px; font-size: 13px; line-height: 1.45; }
.story-ledger { color: var(--success); font-size: 12px; font-weight: 750; }
.analytics-hero { background: radial-gradient(circle at 88% -15%, rgba(85, 241, 209, .13), transparent 42%), linear-gradient(145deg, rgba(16, 40, 59, .93), rgba(8, 25, 38, .96)); }
.analytics-panel, .analytics-details { margin-bottom: 16px; }
.analytics-switch { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.analytics-switch .button.active { color: #031218; border-color: transparent; background: linear-gradient(135deg, var(--cyan), var(--cyan-2)); }
.analytics-filters { align-items: end; }
.analytics-filters label { min-width: 180px; }
.analytics-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.analytics-metrics .metric { min-height: 108px; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 18, 28, .38); box-shadow: none; }
.analytics-metrics .metric strong { font-size: 25px; }
.analytics-two-up { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.analytics-subpanel { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: rgba(5, 18, 28, .38); }
.analytics-subpanel h3, .analytics-subpanel h4 { margin: 0 0 12px; }
.analytics-details { overflow: hidden; }
.analytics-details > summary { padding: 18px 24px; color: var(--text); font-size: 14px; font-weight: 850; cursor: pointer; list-style-position: inside; }
.analytics-details[open] > summary { border-bottom: 1px solid var(--line); background: rgba(37, 212, 239, .04); }
.analytics-detail-body { padding: 24px; }
.analytics-downloads { justify-content: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.modal-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(1, 8, 13, .78); backdrop-filter: blur(8px); }
.portal-modal { width: min(760px, 100%); max-height: min(860px, calc(100vh - 48px)); padding: 26px; overflow-y: auto; }
.purchase-details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.purchase-detail-field { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(5, 18, 28, .42); overflow-wrap: anywhere; }
.purchase-detail-field.wide { grid-column: 1 / -1; }
.purchase-detail-field small, .purchase-detail-field b { display: block; }
.purchase-detail-field small { margin-bottom: 4px; color: var(--muted); }
.purchase-detail-field input, .purchase-detail-field textarea { margin-top: 3px; }
.purchase-detail-field textarea { min-height: 92px; }
.warn-note { color: var(--orange); border-color: rgba(255, 171, 61, .28); }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.imei-duplicate-modal { width: min(560px, 100%); text-align: center; }
.imei-duplicate-icon { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 14px; border: 3px solid rgba(255, 171, 61, .55); border-radius: 50%; color: var(--orange); font-size: 34px; font-weight: 900; }
.imei-duplicate-modal h3 { margin: 0 0 10px; font-size: 25px; }
.imei-duplicate-modal p { line-height: 1.55; }
.imei-duplicate-actions { justify-content: center; }
.purchase-checklist-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 16px 0; }
.check-item { display: flex; grid-template-columns: none; align-items: center; gap: 9px; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: rgba(5, 18, 28, .42); }
.check-item input { width: auto; min-height: auto; margin: 0; accent-color: var(--success); }
.check-item.good { border-color: rgba(86, 227, 159, .28); background: rgba(86, 227, 159, .07); }
.check-item.bad { border-color: rgba(255, 119, 119, .35); background: rgba(255, 119, 119, .08); }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { padding: 11px 10px; color: var(--muted); font-size: 10px; letter-spacing: .1em; text-align: left; text-transform: uppercase; }
td { padding: 12px 10px; border-top: 1px solid var(--line); vertical-align: top; }
td small { display: block; margin-top: 3px; color: var(--muted); }
.empty { display: grid; place-items: center; min-height: 120px; padding: 30px; color: var(--muted); text-align: center; }
.empty span { display: block; margin-top: 5px; }
.pill { display: inline-flex; align-items: center; min-height: 27px; padding: 4px 9px; border: 1px solid rgba(37, 212, 239, .28); border-radius: 999px; color: var(--cyan); background: rgba(37, 212, 239, .08); font-size: 11px; font-weight: 750; }
.pill.good { color: var(--success); border-color: rgba(86, 227, 159, .28); background: rgba(86, 227, 159, .08); }
.pill.warn { color: var(--orange); border-color: rgba(255, 171, 61, .28); }
.pill.bad { color: #ffb3b3; border-color: rgba(255, 119, 119, .35); background: rgba(255, 119, 119, .08); }

.inbox-layout { display: grid; grid-template-columns: minmax(310px, 390px) minmax(480px, 1fr); min-height: calc(100vh - 150px); overflow: hidden; }
.thread-list-column { padding: 20px; border-right: 1px solid var(--line); }
.thread-list { max-height: calc(100vh - 275px); overflow-y: auto; }
.thread-button { display: grid; width: 100%; padding: 14px 10px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.thread-button:hover, .thread-button.active { background: rgba(37, 212, 239, .07); }
.thread-top { display: flex; justify-content: space-between; gap: 12px; }
.thread-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-top time { flex: 0 0 auto; color: var(--muted); font-size: 10px; }
.thread-preview { margin: 5px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.unread-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--cyan); }
.conversation-column { min-width: 0; padding: 20px; }
.conversation-empty { min-height: 60vh; }
.conversation-head { display: flex; justify-content: space-between; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.conversation-head h3 { margin: 0 0 4px; }
.conversation-head p { margin: 0; font-size: 12px; }
.message-list { display: flex; flex-direction: column; gap: 10px; min-height: 380px; max-height: calc(100vh - 355px); padding: 20px 4px; overflow-y: auto; }
.message { align-self: flex-start; max-width: min(75%, 680px); padding: 10px 13px; border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; background: var(--panel-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.message.outbound { align-self: flex-end; border-color: rgba(37, 212, 239, .22); border-radius: 16px 16px 4px 16px; background: rgba(37, 212, 239, .12); }
.message time { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; text-align: right; }
.message img { display: block; max-width: 100%; max-height: 360px; margin-top: 8px; border-radius: 10px; object-fit: contain; }
.reply-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }

.imei-grid { margin-bottom: 16px; }
.result-panel { padding: 26px; }
.result-card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.result-field { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(4, 18, 28, .45); }
.result-field small, .result-field b { display: block; }
.result-field small { margin-bottom: 4px; color: var(--muted); text-transform: capitalize; }

.driver-list { display: grid; gap: 8px; }
.driver-row, .fleet-card { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(5, 18, 28, .44); }
.driver-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.driver-row small { color: var(--muted); }
.fleet-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-bottom: 18px; }
.fleet-card b, .fleet-card span, .fleet-card small { display: block; }
.fleet-card span { margin: 7px 0; }
.fleet-card small { color: var(--muted); }
.drivers-grid { margin-bottom: 16px; }
.offer-hero { background: radial-gradient(circle at 90% -20%, rgba(37, 212, 239, .14), transparent 44%), linear-gradient(145deg, rgba(14, 36, 54, .94), rgba(8, 24, 37, .97)); }
.offer-filters { align-items: end; }
.offer-filters label { min-width: 150px; }
.offer-filters label:first-child, .offer-filters label:nth-child(2) { flex: 1 1 230px; }
.offer-table input[type="number"], .offer-table input[inputmode="decimal"] { min-width: 92px; }
.offer-table input[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--cyan); }
.offer-device-title { display: block; color: var(--text); font-weight: 800; }
.offer-device-code, .offer-bid-note { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.ebay-layout { display: grid; grid-template-columns: minmax(320px, .78fr) minmax(430px, 1.22fr); gap: 16px; }
.ebay-generator, .ebay-copy-panel { min-width: 0; padding: 25px; }
.ebay-generator { align-self: start; }
.ebay-generator label, .ebay-copy-panel label { margin-bottom: 12px; }
.ebay-copy-panel textarea[readonly] { color: var(--text); background: rgba(4, 16, 25, .72); }
.ebay-copy-panel #ebayTitleOutput { font-weight: 750; }
.ebay-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 16px; }
.ebay-detail { padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: rgba(37, 212, 239, .035); }
.ebay-detail small, .ebay-detail b { display: block; }
.ebay-detail small { margin-bottom: 4px; color: var(--muted); }
.ebay-write-boundary { margin-bottom: 0; line-height: 1.55; }
.eta-hero { background: radial-gradient(circle at 84% -22%, rgba(85, 241, 209, .15), transparent 42%), linear-gradient(145deg, rgba(13, 38, 54, .94), rgba(7, 24, 36, .97)); }
.eta-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.eta-metrics .metric { min-height: 100px; }
.eta-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 12px; }
.eta-card-grid > article { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 18, 28, .44); }
.eta-card-grid h4, .eta-card-grid p { margin: 0; }
.eta-card-grid p { margin-top: 8px; color: var(--muted); line-height: 1.45; }
.eta-card-grid .eta-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.eta-card-grid .eta-facts { display: grid; gap: 7px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.eta-card-grid .eta-fact { overflow-wrap: anywhere; font-size: 12px; }
.labels-boundary { margin-top: 0; line-height: 1.55; }
.labels-actions { justify-content: flex-end; flex-wrap: wrap; }
.labels-preview-heading { margin-top: 22px; }
.label-preview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.label-preview-grid > article { display: grid; align-content: start; min-height: 190px; padding: 16px; border: 1px solid rgba(137, 211, 255, .22); border-radius: 14px; color: #07131f; background: #fff; box-shadow: 0 12px 28px rgba(0, 0, 0, .2); text-align: center; }
.label-preview-grid .label-brand { overflow: hidden; font-size: 17px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.label-preview-grid .label-model { margin-top: 5px; font-size: 14px; font-weight: 800; }
.label-preview-grid .label-detail, .label-preview-grid .label-grade, .label-preview-grid .label-footer { margin-top: 4px; font-size: 10px; }
.label-preview-grid .label-code { margin-top: 7px; font-size: 10px; font-weight: 800; letter-spacing: .04em; overflow-wrap: anywhere; }
.label-preview-grid svg, .label-preview-grid canvas { display: block; width: min(100%, 225px); height: 54px; margin: 8px auto 0; }
.labels-table .button { min-height: 34px; padding: 7px 10px; white-space: nowrap; }
.paystub-panel, [data-panel="inventory"] > .panel, [data-panel="imei"] > .panel { padding: 26px; margin-bottom: 16px; }
.billing-card { padding: 27px; }
.billing-card h3 { margin: 8px 0; font-size: 27px; }
.billing-grid { grid-template-columns: 1fr 1fr; }
.pack-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.pack-list button { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(37, 212, 239, .07); cursor: pointer; }

@media (max-width: 1230px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .two-column { grid-template-columns: 1fr; }
  .sales-builder-layout, .sales-records-grid { grid-template-columns: 1fr; }
  .analytics-two-up { grid-template-columns: 1fr; }
  .ebay-layout { grid-template-columns: 1fr; }
  .eta-metrics { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1080px) {
  .inbox-layout { grid-template-columns: 320px minmax(0, 1fr); }
  .readonly-order-toggle { grid-template-columns: 1fr; }
  .readonly-order-totals { justify-content: flex-start; flex-wrap: wrap; white-space: normal; }
}

@media (max-width: 780px) {
  body.mobile-nav-open { overflow: hidden; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; width: min(290px, 88vw); visibility: hidden; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { visibility: visible; transform: translateX(0); }
  .sidebar .brand { padding-right: 48px; }
  .sidebar-close { position: absolute; top: 22px; right: 16px; z-index: 2; display: inline-grid; place-items: center; }
  .sidebar-backdrop:not([hidden]) { position: fixed; inset: 0; z-index: 19; display: block; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; background: rgba(1, 8, 13, .7); cursor: default; }
  .workspace { padding: 0 14px 50px; }
  .topbar { min-height: 78px; gap: 12px; }
  .topbar h2 { font-size: 20px; }
  .location-picker { max-width: 145px; }
  .location-picker select { min-width: 0; }
  .mobile-only { display: inline-grid; place-items: center; }
  .hero { align-items: flex-start; flex-direction: column; padding: 26px; }
  .metric-grid, .metric-grid.three, .billing-grid { grid-template-columns: 1fr 1fr; }
  .inbox-layout { display: block; min-height: auto; }
  .thread-list-column { border-right: 0; border-bottom: 1px solid var(--line); }
  .thread-list { max-height: 360px; }
  .conversation-empty { min-height: 220px; }
  .message-list { max-height: 55vh; }
  .filter-row { align-items: stretch; flex-direction: column; }
  .sales-toolbar { align-items: flex-start; flex-direction: column; }
  .readonly-hero { align-items: flex-start; flex-direction: column; }
  .analytics-hero .heading-actions, .analytics-downloads { width: 100%; }
  .analytics-metrics { grid-template-columns: 1fr 1fr; }
  .eta-metrics { grid-template-columns: 1fr 1fr; }
  .sales-toolbar .heading-actions { width: 100%; flex-wrap: wrap; }
  .sales-pricing-controls, .sales-money-forms { grid-template-columns: 1fr; }
  .sales-metrics { grid-template-columns: 1fr 1fr; }
  .sales-line, .sales-order-item { grid-template-columns: 1fr; }
  .sales-line-actions { justify-content: flex-start; }
  .directory-card { grid-template-columns: 1fr 1fr; }
  .directory-card > :first-child { grid-column: 1 / -1; }
  .directory-quotes { grid-template-columns: 1fr; }
  .story-facts { grid-template-columns: 1fr; }
  .reply-form { grid-template-columns: 1fr; }
  .modal-overlay { padding: 12px; }
  .portal-modal { max-height: calc(100vh - 24px); padding: 20px; }
}

@media (max-width: 520px) {
  .auth-card { padding: 30px 22px; }
  .topbar { align-items: center; flex-wrap: wrap; padding: 10px 0 12px; }
  .topbar > div { flex: 1; min-width: 0; }
  .metric-grid, .metric-grid.three, .billing-grid, .quick-grid, .field-grid, .result-card { grid-template-columns: 1fr; }
  .metric { min-height: 115px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions { width: 100%; }
  .heading-actions .button { flex: 1; }
  .location-picker { display: grid; flex: 1 0 100%; max-width: none; margin-left: 52px; }
  .location-picker select { min-width: 0; }
  .message { max-width: 88%; }
  .purchase-device-grid, .purchase-form-actions { grid-template-columns: 1fr; }
  .purchase-part-number-actions { align-items: flex-start; flex-direction: column; }
  .purchase-details-grid, .purchase-checklist-grid { grid-template-columns: 1fr; }
  .sales-metrics, .sales-form-actions { grid-template-columns: 1fr; }
  .sales-form-actions #salesSubmit { grid-column: auto; }
  .readonly-card-head, .search-result { grid-template-columns: 1fr; }
  .readonly-order-toggle { grid-template-columns: 1fr; }
  .readonly-order-totals { justify-content: flex-start; flex-wrap: wrap; white-space: normal; }
  .readonly-card-totals { justify-content: flex-start; flex-wrap: wrap; }
  .readonly-field-grid { grid-template-columns: 1fr 1fr; }
  .directory-card { grid-template-columns: 1fr; }
  .directory-card > :first-child { grid-column: auto; }
  .readonly-field-grid { grid-template-columns: 1fr; }
  .story-heading, .story-event { align-items: flex-start; grid-template-columns: 1fr; }
  .story-money-grid { grid-template-columns: 1fr; }
  .analytics-metrics { grid-template-columns: 1fr; }
  .eta-metrics, .ebay-details { grid-template-columns: 1fr; }
  .analytics-detail-body { padding: 18px; }
  .analytics-downloads { align-items: stretch; flex-direction: column; }
  .analytics-downloads .button { width: 100%; }
  .modal-actions { align-items: stretch; flex-direction: column; }
  .modal-actions .button { width: 100%; }
}

@media print {
  body { color: #111; background: #fff; }
  .sidebar, .topbar, .global, .view:not([data-panel="cash"]), .heading-actions, .filter-row { display: none !important; }
  .app-shell { display: block; }
  .workspace { padding: 0; }
  .view[data-panel="cash"] { display: block !important; }
  .panel, .metric.inset { border-color: #bbb; color: #111; background: #fff; box-shadow: none; }
  .muted, th, .metric span { color: #555; }
  td { border-color: #ddd; }
}
