/* ---------------------------------------------------------------
   Colour tokens. Replace these with the Seller Imago palette:
   everything else in the interface reads from them.
---------------------------------------------------------------- */
:root {
  --brand: #145c7a;         /* primary actions, current period */
  --brand-soft: #e3eff4;
  --ink: #1d2430;           /* text */
  --ink-2: #5b6474;         /* secondary text */
  --ink-3: #8a93a3;
  --paper: #f3f5f7;         /* page background */
  --surface: #ffffff;
  --line: #dde2e8;
  --compare: #b9c2cf;       /* comparison period */
  --up: #1c7c54;
  --up-soft: #e2f3ea;
  --down: #b83a26;
  --down-soft: #fbe7e3;
  --warn: #9a6400;
  --warn-soft: #fdf1d8;
  /* P&L bar */
  --c-fees: #e08a3c;
  --c-cogs: #7a6fb3;
  --c-mfn: #c4a24a;
  --c-ship: #4f9dbf;
  --c-ads: #d1607a;
  --c-other: #9aa3ae;
  --c-margin: #1c7c54;

  --font: "Schibsted Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r-lg: 10px;
  --r-sm: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  /* no tabular-nums: in Schibsted Grotesk they widen the comma ("9 , 99 €") */
}
h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 6px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  padding: 0 24px; height: 56px;
  background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.mark { font-weight: 700; font-size: 18px; letter-spacing: 0.02em; }
