/* Moe admin — the public site's look, sized for a working page.
   Palette, type and radii are moebot.app's (site/assets/style.css); the
   fonts are the same three files, self-hosted so font-src stays 'self'. */

@font-face { font-family: "Fraunces"; font-weight: 600; font-style: normal; font-display: swap; src: url(/admin/fonts/fraunces.woff2) format("woff2"); }
@font-face { font-family: "Figtree"; font-weight: 400 600; font-style: normal; font-display: swap; src: url(/admin/fonts/figtree.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url(/admin/fonts/plexmono.woff2) format("woff2"); }

:root {
  --paper: #f6f1e5; --sand: #ece5d4; --card: #fdfaf1;
  --ink: #241c12; --dim: #665a4a;
  --wood: #604830; --wood2: #7a6248; --sandal: #c8a27e; --olive: #3d4430;
  --accent: #3f5670; --accent-ink: #f6f1e5;
  --line: #ded4bf; --line2: #c9bda3;
  --ok: #3d6b3a; --warn: #a5651b; --bad: #a8362b; --wait: #5b4b9a;
  --r-sm: 8px; --r-md: 14px; --r-lg: 20px;
  --shadow: 0 1px 2px rgba(36,28,18,.05), 0 22px 50px -22px rgba(36,28,18,.34);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: Fraunces, Georgia, serif;
  --sans: Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 15.5px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.022em; line-height: 1.08; margin: 0; }
h1 { font-size: clamp(30px, 3.4vw, 40px); margin-bottom: 8px; }
h2 { font-size: 22px; margin: 34px 0 14px; }
h3 { font-size: 17px; margin: 0 0 10px; }
p { margin: 0; }
.lab { font: 500 11px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--wood); }
.dim { color: var(--dim); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.lead { color: var(--dim); font-size: 16px; max-width: 62ch; }

/* header */
.top { display: flex; align-items: center; gap: 28px; padding: 18px 28px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 5; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; color: inherit; letter-spacing: -.01em; font-size: 16px; }
.brand img { width: 26px; height: 26px; border-radius: 7px; }
.brand span { color: var(--dim); font-weight: 400; }
.nav { display: flex; gap: 22px; margin-left: 8px; }
.nav a { color: var(--dim); text-decoration: none; font-size: 15px; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--wood); }
.top .grow { flex: 1; }
.top .who { color: var(--dim); font-size: 13px; }
nav[hidden] { display: none; }

main { max-width: 1152px; margin: 0 auto; padding: 36px 28px 96px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 22px 24px; box-shadow: 0 1px 2px rgba(36,28,18,.04); }
.card + .card:not(.grid > .card):not(.two > .card):not(.three > .card) { margin-top: 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .grid { grid-template-columns: 1fr; } }
.two { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.two.wide { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.grid > *, .two > *, .three > * { min-width: 0; }
main { overflow-x: clip; }
.three { display: grid; gap: 14px; grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 860px) { .two, .two.wide, .three { grid-template-columns: 1fr; } .top { flex-wrap: wrap; gap: 14px; } .nav { gap: 16px; } }

.stat { display: flex; flex-direction: column; gap: 6px; min-height: 150px; }
.stat .n { font-family: var(--serif); font-weight: 600; font-size: clamp(30px, 3.2vw, 40px); letter-spacing: -.02em; line-height: 1; }
.stat .n small { font-size: 16px; color: var(--dim); font-family: var(--sans); font-weight: 400; margin-left: 6px; }
.stat .s { color: var(--dim); font-size: 13.5px; margin-top: 2px; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 500 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--wood); padding-bottom: 9px; }
tr:last-child td { border-bottom: 0; }
tr.row { cursor: pointer; }
tr.row:hover td { background: var(--sand); }
td .sub { color: var(--dim); font-size: 12.5px; margin-top: 2px; }

/* status words: small caps in a colour, no box around them */
.pill { display: inline-block; font: 500 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
.pill.open, .pill.suspended, .pill.ERROR { color: var(--bad); }
.pill.investigating, .pill.fixing, .pill.QUEUE { color: var(--warn); }
.pill.awaiting_user, .pill.DRAFT { color: var(--wait); }
.pill.resolved, .pill.away, .pill.away_plus, .pill.active, .pill.PUBLISHED { color: var(--ok); }
.pill.closed, .pill.free { color: var(--dim); }
.pill.on { color: var(--ink); }
.tabs { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tabs a { text-decoration: none; color: var(--dim); font-size: 14.5px; padding: 8px 0 10px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--wood); }
.pill img { display: none; }

/* controls */
button, .btn { font: 600 15px/1 var(--sans); padding: 11px 18px; border-radius: var(--r-sm); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { filter: brightness(1.06); }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border-color: var(--line2); }
button.ghost:hover, .btn.ghost:hover { background: var(--sand); filter: none; }
button.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 55%, transparent); }
button.danger:hover { background: color-mix(in srgb, var(--bad) 8%, transparent); filter: none; }
button.small, .btn.small { padding: 7px 12px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--line2); border-radius: var(--r-sm); background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 13px; color: var(--dim); margin-bottom: 5px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.row-actions > input, .row-actions > select { flex: 1 1 160px; width: auto; }
.actions h3 { margin-top: 22px; }
.actions h3:first-child { margin-top: 0; }
.search { display: flex; gap: 8px; margin-bottom: 16px; }
.search input { max-width: 420px; }

