/* QNY Data Layer on Tabler: light, Google blue on white, Google Analytics-like. */

:root, [data-bs-theme="light"] {
  --tblr-primary: #1a73e8;
  --tblr-primary-rgb: 26, 115, 232;
  --tblr-primary-text-emphasis: #174ea6;
  --tblr-primary-bg-subtle: #e8f0fe;
  --tblr-link-color: #1a73e8;
  --tblr-link-color-rgb: 26, 115, 232;
  --tblr-link-hover-color: #174ea6;
  --tblr-font-sans-serif: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --tblr-body-bg: #f6f8fc;
  --tblr-body-color: #202124;
  --tblr-secondary-color: #5f6368;
  --tblr-border-color: #e3e6ea;
  --tblr-card-border-color: #e3e6ea;
  --tblr-border-radius: 8px;

  /* chart roles read by spend.js; service colours fixed per service */
  --s-google_ads: #1a73e8;
  --s-meta_ads: #e8710a;
  --s-instacart_ads: #1baf7a;
  --s-walmart_ads: #eda100;
  --s-criteo_retail: #e87ba4;
  --s-groundtruth_ads: #008300;
  --s-microsoft_ads: #6250d6;
  --s-other: #c4c7cc;
  --seq: #1a73e8;
  --seq-2: #e8710a;
  --grid: #eceff1;
  --axis: #80868b;
  --ink: #202124;
  --muted: #5f6368;
  --bg: #ffffff;
  --surface: #ffffff;
  --good: #137333;
  --bad: #c5221f;
}

body.qny { font-family: var(--tblr-font-sans-serif); font-size: 14px; }

