:root {
  --ink: #edf4f2;
  --muted: #8ea3a5;
  --muted-2: #6c8184;
  --navy: #0d151b;
  --navy-2: #111e25;
  --panel: #14242b;
  --panel-2: #182b33;
  --line: rgba(177, 205, 203, .13);
  --line-strong: rgba(177, 205, 203, .23);
  --amber: #f4b740;
  --amber-soft: rgba(244, 183, 64, .14);
  --mint: #55d2b0;
  --mint-soft: rgba(85, 210, 176, .12);
  --red: #f27d76;
  --red-soft: rgba(242, 125, 118, .13);
  --blue: #82b7ed;
  --shadow: 0 20px 50px rgba(0,0,0,.18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--navy);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--navy); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 80% -10%, #1c353d 0, transparent 32rem), var(--navy); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(244,183,64,.55); outline-offset: 2px; }

#app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; padding: 28px 16px 18px; border-right: 1px solid var(--line); background: rgba(8,17,22,.86); }
.brand-lockup { display: flex; align-items: center; gap: 11px; padding: 0 11px; }
.brand-mark { width: 25px; height: 25px; display: flex; gap: 3px; align-items: end; }
.brand-mark span { display: block; width: 5px; background: var(--amber); border-radius: 4px 4px 1px 1px; transform: skew(-12deg); }
.brand-mark span:nth-child(1) { height: 14px; opacity: .6; }
.brand-mark span:nth-child(2) { height: 21px; opacity: .84; }
.brand-mark span:nth-child(3) { height: 17px; }
.eyebrow, .topbar-kicker, .panel-kicker, .field-label, .table-heading, .summary-label, .status-label, .micro-label { text-transform: uppercase; letter-spacing: .13em; font-size: 10px; font-weight: 800; color: var(--muted); }
.brand-title { font-size: 14px; letter-spacing: .12em; font-weight: 800; color: var(--ink); margin-top: 2px; }
.live-pulse { display: flex; align-items: center; gap: 8px; margin: 42px 11px 14px; font-size: 10px; letter-spacing: .12em; font-weight: 800; color: var(--amber); }
.pulse-dot, .storage-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.main-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { border: 0; color: var(--muted); background: transparent; text-align: left; display: flex; align-items: center; gap: 12px; width: 100%; border-radius: 9px; padding: 12px 12px; font-size: 13px; transition: .18s ease; }
.nav-item:hover { color: var(--ink); background: rgba(255,255,255,.05); }
.nav-item.active { color: var(--ink); background: linear-gradient(90deg, var(--amber-soft), rgba(244,183,64,.04)); box-shadow: inset 3px 0 0 var(--amber); }
.nav-icon { width: 17px; text-align: center; font-size: 18px; line-height: 1; color: var(--muted-2); }
.nav-item.active .nav-icon { color: var(--amber); }
.sidebar-footer { margin-top: auto; padding: 14px 11px 0; border-top: 1px solid var(--line); color: var(--muted-2); font-size: 10px; line-height: 1.6; }
.storage-label { display: flex; align-items: center; gap: 9px; color: var(--mint); font-size: 10px; letter-spacing: .1em; font-weight: 800; margin-bottom: 4px; }
.storage-label .storage-dot { width: 5px; height: 5px; background: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft); }
.muted { color: var(--muted-2); }

