/* ============================================================================
   Price Watch — 2026 theme. Loaded AFTER style.css and only changes how things look and how easy they are to use.
   To go back to the old look, remove the theme.css <link> and ui.js <script> (includes/header.php, footer.php, login.php, auth_shell.php).
   ============================================================================ */

/* ---------- colours, shape ---------- */
:root {
  --brand-indigo: #4f46e5;
  --brand-indigo-dark: #4338ca;
  --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --hero-gradient: linear-gradient(120deg, #312e81 0%, #4f46e5 48%, #7c3aed 100%);
  --brand-gradient: linear-gradient(145deg, #1e1b4b 0%, #312e81 55%, #4c1d95 100%);

  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-alt: #f7f8fc;
  --border: #e6e8f2;
  --border-strong: #d6d9e8;
  --text: #171a2e;
  --text-muted: #5b6178;
  --text-faint: #8a90a8;
  --info: #4f46e5;
  --info-bg: #eeefff;

  --row-stripe: #fafbff;
  --row-hover: #f0f1ff;
  --nav-bg: #ffffff;
  --nav-text: #3d4260;
  --nav-muted: #8a90a8;
  --nav-hover: #f3f4fd;
  --nav-active-bg: #eeefff;
  --nav-active-text: #3730a3;

  --radius-sm: 10px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(23, 26, 46, .04), 0 1px 8px rgba(23, 26, 46, .03);
  --shadow: 0 6px 18px rgba(49, 46, 129, .10);
  --shadow-lg: 0 18px 44px rgba(49, 46, 129, .18);

  --sidebar-w: 252px;
  --topbar-h: 64px;
  --topbar-bg: rgba(255, 255, 255, .88);
}

:root[data-theme="dark"] {
  --bg: #0c0e1a;
  --surface: #141729;
  --surface-alt: #1b1f35;
  --border: #272c47;
  --border-strong: #353b5c;
  --text: #e9ebf7;
  --text-muted: #a4aac6;
  --text-faint: #767d9d;
  --info: #a5b4fc;
  --info-bg: rgba(129, 140, 248, .18);
  --row-stripe: #161a2e;
  --row-hover: #20254180;
  --nav-bg: #11132200;
  --nav-bg: #111322;
  --nav-text: #c3c8e0;
  --nav-muted: #767d9d;
  --nav-hover: #1b1f35;
  --nav-active-bg: rgba(129, 140, 248, .18);
  --nav-active-text: #e0e3ff;
  --topbar-bg: rgba(20, 23, 41, .88);
}
:root[data-theme="dark"] a:not(.btn):not(.sidebar-link):not(.pill):not(.card) { color: var(--accent-light); }
:root[data-theme="dark"] .btn-outline { color: var(--accent-light); border-color: rgba(165, 180, 252, .35); }
:root[data-theme="dark"] .tab-btn.active { color: #e0e3ff; }

.content { animation: none; max-width: 1680px; padding: 22px 26px 56px; }

::-webkit-scrollbar-thumb { background: #c7cbe0; border: 2px solid transparent; background-clip: padding-box; }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #3a4066; background-clip: padding-box; }

/* ---------- sidebar: light, calm, with a clear "you are here" ---------- */
.sidebar { background: var(--nav-bg); color: var(--nav-text); border-right: 1px solid var(--border); box-shadow: none; }
.sidebar-brand { color: var(--text); border-bottom: 0; padding: 16px 18px 10px; font-size: 17.5px; }
.brand-mark { background: var(--accent-gradient); box-shadow: 0 6px 14px color-mix(in srgb, var(--brand-indigo) 30%, transparent); }
.sidebar-scroll { padding: 4px 10px 14px; scrollbar-width: thin; }

.sidebar-scroll > div.sidebar-section { color: var(--nav-muted); opacity: 1; }
.sidebar-scroll > .sidebar-link { color: var(--nav-text); font-weight: 600; }
.sidebar-scroll > .sidebar-link > i { color: var(--brand-indigo); background: var(--info-bg); }
:root[data-theme="dark"] .sidebar-scroll > .sidebar-link > i { color: var(--accent-light); }
.sidebar-link:hover { background: var(--nav-hover); color: var(--text); transform: none; }
.sidebar-scroll > .sidebar-link.active { background: var(--nav-active-bg); color: var(--nav-active-text); }
.sidebar-scroll > .sidebar-link.active > i { background: var(--accent-gradient); color: #fff; }
.sidebar-link.active::before { left: -10px; background: var(--brand-indigo); box-shadow: none; }

details.nav-group { margin: 3px 0 0; }
details.nav-group > summary.sidebar-section { background: transparent; color: var(--nav-text); font-weight: 600; opacity: 1; }
details.nav-group > summary.sidebar-section:hover { background: var(--nav-hover); }
details.nav-group > summary.sidebar-section > span > i { background: color-mix(in srgb, var(--g) 18%, transparent); color: color-mix(in srgb, var(--g) 72%, #14162b); }
:root[data-theme="dark"] details.nav-group > summary.sidebar-section > span > i { color: var(--g); }
details.nav-group[data-has-active="1"] > summary.sidebar-section { background: transparent; color: var(--text); font-weight: 700; }
details.nav-group > .sidebar-link { color: var(--nav-text); border-left: 2px solid var(--border); margin-left: 22px; }
details.nav-group > .sidebar-link i { opacity: .6; }
details.nav-group > .sidebar-link:hover { background: var(--nav-hover); color: var(--text); border-left-color: color-mix(in srgb, var(--g) 70%, #333); }
details.nav-group > .sidebar-link.active { background: var(--nav-active-bg); color: var(--nav-active-text); border-left: 2px solid var(--brand-indigo); font-weight: 700; }
details.nav-group > .sidebar-link.active i { color: var(--brand-indigo); opacity: 1; }
:root[data-theme="dark"] details.nav-group > .sidebar-link.active i { color: var(--accent-light); }

.sidebar-user { border-top: 1px solid var(--border); background: var(--surface-alt); padding: 12px 16px; }
.sidebar-user .name { color: var(--text); }
.sidebar-user .role { color: var(--nav-muted); }
.sidebar-user .logout-btn { color: var(--text-muted); width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.sidebar-user .logout-btn:hover { color: var(--danger); background: var(--danger-bg); }

/* page search at the top of the menu (assets/js/ui.js) */
.nav-search { position: relative; padding: 2px 12px 8px; }
.nav-search > i { position: absolute; left: 23px; top: 12px; color: var(--nav-muted); font-size: 13px; pointer-events: none; }
.nav-search input { width: 100%; padding: 8px 50px 8px 32px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-alt); color: var(--text); font: inherit; font-size: 13px; }
.nav-search input:focus { outline: none; border-color: var(--brand-indigo); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-indigo) 14%, transparent); }
.nav-search kbd { position: absolute; right: 19px; top: 10px; font: 600 10.5px var(--font-body); color: var(--nav-muted); border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 5px; background: var(--surface); pointer-events: none; }
.nav-search input:focus ~ kbd, .nav-search.has-value kbd { display: none; }
.nav-results { display: none; }
.sidebar.is-searching .sidebar-scroll { display: none; }
.sidebar.is-searching .nav-results { display: block; flex: 1; overflow-y: auto; padding: 0 10px 14px; }
.nav-results a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--nav-text); font-size: 13.5px; font-weight: 500; text-decoration: none; }
.nav-results a i { color: var(--brand-indigo); width: 18px; text-align: center; }
:root[data-theme="dark"] .nav-results a i { color: var(--accent-light); }
.nav-results a span { flex: 1; min-width: 0; }
.nav-results a small { display: block; font-size: 11px; color: var(--nav-muted); font-weight: 500; }
.nav-results a:hover, .nav-results a.is-sel { background: var(--nav-active-bg); color: var(--nav-active-text); text-decoration: none; }
.nav-results .nav-none { padding: 14px 10px; font-size: 13px; color: var(--nav-muted); }

/* hide / show the menu on a computer, so wide tables get the whole screen */
.nav-collapse { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.nav-collapse:hover { background: var(--info-bg); color: var(--brand-indigo); }
@media (min-width: 961px) {
  .main { transition: margin-left .2s ease; }
  html.nav-hidden .sidebar { transform: translateX(-100%); visibility: hidden; }
  html.nav-hidden .main { margin-left: 0; }
  html.nav-hidden .content { max-width: none; }
}
@media (max-width: 960px) { .nav-collapse { display: none; } .sidebar { box-shadow: 0 0 40px rgba(15, 23, 42, .25); } }

/* ---------- top bar ---------- */
.topbar { background: var(--topbar-bg); }
.topbar-crumb { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand-indigo); line-height: 1.2; }
:root[data-theme="dark"] .topbar-crumb { color: var(--accent-light); }
.topbar-title { font-size: 17.5px; line-height: 1.25; }
.topbar-sub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62vw; }
.topbar-left > div { min-width: 0; }
.topbar-title { overflow: hidden; text-overflow: ellipsis; }
.hamburger, .theme-toggle-btn { border-color: var(--border-strong); font-size: 16px; }
.theme-toggle-btn:hover, .hamburger:hover { background: var(--info-bg); color: var(--brand-indigo); }

/* ---------- cards ---------- */
.card { padding: 20px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 16px; }
.card-header h2 { font-size: 17.5px; }
.card-desc { max-width: 100ch; line-height: 1.5; }
a.card:hover { border-color: var(--brand-indigo); }

/* ---------- buttons ---------- */
.btn { border-radius: 10px; padding: 9px 15px; }
.btn-primary { background: var(--accent-gradient); box-shadow: 0 4px 14px color-mix(in srgb, var(--brand-indigo) 28%, transparent); }
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 7px 20px color-mix(in srgb, var(--brand-indigo) 34%, transparent); }
.btn-secondary { box-shadow: 0 1px 2px rgba(23, 26, 46, .05); }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand-indigo); background: var(--info-bg); }
.btn-outline { border-color: color-mix(in srgb, var(--brand-indigo) 28%, transparent); }
.btn-outline:hover:not(:disabled) { border-color: var(--brand-indigo); }
.btn-ghost:hover:not(:disabled) { background: var(--info-bg); }
.btn-sm { padding: 6px 11px; border-radius: 8px; }

/* ---------- tabs as pills ---------- */
.tab-btn { border: 0; border-bottom: 0; border-radius: 999px; padding: 7px 15px; margin: 0 2px 6px 0; }
.tab-btn:hover { background: var(--surface-alt); }
.tab-btn.active { background: var(--info-bg); color: var(--brand-indigo-dark); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-indigo) 28%, transparent); border-bottom-color: transparent; }

