/* Elchi dashboard. Same roles and tokens as Zafar's, so the two feel like one family.
   Colors are roles, defined once per mode; status colors always travel with a label. */
:root {
  color-scheme: light;
  --page: #f9f9f7; --surface: #fcfcfb; --sunk: #f1f0ec;
  --ink: #0b0b0b; --ink2: #52514e; --muted: #77756f;
  --line: #e1e0d9; --border: rgba(11, 11, 11, .10);
  --accent: #2a78d6; --button: #256abf; --button-ink: #ffffff;
  --good: #0c8a0c; --warn: #b87900; --serious: #c9552b; --crit: #d03b3b;
  --tint-good: #e6f4e6; --tint-warn: #fdf1d3; --tint-crit: #fbe4e1; --tint-info: #e4eefb;
  --shadow: 0 1px 2px rgba(11, 11, 11, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --sunk: #232322;
    --ink: #ffffff; --ink2: #c3c2b7; --muted: #9a988f;
    --line: #2c2c2a; --border: rgba(255, 255, 255, .10);
    --accent: #5a9cec; --button: #256abf; --button-ink: #ffffff;
    --good: #58c458; --warn: #f0b93a; --serious: #ee8f66; --crit: #f07a72;
    --tint-good: #16301a; --tint-warn: #3a2e10; --tint-crit: #3b1a18; --tint-info: #15273d;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink);
       font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
h1, h2, h3, h4, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--accent); text-underline-offset: 2px; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.noscript { padding: 24px 16px; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px calc(48px + env(safe-area-inset-bottom)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.pad { padding: 16px; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink2); }
.small { font-size: 13px; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.wraprow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
section { margin-top: 26px; }
section > h2 { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
               color: var(--muted); margin-bottom: 10px; }

/* buttons and fields */
.btn { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 7px 13px;
       cursor: pointer; font-size: 14px; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--sunk); }
.btn.primary { background: var(--button); border-color: transparent; color: var(--button-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: color-mix(in oklab, var(--crit) 55%, transparent); color: var(--crit); }
.btn.quiet { border-color: transparent; background: none; color: var(--ink2); }
.btn:disabled { opacity: .5; cursor: default; }
.field { width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
         padding: 9px 12px; }
textarea.field { resize: vertical; min-height: 46px; display: block; }
.field::placeholder { color: var(--muted); }

/* header */
header.top { display: flex; align-items: center; gap: 12px; padding: 18px 0 6px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: -.01em; }
.brand img { width: 26px; height: 26px; }
.switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--sunk); }
.switch button { border: 1px solid transparent; background: none; border-radius: 8px; padding: 5px 12px;
                 cursor: pointer; font-size: 14px; color: var(--ink2); }
.switch button[aria-pressed="true"] { background: var(--surface); border-color: var(--border); color: var(--ink);
                                      font-weight: 600; box-shadow: var(--shadow); }

/* status */
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 10px;
        font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--sunk); color: var(--ink2); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.good { background: var(--tint-good); color: var(--good); }
.chip.warn { background: var(--tint-warn); color: var(--warn); }
.chip.crit { background: var(--tint-crit); color: var(--crit); }
.chip.info { background: var(--tint-info); color: var(--accent); }
.banner { border-radius: 12px; padding: 10px 14px; background: var(--tint-warn); color: var(--ink);
          border: 1px solid color-mix(in oklab, var(--warn) 35%, transparent); font-size: 14px; }
.banner li + li { margin-top: 4px; }

/* needs you */
.ask { border-left: 4px solid var(--warn); }
.ask h3 { font-size: 15px; }
.ask .qtext { margin: 6px 0 12px; max-height: 320px; overflow: auto; }

/* applications */
.apps { display: flex; flex-direction: column; }
.app { display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px; cursor: pointer; width: 100%;
       text-align: left; background: none; border: 0; border-top: 1px solid var(--line); }
.app:first-child { border-top: 0; }
.app:hover { background: var(--sunk); }
.app:first-child:hover { border-radius: 14px 14px 0 0; }
.app:last-child:hover { border-radius: 0 0 14px 14px; }
.app .t { font-weight: 600; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* profile */
.facts { display: grid; grid-template-columns: minmax(150px, 240px) 1fr auto; gap: 8px 12px; align-items: center; }
.facts label { font-size: 14px; color: var(--ink2); }
@media (max-width: 620px) { .facts { grid-template-columns: 1fr auto; } .facts label { grid-column: 1 / -1; margin-bottom: -4px; } }
.list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }

/* detail dialog */
dialog { border: 1px solid var(--border); border-radius: 16px; background: var(--page); color: var(--ink); padding: 0;
         width: min(900px, calc(100vw - 20px)); max-height: calc(100vh - 28px); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dhead { position: sticky; top: 0; background: var(--page); padding: 16px 18px 10px; border-bottom: 1px solid var(--line);
         z-index: 2; }
.dhead h2 { font-size: 18px; letter-spacing: -.01em; }
.dbody { padding: 14px 18px 22px; }
.tabs { display: flex; gap: 4px; margin-top: 12px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--ink2);
               font-size: 14px; }
.tabs button[aria-selected="true"] { background: var(--sunk); color: var(--ink); font-weight: 600; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.timeline li { display: flex; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.timeline li:first-child { border-top: 0; }
.timeline time { color: var(--muted); font-size: 12.5px; white-space: nowrap; min-width: 86px; padding-top: 1px; }
.timeline .warn { color: var(--serious); }
.answer { padding: 10px 0; border-top: 1px solid var(--line); }
.answer:first-child { border-top: 0; }
.answer .q { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.shot { width: 100%; border: 1px solid var(--border); border-radius: 10px; display: block; background: var(--sunk); }
.screen { width: 100%; border: 1px solid var(--border); border-radius: 10px; display: block; cursor: crosshair;
          background: var(--sunk); touch-action: manipulation; }
.keys { display: flex; flex-wrap: wrap; gap: 6px; }

/* sign-in */
.login { max-width: 380px; margin: 14vh auto 0; }
.login h1 { font-size: 22px; margin-bottom: 4px; }

#toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
         background: var(--ink); color: var(--page); padding: 9px 16px; border-radius: 10px; font-size: 14px;
         opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; max-width: calc(100vw - 32px); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
