/* THE BEST — admin (product register: utilitarian, same night/stone identity) */
:root {
  --night-0: oklch(13% 0.02 268);
  --night-1: oklch(16.5% 0.024 266);
  --night-2: oklch(21% 0.028 264);
  --stone: oklch(80% 0.11 85);
  --stone-hi: oklch(88% 0.12 92);
  --laser: oklch(66% 0.24 350);
  --ink: oklch(95% 0.012 90);
  --ink-dim: oklch(72% 0.02 90);
  --line: oklch(80% 0.11 85 / 0.18);
  --line-soft: oklch(80% 0.11 85 / 0.09);
  --ok: oklch(75% 0.16 150);
  --en: "Anton", sans-serif;
  --ar: "Alexandria", sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: var(--night-0); color: var(--ink); font-family: var(--ar); font-weight: 300; font-size: 15px; line-height: 1.8; }
a { color: inherit; text-decoration: none; }
b { font-weight: 600; }
input, select, textarea {
  font-family: var(--ar); font-size: 14.5px; color: var(--ink);
  background: var(--night-0); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; width: 100%;
}
input:focus, textarea:focus { outline: 2px solid oklch(80% 0.11 85 / 0.4); outline-offset: 1px; }

.abtn {
  font-family: var(--ar); font-weight: 600; font-size: 14px; cursor: pointer;
  color: var(--stone); background: transparent; border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 22px; transition: all 0.25s;
}
.abtn:hover { border-color: var(--stone); }
.abtn.primary { background: var(--stone); border-color: var(--stone); color: var(--night-0); }
.abtn.primary:hover { background: var(--stone-hi); }
.abtn.sm { padding: 4px 14px; font-size: 12.5px; }
.abtn.dangerbtn { color: oklch(70% 0.19 25); border-color: oklch(70% 0.19 25 / 0.4); }
.abtn.dangerbtn:hover { background: oklch(70% 0.19 25); color: var(--night-0); }

/* ---- login ---- */
.login { min-height: 100svh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: min(380px, 100%); text-align: center;
  background: var(--night-1); border: 1px solid var(--line-soft); border-radius: 24px;
  padding: 44px 36px; display: grid; gap: 16px;
}
.login-mark, .side-mark { font-family: var(--en); font-size: 24px; color: var(--stone); letter-spacing: 0.04em; }
.login-mark i, .side-mark i { color: var(--laser); font-style: normal; font-size: 13px; vertical-align: super; }
.login-card h1 { font-size: 19px; font-weight: 800; }
.login-err { color: oklch(70% 0.19 25); font-size: 13.5px; }

/* ---- layout ---- */
.panel { display: grid; grid-template-columns: 240px 1fr; min-height: 100svh; }
.side {
  background: var(--night-1); border-inline-end: 1px solid var(--line-soft);
  padding: 26px 18px; display: flex; flex-direction: column; gap: 26px;
  position: sticky; top: 0; height: 100svh;
}
.side-nav { display: grid; gap: 4px; }
.side-nav button {
  font-family: var(--ar); font-weight: 400; font-size: 15px; text-align: start;
  color: var(--ink-dim); background: none; border: 0; border-radius: 12px;
  padding: 11px 14px; cursor: pointer; transition: all 0.2s;
}
.side-nav button:hover { color: var(--ink); background: var(--night-2); }
.side-nav button.on { color: var(--night-0); background: var(--stone); font-weight: 600; }
.side-foot { margin-top: auto; display: grid; gap: 8px; font-size: 13.5px; color: var(--ink-dim); }
.side-foot button { background: none; border: 0; color: oklch(70% 0.19 25); font-family: var(--ar); font-size: 13.5px; text-align: start; cursor: pointer; padding: 0; }
.content { padding: clamp(20px, 3.5vw, 44px); max-width: 1080px; }
@media (max-width: 800px) {
  .panel { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; }
  .side-nav { display: flex; flex-wrap: wrap; }
  .side-foot { margin: 0; display: flex; gap: 14px; }
}

.tab-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.tab-head h2 { font-size: 24px; font-weight: 800; }
.mode-pill { font-size: 13px; font-weight: 600; padding: 6px 18px; border-radius: 999px; border: 1px solid var(--line); color: var(--stone-hi); }
.mode-pill.voting { color: var(--ok); border-color: oklch(75% 0.16 150 / 0.4); }
.block-title { font-size: 17px; font-weight: 800; margin: 34px 0 14px; display: flex; align-items: center; gap: 12px; }

