@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Light modern surface */
  --bg:         #f5f6f8;
  --bg-card:    #ffffff;
  --bg-card2:   #f3f5f7;
  --bg-hover:   #eef1f4;
  --bg-input:   #ffffff;
  --border:     #e7eaee;
  --border-2:   #dbe0e6;
  --accent:     #a16207;
  --accent-dim: rgba(255,217,71,.22);
  --accent-dim2:rgba(255,217,71,.13);
  --accent-text:#854d0e;
  --warn:       #d97706;
  --warn-dim:   rgba(217,119,6,.10);
  --urgent:     #dc2626;
  --urgent-dim: rgba(220,38,38,.08);
  --info:       #2563eb;
  --info-dim:   rgba(37,99,235,.08);
  --text:       #131313;
  --text-2:     #4d5358;
  --text-muted: #82898f;
  --radius:     14px;
  --radius-sm:  9px;
  --shadow:     0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow-md:  0 4px 12px rgba(16,24,40,.08);
  --shadow-lg:  0 24px 60px rgba(15,23,42,.22);

  /* Dark brand sidebar */
  --side-bg:      #0d0d0d;
  --side-bg2:     #181818;
  --side-border:  rgba(255,255,255,.07);
  --side-text:    #b4b4b4;
  --side-text-dim:#707070;
  --side-accent:  #ffd947;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── Layout ─────────────────────────────────────────────── */
#app { display: flex; height: 100vh; overflow: hidden; }

#sidebar {
  width: 232px; min-width: 232px;
  background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg2) 100%);
  display: flex; flex-direction: column;
  overflow-y: auto;
}

#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  height: 60px; min-height: 60px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(12px);
  z-index: 10;
}
#page-title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
#topbar-right { display: flex; align-items: center; gap: 18px; }
.topbar-brand {
  font-size: 11px; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
}

#content { flex: 1; overflow-y: auto; padding: 28px 32px 48px; }

/* ── Brand ──────────────────────────────────────────────── */
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--side-border);
}
.brand-logo {
  width: 36px; height: 36px; border-radius: 11px;
  background: #ffd947;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(255,217,71,.28);
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-size: 13.5px; font-weight: 700; color: #f5f5f5; letter-spacing: -.01em; }
.brand-sub  { font-size: 11px; color: var(--side-text-dim); font-weight: 500; }

/* ── Nav ────────────────────────────────────────────────── */
#nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 9px;
  font-size: 13px; font-weight: 500; color: var(--side-text);
  cursor: pointer; transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #f0f0f0; }
.nav-item.active {
  background: rgba(255,217,71,.14);
  color: var(--side-accent);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255,217,71,.22);
}
.nav-icon { font-size: 14px; opacity: .75; width: 16px; text-align: center; }

/* ── Sidebar Footer ─────────────────────────────────────── */
.sidebar-footer { padding: 14px 10px 18px; border-top: 1px solid var(--side-border); }
.export-label {
  font-size: 10px; font-weight: 700; color: var(--side-text-dim);
  text-transform: uppercase; letter-spacing: .09em; padding: 0 10px 8px;
}
.export-btn {
  display: block; padding: 6px 12px; margin-bottom: 2px;
  border-radius: 8px; font-size: 12px; color: var(--side-text);
  transition: background .15s, color .15s;
}
.export-btn:hover { background: rgba(255,255,255,.05); color: var(--side-accent); }

/* ── Alert Bell ─────────────────────────────────────────── */
.alert-bell { position: relative; cursor: pointer; padding: 4px; font-size: 16px; }
.alert-badge {
  position: absolute; top: -2px; right: -4px;
  background: var(--urgent); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 17px; height: 17px;
  border-radius: 9px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}
.alert-badge.hidden { display: none; }

