/* AOE Hub — the shared admin look (cream, brown, gold, rounded cards, Baloo 2).
   Later builds copy this file to every AOE admin so they all look and work alike. */

@font-face { font-family: "Baloo 2"; src: url(baloo2.woff2) format("woff2"); font-weight: 400 800; font-display: swap; }

:root {
  --bg: #FBF6EC; --surface: #FFFFFF; --surface-2: #F6EEDF; --surface-3: #EFE3CD;
  --ink: #2F2117; --ink-2: #5A4434; --muted: #75604F;
  --line: #EADFCB; --line-2: #D9C9AE;
  --brown: #6B4423; --gold: #E3A21A; --gold-2: #C98A0B; --on-gold: #2A1D12; --gold-soft: #FBEBC4;
  --ok: #1E7445; --ok-bg: #E3F2E8; --warn: #8E5A00; --warn-bg: #FCEFD3; --bad: #B42318; --bad-bg: #FBE5E1;
  --badge: #C2410C; --focus: #8A4B00;
  --shadow: 0 1px 2px rgba(47,33,23,.06), 0 6px 20px rgba(47,33,23,.06);
  --r: 18px; --r-sm: 12px;
  --side: 256px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: "Baloo 2", var(--font);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #17110C; --surface: #221912; --surface-2: #2B2018; --surface-3: #35281D;
    --ink: #F6ECDD; --ink-2: #DCCBB5; --muted: #B6A189;
    --line: #3A2D22; --line-2: #4E3D2E;
    --brown: #EDCBA0; --gold: #F0B437; --gold-2: #F6C75E; --on-gold: #1C140D; --gold-soft: #3B2C12;
    --ok: #67D196; --ok-bg: #13301F; --warn: #F2C14E; --warn-bg: #33270E; --bad: #FF8F80; --bad-bg: #3B1814;
    --badge: #F26B3A; --focus: #F0B437;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17110C; --surface: #221912; --surface-2: #2B2018; --surface-3: #35281D;
  --ink: #F6ECDD; --ink-2: #DCCBB5; --muted: #B6A189;
  --line: #3A2D22; --line-2: #4E3D2E;
  --brown: #EDCBA0; --gold: #F0B437; --gold-2: #F6C75E; --on-gold: #1C140D; --gold-soft: #3B2C12;
  --ok: #67D196; --ok-bg: #13301F; --warn: #F2C14E; --warn-bg: #33270E; --bad: #FF8F80; --bad-bg: #3B1814;
  --badge: #F26B3A; --focus: #F0B437;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); min-height: 100vh; overflow-x: hidden; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.2; margin: 0 0 .4em; font-weight: 700; }
p { margin: 0 0 .8em; }
a { color: var(--brown); text-underline-offset: 2px; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 6px; }
small, .small { font-size: .875rem; }
.muted { color: var(--muted); }
.bad-t { color: var(--bad); }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 14px; border-radius: 10px; }
.skip:focus { left: 8px; }

/* icons */
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 16px; height: 16px; }
.i.xl { width: 44px; height: 44px; stroke-width: 1.5; color: var(--muted); }
.i.ok { color: var(--ok); }
.mark { width: 34px; height: 34px; flex: none; }
.mark-bg { fill: var(--gold); }
.mark-dot { fill: var(--on-gold); }
.mark-line { stroke: var(--on-gold); stroke-width: 2; stroke-linecap: round; }

