/* VGG Books — "General Sans" purple design, matched to the Bidwave scraper UI */
@font-face { font-family: "General Sans"; src: url("font/GeneralSans-Light.woff") format("woff"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "General Sans"; src: url("font/GeneralSans-Regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "General Sans"; src: url("font/GeneralSans-Semibold.woff") format("woff"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "General Sans"; src: url("font/GeneralSans-Bold.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;
  --page: #f4f2f8;
  --surface: #ffffff;
  --surface-2: #f6f2fb;
  --ink: #333333;
  --ink-2: #52505a;
  --muted: #666666;
  --gridline: #ece6f4;
  --baseline: #e5ddf0;
  --line: #e5ddf0;
  --border: #e5ddf0;
  --accent: #9932cc;
  --accent-strong: #7f21b3;
  --accent-soft: #f1e4f9;
  --viz-pos: #9932cc;
  --viz-neg: #c0392b;
  --good: #157347;
  --good-text: #157347;
  --warning: #946200;
  --critical: #c0392b;
  --shadow: 0 1px 2px rgba(70, 38, 97, 0.05);
  --chip-good-bg: #e7f6ee;
  --chip-warn-bg: #fff3cd;
  --chip-crit-bg: #fde8e8;
  --chip-info-bg: #f1e4f9;
  --chip-muted-bg: #f2f0f5;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(153, 50, 204, 0.12) 0%, transparent 36%),
    linear-gradient(180deg, #ffffff 0%, #faf8fd 40%, var(--page) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font: 15px/1.5 "General Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 700; }
main { max-width: 1240px; margin: 0 auto; padding: 24px; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  background: rgba(255, 255, 255, 0.88); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
  padding: 12px 24px; position: sticky; top: 0; z-index: 50;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 15px; color: var(--ink); white-space: nowrap;
  letter-spacing: -0.01em;
}
.brand::first-letter { color: var(--accent); }
.tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 8px 13px; border-radius: 999px; color: var(--muted);
  white-space: nowrap; font-size: 14px; font-weight: 700;
}
.tabs a.on { background: var(--accent-soft); color: var(--accent-strong); }
.tabs a:hover { background: var(--accent-soft); color: var(--accent-strong); text-decoration: none; }
.logout { color: var(--muted); font-size: 18px; }
.badge {
  background: var(--critical); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; padding: 1px 7px; vertical-align: 2px;
}

/* ---- inbox ---- */
.inbox-item { padding: 12px 14px; }
.inbox-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.inbox-form {
  display: grid; gap: 8px; margin-top: 10px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  align-items: end;
}
.inbox-form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-2); }
.dismiss-form { margin-top: 8px; display: flex; gap: 8px; align-items: center; }

/* ---- drop page ---- */
.drop-page { max-width: 480px; margin: 0 auto; text-align: center; }
.drop-page form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.drop-zone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 2px dashed var(--accent); border-radius: 16px;
  padding: 44px 20px; cursor: pointer; background: var(--surface);
}
.drop-zone:active { background: var(--chip-info-bg); }
.drop-emoji { font-size: 44px; }
.drop-page button { padding: 14px; font-size: 17px; border-radius: 12px; }
.drop-done { padding: 40px 0; }
.drop-again {
  display: inline-block; margin-top: 18px; background: var(--accent);
  color: #fff; padding: 12px 22px; border-radius: 12px; font-weight: 600;
}

.page-title { font-size: 22px; }
.page-title .muted { font-weight: 400; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---- KPI tiles ---- */
.tiles {
  display: grid; gap: 12px; margin: 16px 0;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
}
.tile.hero { grid-column: span 2; }
.tile-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.tile-value { font-size: 26px; font-weight: 700; margin-top: 2px; }
.tile.hero .tile-value { font-size: 34px; }
.tile-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.pos { color: var(--good-text); }
.neg { color: var(--critical); }

/* ---- cards / chart ---- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px; margin-bottom: 16px;
}
.chart-wrap { position: relative; }
.viz-tooltip {
  position: absolute; pointer-events: none;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  padding: 8px 10px; font-size: 12.5px; min-width: 130px; z-index: 10;
}
.dispute-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chip-link { margin-left: auto; font-size: 14px; }

/* ---- totals strip ---- */
.strip {
  display: flex; gap: 18px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; margin: 14px 0; font-size: 14px;
  color: var(--ink-2);
}
.strip b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---- add box & forms ---- */
.add-box {
  background: var(--surface); border: 1px dashed var(--baseline);
  border-radius: 10px; margin-bottom: 14px;
}
.add-box summary { cursor: pointer; padding: 10px 14px; font-weight: 600; color: var(--accent); }
.grid-form {
  display: grid; gap: 10px; padding: 4px 14px 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.grid-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-2); }
