/* Matches the approved design mockup: dark navy sidebar, teal accents,
   card-based dashboard. Real logo from www.angelswholesaleoh.com. */
:root {
  --navy-1: #040d1f;
  --navy-2: #071a33;
  --navy-3: #0a2247;
  --teal: #2c6e63;
  --teal-light: #8fd8c4;
  --ink: #07111f;
  --ink-soft: #64748b;
  --ink-faint: #94a3b8;
  --paper: #f4f8ff;
  --paper-raised: #ffffff;
  --line: #e2e8f0;
  --line-soft: #eef2f7;
  --accent-soft: #eef5f2;
  --good: #16a34a;
  --good-soft: #ecfdf3;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --critical: #dc2626;
  --critical-soft: #fef2f2;
  --info: #1d4ed8;
  --info-soft: #eff6ff;
  --brand-orange: #f97316;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

#app.loading { display: flex; align-items: center; justify-content: center; height: 100vh; }
.boot { color: var(--ink-soft); font-size: 14px; }

/* ---------- shell ---------- */
.shell { display: flex; height: 100vh; width: 100%; overflow: hidden; }

aside {
  width: 262px; flex: 0 0 262px;
  background: linear-gradient(185deg, var(--navy-1) 0%, var(--navy-2) 62%, var(--navy-3) 100%);
  color: #fff; display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.brand { position: relative; padding: 20px 18px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand .logo-box { background: #fff; border-radius: 14px; padding: 10px 14px; display: flex; align-items: center; justify-content: center; }
.brand img { height: 40px; width: auto; max-width: 100%; object-fit: contain; display: block; }
.brand .tag { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--teal-light); font-weight: 800; text-align: center; }

nav { position: relative; padding: 16px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #64748b; font-weight: 800; padding: 8px 12px 6px; }
nav button {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px; border-radius: 10px; border: none;
  background: transparent; color: #cbd5e1; font-size: 13.5px; font-weight: 700;
  cursor: pointer; text-align: left; font-family: inherit;
}
nav button:hover { background: rgba(255,255,255,.06); color: #fff; }
nav button.active { background: linear-gradient(135deg, var(--teal), #1d4a41); color: #fff; }
nav button .icon { flex: 0 0 auto; width: 19px; height: 19px; display: flex; align-items: center; justify-content: center; }
nav button .label { flex: 1; }
nav button .count { font-size: 11px; background: rgba(255,255,255,.14); padding: 2px 8px; border-radius: 999px; font-weight: 700; }
nav button .dot { font-size: 10.5px; background: var(--brand-orange, #f97316); color: #fff; padding: 1px 7px; border-radius: 999px; font-weight: 800; }

.who { position: relative; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 11px; }
.who .avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg,#2f6f63,#db2777); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex: 0 0 auto; }
.who .info { min-width: 0; flex: 1; }
.who .email { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.who .signout { background: none; border: none; color: #f97316; font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; padding: 0; margin-top: 2px; }

main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
header.top {
  height: 74px; flex: 0 0 74px; background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; padding: 0 30px; gap: 20px; z-index: 5;
}
.eyebrow { font-size: 11px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; background: linear-gradient(135deg, var(--teal), #16332e, var(--teal-light)); -webkit-background-clip: text; background-clip: text; color: transparent; }
header.top h1 { font-size: 22px; font-weight: 900; letter-spacing: -.03em; margin: 2px 0 0; }
.top-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

.content { flex: 1; overflow-y: auto; padding: 24px 28px 60px; }

/* ---------- pills / buttons ---------- */
.pill-toggle { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 999px; background: var(--good-soft); border: 1px solid #bbf7d0; font-size: 12px; font-weight: 800; color: var(--good); cursor: default; }
.pill-toggle .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }

.link-pill { display: flex; align-items: center; gap: 6px; padding: 9px 13px; border-radius: 999px; background: #fff; border: 1px solid #dcebe5; font-size: 12px; font-weight: 800; color: var(--teal); text-decoration: none; }

.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 50%; background: #fff; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; cursor: pointer; }

.publish-btn { display: flex; align-items: center; gap: 7px; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: #fff; border: none; font-size: 12.5px; font-weight: 800; cursor: pointer; }
.publish-btn .badge { background: rgba(255,255,255,.18); padding: 1px 7px; border-radius: 999px; }

button.btn {
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  padding: 9px 15px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink);
}
button.btn:hover { background: var(--line-soft); }
button.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
button.btn.primary:hover { background: #235a51; }
button.btn.danger { color: var(--critical); border-color: #fecaca; }
button.btn:disabled { opacity: .5; cursor: not-allowed; }

select, input[type=text], input[type=search], input[type=number] {
  font: inherit; font-size: 13.5px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
}
select:focus, input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--accent-soft); }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }

/* ---------- dashboard stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--paper-raised); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.stat-card .top-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.stat-card .chip { width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft); color: var(--teal); display: flex; align-items: center; justify-content: center; }
.stat-card .flag { font-size: 10.5px; font-weight: 800; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .flag.up { background: var(--good-soft); color: var(--good); }
.stat-card .flag.watch { background: var(--warn-soft); color: var(--warn); }
.stat-card .flag.neutral { background: var(--line-soft); color: var(--ink-faint); }
.stat-card .value { font-size: 30px; font-weight: 900; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-card .label { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }

.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: 1fr; } }

.panel { background: var(--paper-raised); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line-soft); }
.panel-head h3 { font-size: 15px; margin: 0; }
.panel-head a, .panel-head .link { font-size: 12.5px; font-weight: 800; color: var(--teal); text-decoration: none; cursor: pointer; }

.order-row { display: flex; align-items: center; gap: 12px; padding: 13px 20px; border-bottom: 1px solid #f5f8fc; }
.order-row:last-child { border-bottom: none; }
.order-row .initial { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg,#eef5f2,#f3faf6); border: 1px solid #dcebe5; display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--teal); font-size: 13px; flex: 0 0 auto; }
.order-row .info { flex: 1; min-width: 0; }
.order-row .info .name { font-size: 13.5px; font-weight: 700; }
.order-row .info .sub { font-size: 12px; color: var(--ink-soft); margin-top: 1px; }
.order-row .right { text-align: right; flex: 0 0 auto; }
.order-row .amount { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }

.publish-panel { background: linear-gradient(185deg, var(--navy-1) 0%, var(--navy-3) 100%); color: #fff; border-radius: 16px; padding: 20px; margin-bottom: 18px; }
.publish-panel .eyebrow2 { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--teal-light); font-weight: 800; margin-bottom: 10px; }
.publish-panel p { font-size: 14px; line-height: 1.5; margin: 0 0 16px; color: #e2e8f0; }
.publish-panel button { width: 100%; padding: 12px; border-radius: 10px; border: none; background: linear-gradient(135deg,#1c2c44,#0e1a2e); color: #fff; font: inherit; font-size: 13.5px; font-weight: 800; cursor: pointer; }

.alert-row { display: flex; align-items: center; gap: 12px; padding: 13px 20px; border-bottom: 1px solid #f5f8fc; }
.alert-row:last-child { border-bottom: none; }
.alert-row .chip { width: 34px; height: 34px; border-radius: 10px; background: var(--warn-soft); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.alert-row .info { flex: 1; min-width: 0; }
.alert-row .name { font-size: 13px; font-weight: 700; }
.alert-row .sub { font-size: 12px; color: var(--ink-faint); }
.alert-row .qty { font-size: 12.5px; font-weight: 800; color: var(--critical); }

/* ---------- table ---------- */
.table-wrap { background: var(--paper-raised); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.table-wrap.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); background: var(--line-soft); font-weight: 700; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafcff; }
td.num { font-variant-numeric: tabular-nums; }
input.edit-field { width: 84px; padding: 6px 9px; font-size: 13px; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.critical { background: var(--critical-soft); color: var(--critical); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.neutral { background: var(--line-soft); color: var(--ink-soft); }

.note { font-size: 12.5px; color: var(--warn); background: var(--warn-soft); border: 1px solid #fde68a; border-radius: 10px; padding: 11px 14px; margin-bottom: 16px; }
.note.info { color: var(--info); background: var(--info-soft); border-color: #bfdbfe; }

.empty { padding: 60px 20px; text-align: center; color: var(--ink-faint); font-size: 14px; }
.error-banner { background: var(--critical-soft); color: var(--critical); border: 1px solid #fecaca; border-radius: 10px; padding: 11px 14px; font-size: 13px; margin-bottom: 14px; }

.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: none; font: inherit; font-size: 13.5px; font-weight: 700; color: var(--ink-faint); padding: 10px 4px; margin-right: 20px; cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--teal); }

.doc-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.doc-list a { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; text-decoration: none; color: var(--teal); font-size: 13px; font-weight: 600; }
.doc-list a:hover { background: var(--accent-soft); }

.detail-card { background: var(--paper-raised); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; margin-top: 14px; }
.detail-card h3 { margin: 0 0 12px; font-size: 15px; }
.field-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; gap: 20px; }
.field-row:last-child { border-bottom: none; }
.field-row .k { color: var(--ink-faint); flex: 0 0 auto; }
.field-row .v { font-weight: 600; text-align: right; }

textarea.review-note { width: 100%; min-height: 60px; font: inherit; font-size: 13px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; resize: vertical; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.media-tile { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fff; aspect-ratio: 1; }
.media-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile .del-btn { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; background: rgba(7,17,31,.7); color: #fff; border: none; cursor: pointer; font-size: 13px; }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--teal); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.dept-card { background: var(--paper-raised); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.dept-card .name { font-size: 14px; font-weight: 800; margin-bottom: 10px; }
.dept-card .cat-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); color: var(--ink-soft); }
.dept-card .cat-row:last-child { border-bottom: none; }
.dept-card .cat-row .n { font-weight: 700; color: var(--ink); }