/* ---------- frame: sidebar (PC), top bar + bottom bar (phone) ---------- */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 1.25rem; }
.side { display: none; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .brand span { display: none; }
.top-title { flex: 1; font-size: 1.2rem; margin: 0; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.icon-btn .i { display: none; }
[data-theme="auto"] .t-auto, [data-theme="light"] .t-light, [data-theme="dark"] .t-dark { display: block; }
.main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
.main.narrow { max-width: 600px; padding-bottom: 40px; }
.bottom { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 20px rgba(47,33,23,.06); }
.bottom a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 56px; justify-content: center; text-decoration: none; color: var(--muted); font-size: .8rem; font-weight: 600; border-radius: 14px; }
.bottom a .i { width: 24px; height: 24px; padding: 0; }
.bottom a[aria-current="page"] { color: var(--ink); }
.bottom a[aria-current="page"] .i { background: var(--gold-soft); border-radius: 999px; width: 56px; height: 30px; padding: 3px 16px; box-sizing: border-box; color: var(--brown); }
.bottom .badge { position: absolute; top: 2px; left: calc(50% + 8px); }
.foot { text-align: center; color: var(--muted); font-size: .8rem; margin: 40px 0 0; }

@media (min-width: 900px) {
  .has-nav .top, .has-nav .bottom { display: none; }
  .has-nav .side { display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--side); padding: 22px 14px 18px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; z-index: 20; }
  .has-nav .main { margin-left: var(--side); width: calc(100% - var(--side)); max-width: none; padding: 32px clamp(24px, 4vw, 56px) 48px; }
  .has-nav .main > * { max-width: 1060px; }
  .side .brand { padding: 0 8px 18px; }
  .side-nav { display: grid; gap: 4px; }
  .side-nav a, .side-sites a { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; text-decoration: none; color: var(--ink-2); font-weight: 600; }
  .side-nav a:hover, .side-sites a:hover { background: var(--surface-2); color: var(--ink); }
  .side-nav a[aria-current="page"] { background: var(--gold-soft); color: var(--ink); }
  .side-nav a[aria-current="page"]::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold); }
  .side-nav .badge { margin-left: auto; }
  .side-sites { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .side-nav a, .side-sites a { min-width: 0; }
  .side-h { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 12px 6px; font-weight: 700; }
  .side-sites a { font-weight: 500; font-size: .94rem; min-height: 40px; }
  .side-site { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-sites .i { opacity: .55; }
  .side-out { margin-top: auto; padding-top: 16px; }
  .side-out .btn { width: 100%; justify-content: flex-start; }
}

/* ---------- pieces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 20px; }
.hello { font-size: clamp(1.6rem, 4vw, 2.1rem); margin: 0; }
.head .muted { margin: 2px 0 0; }
.h { font-size: 1.3rem; margin: 28px 0 12px; }
.sub { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; margin: 20px 0 8px; }
.lead { color: var(--ink-2); font-size: 1.05rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inline { display: inline; margin: 0; }
.grid2 { display: grid; gap: 0 16px; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--r-sm); border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink); font: 600 .95rem/1.2 var(--font); text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--gold); border-color: var(--gold-2); color: var(--on-gold); }
.btn.primary:hover { background: var(--gold-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.link { background: none; border: 0; padding: 0 4px; min-height: 40px; color: var(--brown); text-decoration: underline; font-weight: 600; }
.btn.link.danger, .btn.danger { color: var(--bad); }
.btn.small { min-height: 40px; padding: 0 12px; font-size: .9rem; }
.btn.big { width: 100%; min-height: 52px; font-size: 1.05rem; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--badge); color: #fff; font-size: .75rem; font-weight: 800; line-height: 1; text-decoration: none; }
.badge.big { height: 28px; border-radius: 14px; padding: 0 10px; font-size: .82rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--line-2); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }

.banner { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink); margin: 0 0 10px; border: 1px solid var(--line); }
.banner > span { flex: 1 1 220px; }
.banner .btn { margin-left: auto; }
.banner.ok { background: var(--ok-bg); border-color: transparent; } .banner.ok > .i { color: var(--ok); }
.banner.warn { background: var(--warn-bg); border-color: transparent; } .banner.warn > .i { color: var(--warn); }
.banner.bad { background: var(--bad-bg); border-color: transparent; } .banner.bad > .i { color: var(--bad); }
.banner.small { font-size: .9rem; padding: 8px 12px; }
.needs .h { margin-top: 0; }

.toast { position: fixed; z-index: 60; left: 50%; top: calc(76px + env(safe-area-inset-top)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; width: max-content; max-width: min(92vw, 560px); padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); box-shadow: 0 10px 30px rgba(0,0,0,.2); font-weight: 600; cursor: pointer; transition: opacity .3s, transform .3s; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.warn { background: var(--warn-bg); color: var(--ink); border: 1px solid var(--warn); }
.toast.gone { opacity: 0; transform: translate(-50%, -12px); pointer-events: none; }
@media (min-width: 900px) { .toast { top: 20px; left: calc(50% + var(--side) / 2); } .no-nav .toast { left: 50%; } }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.top-tiles { grid-template-columns: repeat(2, 1fr); margin-bottom: 8px; }
@media (min-width: 720px) { .top-tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); min-height: 92px; justify-content: center; transition: border-color .15s, transform .1s; }
.card .tile { background: var(--surface-2); border-color: transparent; }
a.tile:hover { border-color: var(--gold); }
.tile-v { display: flex; align-items: center; gap: 6px; font: 700 clamp(1.35rem, 5.4vw, 1.9rem)/1.1 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile-v small { font-size: 1rem; color: var(--muted); font-weight: 600; }
.tile-v.sm { font-size: 1.2rem; white-space: normal; }
.tile-l { font-size: .88rem; color: var(--muted); font-weight: 600; }
.tile-h { font-size: .78rem; color: var(--muted); }
.tile.hot { background: var(--gold-soft); border-color: var(--gold); }
.tile.ok .tile-v { color: var(--ok); } .tile.warn .tile-v { color: var(--warn); } .tile.bad .tile-v { color: var(--bad); }

/* site cards on Home */
.sites { display: grid; gap: 14px; }
.site { padding: 0; overflow: hidden; }
.site-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 16px; }
.site-name { flex: 1 1 180px; min-width: 0; }
.site-name h3 { margin: 0; font-size: 1.2rem; }
.site-head .btn.primary { margin-left: auto; }
@media (max-width: 520px) { .site-head .btn.primary { width: 100%; } }
.site .fold { border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; margin: 0; background: transparent; }
.site .fold > summary { padding: 10px 16px; min-height: 48px; font-size: .95rem; }
.site .fold > summary .fold-t { font: 600 .95rem var(--font); color: var(--ink-2); }
.site-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; }
.empty { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); background: var(--surface-2); border-radius: var(--r-sm); padding: 12px 14px; margin: 0; }

