:root {
  --bg: #f4f1ea; --panel: #fffdf8; --ink: #22262b; --soft: #626a73; --line: #ddd6c8; --accent: #1f6f78; --accent-ink: #fff;
  --good: #2e8b57; --warn: #b7791f; --bad: #b3261e; --chip: #ece6d8; --shadow: 0 1px 2px rgba(40, 30, 10, .08), 0 6px 20px rgba(40, 30, 10, .06);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15181c; --panel: #1e2227; --ink: #e8e6e1; --soft: #9aa3ad; --line: #333a42; --accent: #5cc3cd; --accent-ink: #0c1b1d; --good: #5fcf8f; --warn: #e3b25a; --bad: #ff8a80; --chip: #2a3037; --shadow: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.05rem; letter-spacing: .04em; text-transform: uppercase; color: var(--soft); }
a { color: var(--accent); }
p { margin: .6rem 0; }
.muted { color: var(--soft); } .small { font-size: .85rem; } .hide { display: none !important; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 24px; }
.narrow { width: min(100%, 400px); }

label { display: block; font-size: .85rem; color: var(--soft); margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 9px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, .btn { font: inherit; cursor: pointer; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); text-decoration: none; display: inline-block; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.danger { color: var(--bad); }
button.tiny { padding: 3px 9px; font-size: .82rem; }
button:disabled { opacity: .5; cursor: default; }
.wide { width: 100%; margin-top: 18px; padding: 12px; }
.msg { min-height: 1.4em; margin-top: 12px; font-size: .9rem; }
.msg.bad { color: var(--bad); } .msg.good { color: var(--good); }
.rowline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.check { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; color: var(--ink); font-size: .95rem; }
.check input { margin-top: 5px; }

/* top bar */
.top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top h1 { margin-right: auto; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }

/* home */
.search { max-width: 340px; }
section.cat { margin-top: 28px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 10px; }
.tile { display: flex; gap: 12px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); min-width: 0; }
.tile:hover { border-color: var(--accent); }
.tile .emoji { font-size: 2rem; line-height: 1; }
.tile .name { font-weight: 600; overflow-wrap: anywhere; }
.tile .desc { font-size: .85rem; color: var(--soft); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag { font-size: .72rem; padding: 1px 8px; border-radius: 99px; background: var(--chip); color: var(--soft); white-space: nowrap; }
.tag.beta, .tag.proto, .tag.test, .tag.pending { color: var(--warn); } .tag.down, .tag.removed { color: var(--bad); } .tag.up, .tag.active { color: var(--good); }

/* admin */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 10px 14px; color: var(--soft); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.scroll { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin: 10px 0 24px; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; color: var(--soft); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mid, th.mid { text-align: center; }
td.acts { white-space: nowrap; }
td.acts button { margin: 0 4px 4px 0; }
code { font-size: .85em; background: var(--chip); padding: 1px 5px; border-radius: 5px; }
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--ink); padding: 22px; width: min(94vw, 560px); max-height: 92vh; }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } .top { padding: 12px 16px; } }
.boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 12px; margin-top: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.note { background: var(--chip); border-radius: 10px; padding: 10px 14px; font-size: .9rem; margin: 10px 0; }
.rowline select, .rowline input { width: auto; }
#view h2 { margin: 24px 0 0; }
#view .rowline { margin-bottom: 6px; }
/* admin: the "Saved." / error line floats at the bottom of the window, so it is seen wherever the page is scrolled */
.wrap > #msg { margin: 0; min-height: 0; }
.wrap > #msg:not(:empty) { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 20; max-width: min(92vw, 520px); padding: 12px 20px; border-radius: 10px; font-size: 1rem; font-weight: 600; background: var(--ink); color: var(--bg); box-shadow: 0 6px 24px rgba(0, 0, 0, .3); }
.wrap > #msg.bad:not(:empty) { background: var(--bad); color: #fff; }
.wrap > #msg.good:not(:empty) { background: var(--good); color: #fff; }
