/* ==========================================================
   Cyneqi platform theme — light & dark from one token set.
   Palette values are the validated data-viz reference set.
   ========================================================== */

:root {
  --page:        #f9f9f7;
  --surface:     #fcfcfb;
  --ink:         #0b0b0b;
  --ink-2:       #52514e;
  --muted:       #898781;
  --grid:        #e1e0d9;
  --baseline:    #c3c2b7;
  --border:      rgba(11,11,11,0.10);
  --accent:      #2a78d6;
  --accent-ink:  #ffffff;
  --series-1:    #2a78d6;
  --series-2:    #1baf7a;
  --series-3:    #eda100;
  --series-4:    #008300;
  --good:        #0ca30c;
  --good-text:   #006300;
  --warn:        #fab219;
  --serious:     #ec835a;
  --crit:        #d03b3b;
  --pill-bg:     rgba(11,11,11,0.05);
  --shadow:      0 1px 3px rgba(11,11,11,0.07), 0 4px 14px rgba(11,11,11,0.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --page:      #0d0d0d;
    --surface:   #1a1a19;
    --ink:       #ffffff;
    --ink-2:     #c3c2b7;
    --muted:     #898781;
    --grid:      #2c2c2a;
    --baseline:  #383835;
    --border:    rgba(255,255,255,0.10);
    --accent:    #3987e5;
    --series-1:  #3987e5;
    --series-2:  #199e70;
    --series-3:  #c98500;
    --series-4:  #008300;
    --good-text: #0ca30c;
    --pill-bg:   rgba(255,255,255,0.06);
    --shadow:    0 1px 3px rgba(0,0,0,0.4);
  }
}
:root[data-theme="light"] {
  --page:#f9f9f7; --surface:#fcfcfb; --ink:#0b0b0b; --ink-2:#52514e; --muted:#898781;
  --grid:#e1e0d9; --baseline:#c3c2b7; --border:rgba(11,11,11,0.10);
  --accent:#2a78d6; --series-1:#2a78d6; --series-2:#1baf7a; --series-3:#eda100; --series-4:#008300;
  --good-text:#006300; --pill-bg:rgba(11,11,11,0.05);
  --shadow:0 1px 3px rgba(11,11,11,0.07),0 4px 14px rgba(11,11,11,0.05);
}
:root[data-theme="dark"] {
  --page:#0d0d0d; --surface:#1a1a19; --ink:#ffffff; --ink-2:#c3c2b7; --muted:#898781;
  --grid:#2c2c2a; --baseline:#383835; --border:rgba(255,255,255,0.10);
  --accent:#3987e5; --series-1:#3987e5; --series-2:#199e70; --series-3:#c98500; --series-4:#008300;
  --good-text:#0ca30c; --pill-bg:rgba(255,255,255,0.06);
  --shadow:0 1px 3px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }  h2 { font-size: 1.15rem; }  h3 { font-size: 1rem; }
code, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .9em; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- layout ---------- */
.site-header {
  display: flex; align-items: center; gap: 1.25rem;
  padding: .7rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.brand { font-weight: 700; font-size: 1.05rem; color: var(--ink); letter-spacing: -.01em; }
.brand span { color: var(--accent); }
.site-header nav { display: flex; gap: 1rem; margin-left: auto; align-items: center; }
.site-header nav a { color: var(--ink-2); font-weight: 500; }
.site-header nav a:hover { color: var(--ink); text-decoration: none; }

.shell { display: flex; min-height: calc(100vh - 54px); }
.sidebar {
  width: 230px; flex-shrink: 0;
  padding: 1.1rem .75rem;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.sidebar .nav-group { margin-bottom: 1.4rem; }
.sidebar .nav-title {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 0 .6rem .35rem;
}
.sidebar a {
  display: flex; align-items: center; gap: .55rem;
  padding: .42rem .6rem; border-radius: 7px;
  color: var(--ink-2); font-weight: 500; font-size: .92rem;
}
.sidebar a:hover { background: var(--pill-bg); color: var(--ink); text-decoration: none; }
.sidebar a.active { background: var(--accent); color: var(--accent-ink); }
.sidebar a .ico { width: 17px; text-align: center; opacity: .85; }

.content { flex: 1; padding: 1.5rem 1.75rem 3rem; min-width: 0; max-width: 1200px; }
.page-head { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-2); margin: .1rem 0 0; }
.page-head .actions { margin-left: auto; display: flex; gap: .5rem; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; border-right: 0; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: .25rem; }
  .sidebar .nav-group { margin: 0; display: flex; flex-wrap: wrap; gap: .25rem; }
  .sidebar .nav-title { display: none; }
}