/* folds (closable sections) */
.fold { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); margin: 0 0 12px; }
.fold > summary { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 60px; cursor: pointer; list-style: none; border-radius: var(--r); }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary:hover { background: var(--surface-2); }
.fold-t { flex: 1; font: 700 1.15rem/1.2 var(--display); }
.chev { transition: transform .2s; color: var(--muted); }
.fold[open] > summary .chev { transform: rotate(90deg); }
.fold[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.fold-b { padding: 4px 16px 18px; }
.fold.inner { box-shadow: none; background: var(--bg); border-radius: 14px; margin: 0 0 10px; }
.fold.inner > summary { min-height: 52px; border-radius: 14px; }
.fold.inner > summary .fold-t { font-size: 1.05rem; }
.jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.jump a { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; font-weight: 600; font-size: .9rem; color: var(--ink-2); min-height: 36px; display: inline-flex; align-items: center; }
.jump a:hover { border-color: var(--gold); }

/* forms */
.form { display: grid; gap: 14px; margin: 0 0 12px; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; display: grid; gap: 14px; }
legend { font: 700 1.05rem var(--display); margin-bottom: 8px; padding: 0; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: .95rem; }
.field small { color: var(--muted); }
.field.short { max-width: 160px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line-2); border-radius: var(--r-sm); min-height: 48px; padding: 10px 14px; width: 100%; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input::placeholder { color: var(--muted); opacity: .75; }
.code-in { font: 700 1.6rem var(--mono); letter-spacing: .3em; text-align: center; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--gold-2); flex: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
details.more { margin: 8px 0; }
details.more > summary { cursor: pointer; color: var(--brown); font-weight: 600; min-height: 40px; display: flex; align-items: center; }
details.more[open] > summary { margin-bottom: 8px; }

/* sign-in and setup */
.auth { max-width: 440px; margin: 6vh auto 0; padding: 28px 24px; }
.auth.wide { max-width: 560px; }
.auth > .mark { width: 48px; height: 48px; margin-bottom: 12px; }
.auth h1 { font-size: 1.7rem; }
.steps { padding-left: 0; list-style: none; counter-reset: s; margin: 0 0 14px; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
.steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--gold-soft); color: var(--brown); font-weight: 800; display: grid; place-items: center; font-size: .9rem; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0; list-style: none; margin: 0 0 14px; }
.codes code { display: block; text-align: center; font-size: 1.15rem; padding: 10px; background: var(--surface-2); border-radius: 10px; letter-spacing: .06em; }
.keybox { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 8px 8px 14px; margin: 0 0 12px; }
.keybox code { flex: 1; min-width: 0; background: none; padding: 0; word-break: break-all; font-size: .88rem; }

/* requests */
.reqs { list-style: none; padding: 0; margin: 0 0 8px; }
.reqs.card { padding: 4px 0; }
.req { display: grid; grid-template-columns: 12px 1fr auto; gap: 4px 12px; align-items: start; padding: 12px 16px; text-decoration: none; color: var(--ink); border-radius: 12px; }
.card .req { border-radius: 0; }
.reqs li + li .req { border-top: 1px solid var(--line); }
.req:hover { background: var(--surface-2); }
.req-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; }
.req.new .req-dot { background: var(--badge); }
.req-main { display: grid; min-width: 0; }
.req-site { font-size: .78rem; font-weight: 700; color: var(--brown); text-transform: uppercase; letter-spacing: .04em; }
.req-title { font-weight: 500; overflow-wrap: anywhere; }
.req.new .req-title { font-weight: 700; }
.req-detail { color: var(--muted); font-size: .92rem; overflow-wrap: anywhere; }
.req-time { color: var(--muted); font-size: .82rem; white-space: nowrap; margin-top: 2px; }
.req-go { display: none; }
.day { font-size: 1rem; color: var(--muted); margin: 22px 0 8px; font-family: var(--font); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.fchip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line-2); text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .92rem; }
.fchip b { background: var(--badge); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .75rem; line-height: 20px; }
.fchip[aria-current="true"] { background: var(--brown); border-color: var(--brown); color: var(--bg); }
.fchip.toggle { border-style: dashed; }
.sw { width: 34px; height: 20px; border-radius: 10px; background: var(--line-2); position: relative; flex: none; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: left .15s; }
.on .sw { background: var(--gold-2); }
.on .sw::after { left: 16px; }
.empty-card { text-align: center; padding: 36px 20px; }
.empty-card h3 { margin-top: 8px; }

/* settings lists */
.list { list-style: none; padding: 0; margin: 0 0 12px; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list.log li { display: grid; grid-template-columns: 1fr; gap: 0; justify-content: stretch; }
@media (min-width: 720px) { .list.log li { grid-template-columns: 170px 1fr auto; gap: 12px; } }
.changes { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.changes li { display: flex; flex-wrap: wrap; gap: 6px 10px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; overflow-wrap: anywhere; }
.danger-row { margin-top: 18px; padding-top: 10px; border-top: 1px dashed var(--line-2); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
.codes + .row { margin-bottom: 18px; }