.btn-primary { --tblr-btn-bg: #1a73e8; --tblr-btn-border-color: #1a73e8; --tblr-btn-hover-bg: #1765cc; --tblr-btn-hover-border-color: #1765cc; --tblr-btn-active-bg: #1558b0; }
.btn-outline-primary { --tblr-btn-color: #1a73e8; --tblr-btn-border-color: #dadce0; --tblr-btn-hover-bg: #e8f0fe; --tblr-btn-hover-color: #174ea6; --tblr-btn-hover-border-color: #d2e3fc; }

/* sidebar */
.qny-side { background: #fff; border-right: 1px solid var(--tblr-border-color); }
.qny-brand { font-weight: 500; font-size: 16px; color: #202124; gap: 10px; display: inline-flex; align-items: center; }
.qny-side.navbar-vertical .navbar-brand.qny-brand { justify-content: flex-start !important; gap: 10px; padding-left: 1rem; }
.qny-logo { display: inline-flex; width: 30px; height: 30px; border-radius: 8px; background: #1a73e8; color: #fff; align-items: center; justify-content: center; }
.qny-logo .icon { width: 18px; height: 18px; }
.qny-side .nav-link { border-radius: 0 20px 20px 0; margin-right: 12px; color: #3c4043; font-weight: 500; }
.qny-side .nav-link:hover { background: #f1f3f4; }
.qny-side .nav-item.active .nav-link { background: #e8f0fe; color: #1967d2; }
.qny-side .nav-item.active .nav-link .icon { color: #1967d2; }
.qny-side-foot { position: absolute; bottom: 18px; left: 24px; font-size: 12px; color: var(--tblr-secondary-color); }
.navbar-vertical.navbar-expand-lg .navbar-collapse .nav-link { padding-left: 1.25rem; }

/* top bar */
.qny-top { background: #fff; border-bottom: 1px solid var(--tblr-border-color); min-height: 56px; }
.qny-top-title { font-size: 18px; color: #202124; }
.qny-avatar { background: #1a73e8; color: #fff; font-weight: 500; }

/* page header */
.page-header { margin-top: 1.25rem; }
.page-title { font-weight: 400; font-size: 24px; color: #202124; }
.page-pretitle { color: #5f6368; letter-spacing: 0.04em; }

/* filter */
.qny-filter { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qny-filter .form-select, .qny-filter .form-control { width: auto; }
.qny-filter .qny-custom { display: none; }
.qny-filter.custom .qny-custom { display: block; }
.qny-filter.custom button.qny-custom { display: inline-block; }

/* KPI strip, GA overview style */
.qny-kpis .row > [class^="col"] { padding: 18px 20px; border-right: 1px solid var(--tblr-border-color); }
.qny-kpis .row > [class^="col"]:last-child { border-right: none; }
.qny-kpis .kpi-hero { border-top: 3px solid #1a73e8; background: #fff; }
.qny-kpis .kpi-label { white-space: nowrap; font-size: 13px; color: #5f6368; margin-bottom: 6px; }
.qny-kpis .kpi-value { white-space: nowrap; font-size: 23px; font-weight: 400; color: #202124; line-height: 1.15; margin-bottom: 6px; letter-spacing: -0.01em; }
.qny-kpis .kpi-hero .kpi-value { font-size: 36px; }
.qny-kpis .kpi-vs { font-size: 12px; color: #5f6368; margin-left: 6px; }
@media (max-width: 991px) {
  .qny-kpis .row > [class^="col"] { border-right: none; border-bottom: 1px solid var(--tblr-border-color); }
}

.dl { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 500; color: #5f6368; white-space: nowrap; }
.dl .icon { width: 15px; height: 15px; }
.dl.good { color: var(--good); }
.dl.bad { color: var(--bad); }
.dl.none { font-weight: 400; }

/* chart cards */
.card { box-shadow: 0 1px 2px rgba(60, 64, 67, .08); }
.card-title { font-weight: 500; font-size: 15px; color: #202124; }
.card-subtitle { color: #5f6368; font-size: 13px; margin-top: 2px; }
.qny-chart { position: relative; height: 300px; width: 100%; }
.qny-chart.tall { height: 340px; }
.qny-chart.short { height: 240px; }

/* tables */
.table thead th { font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 500; color: #5f6368; background: #fafbfc; white-space: nowrap; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.strong { font-weight: 500; }
.table tfoot td { font-weight: 500; border-top: 2px solid var(--tblr-border-color); }
table.sortable th { cursor: pointer; user-select: none; }
table.sortable th.asc::after { content: " ▲"; font-size: 9px; }
table.sortable th.desc::after { content: " ▼"; font-size: 9px; }
.qny-matrix td, .qny-matrix th { padding-left: .5rem; padding-right: .5rem; font-size: 13px; }
.qny-matrix th { white-space: normal; vertical-align: bottom; }
.qny-scroll { max-height: 640px; overflow: auto; }
.qny-scroll thead th { position: sticky; top: 0; z-index: 1; }
.cname { max-width: 440px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 8px; vertical-align: -1px; }

.qny-anom .z { font-weight: 500; font-size: 12px; min-width: 56px; text-align: center; }

.qny-top-perf .name { font-size: 13px; line-height: 1.35; min-height: 2.7em; color: #3c4043; }
.qny-top-perf .val { font-size: 26px; font-weight: 400; }

/* login */
.qny-login { background: #f6f8fc; }
.qny-login .card { border-radius: 12px; }
.btn-google { background: #fff; border: 1px solid #dadce0; color: #3c4043; font-weight: 500; gap: 10px; }
.btn-google:hover { background: #f8faff; border-color: #d2e3fc; color: #202124; }
.btn-google svg { width: 18px; height: 18px; }

/* =============================================================================
   Pages whose HTML predates Tabler (forms, connections, pickers, settings).
   Their markup and field names are unchanged; layout_tabler.php wraps them in
   .qny-legacy and these rules give the old class names the new look.
   ========================================================================== */

.qny-legacy { --accent: #1a73e8; --line: var(--tblr-border-color); --panel: #f8f9fa; --danger: #c5221f; --warn: #b06000; padding-top: 1.25rem; padding-bottom: 2rem; }

.qny-legacy .head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.qny-legacy h1 { font-size: 24px; font-weight: 400; margin: 0 0 4px; color: #202124; }
.qny-legacy h2 { font-size: 16px; font-weight: 500; margin: 30px 0 12px; color: #202124; }
.qny-legacy h2 .muted { font-weight: 400; }
.qny-legacy .sub { color: var(--muted); font-size: 14px; margin: 0; max-width: 760px; }
.qny-legacy .muted { color: var(--muted); }
.qny-legacy .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* buttons: old .btn = primary, .ghost = outline, .danger = outline red */
.qny-legacy .btn { --tblr-btn-padding-y: .45rem; display: inline-flex; align-items: center; background: var(--accent); border: 1px solid var(--accent); color: #fff; font-weight: 500; border-radius: 6px; font-size: 14px; text-decoration: none; }
.qny-legacy .btn:hover { background: #1765cc; border-color: #1765cc; color: #fff; }
.qny-legacy .btn.ghost { background: #fff; color: #1a73e8; border-color: #dadce0; }
.qny-legacy .btn.ghost:hover { background: #e8f0fe; border-color: #d2e3fc; color: #174ea6; }
.qny-legacy .btn.danger { background: #fff; color: var(--danger); border-color: #dadce0; }
.qny-legacy .btn.danger:hover { background: #fce8e6; border-color: #f6aea9; }
.qny-legacy .btn.small { padding: 4px 10px; font-size: 13px; }
.qny-legacy .btn:disabled { opacity: .45; cursor: not-allowed; }
.qny-legacy .actions { display: flex; gap: 10px; align-items: center; margin-top: 22px; }
.qny-legacy .linkbtn { background: none; border: none; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; padding: 2px 6px; }
.qny-legacy .linkbtn:hover { text-decoration: underline; }
.qny-legacy .linkbtn.danger { color: var(--danger); }

/* pills and badges */
.qny-legacy .pill { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 12px; font-weight: 500; background: #f1f3f4; color: #5f6368; border: none; white-space: nowrap; }
.qny-legacy .pill.ok { background: #e6f4ea; color: #137333; }
.qny-legacy .pill.bad { background: #fce8e6; color: #c5221f; }
.qny-legacy .pill.warn { background: #fef7e0; color: #b06000; }
.qny-legacy .badge { font-size: 10.5px; font-weight: 500; letter-spacing: .04em; padding: 3px 7px; border-radius: 4px; border: none; background: #f1f3f4; color: #5f6368; }
.qny-legacy .badge.ok { background: #e6f4ea; color: #137333; }
.qny-legacy .badge.warn { background: #fef7e0; color: #b06000; }
.qny-legacy .badge.bad { background: #fce8e6; color: #c5221f; }
.qny-legacy .tag, .qny-legacy .chip { font-size: 11px; color: #5f6368; background: #f1f3f4; border-radius: 4px; padding: 1px 6px; font-weight: 500; }
.qny-legacy .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.qny-legacy .dot.ok { background: #1e8e3e; }
.qny-legacy .dot.warn { background: #f9ab00; }
.qny-legacy .dot.bad { background: #d93025; }

/* messages */
.qny-legacy .flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; background: #e6f4ea; color: #137333; border: none; }
.qny-legacy .flash.err { background: #fce8e6; color: #c5221f; }
.qny-legacy .empty { padding: 40px 20px; text-align: center; color: var(--muted); background: #fff; border: 1px dashed #dadce0; border-radius: 8px; font-size: 14px; }
.qny-legacy .notice { background: #e8f0fe; border: none; border-radius: 8px; padding: 12px 16px; margin-bottom: 22px; font-size: 13.5px; color: #3c4043; }
.qny-legacy .notice strong { color: #174ea6; font-weight: 500; }

/* tables become white cards */
.qny-legacy .table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 1px 2px rgba(60,64,67,.08); overflow-x: auto; }
.qny-legacy .table-wrap table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0; }
.qny-legacy .table-wrap th { text-align: left; font-size: 12px; font-weight: 500; color: #5f6368; background: #fafbfc; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.qny-legacy .table-wrap td { padding: 11px 14px; border-bottom: 1px solid #f1f3f4; vertical-align: middle; }
.qny-legacy .table-wrap tbody tr:last-child td { border-bottom: none; }
.qny-legacy .table-wrap tbody tr:hover { background: #f8faff; }
.qny-legacy td.num, .qny-legacy th.num { text-align: right; font-variant-numeric: tabular-nums; }
.qny-legacy td.tight { white-space: nowrap; }

/* forms */
.qny-legacy form.stack { max-width: 680px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 22px 24px 18px; box-shadow: 0 1px 2px rgba(60,64,67,.08); }
.qny-legacy label { display: block; margin: 0 0 16px; font-size: 13px; color: #3c4043; font-weight: 500; }
.qny-legacy label > span { display: block; margin-bottom: 6px; }
.qny-legacy input[type=text], .qny-legacy input[type=email], .qny-legacy input[type=password], .qny-legacy input[type=time],
.qny-legacy select, .qny-legacy textarea {
  display: block; width: 100%; padding: 8px 11px; border: 1px solid #dadce0; border-radius: 6px; background: #fff; color: #202124; font: inherit; font-size: 14px; font-weight: 400;
}
.qny-legacy input:focus, .qny-legacy select:focus, .qny-legacy textarea:focus { outline: none; border-color: #1a73e8; box-shadow: 0 0 0 3px rgba(26,115,232,.15); }
.qny-legacy textarea { min-height: 90px; resize: vertical; }
.qny-legacy .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.qny-legacy .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.qny-legacy .hint { font-size: 12.5px; color: var(--muted); margin-top: -8px; margin-bottom: 16px; font-weight: 400; }
.qny-legacy .check { display: flex; align-items: center; gap: 8px; color: #202124; font-size: 14px; font-weight: 400; }
.qny-legacy .check input { width: auto; }
@media (max-width: 700px) { .qny-legacy .row2, .qny-legacy .row3 { grid-template-columns: 1fr; } }

/* stat tiles (old overview) */
.qny-legacy .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 26px; }
.qny-legacy .stat { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; box-shadow: 0 1px 2px rgba(60,64,67,.08); }
.qny-legacy .stat .n { font-size: 26px; font-weight: 400; color: #202124; }
.qny-legacy .stat .l { font-size: 13px; color: #5f6368; margin-top: 2px; }

/* connection cards */
.qny-legacy .grp { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #5f6368; margin: 24px 0 10px; font-weight: 500; }
.qny-legacy .conn-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(60,64,67,.08); }
.qny-legacy .conn-head { display: flex; gap: 14px; align-items: flex-start; }
.qny-legacy .conn-icon { flex: 0 0 38px; height: 38px; border-radius: 8px; background: #f1f3f4; display: flex; align-items: center; justify-content: center; color: #3c4043; }
.qny-legacy .conn-title { flex: 1; min-width: 0; }
.qny-legacy .conn-name { font-weight: 500; font-size: 15px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; color: #202124; }
.qny-legacy .conn-state { font-weight: 400; font-size: 13px; color: #5f6368; }
.qny-legacy .conn-meta { font-size: 13px; color: #5f6368; margin-top: 2px; }
.qny-legacy .conn-cta { margin-top: 12px; font-size: 13px; }
.qny-legacy .browse-link { display: inline-block; margin-top: 12px; margin-right: 16px; font-size: 13.5px; font-weight: 500; }
.qny-legacy .redirect-note { margin-top: 12px; padding: 9px 12px; border-radius: 6px; background: #f8f9fa; font-size: 13px; color: #3c4043; word-break: break-all; }

.qny-legacy .acct-list { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.qny-legacy .acct { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: #fafbfc; }
.qny-legacy .acct.st-verified, .qny-legacy .acct.st-syncing { border-color: #ceead6; background: #f6fbf7; }
.qny-legacy .acct.st-failed { border-color: #f6aea9; background: #fef7f6; }
.qny-legacy .acct.st-unverified { border-style: dashed; }
.qny-legacy .acct-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.qny-legacy .acct-name { font-weight: 500; font-size: 14px; }
.qny-legacy .acct-id { color: #5f6368; margin-top: 5px; font-size: 12.5px; }
.qny-legacy .acct-facts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12.5px; }
.qny-legacy .fact { display: inline-flex; align-items: center; gap: 6px; color: #3c4043; }
.qny-legacy .fact .dot { width: 6px; height: 6px; }
.qny-legacy .fact.muted { color: #5f6368; }
.qny-legacy .acct-note { margin-top: 8px; padding-left: 10px; border-left: 2px solid var(--line); font-size: 12.5px; color: #5f6368; }
.qny-legacy .acct-actions { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.qny-legacy .acct-actions .linkbtn { padding: 0; }

/* pickers */
.qny-legacy .picker-bar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.qny-legacy .picker-bar input[type=search] { flex: 1; min-width: 220px; padding: 9px 12px; border: 1px solid #dadce0; border-radius: 6px; background: #fff; font: inherit; font-size: 14px; }
.qny-legacy .picker-bar input[type=search]:focus { outline: none; border-color: #1a73e8; box-shadow: 0 0 0 3px rgba(26,115,232,.15); }
.qny-legacy .picker { display: flex; flex-direction: column; gap: 6px; }
.qny-legacy .pick { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 11px 14px; margin: 0; cursor: pointer; font-size: 14px; font-weight: 400; color: #202124; }
.qny-legacy .pick:hover { border-color: #aecbfa; }
.qny-legacy .pick:has(input:checked) { border-color: #1a73e8; background: #e8f0fe; }
.qny-legacy .pick.is-manager, .qny-legacy .pick.is-taken { cursor: default; background: #f8f9fa; }
.qny-legacy .pick.is-manager .pick-title, .qny-legacy .pick.is-taken .pick-title { color: #80868b; }
.qny-legacy .pick-box { flex: 0 0 auto; padding-top: 2px; }
.qny-legacy .pick-box input { width: 16px; height: 16px; accent-color: #1a73e8; }
.qny-legacy .pick-body { flex: 1; min-width: 0; }
.qny-legacy .pick-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 500; }
.qny-legacy .pick-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 3px; font-size: 12.5px; color: #5f6368; }
.qny-legacy .picker-foot { position: sticky; bottom: 0; display: flex; align-items: center; gap: 14px; margin-top: 18px; padding: 14px 0; border-top: 1px solid var(--line); background: var(--tblr-body-bg); }

/* settings */
.qny-legacy .setting-group { background: #fff; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 14px; overflow: hidden; box-shadow: 0 1px 2px rgba(60,64,67,.08); }
.qny-legacy .setting-group-name { margin: 0; padding: 12px 18px; font-size: 14px; font-weight: 500; background: #fafbfc; border-bottom: 1px solid var(--line); }
.qny-legacy .setting-group-body { padding: 18px 20px 4px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; align-items: start; }
.qny-legacy .setting-row { min-width: 0; }
.qny-legacy .setting-row .hint { overflow-wrap: anywhere; }
/* A group with a single field gets the whole width rather than half a box. */
.qny-legacy .setting-group-body > .setting-row:only-child { grid-column: 1 / -1; max-width: 640px; }
@media (max-width: 900px) { .qny-legacy .setting-group-body { grid-template-columns: 1fr; } }

/* In-page shortcuts (Settings): sticky chip bar plus a sidebar sub-menu. */
html { scroll-behavior: smooth; }
.qny-legacy [id^="set-"] { scroll-margin-top: 72px; }
.qny-jump { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0; margin: -6px 0 14px; background: var(--tblr-body-bg); border-bottom: 1px solid var(--tblr-border-color); }
.qny-jump a { font-size: 13px; font-weight: 500; color: #3c4043; background: #fff; border: 1px solid #dadce0; border-radius: 16px; padding: 4px 12px; text-decoration: none; white-space: nowrap; }
.qny-jump a:hover { background: #e8f0fe; border-color: #d2e3fc; color: #174ea6; }
.qny-jump a.on { background: #1a73e8; border-color: #1a73e8; color: #fff; }
.qny-subnav { display: flex; flex-direction: column; margin: 2px 12px 8px 52px; border-left: 2px solid #e8f0fe; }
.qny-subnav a { font-size: 13px; color: #5f6368; padding: 4px 0 4px 12px; text-decoration: none; }
.qny-subnav a:hover, .qny-subnav a.on { color: #1967d2; }
@media (min-width: 992px) { .qny-side .navbar-collapse { overflow-y: auto; } }
