/* The hub's own page, in the monitor's look (coder_agent/page/overview.html):
   the same colours and type, a calm modern web app, app-like on a phone.
   Open Sans for English and Kantumruy Pro for Khmer, thin weights, never bold
   Khmer; motion is short and gives way to reduced motion. */

:root {
  --bg: #0b1015; --panel: #141c24; --panel-2: #10161d; --ink: #e4eaf0; --muted: #94a3b2; --line: #26323d;
  --accent: #6cb4e4; --accent-ink: #06121b; --ok: #3fb97a; --warn: #e0a24a; --bad: #e5566c;
  --radius: 14px; --ease: cubic-bezier(.2, .7, .2, 1);
  --font: "Open Sans", "Kantumruy Pro", system-ui, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f5f7fa; --panel: #fff; --panel-2: #f0f3f7; --ink: #17202a; --muted: #5d6b7a; --line: #dde3ea; --accent: #2f7fb8; --accent-ink: #fff; color-scheme: light; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-weight: 300; font-size: 14.5px;
  line-height: 1.6; font-synthesis: none; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
:lang(km) { font-family: "Kantumruy Pro", "Open Sans", sans-serif; }
b, strong, h1, h2, h3, h4 { font-weight: 400; }
a { color: inherit; text-decoration: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* top bar */
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink); font-weight: 400; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
nav { display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--ink); background: var(--panel);
  transition: border-color .2s var(--ease), transform .2s var(--ease); }
.pill:hover { border-color: var(--accent); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); font-size: 13px; }

main { max-width: 760px; margin: 0 auto; padding: 18px 16px 48px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
h1 { font-size: 22px; margin: 2px 0; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0; }
h4 { margin: 0 0 8px; font-size: 12px; font-weight: 400; color: var(--muted); letter-spacing: .02em; }
p { margin: 0; }
.dim { color: var(--muted); }
.small { font-size: 12.5px; }

/* panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; min-width: 0; }
.panel.center { max-width: 420px; width: 100%; margin: 6vh auto 0; }
.sec { display: grid; gap: 10px; }
.sec + .sec { border-top: 1px solid var(--line); padding-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* list rows */
.list { list-style: none; margin: 0; padding: 0; display: grid; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 0; min-width: 0; }
.item + .item { border-top: 1px solid var(--line); }
.item.wrap { flex-wrap: wrap; }
.item .who { flex: 1; min-width: 0; display: grid; }
.item .who > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line); flex: none; font-size: 13px; }
.mark.round { border-radius: 50%; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--line); font-size: 12px; color: var(--muted); white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.chip.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }

/* buttons and fields */
button, select, input { font: inherit; color: inherit; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; transition: background .2s var(--ease), border-color .2s var(--ease), transform .12s var(--ease); }
button:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
button:active { transform: scale(.98); }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.primary:hover { filter: brightness(1.06); }
.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.danger { color: var(--bad); }
.block { width: 100%; min-height: 46px; }
.btnlink { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; border: 1px solid var(--accent); }
.small-btn { min-height: 34px; padding: 0 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; transform: none; }
input, select { min-height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); width: 100%; min-width: 0; outline: none;
  transition: border-color .2s var(--ease); }
input:focus, select:focus { border-color: var(--accent); }
select.mini { width: auto; min-height: 34px; padding: 0 8px; font-size: 13px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
form { display: grid; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.check input { width: auto; min-height: 0; }
.stack { display: grid; gap: 10px; }

/* tabs: a segmented control that scrolls on a phone */
.tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 1 0 auto; text-align: center; padding: 7px 12px; border-radius: 9px; font-size: 13.5px; color: var(--muted); white-space: nowrap; transition: background .2s var(--ease), color .2s var(--ease); }
.tabs a.on { background: var(--panel-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { min-height: 32px; padding: 0 12px; border-radius: 999px; font-size: 13px; }
.seg button.on { border-color: var(--accent); color: var(--accent); }

/* code and secrets */
.code { position: relative; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; line-height: 1.5; padding: 12px 46px 12px 12px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line); word-break: break-all; white-space: pre-wrap; user-select: all; }
.code .copy { position: absolute; top: 6px; right: 6px; min-height: 32px; width: 32px; padding: 0; }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 15px; letter-spacing: .04em; text-align: center; padding: 14px; border-radius: 10px; border: 1px dashed var(--accent); user-select: all; word-break: break-all; }

/* first-run steps */
.steps { display: flex; align-items: center; gap: 6px; }
.steps span { height: 4px; flex: 1; border-radius: 4px; background: var(--line); transition: background .4s var(--ease); }
.steps span.on { background: var(--accent); }
.qr { width: 200px; max-width: 70%; margin: 4px auto; border-radius: 12px; overflow: hidden; background: #fff; }
.qr svg { width: 100%; height: auto; display: block; stroke: none; }
.qr svg * { stroke: none; }
.wait { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* motion */
.enter { animation: enter .28s var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

#toast { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); margin: 0 auto; max-width: 480px; padding: 12px 14px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 10px 30px #0007; z-index: 10; animation: enter .2s var(--ease) both; }

@media (max-width: 520px) {
  html, body { font-size: 13.5px; }
  .brand span { display: none; }
  h1 { font-size: 19px; }
  main { padding: 14px 12px 40px; gap: 12px; }
  .panel { padding: 14px; }
  .item { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
