/* Admin: side navigation + working area. Uses the tokens from app.css. */
html, body.admin-body { height: auto; min-height: 100%; }
.admin { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 62px); }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; }
.side button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: var(--r); cursor: pointer; font-size: 13.5px; color: var(--muted); }
.side button:hover { background: var(--surface-2); color: var(--ink); }
.side-link { margin-top: 12px; padding: 8px 10px; font-size: 13px; color: var(--accent); text-decoration: none; border-top: 1px solid var(--line); }
.side-link:hover { text-decoration: underline; }
.side button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.view { padding: 24px max(16px, env(safe-area-inset-right, 0px)) 48px 28px; display: flex; flex-direction: column; gap: 16px; max-width: 1180px; min-width: 0; }
.vhead { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: end; }
.vhead h2 { margin: 0; font-size: 22px; }
.vhead p { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.box:empty { display: none; }
.box h3 { margin: 0; font-size: 15px; }
.box summary { cursor: pointer; font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.card .n { font: 600 22px var(--font-data); }
.card .l { font-size: 12.5px; color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { color: var(--accent-ink); filter: brightness(1.08); }
.btn.danger { color: var(--select); }
.btn.wide { width: 100%; justify-content: center; padding: 10px; }
a.btn { text-decoration: none; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.err { margin: 0; color: var(--select); font-size: 13px; white-space: pre-line; }
.ok { margin: 0; color: var(--accent); font-size: 13px; }
.pending { border-left: 3px solid var(--select); }
.tablebox { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.atable { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.atable th, .atable td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.atable th { background: var(--surface-2); font-weight: 600; font-size: 12px; color: var(--muted); position: sticky; top: 0; }
.atable td code, code { font: 12px var(--font-data); background: var(--surface-2); padding: 1px 4px; border-radius: 3px; }
.atable tbody tr.click { cursor: pointer; }
.atable tbody tr.click:hover td { background: var(--surface-2); }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.warn { background: color-mix(in srgb, var(--select) 15%, transparent); color: var(--select); }
.tag.ok { background: var(--accent-soft); color: var(--accent); }
pre { margin: 0; font: 12px/1.5 var(--font-data); white-space: pre-wrap; background: var(--surface-2); padding: 10px; border-radius: 6px; max-height: 320px; overflow: auto; }
.form .grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form .f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.form .f.wide { grid-column: 1 / -1; }
.form label, .form .lbl { font-size: 12.5px; color: var(--muted); }
.form input, .form select, .form textarea, .dash-edit select {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); width: 100%; font: inherit;
}
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; width: fit-content; }
.seg button { border: 0; background: var(--surface-2); padding: 6px 12px; cursor: pointer; font-size: 12.5px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
dialog { border: 1px solid var(--line); border-radius: 10px; padding: 20px; width: min(760px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(10 20 20 / 0.45); }
dialog h3 { margin: 0 0 12px; }
.dlg-actions { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
.dash-edit { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.dash-edit .f { width: 280px; display: flex; flex-direction: column; gap: 4px; }
.dash-edit label { font-size: 12.5px; color: var(--muted); }
#dash-text { width: 100%; min-height: 460px; font: 12.5px/1.5 var(--font-data); padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); resize: vertical; }
.ver { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; align-items: center; }

.login { min-height: 100vh; display: grid; place-items: center; padding-inline: max(16px, env(safe-area-inset-left, 0px)); }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.login-card h1 { margin: 0; font-size: 20px; }
.login-card p { margin: 0; }
.login-card form { display: flex; flex-direction: column; gap: 8px; }
.login-card input { padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.login-card a { color: var(--accent); }
.devnote { font-size: 12.5px; background: var(--surface-2); border-radius: 6px; padding: 10px; color: var(--muted); }
@media (max-width: 800px) {
  .admin { grid-template-columns: minmax(0, 1fr); }
  .side { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side button { white-space: nowrap; }
  .view { padding-left: max(16px, env(safe-area-inset-left, 0px)); }
  .form .grid2 { grid-template-columns: minmax(0, 1fr); }
}
/* dashboard editor */
.de-top h3 { margin-top: 0; }
.de-secs { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.de-sec { padding: 8px 10px; }
.de-head { display: flex; align-items: center; gap: 6px; }
.de-num { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; color: var(--muted); flex: none; }
.de-title { flex: 1; text-align: left; border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; gap: 1px; padding: 4px; color: var(--ink); }
.de-sec.open { border-color: var(--accent); }
.de-body { padding: 8px 4px 4px 30px; }
.de-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.de-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); color: var(--ink); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 12.5px; }
.de-x { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; color: var(--muted); padding: 0 4px; }
.de-item { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; align-items: end; padding: 8px; margin: 6px 0; border: 1px solid var(--line); border-radius: var(--r); }
.de-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#dash-advanced textarea { min-height: 260px; }
.de-item .de-rm-item { justify-self: start; width: auto; }
.de-add { flex-direction: row; align-items: center; justify-content: flex-start; text-align: left; }
.de-add select { width: auto; min-width: 220px; }
.de-body > .grid2 > .f.wide > .btn { width: auto; align-self: flex-start; }
.agol-row { display: flex; gap: 8px; }
.agol-row input { flex: 1; min-width: 0; }
.seg-radio { display: flex; gap: 16px; flex-wrap: wrap; margin: 6px 0 10px; }
#agol-info [hidden] { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