/* key-value */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 14.5px; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; }

/* history */
.event { padding: 12px 0; border-bottom: 1px solid var(--line); }
.event:last-child { border-bottom: 0; }
.event .meta { color: var(--dim); font-size: 12.5px; margin-bottom: 4px; }
.event .body { white-space: pre-wrap; }
.event.plan .body { border-left: 3px solid var(--wait); padding-left: 12px; }
.event.resolved .body { border-left: 3px solid var(--ok); padding-left: 12px; }
.event.approved .body, .event.declined .body { font-weight: 600; }
pre { background: var(--sand); padding: 12px 14px; border-radius: var(--r-sm); overflow: auto; font: 12px/1.5 var(--mono); max-height: 320px; margin: 0; max-width: 100%; }
pre.log { white-space: pre-wrap; overflow-wrap: anywhere; }
.diag h4 { font: 500 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--wood); margin: 16px 0 8px; }
.diag details summary { cursor: pointer; color: var(--dim); font-size: 13px; margin-top: 14px; }
.said { font-size: 17px; line-height: 1.6; white-space: pre-wrap; max-width: 70ch; }
.banner { background: color-mix(in srgb, var(--warn) 10%, var(--card)); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: var(--r-md); padding: 14px 18px; }
.banner.bad { background: color-mix(in srgb, var(--bad) 8%, var(--card)); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }

/* charts: plain boxes with pixel heights, so nothing is stretched or guessed */
.chart { display: grid; grid-template-rows: 120px auto; gap: 6px; margin-top: 6px; }
.chart .bars { display: flex; align-items: flex-end; gap: 2px; height: 120px; border-bottom: 1px solid var(--line2); position: relative; }
.chart .bars .bar { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 0; opacity: .9; }
.chart .bars .bar.dl { background: var(--olive); }
.chart .bars .bar:hover { opacity: 1; }
.chart .bars .max { position: absolute; right: 0; top: -2px; font: 10.5px var(--mono); color: var(--dim); }
.chart .labels { display: flex; gap: 2px; }
.chart .labels span { flex: 1; font: 10.5px var(--mono); color: var(--dim); white-space: nowrap; overflow: visible; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--dim); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; background: var(--accent); }
.legend i.dl { background: var(--olive); }

/* social */
.post { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); align-items: start; }
.post:last-child { border-bottom: 0; }
.post img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: var(--sand); }
.post .ch { font-size: 13px; color: var(--dim); }
.post .txt { white-space: pre-wrap; margin-top: 4px; }
.post .when { text-align: right; font-size: 13px; color: var(--dim); white-space: nowrap; }
.post .when .pill { margin-top: 6px; }

/* login */
.login { max-width: 440px; margin: 14vh auto 0; padding: 32px 34px; }
.login .brand { margin-bottom: 18px; }
.login p { color: var(--dim); margin: 6px 0 18px; }
.login .status { margin-top: 18px; font-size: 13px; color: var(--dim); }

#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 11px 18px; border-radius: 10px; font-weight: 600; z-index: 9; box-shadow: var(--shadow); }
.empty { color: var(--dim); padding: 18px 0; }
