body.admin { background: var(--bg); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); border-radius: 999px; padding: 8px 18px; cursor: pointer; text-decoration: none; font-weight: 500; font-size: .95rem; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--warn); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 8px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: linear-gradient(180deg, #24476E 0%, #8CC3E3 100%); }
.login-card { background: var(--surface); border-radius: 26px; padding: 34px 32px; max-width: 430px; width: 100%; }
.login-card h1 { font-size: 2rem; margin: 18px 0 10px; }
.login-card p { margin: 0 0 16px; }
.login-card .btn { width: 100%; padding: 12px 18px; font-size: 1.05rem; margin: 6px 0 18px; }
.brand-mark.big { display: block; width: 52px; height: 52px; border-radius: 14px; background: url(/icon.svg) center/cover; }
.note { padding: 10px 14px; border-radius: 12px; background: var(--sun-soft); }
.note.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); }
code { font-size: .9em; background: var(--bg); padding: 1px 6px; border-radius: 6px; }

/* shell */
.abar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.abar-r { display: flex; gap: 8px; }
.ashell { display: grid; grid-template-columns: 220px 1fr; max-width: 1180px; margin: 0 auto; }
.anav { display: flex; flex-direction: column; gap: 2px; padding: 24px 14px; position: sticky; top: 64px; align-self: start; }
.anav button { text-align: left; border: 0; background: none; padding: 9px 14px; border-radius: 10px; cursor: pointer; color: var(--muted); font-size: 1rem; }
.anav button:hover { color: var(--ink); }
.anav button[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 600; }
.amain { padding: 28px 24px 80px; min-width: 0; }
.amain h1 { font-size: 2rem; margin-bottom: 8px; }
.amain h2 { font-size: 1.15rem; margin: 30px 0 6px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.kpi { background: var(--surface); border-radius: 16px; padding: 14px 16px; }
.kpi span { color: var(--muted); font-size: .88rem; display: block; }
.kpi b { font: 600 1.45rem/1.2 var(--display); font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 22px; margin: 10px 0 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; background: var(--bat); }
.dot.bad { background: var(--warn); }

/* forms */
.form { margin-top: 18px; max-width: 760px; }
.fgroup { background: var(--surface); border-radius: 18px; padding: 6px 20px; margin-bottom: 16px; }
.fgroup h3 { font: 600 1.02rem var(--display); padding: 14px 0 4px; }
.field { display: grid; grid-template-columns: 1fr 230px; gap: 6px 20px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.fgroup h3 + .field { border-top: 0; }
.field.wide { grid-template-columns: 1fr; }
.field label { font-weight: 500; }
.field .hint { display: block; color: var(--muted); font-size: .86rem; font-weight: 400; }
.field input[type=text], .field input[type=number], .field select, .field textarea, .spec-rows input, .search {
  width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 12px; }
.field textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.field .unit { display: flex; align-items: center; gap: 8px; }
.field .unit span { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.switch { position: relative; width: 46px; height: 26px; justify-self: end; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + i { background: var(--bat); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 3px solid var(--sun); outline-offset: 2px; }
.savebar { position: sticky; bottom: 0; display: flex; gap: 14px; align-items: center; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 30%); }
.saved { color: var(--bat); font-size: .95rem; }
.saved.err { color: var(--warn); }
.spec-rows { display: grid; gap: 8px; }
.spec-row { display: grid; grid-template-columns: 200px 1fr auto; gap: 8px; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: 16px; margin-top: 10px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .94rem; }
.tbl th, .tbl td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 500; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .crit { color: var(--warn); }
.search { max-width: 320px; margin-top: 8px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 140%); background: var(--ink); color: var(--bg); padding: 10px 20px; border-radius: 999px; transition: transform .25s, opacity .25s; z-index: 10; opacity: 0; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 820px) {
  .ashell { grid-template-columns: 1fr; }
  .anav { flex-direction: row; overflow-x: auto; position: sticky; top: 61px; z-index: 4; background: var(--bg); padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .anav button { white-space: nowrap; }
  .amain { padding: 20px 16px 80px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field { grid-template-columns: 1fr; }
  .switch { justify-self: start; }
  .spec-row { grid-template-columns: 1fr; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .spec-row .btn { justify-self: start; }
  .abar .btn.ghost:first-child { display: none; }
}