/* ---------- forms and filter bars ---------- */
.input, .select, textarea { border-radius: 10px; padding: 9px 12px; }
.input:hover:not(:focus):not(:disabled) { border-color: #b9bdd8; }
:root[data-theme="dark"] .input:hover:not(:focus):not(:disabled) { border-color: #4a5180; }
/* the search box of a filter row keeps a usable width instead of being squeezed by the other filters */
.flex.flex-wrap > .input-group[style*="flex:1"], .flex.flex-wrap > .input-group[style*="flex: 1"] { flex: 1 1 260px !important; min-width: min(260px, 100%); max-width: 460px !important; }
.flex.flex-wrap > select.input { width: auto; min-width: 130px; flex: 0 1 auto; }
.flex.flex-wrap > select.input.search-field-select { min-width: 150px; max-width: 190px !important; }
.date-range { border-radius: 10px; }
.checkbox-row input, table.data-table input[type="checkbox"] { accent-color: var(--brand-indigo); }
table.data-table input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* ---------- tables: more rows on screen, readable headings that stay put ---------- */
.table-wrap { border-radius: 12px; background: var(--surface); }
table.data-table thead th { text-transform: none; letter-spacing: 0; font-size: 12.25px; font-weight: 700; color: var(--text-muted); background: var(--surface-alt); padding: 9px 11px; }
table.data-table tbody td { padding: 8px 11px; line-height: 1.4; }
table.data-table tbody tr:nth-child(even) { background: var(--row-stripe); }
table.data-table tbody tr:hover { background: var(--row-hover); }
table.data-table tbody tr.row-flagged { background: var(--danger-bg); }
.cell-num { font-variant-numeric: tabular-nums; }
@media (min-width: 701px) {
  /* the table scrolls inside its own box, so the column headings never scroll out of sight */
  .table-wrap { max-height: max(420px, calc(100vh - var(--topbar-h) - 48px)); overflow: auto; }
  table.data-table thead th, table.data-table tbody td { border-right-color: var(--border); border-bottom-color: var(--border); }
  table.data-table thead th { border-bottom: 2px solid var(--border-strong); }
  table.data-table thead th.col-wide { min-width: 230px; }
  table.data-table thead th.col-mid { min-width: 148px; }
}
table.data-table thead th.cell-num { font-family: var(--font-body); }
@media print { .table-wrap { max-height: none; overflow: visible; } .sidebar, .topbar, .to-top { display: none; } .main { margin-left: 0; } }

.pager { margin-top: 14px; padding: 4px 0; }
.badge { padding: 3px 10px; }
.empty-state { padding: 44px 20px; }
.empty-state i { width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 50%; background: var(--info-bg); color: var(--brand-indigo); display: flex; align-items: center; justify-content: center; font-size: 26px; }
:root[data-theme="dark"] .empty-state i { color: var(--accent-light); }

/* ---------- popups and messages ---------- */
.modal-backdrop { background: rgba(17, 19, 45, .55); }
.modal { box-shadow: 0 30px 70px rgba(17, 19, 45, .35); }
.toast { border-radius: 12px; }
.toast.success { background: #046c4e; }
.toast.error { background: #9b1c1c; }
.auth-alert { border-radius: 12px; border: 1px solid transparent; }
.auth-alert.error { border-color: rgba(240, 68, 56, .25); }
.auth-alert.success { border-color: rgba(18, 183, 106, .25); }
.auth-alert.info { border-color: var(--border); }
:root[data-theme="dark"] .auth-alert.error { color: #fda29b; }
:root[data-theme="dark"] .auth-alert.success { color: #75e0a7; }

/* back to top (ui.js) */
.to-top { position: fixed; right: 31px; bottom: 26px; z-index: 110; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--brand-indigo); box-shadow: var(--shadow); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 17px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease; }
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
:root[data-theme="dark"] .to-top { color: var(--accent-light); }
body.has-ai-chat .to-top { bottom: 92px; }
body.ai-chat-open .to-top { display: none; }
@media (max-width: 560px) { body.has-ai-chat .to-top, .to-top { right: auto; bottom: auto; left: calc(100vw - 63px); top: calc(100vh - 134px); top: calc(100dvh - 134px); } }

/* ---------- dashboard ---------- */
.dash-hero { background: var(--hero-gradient); border-radius: 20px; padding: 24px 26px; color: #fff; margin-bottom: 18px; position: relative; overflow: hidden; box-shadow: 0 16px 36px color-mix(in srgb, var(--brand-indigo) 28%, transparent); }
.dash-hero::after { content: ''; position: absolute; width: 360px; height: 360px; right: -110px; top: -190px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 68%); pointer-events: none; }
.dash-hero h1 { color: #fff; font-size: 25px; }
.dash-hero p { color: rgba(255, 255, 255, .82); margin-bottom: 0; }
.dash-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; position: relative; z-index: 1; }
.dash-hero .btn-hero { background: #fff; color: var(--brand-indigo-dark); box-shadow: 0 8px 20px rgba(17, 19, 45, .22); }
.dash-hero .btn-hero:hover { text-decoration: none; transform: translateY(-1px); }
.dash-sync { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .18); position: relative; z-index: 1; }
.dash-sync-label { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: rgba(255, 255, 255, .72); margin-right: 4px; }
.dash-sync .btn { background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .24); color: #fff; box-shadow: none; }
.dash-sync .btn:hover:not(:disabled) { background: rgba(255, 255, 255, .24); border-color: rgba(255, 255, 255, .45); }
.dash-sync .spinner.dark { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }

.stat-grid { grid-template-columns: repeat(auto-fit, minmax(188px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { padding: 17px 18px; display: block; color: var(--text); }
.stat-card::before { height: 0; }
.stat-card .icon { width: 38px; height: 38px; margin-bottom: 11px; }
.stat-card.indigo .icon { background: linear-gradient(135deg, #818cf8, #4f46e5); }
.stat-card .value { font-size: 26px; line-height: 1.2; }
.stat-card:hover { transform: none; box-shadow: var(--shadow-sm); }
a.stat-card { text-decoration: none; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
a.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand-indigo) 45%, transparent); text-decoration: none; }
a.stat-card .go { position: absolute; right: 14px; top: 16px; color: var(--text-faint); font-size: 15px; opacity: 0; transition: opacity .16s ease, transform .16s ease; }
a.stat-card:hover .go, a.stat-card:focus-visible .go { opacity: 1; transform: translateX(2px); }

.dash-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: stretch; margin-bottom: 16px; }
.dash-split > .card { margin: 0; min-width: 0; }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.quick-tile { display: flex; align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; color: var(--text); background: var(--surface); transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.quick-tile:hover { text-decoration: none; border-color: var(--brand-indigo); transform: translateY(-2px); box-shadow: var(--shadow); }
.quick-tile > i { width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 19px; background: color-mix(in srgb, var(--q) 15%, transparent); color: var(--q); }
.quick-tile h3 { margin: 0; font-size: 14.5px; }
.quick-tile span { display: block; font-size: 12.5px; color: var(--text-muted); }
.activity { list-style: none; padding: 0; margin: 0; }
.activity li { position: relative; padding: 0 0 15px 22px; }
.activity li::before { content: ''; position: absolute; left: 3px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--brand-indigo); box-shadow: 0 0 0 3px var(--info-bg); }
.activity li::after { content: ''; position: absolute; left: 7px; top: 19px; bottom: 1px; width: 1px; background: var(--border-strong); }
.activity li:last-child { padding-bottom: 0; }
.activity li:last-child::after { display: none; }
.activity b { display: block; font-size: 12.75px; }
.activity p { margin: 1px 0; font-size: 12.5px; color: var(--text-muted); overflow-wrap: anywhere; }
.activity small { font-size: 11.5px; color: var(--text-faint); }
.dash-split.dash-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) { .dash-split, .dash-split.dash-even { grid-template-columns: minmax(0, 1fr); } }

/* ---------- header bar on every chart, so each one is easy to recognise ---------- */
.chart-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin: -20px -20px 16px; padding: 14px 20px 13px;
  border-bottom: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--ch, #4f46e5) 13%, var(--surface)) 0%, var(--surface) 85%); box-shadow: inset 0 3px 0 var(--ch, #4f46e5); }
.chart-head-icon { width: 40px; height: 40px; flex-shrink: 0; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 19px; color: #fff; background: var(--ch, #4f46e5); }
.chart-head-text { flex: 1 1 330px; min-width: 0; } /* when this much room is not left beside the buttons, they move to their own line */
.chart-head .ds-card-tools { margin-left: auto; }
.chart-head-text h2 { margin: 0; font-size: 17px; line-height: 1.3; color: var(--text); }
.chart-head-text p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-muted); }
.chart-head-text p:empty, .chart-head-tags:empty { display: none; }
.chart-head-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.chart-head-tags span { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; padding: 2px 10px; }
.chart-head .ds-card-tools { align-self: center; }
@media (max-width: 700px) {
  .chart-head { margin: -15px -15px 14px; padding: 13px 15px 12px; }
  .chart-head-text { flex-basis: calc(100% - 54px); }
  .chart-head-icon { width: 34px; height: 34px; font-size: 16px; }
  .chart-head-text h2 { font-size: 15.5px; }
  .chart-head .ds-card-tools { width: 100%; }
}

/* ---------- sign-in pages ---------- */
.auth-form-side { background: radial-gradient(900px 500px at 85% -10%, color-mix(in srgb, var(--accent-2) 9%, transparent), transparent 60%), var(--surface); }
.auth-visual::before { background: radial-gradient(circle, rgba(255, 255, 255, .18), transparent 70%); }
.auth-visual::after { background: radial-gradient(circle, rgba(255, 255, 255, .14), transparent 70%); }
.auth-visual .pitch h1 { font-size: 36px; }
.auth-visual .pitch p, .auth-visual .stats-row div span { color: rgba(255, 255, 255, .84); }
.auth-form-box .input { padding-top: 12px; padding-bottom: 12px; }
.auth-form-box .btn-lg { margin-top: 4px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--text-muted); cursor: pointer; }
.pw-eye:hover { background: var(--info-bg); color: var(--brand-indigo); }
.input-group .pw-eye i { position: static; transform: none; color: inherit; }
.input-group.has-eye .input { padding-right: 44px; }

/* ---------- phones ---------- */
@media (max-width: 700px) {
  .content { padding: 14px 12px 48px; }
  .card { padding: 15px; }
  .hero-row > .flex, .card-header > .flex { flex-wrap: wrap; }
  .btn { max-width: 100%; white-space: normal; }
  .topbar-sub, .topbar-crumb { display: none; }
  .tab-btn { padding: 7px 12px; }
  table.data-table tbody tr:nth-child(even) { background: var(--surface); }
  .dash-hero { padding: 18px 16px; border-radius: 16px; }
  .dash-hero h1 { font-size: 21px; }
  .dash-hero .btn-hero { width: 100%; }
  .dash-sync .btn { flex: 1 1 140px; }
  .quick-grid { grid-template-columns: minmax(0, 1fr); }
  .flex.flex-wrap > select.input { flex: 1 1 140px; max-width: 100% !important; }
  .flex.flex-wrap > .input-group[style*="flex:1"], .flex.flex-wrap > .input-group[style*="flex: 1"] { max-width: 100% !important; }
  table.data-table tbody td { white-space: normal !important; } /* stacked row cards must wrap, whatever a page asks for on wide screens */
  .as-field > label { flex-wrap: wrap; }
  .as-field > label, .as-hint { overflow-wrap: anywhere; }
}
@media (max-width: 480px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .stat-card { padding: 13px; } .stat-card .value { font-size: 21px; } }


/* ============================================================================
   LOOK: colour themes, fonts, text size (chosen in the Appearance panel — assets/js/prefs.js + ui.js)
   ============================================================================ */
:root, :root[data-accent="ocean"] { --brand-indigo: #1565c0; --brand-indigo-dark: #0d47a1; --accent-2: #0e7490; --accent-light: #8ecbff; }
:root[data-accent="lagoon"] { --brand-indigo: #0f766e; --brand-indigo-dark: #115e59; --accent-2: #0369a1; --accent-light: #5eead4; }
:root[data-accent="indigo"] { --brand-indigo: #4f46e5; --brand-indigo-dark: #4338ca; --accent-2: #7c3aed; --accent-light: #b4bcff; }
:root[data-accent="forest"] { --brand-indigo: #15803d; --brand-indigo-dark: #166534; --accent-2: #0f766e; --accent-light: #86efac; }
:root[data-accent="berry"] { --brand-indigo: #a21caf; --brand-indigo-dark: #86198f; --accent-2: #be185d; --accent-light: #f5b8fc; }
:root[data-accent="graphite"] { --brand-indigo: #334155; --brand-indigo-dark: #1e293b; --accent-2: #475569; --accent-light: #cbd5e1; }

/* everything coloured is worked out from the four theme colours above */
:root, :root[data-theme="dark"] {
  --brand-teal: var(--brand-indigo);
  --accent-gradient: linear-gradient(135deg, var(--brand-indigo) 0%, var(--accent-2) 100%);
  --hero-gradient: linear-gradient(120deg, var(--brand-indigo-dark) 0%, var(--brand-indigo) 52%, var(--accent-2) 100%);
  --brand-gradient: linear-gradient(145deg, #0f172a 0%, var(--brand-indigo-dark) 68%, var(--accent-2) 135%);
}
:root {
  --bg: color-mix(in srgb, var(--brand-indigo) 3%, #f6f7f9);
  --surface: #ffffff;
  --surface-alt: color-mix(in srgb, var(--brand-indigo) 2%, #f8f9fb);
  --border: #e3e7ee;
  --border-strong: #cfd6e0;
  --text: #121826;
  --text-muted: #475467;
  --text-faint: #5f6b7e;
  --info: var(--brand-indigo);
  --info-bg: color-mix(in srgb, var(--brand-indigo) 9%, #ffffff);
  --row-stripe: color-mix(in srgb, var(--brand-indigo) 2%, #ffffff);
  --row-hover: color-mix(in srgb, var(--brand-indigo) 7%, #ffffff);
  --nav-bg: #ffffff;
  --nav-text: #344054;
  --nav-muted: #667085;
  --nav-hover: color-mix(in srgb, var(--brand-indigo) 5%, #ffffff);
  --nav-active-bg: color-mix(in srgb, var(--brand-indigo) 11%, #ffffff);
  --nav-active-text: var(--brand-indigo-dark);
  --topbar-bg: rgba(255, 255, 255, .92);
}
:root[data-theme="dark"] {
  --bg: #0e1218;
  --surface: #161c25;
  --surface-alt: #1d2530;
  --border: #2a3442;
  --border-strong: #3b4757;
  --text: #edf1f7;
  --text-muted: #b3bdcc;
  --text-faint: #95a1b3;
  --info: var(--accent-light);
  --info-bg: color-mix(in srgb, var(--accent-light) 15%, transparent);
  --row-stripe: #19202a;
  --row-hover: color-mix(in srgb, var(--accent-light) 9%, #161c25);
  --nav-bg: #121821;
  --nav-text: #cbd4e1;
  --nav-muted: #95a1b3;
  --nav-hover: #1d2530;
  --nav-active-bg: color-mix(in srgb, var(--accent-light) 17%, transparent);
  --nav-active-text: #ffffff;
  --topbar-bg: rgba(22, 28, 37, .92);
}
:root[data-theme="dark"] .tab-btn.active { color: #ffffff; }
.input:focus, .select:focus, textarea:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-indigo) 18%, transparent); }
:root[data-theme="dark"] .input:focus, :root[data-theme="dark"] .select:focus, :root[data-theme="dark"] textarea:focus { border-color: var(--accent-light); }
:focus-visible { outline-color: var(--info); }
::selection { background: color-mix(in srgb, var(--brand-indigo) 24%, transparent); }
.spinner.dark { border-color: color-mix(in srgb, var(--info) 28%, transparent); border-top-color: var(--info); }
.aic-launch { box-shadow: 0 10px 28px color-mix(in srgb, var(--brand-indigo) 45%, transparent); }
.aic-chips button { border-color: color-mix(in srgb, var(--brand-indigo) 35%, transparent); color: var(--info); }
.btn-outline, .ds-head h2 i, .nav-collapse:hover, .theme-toggle-btn:hover, .hamburger:hover, .to-top, .ds-tool:hover, .ds-tool[aria-pressed="true"] { color: var(--info); }
:root[data-theme="dark"] .ds-chips button:hover, :root[data-theme="dark"] .ds-chips select:hover { color: var(--accent-light); }

/* ---------- fonts ---------- */
:root, :root[data-font="figtree"] { --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif; --font-display: 'Figtree', system-ui, 'Segoe UI', sans-serif; }
:root[data-font="inter"] { --font-body: 'Inter', system-ui, 'Segoe UI', sans-serif; --font-display: 'Plus Jakarta Sans', 'Inter', sans-serif; }
:root[data-font="lexend"] { --font-body: 'Lexend', system-ui, 'Segoe UI', sans-serif; --font-display: 'Lexend', system-ui, sans-serif; }
:root[data-font="system"] { --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --font-display: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
h1, h2, h3, h4 { letter-spacing: -0.005em; }
h1, h2 { font-weight: 700; }
/* money and quantities in the reading font, with digits that line up; only codes (SKU, order numbers) stay in the code font */
.cell-num { font-family: var(--font-body); font-variant-numeric: tabular-nums; }

/* ---------- text size: --fs grows every common piece of text together ---------- */
:root { --fs: 1; }
:root[data-size="large"] { --fs: 1.1; }
:root[data-size="xlarge"] { --fs: 1.2; }
:root { --sidebar-w: calc(256px + (var(--fs) - 1) * 190px); }
html body { font-size: calc(15px * var(--fs)); line-height: 1.55; }
html body .input, html body .select, html body textarea { font-size: calc(14px * var(--fs)); }
html body .btn { font-size: calc(14px * var(--fs)); }
html body .btn-sm { font-size: calc(13px * var(--fs)); }
html body .btn-lg { font-size: calc(15px * var(--fs)); }
html body .sidebar-link, html body .sidebar-scroll > .sidebar-link, html body details.nav-group > summary.sidebar-section, html body .nav-results a { font-size: calc(14.25px * var(--fs)); }
html body details.nav-group > .sidebar-link { font-size: calc(13.75px * var(--fs)); }
html body .card-desc, html body .text-sm, html body .stat-card .label, html body .quick-tile span, html body .activity b, html body .activity p, html body .auth-alert { font-size: calc(13.5px * var(--fs)); }
html body .form-hint, html body .stat-card .meta, html body .activity small, html body .topbar-sub, html body .as-hint { font-size: calc(12.75px * var(--fs)); }
html body .form-group label { font-size: calc(13.25px * var(--fs)); }
html body .tab-btn { font-size: calc(14px * var(--fs)); }
html body .badge { font-size: calc(11.75px * var(--fs)); }
html body table.data-table { font-size: calc(13.75px * var(--fs)); }
html body table.data-table thead th { font-size: calc(12.75px * var(--fs)); color: var(--text); }
html body table.data-table .cell-mono { font-size: calc(12.75px * var(--fs)); }
html body .chart-head-text h2 { font-size: calc(18px * var(--fs)); }
html body .chart-head-text p { font-size: calc(13.25px * var(--fs)); }
html body .chart-head-tags span { font-size: calc(12.25px * var(--fs)); }
html body .ds-kpi .lbl, html body .ds-showing, html body .ds-chips button, html body .ds-chips select, html body .ds-pie ul, html body .ds-table table, html body .ds-fig .lbl { font-size: calc(13.5px * var(--fs)); }
html body .ds-kpi .sub, html body .ds-fig .sub, html body .ds-tool, html body .ds-seg button { font-size: calc(12.75px * var(--fs)); }

/* long setting names and addresses inside a notice wrap instead of widening the page */
.auth-alert > span { min-width: 0; overflow-wrap: anywhere; }

/* ---------- table rows ---------- */
@media (min-width: 701px) {
  html body table.data-table tbody td { padding: 10px 12px; }
  html[data-rows="compact"] body table.data-table tbody td { padding: 4px 9px; line-height: 1.3; }
  html[data-rows="compact"] body table.data-table thead th { padding: 6px 9px; }
}

/* ---------- Appearance panel ---------- */
.look-wrap { position: relative; }
.look-btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 600 13.5px var(--font-body); cursor: pointer; white-space: nowrap; }
.look-btn i { font-size: 16px; color: var(--info); }
.look-btn:hover, .look-btn[aria-expanded="true"] { background: var(--info-bg); border-color: var(--info); }
.look-panel { position: absolute; right: 0; top: calc(100% + 10px); z-index: 80; width: 340px; max-height: calc(100vh - var(--topbar-h) - 24px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 16px; text-align: left; }
.look-panel[hidden] { display: none; }
.look-panel h3 { font-size: 15px; margin: 0 0 2px; }
.look-note { font-size: 12.5px; color: var(--text-muted); margin: 0 0 6px; }
.look-label { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin: 14px 0 7px; }
.look-grid { display: grid; gap: 7px; }
.look-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.look-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.look-opt { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: 600 13px var(--font-body); cursor: pointer; }
.look-opt:hover { border-color: var(--info); }
.look-opt[aria-pressed="true"] { border-color: var(--info); background: var(--info-bg); box-shadow: inset 0 0 0 1px var(--info); }
.look-swatch { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.look-reset { margin-top: 14px; width: 100%; border: 0; background: transparent; color: var(--info); font: 600 13px var(--font-body); cursor: pointer; padding: 6px; border-radius: 8px; }
.look-reset:hover { background: var(--info-bg); }
@media (max-width: 700px) {
  .look-btn { width: 38px; padding: 0; justify-content: center; }
  .look-btn span { display: none; }
  .look-panel { position: fixed; left: 10px; right: auto; top: calc(var(--topbar-h) + 4px); width: calc(100vw - 20px); max-width: 400px; }
}

/* Phone cards: a long column label (with its price basis) wraps instead of squeezing the value into a narrow strip */
@media (max-width: 700px) {
  table.data-table tbody td::before { flex-shrink: 0; max-width: 56%; }
  table.data-table tbody td > div { min-width: 0; }
}