.brand-sub { color: #aab3c2; font-size: 13px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tab {
  background: none; border: 0; color: #c8cfda; padding: 8px 12px; border-radius: var(--r-sm);
  cursor: pointer; white-space: nowrap;
}
.tab:hover { color: #fff; }
.tab.is-active { color: #fff; background: rgba(255,255,255,.12); }
.sync-pill { margin-left: auto; font-size: 12px; color: #aab3c2; white-space: nowrap; }
.sync-pill .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--up); }
.sync-pill .dot.err { background: #ff8a73; }
.sync-pill .dot.run { background: #ffd166; }

main { max-width: 1480px; margin: 0 auto; padding: 20px 24px 60px; }
.view { display: none; }
.view.is-active { display: block; }

/* ---------------- filters */
.filters {
  display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end;
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.fgroup { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fgroup.grow { flex: 1 1 180px; }
.fgroup.dates { flex-direction: row; align-items: center; gap: 6px; }
.fgroup.dates[hidden] { display: none; }
.dash { color: var(--ink-3); }
label { font-size: 12px; color: var(--ink-2); }
select, input[type=date], input[type=search], input[type=number], input:not([type]), input[type=text],
input[type=password], input[type=email], input[type=tel], input[type=url] {
  height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); min-width: 0;
}
select { padding-right: 28px; max-width: 240px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
  height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer; font-weight: 500;
}
.chip.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }

.period-line { color: var(--ink-2); margin: 16px 2px 10px; font-size: 13px; }
.period-line strong { color: var(--ink); font-weight: 600; }
.swatch { display: inline-block; width: 18px; height: 3px; border-radius: 2px; vertical-align: middle; margin: 0 6px 2px 0; }

/* ---------------- KPI ledger: one strip, each cell selects the chart metric */
.kpis {
  display: grid; grid-template-columns: repeat(8, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg) var(--r-lg) 0 0;
  overflow: hidden;
}
.kpi {
  text-align: left; border: 0; background: none; cursor: pointer;
  padding: 14px 16px 16px; border-right: 1px solid var(--line); position: relative;
}
.kpi:last-child { border-right: 0; }
.kpi:hover { background: #f8fafb; }
.kpi[aria-selected="true"] { background: var(--brand-soft); }
.kpi[aria-selected="true"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--brand);
}
.kpi[disabled] { cursor: default; }
.kpi-name { font-size: 12px; color: var(--ink-2); display: block; }
.kpi-val { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; display: block; margin: 4px 0 6px; white-space: nowrap; }
.kpi-was { font-size: 12px; color: var(--ink-3); display: block; margin-top: 4px; white-space: nowrap; }

.delta {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 4px; white-space: nowrap;
}
.delta.up { color: var(--up); background: var(--up-soft); }
.delta.down { color: var(--down); background: var(--down-soft); }
.delta.flat { color: var(--ink-2); background: #eef0f3; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.chart-panel { border-top: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); padding: 14px 16px 8px; }
.chart-wrap { position: relative; height: 280px; }

/* ---------------- P&L bar */
.pnl { margin-top: 16px; padding: 16px; }
.pnl-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.pnl-head h2 { font-size: 15px; margin: 0; font-weight: 600; }
.pnl-head .muted { color: var(--ink-2); font-size: 13px; }
.pnl-bar { display: flex; height: 30px; border-radius: var(--r-sm); overflow: hidden; background: #eef0f3; }
.pnl-bar span { display: block; height: 100%; min-width: 2px; }
.pnl-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 12px; }
.pnl-legend div { display: flex; flex-direction: column; }
.pnl-legend .k { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.pnl-legend .k i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.pnl-legend .v { font-weight: 600; font-size: 15px; }
.pnl-legend .p { font-size: 12px; color: var(--ink-3); }
.warn-line {
  margin-top: 12px; padding: 8px 12px; border-radius: var(--r-sm);
  background: var(--warn-soft); color: var(--warn); font-size: 13px;
}
.warn-line button { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: 0; font-weight: 600; }

/* ---------------- tables */
.table-panel { margin-top: 16px; }
.table-tools { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 12px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.is-on { background: var(--ink); color: #fff; }
.btn {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer; font-weight: 600;
  text-decoration: none; white-space: nowrap; font-size: 14px;
}
.btn.ghost { background: var(--surface); color: var(--brand); }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.danger { background: none; border-color: transparent; color: var(--down); }
.btn:disabled { opacity: .5; cursor: default; }

.table-scroll { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
.data th {
  text-align: right; font-weight: 600; color: var(--ink-2); font-size: 12px; padding: 10px 12px;
  border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--surface);
}
.data th.sortable { cursor: pointer; user-select: none; }
.data th.sortable:hover { color: var(--ink); }
.data th.sorted::after { content: " ↓"; }
.data th.sorted.asc::after { content: " ↑"; }
.data th:first-child, .data td:first-child { text-align: left; }
.data td { padding: 9px 12px; border-bottom: 1px solid #eef0f3; text-align: right; vertical-align: top; white-space: nowrap; }
.data tr:hover td { background: #fafbfc; }
.data tfoot td { font-weight: 700; border-top: 1px solid var(--line); border-bottom: 0; background: #fafbfc; }
.data .num-main { display: block; font-weight: 500; }
.data .num-sub { display: block; margin-top: 2px; }
.data .neg { color: var(--down); }
.data td.prod { min-width: 220px; max-width: 360px; white-space: normal; }
.prod-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
.prod-meta { color: var(--ink-3); font-size: 12px; margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.badge { font-size: 11px; font-weight: 600; padding: 0 5px; border-radius: 3px; background: #eef0f3; color: var(--ink-2); }
.badge.mfn { background: #fff0dc; color: #8a5a00; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.note { color: var(--brand); }
.empty { padding: 40px 16px; text-align: center; color: var(--ink-2); }

/* ---------------- secondary views */
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 6px 0 14px; flex-wrap: wrap; }
.lede { color: var(--ink-2); margin: 0; max-width: 70ch; }
.hint { color: var(--ink-2); font-size: 13px; margin: 0 0 12px; max-width: 90ch; }
.head-actions { display: flex; gap: 8px; }
.costs input { height: 30px; width: 70px; text-align: right; }
.costs input.w-date { width: 124px; text-align: left; }
.costs input.w-text { width: 118px; text-align: left; }
.costs td, .costs th { padding-left: 8px; padding-right: 8px; }
.data.costs td.prod { min-width: 190px; max-width: 240px; }
.costs .unit { color: var(--ink-3); margin-left: 3px; }
.costs td { vertical-align: middle; }
.history { color: var(--ink-3); font-size: 12px; white-space: normal; }
.expense-form { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; padding: 14px 16px; margin-bottom: 16px; }
.status-ok { color: var(--up); font-weight: 600; }
.status-error { color: var(--down); font-weight: 600; }
.status-running { color: var(--warn); font-weight: 600; }
.msg { white-space: normal; text-align: left !important; color: var(--ink-2); max-width: 640px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-sm);
  transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.loading { opacity: .55; transition: opacity .15s; }

@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi:nth-child(4n) { border-right: 0; } .kpi:nth-child(-n+4) { border-bottom: 1px solid var(--line); } }
@media (max-width: 700px) {
  main { padding: 14px 12px 40px; }
  .topbar { padding: 0 12px; gap: 12px; }
  .brand-sub, .sync-pill { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-bottom: 1px solid var(--line); }
  .kpi:nth-child(2n) { border-right: 0; }
  .kpi:nth-child(4n) { border-right: 0; }
  .kpi-val { font-size: 19px; }
  .chart-wrap { height: 220px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------------- profile menu */
.profile { position: relative; }
.sync-pill + .profile { margin-left: 16px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.avatar:hover, .avatar[aria-expanded="true"] { box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.menu {
  position: absolute; right: 0; top: 44px; width: 270px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 10px 30px rgba(29,36,48,.18);
  padding: 6px; z-index: 40;
}
.menu[hidden] { display: none; }
.menu-head { padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: flex; flex-direction: column; gap: 2px; }
.menu-head span { color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.menu-company { margin-top: 4px; font-weight: 600; color: var(--ink) !important; }
.menu button {
  display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left;
  border: 0; background: none; padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer;
}
.menu button:hover { background: var(--paper); }
.menu-hint { font-size: 12px; color: var(--warn); }
.menu-hint.ok { color: var(--up); }

/* ---------------- connections */
.conn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.conn { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.conn .fgroup input, .conn .fgroup select { width: 100%; max-width: none; }
.conn-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.conn h2, .form-grid h2 { font-size: 16px; margin: 0; font-weight: 600; }
.muted { color: var(--ink-2); font-size: 13px; margin: 2px 0 0; }
.help { color: var(--ink-2); font-size: 12.5px; margin: 0; max-width: 70ch; }
.conn-status { margin: 0; font-size: 13px; }
.conn-status:empty { display: none; }
.conn-status.ok { color: var(--up); }
.conn-status.err { color: var(--down); }
.conn-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status-badge { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; background: #eef0f3; color: var(--ink-2); }
.status-badge.ok { background: var(--up-soft); color: var(--up); }
.status-badge.err { background: var(--down-soft); color: var(--down); }
.status-badge.warn { background: var(--warn-soft); color: var(--warn); }
.profiles:empty { display: none; }
.profiles { border: 1px solid var(--line); border-radius: var(--r-sm); }
.profiles-head { font-size: 12px; color: var(--ink-2); padding: 8px 10px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.profile-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid #eef0f3; cursor: pointer; }
.profile-row:last-child { border-bottom: 0; }
.profile-row input { width: 16px; height: 16px; }
.profile-row .p-sub { color: var(--ink-3); font-size: 12px; margin-left: auto; }

/* ---------------- forms */
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; padding: 18px; }
.form-grid .fgroup input, .form-grid .fgroup select { width: 100%; max-width: none; }
.form-grid h2:not(:first-child) { margin-top: 8px; }
.span-all { grid-column: 1 / -1; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; }
.login-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.login-grid .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
input:disabled, select:disabled { background: var(--paper); color: var(--ink-2); }

/* ---------------- login page */
.login-body { min-height: 100vh; display: flex; }
.login-wrap { margin: auto; width: 100%; max-width: 400px; padding: 24px 16px; }
.login-brand { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; color: var(--ink-2); }
.login-brand .mark { color: var(--ink); font-size: 20px; }
.login-card { padding: 26px 24px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { margin: 0; }
.login-card input { width: 100%; height: 40px; }
.btn.wide { width: 100%; justify-content: center; height: 42px; }
.form-error { color: var(--down); margin: 0; font-size: 13px; min-height: 0; }
.form-error:empty { display: none; }

@media (max-width: 1000px) {
  .conn-grid, .login-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .form-grid, .login-grid .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .menu { position: fixed; right: 8px; left: 8px; width: auto; top: 56px; }
}

/* ---------------- column picker */
.colpick { position: relative; }
.colpanel {
  position: absolute; left: 0; top: 40px; z-index: 30; width: max-content; max-width: 92vw;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 10px 30px rgba(29,36,48,.16); padding: 14px 16px;
}
.colpanel[hidden] { display: none; }
.colpanel-grid { display: grid; grid-template-columns: repeat(5, max-content); gap: 12px 28px; }
.colpanel fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.colpanel legend { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; padding: 0; }
.colpanel label { font-size: 13px; color: var(--ink); display: flex; gap: 7px; align-items: center; cursor: pointer; white-space: nowrap; }
.colpanel input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--brand); }
.colpanel-foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; flex-wrap: wrap; }

/* ---------------- one-line P&L table */
.table-scroll { max-height: 75vh; overflow: auto; }
.data thead th { z-index: 2; }
.data th:first-child, .data td:first-child {
  position: sticky; left: 0; z-index: 1; background: var(--surface);
  box-shadow: 1px 0 0 var(--line);
}
.data thead th:first-child { z-index: 3; }
.data tr:hover td:first-child { background: #fafbfc; }
.data tfoot td { position: sticky; bottom: 0; z-index: 1; }
.data tfoot td:first-child { z-index: 2; background: #fafbfc; }
.data th.sub, .data td.sub { background: var(--brand-soft); }
.data tr:hover td.sub { background: #d9e8ee; }
.data tfoot td.sub { background: #d9e8ee; }
.data td.sub .num-main { font-weight: 700; }
.data td.cost .num-main { color: var(--ink-2); }
.data.compact td { padding-top: 7px; padding-bottom: 7px; }
.data.compact .prod-title { -webkit-line-clamp: 1; }
.data.compact .prod-meta { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }
.data td.prod { min-width: 290px; max-width: 340px; }
@media (max-width: 800px) {
  .colpanel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .colpanel { width: auto; }
  .colpanel { position: fixed; left: 8px; right: 8px; top: 110px; width: auto; max-height: 70vh; overflow: auto; }
  .data td.prod { min-width: 160px; max-width: 200px; }
}

[hidden] { display: none !important; }

/* ---------------- client switcher */
.switcher { position: relative; }
.switch-btn {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; max-width: 260px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); border-radius: var(--r-sm);
  color: #fff; cursor: pointer; font-weight: 600;
}
.switch-btn:hover, .switch-btn[aria-expanded="true"] { background: rgba(255,255,255,.16); }
.switch-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { font-size: 11px; color: #aab3c2; }
.switch-static { color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.switch-panel {
  position: absolute; left: 0; top: 42px; width: 330px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 10px 30px rgba(29,36,48,.18);
  padding: 8px; z-index: 40;
}
.switch-panel input[type=search] { width: 100%; margin-bottom: 6px; }
.switch-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow: auto; }
.switch-list button {
  width: 100%; display: grid; grid-template-columns: 10px 1fr; column-gap: 10px; align-items: center;
  text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer;
}
.switch-list button:hover { background: var(--paper); }
.switch-list [aria-selected="true"] button { background: var(--brand-soft); }
.switch-list .dot { width: 8px; height: 8px; border-radius: 50%; grid-row: span 2; background: var(--compare); }
.switch-list .dot.ok { background: var(--up); }
.switch-list .dot.err { background: var(--down); }
.sw-main { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-sub { font-size: 12px; color: var(--ink-2); }
.sw-empty { padding: 10px; color: var(--ink-2); font-size: 13px; }
.switch-add { width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); background: none; padding: 10px; margin-top: 6px; color: var(--brand); font-weight: 600; cursor: pointer; }
.switch-new { border-top: 1px solid var(--line); margin-top: 6px; padding: 10px 4px 4px; display: flex; flex-direction: column; gap: 8px; }
.switch-new input { width: 100%; }
.switch-new .chip { height: 28px; padding: 0 8px; font-size: 12px; }
.switch-new-actions { display: flex; justify-content: flex-end; gap: 6px; }
button.sync-pill { background: none; border: 0; cursor: pointer; padding: 6px 8px; border-radius: var(--r-sm); }
button.sync-pill:hover:not(:disabled) { background: rgba(255,255,255,.08); color: #fff; }
button.sync-pill:disabled { cursor: default; }

/* ---------------- team & access */
.invite { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; padding: 14px 16px; margin-bottom: 16px; }
.invite input { width: 100%; }
.credentials { padding: 16px; margin-bottom: 16px; display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; border-color: var(--brand); background: var(--brand-soft); }
.credentials pre { margin: 10px 0 0; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); font: 13px/1.6 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; }
.cred-actions { display: flex; gap: 8px; }

/* ---------------- first password */
.overlay { position: fixed; inset: 0; background: rgba(29,36,48,.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.overlay .login-card { width: 100%; max-width: 400px; }

@media (max-width: 700px) {
  .brand { display: none; }
  .switch-btn { max-width: 150px; }
  .switch-panel { position: fixed; left: 8px; right: 8px; width: auto; top: 56px; }
}

#invRole { min-width: 290px; max-width: none; }

/* ---------------- product cell: thumbnail, ASIN link, SKU, category */
.prod-wrap { display: flex; gap: 10px; align-items: flex-start; }
.prod-text { min-width: 0; }
.thumb { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 6px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.thumb.empty { display: inline-block; background: var(--paper); }
.data.compact .thumb { width: 28px; height: 28px; flex-basis: 28px; }
.prod-meta a.asin { color: var(--ink-2); text-decoration: none; border-bottom: 1px dotted var(--ink-3); }
.prod-meta a.asin:hover { color: var(--brand); border-color: var(--brand); }
.sku { color: var(--ink-2); }
.badge.cat { background: var(--brand-soft); color: var(--brand); font-weight: 500; }

/* ---------------- stock and buy box */
.data td.stock-low .num-main { color: var(--down); font-weight: 700; }
.data td.stock-mid .num-main { color: var(--warn); font-weight: 600; }
.muted-cell { color: var(--ink-3); font-size: 12px; }
.bbcell { text-align: left !important; }
.bb-line { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.bb { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: 0 0 20px; }
.bb.yes { background: var(--up-soft); color: var(--up); }
.bb.no { background: var(--down-soft); color: var(--down); }
.bbcell a { color: var(--ink-2); }
.bb-price { margin-left: 26px; color: var(--ink-3); font-size: 12px; }

/* ---------------- sync progress */
#syncProgress { padding: 18px; margin-bottom: 16px; border-color: var(--brand); }
.progress-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; margin-bottom: 10px; }
.progress-eta { font-weight: 600; color: var(--brand); }
.bar { height: 10px; background: var(--paper); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .6s ease; }
.progress-foot { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-2); font-size: 13px; margin: 8px 0 10px; flex-wrap: wrap; }
.status-partial, .status-stalled { color: var(--warn); font-weight: 600; }

/* ---------------- language switch */
.menu-lang { display: flex; gap: 4px; padding: 6px 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 6px 0; }
.menu .menu-lang button { width: auto; flex: 1; justify-content: center; border: 1px solid var(--line); padding: 5px 8px; font-size: 13px; }
.menu .menu-lang button.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }
.login-lang { margin-left: auto; display: inline-flex; gap: 4px; }
.login-lang button { border: 1px solid var(--line); background: var(--surface); border-radius: 4px; padding: 2px 8px; font-size: 12px; cursor: pointer; color: var(--ink-2); }
.login-lang button.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }
.login-brand { width: 100%; }

/* long column titles (FR) wrap instead of widening the table */
.data thead th { white-space: normal; min-width: 64px; max-width: 118px; vertical-align: bottom; line-height: 1.25; hyphens: auto; }
.data thead th:first-child { max-width: none; }
.costs thead th, #runTable thead th, #teamTable thead th, #expenseTable thead th { max-width: none; white-space: nowrap; }

/* ---------------- sync options: 30 d / 60 d / 90 d / 6 months / 13 months */
.sync-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.sync-opt { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.sync-opt.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.sync-opt.done { background: #fbfcfd; }
.so-head { display: flex; flex-direction: column; gap: 2px; }
.so-head strong { font-size: 16px; }
.so-head .muted { font-size: 12px; }
.so-missing { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; }
.so-missing .ok { color: var(--up); font-weight: 600; }
.so-time { font-size: 13px; color: var(--brand); font-weight: 600; }
.so-note { font-size: 12px; color: var(--ink-3); }
.so-last { font-size: 12px; color: var(--ink-2); margin-top: auto; }
.sync-opt .btn { justify-content: center; width: 100%; }
@media (max-width: 1100px) { .sync-options { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .sync-options { grid-template-columns: 1fr 1fr; } }

/* ---------------- loading placeholders */
.sk-line, .sk-bar { display: block; height: 10px; border-radius: 4px; margin: 6px 0; background: linear-gradient(90deg, #eceff3 0%, #f6f7f9 50%, #eceff3 100%); background-size: 200% 100%; animation: sk 1.2s ease-in-out infinite; }
.sk-line.big { height: 20px; }
.sk-bar { height: 30px; margin-top: 12px; }
.w30 { width: 30%; } .w40 { width: 40%; } .w70 { width: 70%; }
.kpi.sk { cursor: default; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk-line, .sk-bar { animation: none; } }
.so-foot { grid-column: 1 / -1; margin: 0; }

/* ---------------- stop sync */
.stop-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 10px; }
.btn.danger-solid { background: var(--down); border-color: var(--down); color: #fff; }
.stopping { color: var(--warn); font-weight: 600; font-size: 13px; }
.status-stopped { color: var(--ink-2); font-weight: 600; }

/* ---------------- Amazon Ads report import */
.ads-import { padding: 16px 18px; margin-bottom: 16px; }
.ads-import h2 { font-size: 15px; margin: 0 0 4px; }
.ads-import-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
#adsPreview { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
#adsPreview table.data { margin: 8px 0 4px; }
#adsPreview tfoot th { border-top: 1px solid var(--line); }
#adsPreview .help { margin-top: 10px; }

/* ---------------- v4.2 */
.app-version { font-size: 10.5px; color: rgba(255, 255, 255, 0.5); letter-spacing: 0.02em; }
.danger-zone { padding: 16px 18px; margin-top: 16px; border-color: var(--down); }
.danger-zone h2 { font-size: 15px; margin: 0 0 4px; color: var(--down); }
.danger-zone .invite { border: 0; padding: 12px 0 0; }
#allUsersPanel { margin-top: 16px; }
#allUsersPanel .panel-head { padding: 14px 16px 6px; }
#allUsersPanel h2 { font-size: 15px; margin: 0 0 4px; }

/* ---------------- v5.0 sign-in pages */
.login-links { margin: 14px 0 0; font-size: 13.5px; text-align: center; }
.login-links a { color: var(--accent, #175873); }
.form-note { margin: 0 0 10px; padding: 8px 10px; border-radius: 6px; background: #e6f3ec; color: #1f6b46; font-size: 13.5px; }
.mail-test { padding: 16px 18px; margin-top: 16px; }
.mail-test h2 { font-size: 15px; margin: 0 0 4px; }

/* ---------------- v5.2 product costs: per-order cost, fill many, save once */
.mfn-order { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end; padding: 16px 18px; margin-bottom: 14px; }
.mfn-order-text { flex: 1 1 360px; }
.mfn-order h2 { font-size: 15px; margin: 0 0 4px; }
.mfn-order .help { margin: 0; }
.mfn-order .history { margin-top: 6px; }
.mfn-order input[type=number] { width: 110px; }
.fill-bar { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; padding: 14px 18px; margin-bottom: 14px; }
.fill-bar .grow { flex: 1 1 260px; }
.fill-bar .grow input { width: 100%; }
.fill-bar #fillValue { width: 140px; }
.fill-count { flex-basis: 100%; margin: 0; font-size: 12.5px; color: var(--ink-2); }
table.costs th.tick, table.costs td.tick { width: 34px; text-align: center; padding-left: 10px; padding-right: 4px; }
table.costs tr.dirty td { background: #fff8e6; }
table.costs tr.dirty td.tick { box-shadow: inset 3px 0 0 #e0a100; }
table.costs tr.missing td { background: var(--warn-soft); }
table.costs tr.missing input[name=unit_cost] { border-color: var(--down); box-shadow: 0 0 0 2px rgba(192, 57, 43, .18); }
.save-bar { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; gap: 12px; justify-content: flex-end;
  margin-top: 12px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 6px 24px rgba(23, 32, 51, .14); }
.save-bar #dirtyCount { margin-right: auto; font-weight: 600; }
/* the tick column comes first on the costs page: the product column keeps the left alignment */
table.costs th:nth-child(2), table.costs td:nth-child(2) { text-align: left; }
table.costs th.tick, table.costs td.tick { position: static; }
table.costs td.prod .prod-wrap { justify-content: flex-start; }
table.costs .tick input[type=checkbox] { width: 16px; height: 16px; padding: 0; margin: 0; accent-color: var(--brand); cursor: pointer; }