/* ── Cards & Grid ───────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }

.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow);
}
.card-sm { padding: 14px 16px; }

.card-title {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 14px;
}

/* ── KPI Cards ──────────────────────────────────────────── */
.kpi { display: flex; flex-direction: column; gap: 6px; transition: box-shadow .2s, transform .2s; }
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-value {
  font-size: 27px; font-weight: 800; color: var(--text);
  line-height: 1.05; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.kpi-label {
  font-size: 11px; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
}
.kpi-sub   { font-size: 12px; color: var(--text-2); font-weight: 500; }
.kpi .accent { color: var(--accent); }

/* ── Pipeline Kanban ────────────────────────────────────── */
.pipeline { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; }
.pipeline-col {
  min-width: 225px; flex-shrink: 0;
  background: var(--bg-card2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.pipeline-header {
  padding: 11px 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.pipeline-stage { font-size: 12px; font-weight: 700; letter-spacing: -.01em; }
.pipeline-count {
  font-size: 11px; font-weight: 700;
  background: var(--bg-card); color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 1px 8px; border-radius: 999px;
}
.pipeline-cards { padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.order-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 11px; padding: 12px 14px;
  cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s;
  box-shadow: var(--shadow);
}
.order-card:hover { border-color: rgba(202,138,4,.55); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.order-card-id   { font-size: 10.5px; color: var(--text-muted); font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.order-card-client { font-size: 13px; font-weight: 700; margin: 3px 0 1px; letter-spacing: -.01em; }
.order-card-value  { font-size: 13px; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.order-card-meta   { font-size: 11px; color: var(--text-muted); margin-top: 5px; }
.order-card-flags  { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.flag { font-size: 10px; font-weight: 700; padding: 2.5px 8px; border-radius: 999px; }
.flag-warn  { background: var(--warn-dim);   color: var(--warn); }
.flag-ok    { background: var(--accent-dim); color: var(--accent-text); }
.flag-info  { background: var(--info-dim);   color: var(--info); }
.flag-urgent{ background: var(--urgent-dim); color: var(--urgent); }

/* ── Stage Pill ─────────────────────────────────────────── */
.stage-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; padding: 3.5px 11px; border-radius: 999px;
  letter-spacing: -.005em; white-space: nowrap;
}
.stage-quote    { background: var(--info-dim);   color: var(--info); }
.stage-deposit  { background: var(--warn-dim);   color: var(--warn); }
.stage-artwork  { background: rgba(124,58,237,.09); color: #7c3aed; }
.stage-production { background: var(--accent-dim); color: var(--accent-text); }
.stage-shipped  { background: rgba(234,88,12,.10); color: #ea580c; }
.stage-delivered{ background: rgba(100,116,139,.10); color: #475569; }

/* ── Table ──────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-card);
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { background: var(--bg-card2); }
th {
  padding: 11px 16px; text-align: left; font-size: 10.5px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .07em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #fafbfc; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 15px; border-radius: 12px;
  border: 1px solid transparent; font-size: 13px;
  background: var(--bg-card); box-shadow: var(--shadow);
}
.alert-item.warning { border-color: rgba(217,119,6,.25); background: #fffdf7; }
.alert-item.urgent  { border-color: rgba(220,38,38,.25); background: #fffafa; }
.alert-item.info    { border-color: rgba(37,99,235,.22); background: #fafcff; }
.alert-icon  { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-title { font-weight: 700; font-size: 12.5px; margin-bottom: 1px; letter-spacing: -.01em; }
.alert-item.warning .alert-title { color: var(--warn); }
.alert-item.urgent  .alert-title { color: var(--urgent); }
.alert-item.info    .alert-title { color: var(--info); }
.alert-msg   { color: var(--text-2); font-size: 12.5px; }

/* ── Inventory Cards ────────────────────────────────────── */
.inv-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px,1fr)); gap: 16px; }
.inv-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s;
}
.inv-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.inv-card.low-stock { border-color: rgba(220,38,38,.3); }
.inv-card-name  { font-size: 14px; font-weight: 700; margin-bottom: 12px; letter-spacing: -.01em; }
.inv-card-stock { font-size: 26px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.inv-card-stock.low { color: var(--urgent); }
.inv-card-stock.ok  { color: var(--text); }
.inv-card-meta  { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.inv-bar-wrap { margin: 12px 0 8px; background: var(--bg-hover); border-radius: 999px; height: 6px; overflow: hidden; }
.inv-bar { height: 100%; border-radius: 999px; transition: width .4s; }
.inv-bar.low { background: linear-gradient(90deg, #f87171, #dc2626); }
.inv-bar.ok  { background: linear-gradient(90deg, #ffe15c, #f2c200); }
.inv-low-badge {
  position: absolute; top: 12px; right: 12px;
  font-size: 9.5px; font-weight: 800; padding: 3px 8px;
  background: var(--urgent-dim); color: var(--urgent);
  border-radius: 999px; letter-spacing: .04em;
}
.inv-pricing { display: flex; gap: 12px; margin-top: 10px; }
.inv-price-item { font-size: 11px; }
.inv-price-label { color: var(--text-muted); font-weight: 500; }
.inv-price-val   { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.inv-edit-btn {
  margin-top: 12px; width: 100%; padding: 7px;
  background: var(--bg-card); border: 1px solid var(--border-2);
  color: var(--text-2); border-radius: var(--radius-sm);
  cursor: pointer; font-size: 12px; font-weight: 600;
  font-family: 'Inter', sans-serif; transition: all .15s;
}
.inv-edit-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* ── Production Timeline ────────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: flex; gap: 18px; }
.tl-spine { display: flex; flex-direction: column; align-items: center; gap: 0; flex-shrink: 0; }
.tl-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0; margin-top: 4px;
  box-shadow: 0 0 0 4px var(--accent-dim);
}
.tl-dot.inactive { background: var(--border-2); box-shadow: 0 0 0 4px rgba(148,163,184,.1); }
.tl-line { flex: 1; width: 2px; background: var(--border-2); min-height: 24px; }
.tl-content {
  flex: 1; padding: 16px 20px; margin-bottom: 18px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.tl-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.tl-order-id { font-size: 11px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; font-weight: 600; }
.tl-client   { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.tl-body { font-size: 12.5px; color: var(--text-2); line-height: 1.6; }

/* ── Stage Bar ──────────────────────────────────────────── */
.stage-bar { display: flex; gap: 5px; margin: 14px 0; }
.stage-step {
  flex: 1; padding: 6px 4px; text-align: center;
  font-size: 10px; font-weight: 700; border-radius: 999px;
  background: var(--bg-hover); color: var(--text-muted);
  border: 1px solid transparent;
  transition: all .2s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stage-step.done    { background: var(--accent-dim); color: var(--accent-text); }
.stage-step.current {
  background: linear-gradient(135deg, #ffe15c, #ffc933);
  color: #131313;
  box-shadow: 0 2px 8px rgba(255,201,51,.5);
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: 'Inter', sans-serif; letter-spacing: -.005em;
  transition: all .15s; border: 1px solid transparent;
}
.btn-primary {
  background: linear-gradient(135deg, #ffdf5c, #ffc933);
  color: #131313;
  box-shadow: 0 1px 2px rgba(224,168,0,.4), 0 4px 12px rgba(255,201,51,.3);
}
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 2px 4px rgba(224,168,0,.45), 0 6px 16px rgba(255,201,51,.38); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: var(--bg-card); color: var(--text-2);
  border-color: var(--border-2); box-shadow: var(--shadow);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); border-color: #cbd2da; }
.btn-danger { background: var(--urgent-dim); color: var(--urgent); border-color: rgba(220,38,38,.2); }
.btn-danger:hover { background: rgba(220,38,38,.14); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-xs { padding: 4px 10px; font-size: 11px; border-radius: 7px; }

/* ── Page Header ────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h2 { font-size: 20px; font-weight: 800; letter-spacing: -.025em; }
.page-header-sub { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ── Section label ──────────────────────────────────────── */
.section-title {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .09em;
  margin-bottom: 12px; margin-top: 26px;
}
.section-title:first-child { margin-top: 0; }

/* ── Forms ──────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 600; color: var(--text-2); }
input, select, textarea {
  background: var(--bg-input); border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); padding: 9px 12px;
  font-size: 13px; color: var(--text); font-family: 'Inter', sans-serif;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
select option { background: var(--bg-card); }
input[type="checkbox"] {
  width: 16px; height: 16px; flex-shrink: 0;
  accent-color: #1a1a1a; cursor: pointer;
  box-shadow: none;
}
textarea { resize: vertical; min-height: 70px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* ── Modal ──────────────────────────────────────────────── */
#modal-overlay {
  position: fixed; inset: 0; background: rgba(10,10,10,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(6px);
}
#modal-overlay.hidden { display: none; }
#modal {
  background: var(--bg-card);
  border-radius: 18px; width: min(620px, 95vw);
  max-height: 85vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modal-in .18s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
#modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
}
#modal-title { font-size: 15px; font-weight: 800; letter-spacing: -.015em; }
#modal-close {
  background: var(--bg-hover); border: none; color: var(--text-muted);
  cursor: pointer; font-size: 13px; width: 28px; height: 28px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  transition: color .15s, background .15s;
}
#modal-close:hover { color: var(--text); background: var(--border); }
#modal-body { padding: 22px 24px; overflow-y: auto; }

/* ── Detail Panel ───────────────────────────────────────── */
.detail-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-muted); font-weight: 500; }
.detail-val   { font-weight: 600; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }

/* ── Supplier Card ──────────────────────────────────────── */
.sup-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow);
}
.sup-name { font-size: 16px; font-weight: 800; margin-bottom: 4px; letter-spacing: -.02em; }
.sup-country { font-size: 12px; color: var(--accent); font-weight: 600; margin-bottom: 14px; }
.sup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 28px; }
.sup-item-label {
  font-size: 10.5px; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
}
.sup-item-val   { font-size: 14px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

/* ── Client Card ────────────────────────────────────────── */
.client-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  cursor: pointer; transition: border-color .15s, box-shadow .2s, transform .2s;
  box-shadow: var(--shadow);
}
.client-card:hover { border-color: rgba(202,138,4,.45); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.client-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.client-name   { font-size: 14.5px; font-weight: 800; letter-spacing: -.015em; }
.client-type   { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }
.status-badge  { font-size: 10px; font-weight: 800; padding: 3.5px 10px; border-radius: 999px; flex-shrink: 0; letter-spacing: .02em; }
.status-active  { background: var(--accent-dim); color: var(--accent-text); }
.status-prospect{ background: var(--warn-dim);   color: var(--warn); }
.status-inactive{ background: rgba(100,116,139,.1); color: #64748b; }
.client-meta { font-size: 12px; color: var(--text-2); display: flex; flex-direction: column; gap: 4px; }

/* ── Portal ─────────────────────────────────────────────── */
.portal-selector { margin-bottom: 22px; max-width: 320px; }
.portal-hero {
  background: linear-gradient(135deg, #0d0d0d 0%, #2a2205 100%);
  color: #eaf4ee;
  border-radius: var(--radius); padding: 24px; margin-bottom: 18px;
  box-shadow: var(--shadow-md);
}
.portal-hero .sup-item-label { color: rgba(234,244,238,.55); }
.portal-hero .sup-item-val { color: #eaf4ee; }
.portal-hero .text-accent { color: #ffd947; }
.portal-hero [style*="border-top"] { border-top-color: rgba(255,255,255,.12) !important; }
.portal-client-name { font-size: 21px; font-weight: 800; margin-bottom: 4px; letter-spacing: -.02em; }
.portal-client-meta { font-size: 13px; color: rgba(234,244,238,.65); }

/* ── Quote/Invoice ──────────────────────────────────────── */
.inv-summary {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.inv-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.inv-id    { font-size: 13.5px; font-weight: 800; letter-spacing: -.01em; }
.inv-meta  { font-size: 12px; color: var(--text-muted); }
.inv-amounts { display: flex; gap: 22px; }
.inv-amount-label { font-size: 11px; color: var(--text-muted); }
.inv-amount-val   { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.inv-amount-val.paid   { color: var(--accent); }
.inv-amount-val.unpaid { color: var(--warn); }
.inv-amount-val.urgent { color: var(--urgent); }

/* ── Misc ───────────────────────────────────────────────── */
.text-accent  { color: var(--accent); }
.text-muted   { color: var(--text-muted); }
.text-warn    { color: var(--warn); }
.text-urgent  { color: var(--urgent); }
.text-info    { color: var(--info); }
.mono         { font-family: 'JetBrains Mono', 'SF Mono', monospace; font-size: .95em; }
.fw-600       { font-weight: 600; }
.fw-700       { font-weight: 700; }
.mt-4         { margin-top: 4px; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }
.mt-20        { margin-top: 20px; }
.mb-12        { margin-bottom: 14px; }
.gap-8        { gap: 8px; }
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.empty-state  { text-align: center; padding: 48px 20px; color: var(--text-muted); font-size: 13px; }
.divider      { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.order-items-table { width: 100%; font-size: 12.5px; border-collapse: collapse; margin-top: 8px; }
.order-items-table th { text-align: left; color: var(--text-muted); font-weight: 600; padding: 5px 0; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; border-bottom: none; background: transparent; }
.order-items-table td { padding: 6px 0; border-top: 1px solid var(--border); border-bottom: none; }

/* ── AI Panel ───────────────────────────────────────────── */
.ai-panel {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 440px; background: var(--bg-card);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 900; box-shadow: -16px 0 50px rgba(15,23,42,.14);
  transform: translateX(100%); transition: transform .28s cubic-bezier(.32,.72,.28,1);
}
.ai-panel.open { transform: translateX(0); }
.ai-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.ai-panel-title { font-size: 14px; font-weight: 800; display: flex; align-items: center; gap: 8px; letter-spacing: -.01em; }
.ai-panel-close {
  background: var(--bg-hover); border: none; color: var(--text-muted);
  cursor: pointer; font-size: 14px; width: 28px; height: 28px; border-radius: 8px;
  font-family: 'Inter', sans-serif;
  display: flex; align-items: center; justify-content: center;
}
.ai-panel-close:hover { color: var(--text); background: var(--border); }
.ai-panel-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.ai-panel-footer {
  padding: 14px 22px; border-top: 1px solid var(--border); flex-shrink: 0;
  display: flex; gap: 8px; background: var(--bg-card2);
  border-radius: 0 0 0 0;
}
.ai-panel-footer input {
  flex: 1; background: var(--bg-card); border: 1px solid var(--border-2);
  border-radius: 999px; padding: 9px 16px;
  font-size: 13px; color: var(--text); font-family: 'Inter', sans-serif;
}
.ai-panel-footer input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.ai-panel-footer .btn { border-radius: 999px; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.ai-chip {
  background: var(--accent-dim); color: var(--accent-text);
  border: 1px solid rgba(202,138,4,.28);
  border-radius: 999px; padding: 5px 14px; font-size: 11.5px; font-weight: 700;
  cursor: pointer; transition: all .15s; font-family: 'Inter', sans-serif;
}
.ai-chip:hover { background: linear-gradient(135deg, #ffdf5c, #ffc933); color: #131313; border-color: transparent; }
.ai-response {
  font-size: 13px; line-height: 1.75; color: var(--text-2); word-break: break-word;
}
.ai-response h2 { font-size: 13px; font-weight: 800; color: var(--accent-text); margin: 16px 0 5px; }
.ai-response h3 { font-size: 13px; font-weight: 700; color: var(--text); margin: 11px 0 4px; }
.ai-response h4 { font-size: 12px; font-weight: 700; color: var(--text-2); margin: 8px 0 3px; }
.ai-response strong { color: var(--text); font-weight: 700; }
.ai-response ul { padding-left: 18px; margin: 5px 0; }
.ai-response li { margin: 3px 0; }
.ai-response code { background: var(--bg-hover); padding: 1px 6px; border-radius: 5px; font-size: 11px; font-family: 'JetBrains Mono', monospace; }
.ai-response hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.ai-loading {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-muted); font-size: 13px; padding: 16px 0;
}
.ai-loading::before {
  content: ''; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--accent); border-top-color: transparent;
  animation: ai-spin .7s linear infinite; flex-shrink: 0;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-msg { margin-bottom: 16px; }
.ai-msg-label {
  font-size: 10px; font-weight: 800; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 5px;
}
.ai-msg-user {
  background: var(--accent-dim); color: var(--accent-text);
  border-radius: 12px; padding: 9px 14px;
  font-size: 12.5px; font-weight: 600;
}
.ai-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 13px; border-radius: 10px;
  font-size: 12px; font-weight: 700; cursor: pointer;
  font-family: 'Inter', sans-serif; transition: all .15s;
  background: var(--accent-dim); color: var(--accent-text);
  border: 1px solid rgba(202,138,4,.28);
}
.ai-btn:hover { background: linear-gradient(135deg, #ffdf5c, #ffc933); color: #131313; border-color: transparent; }
.ai-fab {
  position: fixed; right: 26px; bottom: 26px;
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, #ffd947, #f0b90b);
  color: #131313;
  border: none; cursor: pointer; font-size: 22px;
  box-shadow: 0 8px 26px rgba(240,185,11,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 800; transition: all .2s; font-family: 'Inter', sans-serif;
}
.ai-fab:hover { transform: scale(1.08) translateY(-2px); box-shadow: 0 12px 34px rgba(240,185,11,.55); }
.ai-email-pills { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px; }
.ai-email-pill {
  padding: 4px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 700; cursor: pointer;
  background: var(--bg-hover); color: var(--text-2);
  border: 1px solid var(--border-2); font-family: 'Inter', sans-serif;
  transition: all .15s;
}
.ai-email-pill:hover, .ai-email-pill.sel { background: var(--accent-dim); color: var(--accent-text); border-color: rgba(202,138,4,.3); }

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cfd6dd; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #aeb8c2; background-clip: content-box; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); background-clip: content-box; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .grid-5 { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 900px) {
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  #sidebar { width: 190px; min-width: 190px; }
  #content { padding: 20px; }
}

/* ── Finance & Reports ──────────────────────────────────── */
.flow-chart { display: flex; align-items: flex-end; gap: 10px; height: 185px; padding-top: 8px; }
.flow-month { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.flow-bars { flex: 1; display: flex; align-items: flex-end; gap: 4px; width: 100%; justify-content: center; }
.flow-bar { width: 18px; border-radius: 6px 6px 2px 2px; min-height: 3px; transition: height .35s ease; }
.flow-bar.in  { background: linear-gradient(180deg, #ffe15c, #f2c200); }
.flow-bar.out { background: linear-gradient(180deg, #fca5a5, #ef4444); }
.flow-label { font-size: 11px; color: var(--text-muted); margin-top: 8px; font-weight: 600; }
.flow-net { font-size: 10px; font-weight: 700; margin-top: 1px; font-variant-numeric: tabular-nums; }
.flow-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.flow-dot.in  { background: #f2c200; }
.flow-dot.out { background: #ef4444; }
.report-row { margin-bottom: 14px; }
.report-row-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; font-weight: 500; }
