:root {
  color-scheme: dark;
  --bg: #0d1117; --panel: #151b23; --panel2: #1c2430; --line: #2a3442;
  --text: #dde5ee; --muted: #8a97a8; --accent: #FDB813; --accent-ink: #1a1400;
  --ok: #3fb950; --warn: #d29922; --err: #f85149;
  --bar-h: 48px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .grow { flex: 1; }
.center { display: grid; place-items: center; min-height: 60vh; text-align: center; padding: 24px; }

button, select, input, textarea {
  font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 10px;
}
button { cursor: pointer; }
button:hover { border-color: var(--muted); }
button.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.ghost, a.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover, a.ghost:hover { color: var(--text); text-decoration: none; }
button.danger { color: var(--err); }
button:disabled { opacity: .5; cursor: default; }
input, textarea { width: 100%; }
label { display: block; margin: 8px 0; color: var(--muted); font-size: 12px; }
label > input, label > textarea, label > select { margin-top: 3px; color: var(--text); font-size: 14px; }
label.chk { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; }
label.chk input { width: auto; }
kbd { border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; font-size: 11px; }

#bar { position: fixed; inset: 0 0 auto 0; height: var(--bar-h); display: flex; align-items: center; gap: 8px;
  padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 10; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; white-space: nowrap; }
.brand svg { width: 34px; height: 17px; }
#bar nav { display: flex; gap: 2px; }
#bar nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); }
#bar nav a.on, #bar nav a:hover { color: var(--text); background: var(--panel2); text-decoration: none; }
#sitePick { max-width: 280px; }
#accountLink { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 8px; }

#main { padding-top: var(--bar-h); min-height: 100%; }
#main.viewer { height: 100%; }
#main.viewer iframe { display: block; width: 100%; height: calc(100vh - var(--bar-h)); border: 0; background: #000; }
.page { max-width: 1180px; margin: 0 auto; padding: 24px 16px 60px; }
.page h2 { margin: 4px 0 16px; font-size: 20px; }
.page h3 { margin: 28px 0 10px; font-size: 15px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; display: flex;
  flex-direction: column; gap: 6px; min-height: 130px; }
.card b { font-size: 16px; }
.card .grow { flex: 1; }
.card a.open { align-self: flex-start; background: var(--accent); color: var(--accent-ink); padding: 6px 14px;
  border-radius: 6px; font-weight: 600; }
.card a.open:hover { text-decoration: none; filter: brightness(1.08); }
.project + .project { margin-top: 26px; }
.apps { margin-top: 30px; }
.project > h3 { margin: 0 0 10px; font-size: 15px; }
.project-block { margin-bottom: 22px; }
.project-block h3 { margin-top: 0; }
.project-block td input { min-width: 0; }