/* ---- kpis ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { background: var(--night-1); border: 1px solid var(--line-soft); border-radius: 16px; padding: 18px 20px; }
.kpi b { display: block; font-family: var(--en); font-weight: 400; font-size: 34px; color: var(--stone-hi); line-height: 1.2; direction: ltr; text-align: right; }
.kpi span { font-size: 13px; color: var(--ink-dim); }

/* ---- live results ---- */
.res-cat { background: var(--night-1); border: 1px solid var(--line-soft); border-radius: 16px; padding: 18px 22px; margin-bottom: 14px; }
.res-cat h4 { font-size: 15.5px; font-weight: 800; margin-bottom: 4px; }
.res-cat h4 small { color: var(--ink-dim); font-weight: 300; margin-inline-start: 8px; }
.res-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 7px 0; }
.res-track { position: relative; height: 26px; border-radius: 8px; background: var(--night-0); overflow: hidden; }
.res-track i {
  position: absolute; inset-block: 0; inset-inline-start: 0; width: var(--p);
  background: oklch(80% 0.11 85 / 0.35); border-radius: 8px;
}
.res-row.lead .res-track i { background: oklch(66% 0.24 350 / 0.5); }
.res-name { position: absolute; inset-inline-start: 10px; top: 0; line-height: 26px; font-size: 12.5px; font-weight: 600; z-index: 1; white-space: nowrap; }
.res-nums { font-size: 12.5px; color: var(--ink-dim); direction: ltr; white-space: nowrap; }
.res-nums b { color: var(--stone-hi); font-weight: 600; }

/* ---- fields tree ---- */
.field-block { background: var(--night-1); border: 1px solid var(--line-soft); border-radius: 18px; padding: 20px 24px; margin-bottom: 18px; }
.field-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.field-head h3 { font-size: 18px; font-weight: 800; color: var(--stone); flex: 1; }
.cat-block { border-top: 1px solid var(--line-soft); padding: 14px 0; }
.cat-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cat-row b { font-size: 15px; flex: 1; }
.cat-row .off { color: var(--ink-dim); font-size: 12px; border: 1px solid var(--line-soft); padding: 2px 10px; border-radius: 99px; }
.nom-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.nom-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--night-0); border: 1px solid var(--line-soft); border-radius: 999px;
  padding: 5px 7px 5px 14px; font-size: 13px;
}
.nom-chip .seedn { color: var(--ink-dim); font-size: 11.5px; direction: ltr; }
.chip-btn { background: none; border: 0; cursor: pointer; color: var(--ink-dim); font-size: 13px; padding: 2px 5px; border-radius: 99px; }
.chip-btn:hover { color: var(--stone-hi); background: var(--night-2); }
.chip-btn.del:hover { color: oklch(70% 0.19 25); }

/* ---- tables ---- */
.dtable { width: 100%; border-collapse: collapse; background: var(--night-1); border: 1px solid var(--line-soft); border-radius: 16px; overflow: hidden; display: block; overflow-x: auto; }
.dtable table { width: 100%; border-collapse: collapse; }
.dtable th, .dtable td { padding: 11px 16px; text-align: start; font-size: 13.5px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.dtable th { color: var(--ink-dim); font-weight: 600; font-size: 12px; background: var(--night-2); }
.dtable td.grow { white-space: normal; min-width: 220px; }
.row-actions { display: flex; gap: 6px; }

/* ---- settings ---- */
.card { background: var(--night-1); border: 1px solid var(--line-soft); border-radius: 18px; padding: 26px 28px; margin-bottom: 20px; max-width: 640px; }
.card h3 { font-size: 17px; font-weight: 800; margin-bottom: 16px; }
.card p { color: var(--ink-dim); font-size: 13.5px; margin-bottom: 14px; }
.mode-radios { display: grid; gap: 10px; margin-bottom: 18px; }
.mode-radios label {
  display: grid; grid-template-columns: auto auto 1fr; gap: 10px; align-items: baseline;
  border: 1px solid var(--line-soft); border-radius: 14px; padding: 13px 16px; cursor: pointer;
}
.mode-radios label:has(:checked) { border-color: var(--stone); background: oklch(80% 0.11 85 / 0.06); }
.mode-radios input { width: auto; accent-color: oklch(66% 0.24 350); }
.mode-radios span { color: var(--ink-dim); font-size: 12.5px; }
.form-row { display: grid; gap: 6px; margin-bottom: 14px; }
.form-row label { font-size: 13px; color: var(--ink-dim); font-weight: 400; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card.danger { border-color: oklch(70% 0.19 25 / 0.3); }
.chk { display: flex; gap: 10px; align-items: center; font-size: 13.5px; margin-bottom: 16px; cursor: pointer; }
.chk input { width: auto; accent-color: oklch(70% 0.19 25); }

/* ---- dialog ---- */
dialog {
  margin: auto; border: 1px solid var(--line); border-radius: 20px;
  background: var(--night-1); color: var(--ink); padding: 28px;
  width: min(480px, calc(100vw - 32px));
}
dialog::backdrop { background: oklch(0% 0 0 / 0.6); backdrop-filter: blur(4px); }
dialog h3 { font-weight: 800; margin-bottom: 18px; }
#rowFields { display: grid; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ---- toast ---- */
.toast {
  position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translate(50%, 140%);
  z-index: 90; background: var(--stone); color: var(--night-0);
  font-weight: 600; font-size: 14px; padding: 12px 26px; border-radius: 999px;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1); pointer-events: none;
}
.toast.show { transform: translate(50%, 0); }
.toast.err { background: oklch(70% 0.19 25); color: white; }