.main-content { min-width: 0; padding: 0 40px 52px; }
.topbar { min-height: 104px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); gap: 20px; }
.topbar-kicker { color: var(--amber); margin-bottom: 7px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(22px, 3vw, 31px); letter-spacing: -.035em; line-height: 1.05; }
h2 { font-size: 19px; letter-spacing: -.02em; }
h3 { font-size: 15px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.ghost-button, .text-button { border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 9px 0; }
.ghost-button:hover, .text-button:hover { color: var(--ink); }
.sample-badge { display: inline-flex; border: 1px solid rgba(130,183,237,.3); color: var(--blue); background: rgba(130,183,237,.1); border-radius: 999px; padding: 6px 9px; font-size: 9px; letter-spacing: .13em; font-weight: 900; }
.hidden { display: none !important; }
.app-view { padding-top: 28px; max-width: 1500px; }
.toast-region { position: fixed; z-index: 30; right: 28px; top: 22px; display: grid; gap: 8px; max-width: 360px; }
.toast { border: 1px solid var(--line-strong); background: #1b3037; color: var(--ink); padding: 12px 14px; border-radius: 9px; box-shadow: var(--shadow); font-size: 12px; animation: toast-in .2s ease both; }
.toast.success { border-color: rgba(85,210,176,.36); }
.toast.warning { border-color: rgba(244,183,64,.45); }
.toast.error { border-color: rgba(242,125,118,.5); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

.hero-strip { display: flex; justify-content: space-between; gap: 20px; align-items: end; padding: 20px 22px; background: linear-gradient(105deg, rgba(244,183,64,.13), rgba(17,35,42,.7) 52%, rgba(85,210,176,.08)); border: 1px solid rgba(244,183,64,.22); border-radius: 13px; margin-bottom: 18px; overflow: hidden; position: relative; }
.hero-strip::after { content: ""; position: absolute; right: -40px; top: -70px; width: 220px; height: 220px; border: 1px solid rgba(244,183,64,.12); border-radius: 50%; box-shadow: 0 0 0 18px rgba(244,183,64,.025), 0 0 0 36px rgba(244,183,64,.018); }
.hero-content, .hero-action { position: relative; z-index: 1; }
.hero-eyebrow { color: var(--amber); font-size: 10px; letter-spacing: .15em; text-transform: uppercase; font-weight: 900; margin-bottom: 7px; }
.hero-title { font-size: 25px; letter-spacing: -.035em; margin-bottom: 7px; }
.hero-meta { color: var(--muted); font-size: 12px; }
.hero-action { min-width: 160px; text-align: right; }

.button { border: 1px solid transparent; border-radius: 8px; padding: 11px 15px; color: var(--navy); background: var(--amber); font-size: 12px; font-weight: 900; letter-spacing: .01em; transition: .16s ease; }
.button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.button:active { transform: translateY(1px); }
.button.secondary { color: var(--ink); background: var(--panel-2); border-color: var(--line-strong); }
.button.danger { color: var(--ink); background: var(--red); }
.button.mint { color: var(--navy); background: var(--mint); }
.button.large { min-height: 88px; padding: 16px 20px; font-size: 16px; }
.button.block { width: 100%; }

.panel { background: rgba(20,36,43,.82); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.08); }
.panel.pad { padding: 20px; }
.panel-header { display: flex; justify-content: space-between; align-items: start; gap: 14px; margin-bottom: 18px; }
.panel-kicker { color: var(--amber); margin-bottom: 6px; }
.panel-subtitle { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .85fr); gap: 18px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.metric { padding: 17px 15px; min-height: 113px; background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 10px; }
.metric.accent { background: linear-gradient(145deg, var(--amber-soft), rgba(255,255,255,.025)); border-color: rgba(244,183,64,.25); }
.metric.good { background: linear-gradient(145deg, var(--mint-soft), rgba(255,255,255,.025)); border-color: rgba(85,210,176,.22); }
.metric .metric-value { font-size: 28px; font-weight: 800; letter-spacing: -.05em; margin-top: 15px; font-variant-numeric: tabular-nums; }
.metric .metric-unit { font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 3px; letter-spacing: 0; }
.metric .metric-note { color: var(--muted); font-size: 10px; margin-top: 7px; }
.main-metric { padding: 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: end; gap: 15px; }
.main-metric .metric-value { font-size: clamp(44px, 7vw, 72px); line-height: .9; margin-top: 12px; }
.main-metric .metric-unit { font-size: 13px; }
.level-bar { height: 7px; margin-top: 19px; background: #0d1a20; border-radius: 999px; overflow: hidden; }
.level-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--amber), var(--mint)); transition: width .25s ease; }
.level-fill.warning { background: linear-gradient(90deg, var(--red), var(--amber)); }
.level-caption { display: flex; justify-content: space-between; gap: 12px; margin-top: 7px; font-size: 10px; color: var(--muted); }
.status-card { padding: 20px; min-height: 100%; display: flex; flex-direction: column; justify-content: space-between; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 7px 10px; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; }
.status-pill.good { color: var(--mint); background: var(--mint-soft); }
.status-pill.warn { color: var(--amber); background: var(--amber-soft); }
.status-pill.bad { color: var(--red); background: var(--red-soft); }
.status-pill.neutral { color: var(--muted); background: rgba(255,255,255,.06); }
.status-pill::before { content: ""; width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.status-number { font-size: 42px; letter-spacing: -.06em; margin-top: 23px; font-variant-numeric: tabular-nums; }
.status-copy { font-size: 12px; color: var(--muted); line-height: 1.55; margin-top: 6px; }
.section-gap { margin-top: 18px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 18px; }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-actions .button { min-height: 77px; text-align: left; display: flex; justify-content: space-between; align-items: end; }
.action-title { display: block; font-size: 17px; margin-bottom: 5px; }
.action-subtitle { display: block; color: rgba(13,21,27,.68); font-size: 10px; font-weight: 700; }
.action-symbol { font-size: 31px; line-height: 1; opacity: .7; }
.info-banner { padding: 13px 15px; border: 1px solid rgba(130,183,237,.25); background: rgba(130,183,237,.08); border-radius: 9px; color: var(--blue); font-size: 11px; line-height: 1.5; }
.warning-banner { padding: 13px 15px; border: 1px solid rgba(244,183,64,.3); background: var(--amber-soft); border-radius: 9px; color: #ffd77f; font-size: 11px; line-height: 1.5; }
.error-banner { padding: 13px 15px; border: 1px solid rgba(242,125,118,.35); background: var(--red-soft); border-radius: 9px; color: #ffb4ae; font-size: 11px; line-height: 1.5; }

.form-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(270px, .75fr); gap: 18px; align-items: start; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field-label { color: var(--muted); }
input, select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 7px; background: #0e1a20; color: var(--ink); padding: 12px 12px; min-height: 44px; font-size: 13px; }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:disabled { opacity: .65; }
.field-help { font-size: 10px; color: var(--muted-2); line-height: 1.45; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 20px; }
.checkbox-field { display: flex; gap: 9px; align-items: start; color: var(--muted); font-size: 12px; line-height: 1.45; }
.checkbox-field input { width: 17px; height: 17px; min-height: 17px; margin-top: 1px; accent-color: var(--amber); }
.calc-card { padding: 19px; background: linear-gradient(160deg, rgba(244,183,64,.1), rgba(20,36,43,.82)); border: 1px solid rgba(244,183,64,.2); border-radius: 12px; }
.calc-big { font-size: 45px; letter-spacing: -.065em; font-variant-numeric: tabular-nums; margin: 12px 0 4px; }
.calc-unit { color: var(--muted); font-size: 12px; }
.calc-rows { display: grid; gap: 10px; margin-top: 22px; }
.calc-row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; border-bottom: 1px solid var(--line); padding-bottom: 9px; }
.calc-row strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.sales-hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; align-items: stretch; }
.sales-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sale-button { min-height: 170px; border: 1px solid rgba(244,183,64,.3); border-radius: 13px; text-align: left; padding: 20px; background: linear-gradient(145deg, var(--amber), #df9529); color: var(--navy); transition: .16s ease; }
.sale-button:hover { transform: translateY(-2px); filter: brightness(1.06); }
.sale-button.jug { background: linear-gradient(145deg, #6fe0c1, #36b99c); border-color: rgba(85,210,176,.35); }
.sale-button .sale-symbol { display: flex; justify-content: space-between; align-items: start; font-size: 36px; font-weight: 900; line-height: 1; }
.sale-button .sale-name { font-size: 20px; font-weight: 900; margin-top: 45px; }
.sale-button .sale-size { font-size: 12px; margin-top: 3px; opacity: .68; font-weight: 800; }
.sales-side { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sales-total { grid-column: 1 / -1; padding: 18px; background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 10px; }
.sales-total .big-number { font-size: 40px; margin-top: 9px; font-variant-numeric: tabular-nums; letter-spacing: -.06em; }
.last-movement { margin-top: 10px; padding: 13px 14px; background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 9px; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.last-movement p { color: var(--muted); font-size: 11px; margin-top: 4px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 620px; }
th { text-align: left; padding: 11px 12px; color: var(--muted-2); font-size: 9px; text-transform: uppercase; letter-spacing: .13em; border-bottom: 1px solid var(--line); }
td { padding: 14px 12px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
td strong { color: var(--ink); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.tag { display: inline-flex; border-radius: 5px; padding: 4px 7px; background: rgba(255,255,255,.07); color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.tag.sale { color: var(--amber); background: var(--amber-soft); }
.tag.usage { color: var(--red); background: var(--red-soft); }
.tag.audit { color: var(--blue); background: rgba(130,183,237,.12); }
.tag.closed { color: var(--mint); background: var(--mint-soft); }
.empty-state { padding: 42px 24px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 8px; }

.formula-list { display: grid; gap: 10px; }
.formula-item { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 13px; padding: 15px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.02); }
.formula-number { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: var(--amber-soft); color: var(--amber); font-size: 11px; font-weight: 900; }
.formula-code { color: var(--mint); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.6; }
.formula-explain { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.demo-stat { padding: 14px; background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 8px; }
.demo-stat .demo-value { font-size: 24px; font-weight: 800; margin-top: 9px; font-variant-numeric: tabular-nums; }

.modal-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(3,9,12,.78); }
.modal { width: min(470px, 100%); padding: 22px; border: 1px solid var(--line-strong); border-radius: 12px; background: #172930; box-shadow: var(--shadow); }
.modal h2 { margin-bottom: 8px; }
.modal p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 21px; }

@media (max-width: 1020px) {
  #app-shell { grid-template-columns: 78px minmax(0, 1fr); }
  .sidebar { padding-left: 10px; padding-right: 10px; }
  .brand-lockup { justify-content: center; padding: 0; }
  .brand-lockup > div:last-child, .live-pulse span:last-child, .nav-item span:last-child, .sidebar-footer { display: none; }
  .live-pulse { justify-content: center; margin: 42px 0 14px; }
  .nav-item { justify-content: center; padding: 14px 8px; }
  .nav-icon { font-size: 21px; }
  .main-content { padding-left: 28px; padding-right: 28px; }
}
@media (max-width: 800px) {
  .topbar { align-items: start; flex-direction: column; justify-content: center; padding: 20px 0; min-height: 128px; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .dashboard-grid, .two-col, .form-layout, .sales-hero { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-content { padding-left: 19px; padding-right: 19px; }
}
@media (max-width: 520px) {
  #app-shell { display: block; }
  .sidebar { position: sticky; top: 0; z-index: 10; display: block; padding: 11px 12px; border-right: 0; border-bottom: 1px solid var(--line); background: rgba(8,17,22,.96); }
  .brand-lockup { justify-content: flex-start; }
  .brand-lockup > div:last-child { display: block; }
  .live-pulse { display: none; }
  .main-nav { overflow-x: auto; flex-direction: row; gap: 2px; margin-top: 11px; padding-bottom: 2px; }
  .nav-item { flex: 0 0 auto; width: auto; min-width: 40px; padding: 9px 10px; }
  .nav-item span:last-child { display: none; }
  .nav-item.active { box-shadow: inset 0 -3px 0 var(--amber); }
  .main-content { padding: 0 14px 36px; }
  .topbar { min-height: 118px; }
  .hero-strip { align-items: start; flex-direction: column; padding: 17px; }
  .hero-action { width: 100%; text-align: left; }
  .hero-action .button { width: 100%; }
  .metric-grid, .form-grid, .form-grid.three, .quick-actions, .sales-buttons, .sales-side, .demo-grid, .three-col { grid-template-columns: 1fr; }
  .metric { min-height: 96px; }
  .metric .metric-value { margin-top: 12px; }
  .main-metric .metric-value { font-size: 52px; }
  .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .form-actions .button { width: 100%; }
  .sale-button { min-height: 135px; }
  .sale-button .sale-name { margin-top: 27px; }
  .ghost-button { font-size: 11px; }
}