.grid-form .span2 { grid-column: span 2; }
input, select, button {
  font: inherit; color: var(--ink);
  background: var(--page); border: 1px solid var(--baseline);
  border-radius: 8px; padding: 8px 10px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[type="file"] { padding: 6px; background: transparent; border-style: dashed; }
button {
  cursor: pointer; background: var(--accent); border-color: transparent;
  color: #fff; font-weight: 600;
}
button:hover { filter: brightness(1.08); }
button.mini, a.mini {
  background: var(--chip-muted-bg); color: var(--ink-2); font-weight: 500;
  padding: 4px 9px; font-size: 12.5px; border: 1px solid var(--border); border-radius: 7px;
  display: inline-block;
}
button.mini.good { color: var(--good-text); background: var(--chip-good-bg); }
button.mini.danger, button.chip-x { color: var(--critical); background: var(--chip-crit-bg); }
button.chip-x { padding: 0 6px; border: none; border-radius: 6px; font-size: 12px; }

/* ---- tables ---- */
.table-wrap {
  overflow-x: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
}
table { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 640px; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 600; padding: 10px 12px;
  border-bottom: 1px solid var(--gridline); white-space: nowrap;
}
td { padding: 9px 12px; border-bottom: 1px solid var(--gridline); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--chip-muted-bg); }
.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.strong { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; font-weight: 400; }
.empty { text-align: center; color: var(--muted); padding: 28px !important; }
.actions { white-space: nowrap; }
.actions > * { margin: 1px 2px 1px 0; }
.inline-form { display: inline; }
.good-text { color: var(--good-text); }
.crit-text { color: var(--critical); font-weight: 600; }
.warn-text { color: var(--critical); }

.card-h { margin: 0 0 12px; font-size: 16px; }
.mono { font-variant-numeric: tabular-nums; }

/* ---- hottest events (Sales) ---- */
.hotlist { display: flex; flex-direction: column; gap: 12px; }
.hot-row { display: flex; align-items: center; gap: 12px; }
.hot-rank {
  flex: none; width: 24px; height: 24px; border-radius: 999px;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--chip-muted-bg); color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.hot-row:first-child .hot-rank { background: #f59e0b; color: #fff; }
.hot-main { flex: 1; min-width: 0; }
.hot-name { font-weight: 600; }
.hot-bar { height: 8px; border-radius: 6px; background: var(--chip-muted-bg); overflow: hidden; margin: 5px 0; }
.hot-bar-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), #f59e0b); min-width: 3px; }
.hot-val { flex: none; text-align: right; white-space: nowrap; }

/* ---- cost breakdown (Variable Costs) ---- */
.catbreak { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.catrow { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; background: var(--page); }
.catrow summary { display: flex; justify-content: space-between; gap: 8px; cursor: pointer; font-weight: 600; }
.cat-total { font-variant-numeric: tabular-nums; color: var(--ink); }
.sublist { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.subrow { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-2); }

/* ---- status chips ---- */
.status-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  white-space: nowrap;
}
.status-chip b { font-size: 14px; }
.st-good { background: var(--chip-good-bg); color: var(--good-text); }
.st-warning { background: var(--chip-warn-bg); color: var(--ink); }
.st-critical { background: var(--chip-crit-bg); color: var(--critical); }
.st-info { background: var(--chip-info-bg); color: var(--accent); }
.st-muted { background: var(--chip-muted-bg); color: var(--ink-2); }