/* ---------- cards / grids ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
}
.card + .card, .card + .grid, .grid + .card, .grid + .grid { margin-top: 1.1rem; }
.card h2 { margin-bottom: .8rem; }
.grid { display: grid; gap: 1.1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* stat tiles */
.stat { padding: .95rem 1.1rem; }
.stat .stat-label { font-size: .8rem; color: var(--ink-2); margin-bottom: .15rem; }
.stat .stat-value { font-size: 1.55rem; font-weight: 650; letter-spacing: -.01em; }
.stat .stat-value small { font-size: .85rem; font-weight: 500; color: var(--muted); }
.stat .stat-foot { font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.stat .delta-up { color: var(--good-text); font-weight: 600; }
.stat .delta-down { color: var(--crit); font-weight: 600; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th {
  text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600;
  padding: .45rem .7rem; border-bottom: 1px solid var(--baseline);
  white-space: nowrap;
}
table.data td { padding: .55rem .7rem; border-bottom: 1px solid var(--grid); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--pill-bg); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .row-actions { white-space: nowrap; text-align: right; }
table.data .row-actions a, table.data .row-actions button { margin-left: .6rem; }

/* ---------- pills, badges, dots ---------- */
.pill {
  display: inline-flex; align-items: center; gap: .38rem;
  padding: .13rem .6rem .13rem .5rem; border-radius: 99px;
  font-size: .78rem; font-weight: 600; background: var(--pill-bg); color: var(--ink-2);
  white-space: nowrap;
}
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.pill-good  .pill-dot { background: var(--good); }   .pill-good  { color: var(--good-text); }
.pill-warn  .pill-dot { background: var(--warn); }
.pill-crit  .pill-dot { background: var(--crit); }   .pill-crit  { color: var(--crit); }
.pill-maint .pill-dot { background: var(--series-1); }
.pill-muted .pill-dot { background: var(--muted); }

.badge {
  display: inline-block; padding: .1rem .45rem; border-radius: 5px;
  font-size: .7rem; font-weight: 700; letter-spacing: .04em;
}
.badge-info  { background: rgba(42,120,214,.14); color: var(--accent); }
.badge-warn  { background: rgba(250,178,25,.16); color: #8a6100; }
.badge-crit  { background: rgba(208,59,59,.14);  color: var(--crit); }
.badge-muted { background: var(--pill-bg); color: var(--muted); }
:root[data-theme="dark"] .badge-warn { color: var(--warn); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge-warn { color: var(--warn); } }

/* ---------- buttons / forms ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .95rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: .88rem;
  cursor: pointer;
}
.btn:hover { background: var(--pill-bg); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn-danger { color: var(--crit); border-color: rgba(208,59,59,.4); }
.btn-danger:hover { background: rgba(208,59,59,.08); }
.btn-sm { padding: .22rem .6rem; font-size: .8rem; border-radius: 6px; }
.btn-link { border: 0; background: none; color: var(--accent); padding: 0; font-weight: 600; cursor: pointer; font-size: .85rem; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--crit); }

label.field { display: block; margin-bottom: .9rem; font-weight: 600; font-size: .87rem; }
label.field span { display: block; margin-bottom: .3rem; }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%; padding: .5rem .7rem; border-radius: 8px;
  border: 1px solid var(--baseline); background: var(--page); color: var(--ink);
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.flash { padding: .7rem 1rem; border-radius: 9px; margin-bottom: 1rem; font-weight: 500; border: 1px solid; }
.flash-ok   { background: rgba(12,163,12,.09);  border-color: rgba(12,163,12,.3);  color: var(--good-text); }
.flash-err  { background: rgba(208,59,59,.09);  border-color: rgba(208,59,59,.3);  color: var(--crit); }
.flash-info { background: rgba(42,120,214,.09); border-color: rgba(42,120,214,.3); color: var(--accent); }

/* key reveal boxes */
.keybox {
  display: flex; align-items: center; gap: .6rem;
  background: var(--page); border: 1px dashed var(--baseline); border-radius: 8px;
  padding: .5rem .8rem; font-family: ui-monospace, Consolas, monospace; font-size: .85rem;
  overflow-x: auto; white-space: nowrap;
}

/* ---------- product cards (store + dashboard) ---------- */
.product-card { display: flex; flex-direction: column; gap: .45rem; transition: transform .12s ease; }
a.product-card { color: inherit; }
a.product-card:hover { text-decoration: none; transform: translateY(-2px); }
.product-card .cat { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.product-card .price { font-weight: 700; font-size: 1.05rem; }
.product-card .tagline { color: var(--ink-2); font-size: .9rem; flex: 1; }
.product-card footer { display: flex; align-items: center; justify-content: space-between; margin-top: .4rem; }

/* ---------- charts ---------- */
.chart-card .chart-head { display: flex; align-items: baseline; gap: .75rem; margin-bottom: .5rem; flex-wrap: wrap; }
.chart-card .chart-head h3 { margin: 0; }
.chart-card .chart-head .hint { color: var(--muted); font-size: .78rem; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; }
.chart-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .4rem; font-size: .8rem; color: var(--ink-2); }
.chart-legend .li { display: inline-flex; align-items: center; gap: .4rem; }
.chart-legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow); padding: .45rem .65rem; font-size: .8rem;
  min-width: 120px; display: none;
}
.chart-tip .tip-title { font-weight: 700; margin-bottom: .2rem; }
.chart-tip .tip-row { display: flex; align-items: center; gap: .4rem; justify-content: space-between; }
.chart-tip .tip-row b { font-variant-numeric: tabular-nums; font-weight: 600; }
.chart-tip .sw { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: .3rem; }

/* health rows */
.health-row { display: flex; align-items: center; gap: .8rem; padding: .55rem 0; border-bottom: 1px solid var(--grid); }
.health-row:last-child { border-bottom: 0; }
.health-row .hname { font-weight: 600; }
.health-row .hmsg { color: var(--muted); font-size: .82rem; flex: 1; }
.health-row .hwhen { color: var(--muted); font-size: .78rem; }

/* notifications */
.notif { display: flex; gap: .8rem; padding: .8rem .2rem; border-bottom: 1px solid var(--grid); }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: rgba(42,120,214,.05); }
.notif .n-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: .45rem; flex-shrink: 0; background: var(--grid); }
.notif.unread .n-dot { background: var(--accent); }
.notif .n-title { font-weight: 650; }
.notif .n-body { color: var(--ink-2); font-size: .88rem; }
.notif .n-meta { color: var(--muted); font-size: .76rem; margin-top: .15rem; }

/* misc */
.kv { display: grid; grid-template-columns: minmax(140px, 38%) 1fr; gap: .3rem .8rem; font-size: .9rem; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.spacer { flex: 1; }
.center-page { max-width: 420px; margin: 7vh auto; padding: 0 1rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mt { margin-top: 1.1rem; }
.bell { position: relative; }
.bell .bubble {
  position: absolute; top: -6px; right: -9px; background: var(--crit); color: #fff;
  border-radius: 99px; font-size: .62rem; font-weight: 700; padding: 0 .32rem; line-height: 1.5;
}
footer.site-foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 1rem; }