table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; background: var(--panel2); }
tr:last-child td { border-bottom: 0; }
td .row { justify-content: flex-end; }
.tablewrap { overflow-x: auto; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.form .row > label { flex: 1; min-width: 160px; margin: 0; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; background: var(--panel2);
  border: 1px solid var(--line); margin: 1px 2px 1px 0; }
.tag.ok { color: var(--ok); border-color: #2a5532; } .tag.warn { color: var(--warn); border-color: #5a4a20; }
.tag.err { color: var(--err); border-color: #5a2a2a; } .tag.acc { color: var(--accent); border-color: #5a4a10; }
.banner { background: #2a2210; border: 1px solid #5a4a10; color: var(--accent); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.site-block { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 18px; }
.site-block table { background: var(--bg); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.secret { font-size: 15px; letter-spacing: 1px; background: var(--panel2); padding: 8px 10px; border-radius: 6px; word-break: break-all; }

#drawer { position: fixed; top: var(--bar-h); right: 0; bottom: 0; width: min(380px, 100vw); background: var(--panel);
  border-left: 1px solid var(--line); z-index: 9; display: flex; flex-direction: column; box-shadow: -8px 0 24px rgba(0,0,0,.4); }
.drawer-head, .drawer-foot { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.drawer-foot { border-bottom: 0; border-top: 1px solid var(--line); justify-content: flex-end; }
.drawer-body { padding: 4px 14px 14px; overflow: auto; flex: 1; }
.drawer-body h4 { margin: 18px 0 2px; font-size: 13px; }
.drawer-body p { margin: 4px 0 8px; }
.chips { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.chips li { display: flex; gap: 6px; align-items: center; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 6px 4px 8px; font-size: 12px; }
.chips li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips li em { color: var(--muted); font-style: normal; }
.chips li button { padding: 0 6px; }

#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; z-index: 20;
  transition: all .2s; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { border-color: var(--err); color: #ffb3ad; }

@media (max-width: 760px) {
  .brand span, #bar nav { display: none; }
  #bar { gap: 4px; padding: 0 6px; }
  #sitePick { max-width: 45vw; }
}
.weather-block{margin-top:12px;padding-top:10px;border-top:1px solid var(--line, #2a3440)}
.weather-block .tag{margin-right:4px}
.warn-text{color:#f2c94c}

/* admin Sites: nav on the left, the chosen site (or Projects) on the right */
.page.page-wide { max-width: 1400px; }
.ssplit { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.snav { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 10px; }
.snav-group { display: flex; flex-direction: column; gap: 2px; }
.snav-head { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 4px 10px 2px; }
.snav-item { display: flex; flex-direction: column; padding: 7px 10px; border-radius: 8px; border: 1px solid transparent; color: var(--text); }
.snav-item:hover { background: var(--panel); text-decoration: none; }
.snav-item.on { background: var(--panel); border-color: var(--line); box-shadow: inset 3px 0 0 var(--accent); }
.snav-name { font-weight: 600; font-size: 14px; }
.snav-sub, .snav-empty { font-size: 11px; color: var(--muted); }
.snav-empty { padding: 2px 10px; }
.snav-arch .snav-item { opacity: .7; }
.snav-proj { border-color: var(--line); }
.spane { margin-bottom: 0; min-width: 0; }
.shead { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.shead h2 { margin: 0 0 6px; }
.shead .tag { margin-right: 4px; }
a.btnlink { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); color: var(--text); white-space: nowrap; }
a.btnlink:hover { border-color: var(--accent); text-decoration: none; }
.stabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0 14px; flex-wrap: wrap; }
.stabs a { padding: 7px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.stabs a:hover { color: var(--text); text-decoration: none; }
.stabs a.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.stabs .count { margin-left: 6px; font-size: 11px; padding: 0 6px; border-radius: 8px; background: var(--panel2); color: var(--muted); }
tr.isdef td { background: rgba(253, 184, 19, .06); }
tr.isdef td .tag.acc { margin-left: 6px; }
@media (max-width: 760px) {
  .ssplit { grid-template-columns: 1fr; }
  .snav { position: static; }
}

/* AWS usage (#/admin/costs) */
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 8px 0 16px; }
.stat { background: var(--panel, #161a22); border: 1px solid var(--line, #2a3040); border-radius: 10px; padding: 12px 16px; min-width: 180px; }
.stat .big { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.banner.over { border-color: #8a3a2a; background: #2a1510; color: #f2b8a8; }
.costbars { display: flex; align-items: flex-end; gap: 2px; height: 140px; padding: 4px 0; border-bottom: 1px solid var(--line, #2a3040); }
.costbar { flex: 1; min-width: 4px; background: var(--accent, #FDB713); border-radius: 4px 4px 0 0; opacity: .85; cursor: default; }
.costbar:hover, .costbar:focus { opacity: 1; outline: none; }
.costtip { min-height: 1.4em; margin-top: 4px; font-variant-numeric: tabular-nums; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
#adminNav a.warn::after { content: " ⚠"; color: #f2b8a8; }