/* ---- receipts ---- */
.receipts { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.receipt-chip {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--chip-muted-bg); border-radius: 7px; padding: 1px 4px 1px 7px;
  font-size: 12px;
}
.upload-label { cursor: pointer; }

/* ---- dialogs ---- */
dialog {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; max-width: 560px; width: calc(100vw - 40px);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog h2 { margin-bottom: 4px; }
.dlg-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* ---- flash ---- */
.flash {
  position: fixed; top: 60px; right: 16px; z-index: 100;
  display: flex; flex-direction: column; gap: 6px;
}
.flash div {
  background: var(--ink); color: var(--page);
  padding: 9px 14px; border-radius: 9px; font-size: 13.5px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

/* ---- login ---- */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card {
  background: rgba(255, 255, 255, 0.9); border: 1px solid var(--line);
  border-radius: 28px; padding: 40px 36px; width: min(380px, 90vw); text-align: center;
  box-shadow: 0 12px 44px rgba(70, 38, 97, 0.12); backdrop-filter: blur(12px);
}
.login-logo {
  display: inline-grid; place-items: center; width: 60px; height: 60px;
  margin: 0 auto 6px; border-radius: 20px; font-size: 30px;
  background: linear-gradient(160deg, var(--accent), var(--accent-strong));
  box-shadow: 0 8px 22px rgba(153, 50, 204, 0.32);
}
.login-card h1 { margin: 10px 0 2px; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.login-card input { border-radius: 14px; padding: 12px 14px; text-align: center; }
.login-card button { padding: 12px; font-size: 16px; }
.login-error { color: var(--critical); font-weight: 600; }

/* ---- mobile ---- */
@media (max-width: 640px) {
  .tile.hero { grid-column: span 1; }
  .grid-form { grid-template-columns: 1fr 1fr; }
  .grid-form .span2 { grid-column: span 2; }
  main { padding: 10px; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile-value { font-size: 21px; }
  .tile.hero .tile-value { font-size: 27px; }
}

/* ===== Command Center / Bidwave HQ ===== */
.pipeline { display: flex; align-items: stretch; gap: 4px; overflow-x: auto; padding: 4px 0; }
.pipe-stage {
  flex: 1; min-width: 110px; background: var(--page); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 10px; text-align: center; color: var(--ink);
  display: flex; flex-direction: column; gap: 3px; transition: background .1s;
}
.pipe-stage:hover { background: var(--chip-info-bg); }
.pipe-ext { opacity: .7; }
.pipe-name { font-size: 13px; font-weight: 600; }
.pipe-metric { font-size: 20px; font-weight: 700; }
.pipe-sub { font-size: 11px; color: var(--muted); }
.pipe-arrow { display: flex; align-items: center; color: var(--muted); font-size: 18px; }

.hq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 780px) { .hq-grid { grid-template-columns: 1fr; } }

.todo-add { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.todo-add input[name="title"] { flex: 1; min-width: 160px; }
.todo-list { list-style: none; padding: 0; margin: 0; }
.todo-item { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--gridline); }
.todo-item.prio-high { border-left: 3px solid var(--critical); padding-left: 8px; }
.todo-check { background: none; border: 1.5px solid var(--baseline); color: var(--muted); border-radius: 50%; width: 22px; height: 22px; padding: 0; font-size: 12px; cursor: pointer; }
.todo-check:hover { border-color: var(--good); color: var(--good); }
.todo-title { flex: 1; }
.todo-area { font-size: 11px; color: var(--accent); background: var(--chip-info-bg); padding: 1px 7px; border-radius: 999px; }
.todo-due { font-size: 12px; color: var(--muted); }

.proj { padding: 9px 0; border-bottom: 1px solid var(--gridline); }
.proj-blocked { border-left: 3px solid var(--critical); padding-left: 8px; }
.proj-head { display: flex; align-items: center; gap: 8px; }

.ops-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.ops-card { background: var(--page); border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; color: var(--ink); }
.ops-card:hover { background: var(--chip-info-bg); }
.ops-icon { font-size: 28px; }
.ops-name { font-weight: 600; margin-top: 4px; }

/* ===== Sourcing cockpit ===== */
.sourcing-table td { vertical-align: middle; }
.cell-in { padding: 7px 9px; font-size: 13px; border-radius: 10px; width: 100%; min-width: 70px; }
.cell-in.num { width: 64px; min-width: 64px; text-align: right; }
.row-urgent td:first-child { border-left: 3px solid var(--accent); }
.row-stop { opacity: .55; }

/* =====================================================================
   SCRAPER SKIN — rounded cards, gradient tiles, pill buttons, soft tables
   (appended last so it wins the cascade; class names unchanged)
   ===================================================================== */
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.page-title .muted { font-weight: 400; }
h2 { font-family: "General Sans", system-ui, sans-serif; }

/* cards & panels */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 24px; padding: 22px; box-shadow: var(--shadow);
}
.card-h { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }

/* KPI tiles → scraper metric style */
.tiles { gap: 14px; }
.tile {
  border: 1px solid var(--line); border-radius: 20px; padding: 16px 18px;
  background: linear-gradient(180deg, #ffffff 0%, var(--surface-2) 100%);
  box-shadow: var(--shadow);
}
.tile-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--muted); }
.tile-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.tile.hero { background: linear-gradient(180deg, #ffffff 0%, var(--accent-soft) 100%); }
.tile.hero .tile-value { font-size: 38px; }
.pos { color: var(--good-text); }

/* totals strip → soft rounded bar */
.strip {
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
  box-shadow: var(--shadow); gap: 20px; padding: 12px 16px;
}
.strip b { color: var(--ink); }

/* business pipeline cells (command center) */
.pipe, .pipeline-cell, .ops-card { border-radius: 16px; }
.ops-card:hover { background: var(--accent-soft); }

/* status chips → scraper badges */
.status-chip {
  border: 1px solid var(--line); text-transform: uppercase;
  letter-spacing: 0.06em; font-size: 11.5px; font-weight: 700;
}
.st-muted { background: var(--chip-muted-bg); color: var(--muted); }

/* buttons → pill */
button, .add-box summary {
  border-radius: 999px; font-weight: 700; letter-spacing: 0.01em;
}
button { padding: 10px 18px; transition: transform .16s ease, background .16s ease; }
button:hover { background: var(--accent-strong); transform: translateY(-1px); }
button.mini, a.mini {
  border-radius: 999px; background: var(--chip-muted-bg); color: var(--ink-2);
  border: 1px solid var(--line); padding: 6px 12px; font-weight: 600;
}
button.mini:hover, a.mini:hover { background: var(--accent-soft); color: var(--accent-strong); transform: none; }

/* inputs → rounded */
input, select, textarea { border-radius: 12px; border: 1px solid var(--line); }
input:focus, select:focus { outline: 2px solid var(--accent); }

/* add-box → dashed purple */
.add-box { border: 1px dashed color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: 16px; }
.add-box summary { color: var(--accent-strong); border-radius: 16px; }

/* tables → scraper look */
.table-wrap { border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; overflow-x: auto; background: var(--surface); }
table { border-collapse: collapse; width: 100%; }
thead th {
  color: var(--muted); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  font-weight: 700; background: var(--surface-2); border-bottom: 1px solid var(--line);
  padding: 11px 12px; text-align: left; position: sticky; top: 0; z-index: 2;
}
tbody td { border-bottom: 1px solid var(--line); padding: 11px 12px; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, white); }
tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 40%, white); }
tbody tr:last-child td { border-bottom: 0; }

/* dialogs → rounded */
dialog { border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 12px 40px rgba(70,38,97,.18); }

/* flash → info note */
.flash { max-width: 1240px; margin: 12px auto 0; padding: 0 24px; }
.flash > div {
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  color: var(--accent-strong); border-radius: 14px; padding: 12px 16px; font-weight: 600;
}

/* hottest-events bar already themed; ensure fill uses purple gradient */
.hot-bar-fill { background: linear-gradient(90deg, var(--accent), #c77dff); }
.hot-row:first-child .hot-rank { background: var(--accent); }
