/* Moab shell: a chat. Palette discipline: neutral surfaces, Canopy's brand green (--accent) used sparingly
   (the wordmark, focus, the send button, note rules). The greens are Canopy's brand scale (stemcell-canopy static/css/app.css):
   --brand-700 #4c7520, --brand-800 #3b5b18 (its Sign in button and hover), --brand-400 #8dc63f (the dark-theme accent). Theme = light by default values, dark by system preference
   or by an explicit data-theme choice (theme.js). */
:root {
  color-scheme: light;
  --bg:#f7f8f6; --panel:#ffffff; --line:#e2e6e0; --text:#18201b; --muted:#68736b;
  --ok:#1f8a4c; --warn:#a56a00; --bad:#c9302c; --accent:#4c7520; --on-accent:#ffffff; --bubble:#eceee9;
  --composer:var(--panel); --send-bg:var(--accent); --send-fg:var(--on-accent);
  /* --accent is the green as ink and stroke (links, the wordmark, focus, chart lines); --accent-fill is the green as a surface under --on-accent text */
  --accent-fill:#4c7520; --accent-fill-hover:#3b5b18;
  --login-card:#ffffff; --focus-ring:#416d20; /* Canopy login: .login-panel background (--ui-panel) and the field focus outline (--ui-accent) */
  --field-line:#7a857d; /* input borders: >= 3:1 on the card (WCAG 1.4.11); --line is a hairline divider, too faint to outline a field */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:#000000; --panel:#151b17; --line:#242d27; --text:#e5ebe6; --muted:#8a968d;
    --ok:#3fb96a; --warn:#d29922; --bad:#f06a63; --accent:#8dc63f; --on-accent:#ffffff; --bubble:#1b231e;
    --composer:#0e0e0e; --send-bg:#292929; --send-fg:#a1a1a1; --field-line:#6a766e;
    --accent-fill:#4c7520; --accent-fill-hover:#3b5b18; --login-card:#202022; --focus-ring:#acd774;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:#000000; --panel:#151b17; --line:#242d27; --text:#e5ebe6; --muted:#8a968d;
  --ok:#3fb96a; --warn:#d29922; --bad:#f06a63; --accent:#8dc63f; --on-accent:#ffffff; --bubble:#1b231e;
  --composer:#0e0e0e; --send-bg:#292929; --send-fg:#a1a1a1; --field-line:#6a766e;
  --accent-fill:#4c7520; --accent-fill-hover:#3b5b18; --login-card:#202022; --focus-ring:#acd774;
}
* { box-sizing: border-box; }
body { margin:0; background:var(--bg); color:var(--text); font:15px/1.5 system-ui, sans-serif; min-height:100dvh; display:flex; flex-direction:column; }
svg { width:1.05rem; height:1.05rem; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; flex:none; }
a { color:var(--accent); }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }

button { background:transparent; color:var(--text); border:1px solid var(--line); border-radius:8px; padding:.35rem .75rem; cursor:pointer; font:inherit; }
button:hover { border-color:var(--accent); }
button.on { background:var(--accent-fill); color:var(--on-accent); border-color:var(--accent-fill); }
button.primary { background:var(--accent-fill); color:var(--on-accent); border-color:var(--accent-fill); }
button.primary:hover { background:var(--accent-fill-hover); border-color:var(--accent-fill-hover); }

/* header: jungleSTEM logo, product name and tagline left; the PDF download and the profile button right */
.topbar { display:flex; align-items:center; gap:1rem; padding:.7rem 1.25rem; max-width:56rem; width:100%; margin:0 auto; }
.brand { display:flex; align-items:center; gap:.55rem; min-width:0; text-decoration:none; color:var(--text); }
.brand-logo { height:2.25rem; width:auto; flex:none; margin-block:-.375rem; transform:translateY(-17.7%); }
/* Logo size and centring (issue #45). The png is a 1024x333 box whose lettering is only a band of it: the STEM capitals are
   115px tall (34.5% of the box) and sit 17.7% of the box height below its centre. So the box is sized for the lettering, not
   the box: 2.25rem puts the STEM capitals at ~12.4px against "Moab"'s ~10.5px cap height (the logo reads at least as big as the name),
   and translateY(-17.7%) lifts the lettering onto the same centre line the flex row centres the name and tagline on. The negative
   block margin trims the transparent padding out of layout, so the header is no taller than it was. */
.brand-name { font-weight:600; letter-spacing:.04em; }
.brand-tagline { color:var(--muted); font-size:.75rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
/* the logo follows the effective theme: the original (white lettering) on dark, the light variant (black lettering) on light.
   theme.js sets data-theme to the effective theme; the media rule keeps system-following without script. */
.logo-dark { display:none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-dark { display:inline; } :root:not([data-theme="light"]) .logo-light { display:none; } }
:root[data-theme="dark"] .logo-dark { display:inline; }
:root[data-theme="dark"] .logo-light { display:none; }
.topbar-end { margin-left:auto; display:flex; align-items:center; gap:.6rem; }
.report { border:0; padding:.3rem; border-radius:6px; color:var(--muted); display:flex; }
.report:not(:disabled):hover { color:var(--text); }

.signin { color:var(--muted); font-size:.85rem; padding:.2rem .5rem; border-radius:6px; text-decoration:none; }
.signin:hover { color:var(--text); background:var(--bubble); }

/* profile menu: a round initial button; the dropdown holds identity, theme, sound and sign out */
.profile { position:relative; }
.avatar { display:inline-flex; align-items:center; justify-content:center; flex:none; width:2rem; height:2rem; padding:0; border-radius:50%; border:1px solid var(--accent-fill); background:var(--accent-fill); color:var(--on-accent); font-weight:600; font-size:.9rem; line-height:1; text-transform:uppercase; }
button.avatar:hover { background:var(--accent-fill-hover); border-color:var(--accent-fill-hover); }
.profile-pop { position:absolute; right:0; top:calc(100% + .4rem); z-index:5; width:15.5rem; max-width:calc(100vw - 1.8rem); background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:.35rem; box-shadow:0 6px 24px rgba(0,0,0,.18); }
.profile-pop[hidden] { display:none; }
.profile-pop form { margin:0; }
.profile-id { display:flex; align-items:center; gap:.65rem; padding:.5rem .55rem; }
.profile-id .avatar { width:2.2rem; height:2.2rem; }
.profile-who { display:flex; flex-direction:column; min-width:0; }
.profile-name { font-weight:600; overflow:hidden; text-overflow:ellipsis; }
.profile-email { color:var(--muted); font-size:.8rem; overflow:hidden; text-overflow:ellipsis; }
.profile-sep { height:1px; background:var(--line); margin:.3rem .25rem; }
.profile-heading { padding:.3rem .55rem .15rem; color:var(--muted); font-size:.75rem; text-transform:uppercase; letter-spacing:.05em; }
.mi { display:flex; align-items:center; gap:.55rem; width:100%; padding:.4rem .55rem; border:0; border-radius:6px; background:transparent; color:var(--text); text-align:left; font-size:.9rem; }
.mi:hover, .mi:focus-visible { background:var(--bubble); }
.mi:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
.mi .check { width:.95rem; height:.95rem; visibility:hidden; }
.mi[aria-checked="true"] .check { visibility:visible; }
.mi[aria-current="true"] { color:var(--accent); font-weight:600; }
.mi-row { justify-content:space-between; }
.switch { position:relative; flex:none; width:2rem; height:1.1rem; border-radius:999px; background:var(--field-line); }
.switch::after { content:""; position:absolute; top:.15rem; left:.15rem; width:.8rem; height:.8rem; border-radius:50%; background:#fff; transition:transform .12s; }
.mi[aria-checked="true"] .switch { background:var(--accent-fill); }
.mi[aria-checked="true"] .switch::after { transform:translateX(.9rem); }

/* pinned answers: a slim rail, only present when there are pins */
.rail { display:flex; gap:.4rem; overflow-x:auto; padding:.1rem 1.25rem .5rem; max-width:56rem; width:100%; margin:0 auto; scrollbar-width:none; }
.rail::-webkit-scrollbar { display:none; }
.pin { display:inline-flex; align-items:center; gap:.35rem; flex:none; border-radius:999px; padding:.15rem .7rem; font-size:.85rem; color:var(--muted); }
.pin svg { width:.85rem; height:.85rem; }
.pin:hover { color:var(--text); }

/* the conversation */
.thread { flex:1; width:100%; max-width:56rem; margin:0 auto; padding:1rem 1.25rem 1.5rem; display:flex; flex-direction:column; gap:1.1rem; }
.welcome { margin:auto; text-align:center; color:var(--muted); }
.welcome p { margin:.3rem 0; }
.chip { display:inline-block; margin:.15rem .2rem; padding:.1rem .7rem; border:1px solid var(--line); border-radius:999px; color:var(--accent); text-decoration:none; }
.msg { max-width:100%; }
.msg.q { align-self:flex-end; background:var(--bubble); border-radius:16px 16px 4px 16px; padding:.5rem .9rem; max-width:80%; overflow-wrap:anywhere; display:flex; align-items:center; gap:.4rem; }
.msg.q svg { width:.85rem; height:.85rem; color:var(--muted); }
.msg.a { align-self:stretch; min-width:0; }
.msg.pending, .msg.err { color:var(--muted); }
.msg.err { color:var(--bad); }
.meta { margin:.45rem 0 0; color:var(--muted); font-size:.8rem; }

/* the question box, anchored at the bottom */
.dock { position:sticky; bottom:0; background:linear-gradient(to top, var(--bg) 70%, transparent); padding:0 1.25rem calc(.9rem + env(safe-area-inset-bottom)); }
.status { max-width:56rem; margin:0 auto; min-height:1.2rem; padding:0 .4rem; font-size:.82rem; color:var(--muted); }
.status.ok { color:var(--ok); } .status.warn { color:var(--warn); } .status.bad { color:var(--bad); }
.ask { max-width:56rem; margin:0 auto; display:flex; align-items:center; gap:.4rem; background:var(--composer); border:1px solid var(--line); border-radius:999px; padding:.3rem; box-shadow:0 2px 12px rgba(0,0,0,.06); }
.ask:focus-within { border-color:var(--accent); }
.clear { width:2.2rem; height:2.2rem; padding:0; border:0; border-radius:50%; display:flex; align-items:center; justify-content:center; background:transparent; color:var(--muted); flex:none; }
.clear:hover { color:var(--text); background:var(--bubble); }
.ask input { flex:1; min-width:0; border:0; outline:0; background:transparent; color:var(--text); font:inherit; padding:.4rem 0; }
.send { width:2.2rem; height:2.2rem; padding:0; border-radius:50%; display:flex; align-items:center; justify-content:center; background:var(--send-bg); color:var(--send-fg); border-color:var(--send-bg); }
.send:hover { opacity:.88; }

/* sign in: the shared STEMcell login treatment (Canopy's): a full-bleed product backdrop, one centred panel card with a
   branding strip, labelled-by-placeholder fields and a full-width green button. Only the backdrop is Moab's: Balanced Rock under
   the Milky Way, the La Sal Mountains on the horizon. The photo is never filtered or brightened and stays the night photo in
   both themes; the opaque, theme-aware card carries all the text, and the page has no header and no theme or sound switch: it renders in the effective theme and offers no way to change it. */
.login-page { background:#02040a url("img/moab-login-backdrop.jpg") 46% 100% / cover no-repeat; }
.login-wrap { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1.5rem; padding:1.25rem; }
.login-card { width:100%; max-width:24rem; padding:1.75rem 2rem 2rem; background:var(--login-card); color:var(--text); border:1px solid var(--line); border-radius:8px; box-shadow:0 10px 40px rgba(0,0,0,.55); }
.login-branding { display:flex; align-items:center; justify-content:center; gap:.5rem; margin-bottom:1.25rem; padding:.5rem; background:#0e1511; border:1px solid #2c372f; border-radius:5px; color:#e5ebe6; font-size:1.15rem; }
.login-home { display:flex; align-items:center; gap:.55rem; color:inherit; text-decoration:none; }
.login-home:focus-visible { outline-color:#8dc63f; }
.login-logo { height:2.75rem; width:auto; flex:none; margin-block:-.5rem; transform:translateY(-17.7%); } /* the original (white lettering): the strip band is #0e1511 in both themes */
.login { display:flex; flex-direction:column; gap:.75rem; }
.login input { padding:.6rem .8rem; background:var(--login-card); border:1px solid var(--field-line); border-radius:8px; color:var(--text); font:inherit; }
.login input::placeholder { color:var(--muted); opacity:1; }
.login input:focus-visible { outline:2px solid var(--focus-ring); outline-offset:3px; } /* Canopy's focus highlight; the border keeps its 3:1 colour */
.login button, .login .button { padding:.6rem; border-radius:8px; }
.login .button { display:block; text-align:center; text-decoration:none; background:var(--accent-fill); color:var(--on-accent); border:1px solid var(--accent-fill); }
.login .button:hover { background:var(--accent-fill-hover); border-color:var(--accent-fill-hover); }
.login-note { margin:0; color:var(--muted); font-size:.9rem; }
.login-aside { margin:1rem 0 0; text-align:right; font-size:.75rem; } /* "Forgot password?", bottom-right under the form, as in Canopy */
.login-aside a { color:var(--muted); } .login-aside a:hover { text-decoration:underline; }

/* canvas components: quiet cards in the flow */
.moab-stack { display:flex; flex-direction:column; gap:.6rem; }
.moab-title h2 { margin:.2rem 0 0; font-size:1.2rem; font-weight:600; } .moab-title p { margin:.15rem 0 0; color:var(--muted); }
.moab-card { background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:.75rem 1rem; }
.moab-row { display:flex; align-items:center; gap:.6rem; flex-wrap:wrap; } .moab-spacer { flex:1; }
.moab-badge { display:inline-block; padding:.02rem .5rem; border-radius:999px; font-size:.75rem; border:1px solid var(--line); margin-left:.3rem; }
.moab-ok { color:var(--ok); border-color:var(--ok); } .moab-warn { color:var(--warn); border-color:var(--warn); }
.moab-bad { color:var(--bad); border-color:var(--bad); } .moab-muted { color:var(--muted); }
.moab-prov { display:block; margin-top:.25rem; font-size:.78rem; color:var(--muted); }
.moab-attempt { display:block; margin-top:.1rem; }
.moab-btn { font-size:.78rem; padding:.15rem .6rem; color:var(--muted); border-radius:999px; }
.moab-btn:hover { color:var(--text); }
.moab-levels, .moab-steps { list-style:none; margin:.5rem 0 0; padding:0; display:flex; flex-direction:column; gap:.35rem; }
.moab-levels li, .moab-step { display:flex; align-items:center; gap:.6rem; flex-wrap:wrap; border-top:1px solid var(--line); padding-top:.35rem; }
.moab-levels .moab-prov, .moab-step .moab-prov { display:inline; margin:0 0 0 auto; }
.moab-level-name { min-width:6.5rem; text-transform:capitalize; }
.moab-big { font-size:1.8rem; font-weight:600; }
.moab-needs { border-color:var(--bad); }
.moab-note { border-left:3px solid var(--accent); background:var(--panel); padding:.7rem 1rem; border-radius:0 12px 12px 0; }
.moab-tone-warning { border-color:var(--warn); } .moab-tone-refusal { border-color:var(--bad); }
.moab-bar-row { display:flex; align-items:center; gap:.6rem; margin-top:.4rem; }
.moab-bar { flex:1; height:.5rem; background:var(--line); border-radius:4px; overflow:hidden; } .moab-bar span { display:block; height:100%; background:var(--accent); }
.moab-errors { color:var(--bad); font-size:.8rem; }

@media (max-width:600px) {
  .topbar, .rail, .thread { padding-left:.9rem; padding-right:.9rem; }
  .dock { padding-left:.9rem; padding-right:.9rem; }
  .msg.q { max-width:92%; }
  .brand-tagline { display:none; } /* no room beside the logo, the name and the buttons */
}

/* SeriesChart: a thin 2px line, recessive grid, 8px markers; text in the text inks, never the series colour. */
.moab-chart-svg { width:100%; height:auto; display:block; margin-top:.4rem; stroke:none; stroke-width:0; fill:none; } /* resets the icon-svg rule above */
.moab-chart-grid { stroke:var(--line); stroke-width:1; }
.moab-chart-text { fill:var(--muted); font-size:11px; }
.moab-chart-line { fill:none; stroke:var(--accent); stroke-width:2; stroke-linejoin:round; stroke-linecap:round; }
.moab-chart-dot { fill:var(--accent); stroke:var(--panel); stroke-width:2; }
.moab-chart-miss { stroke:var(--bad); stroke-width:2; stroke-linecap:round; }
.moab-chart-hit { fill:transparent; }
.moab-chart-hit:hover { fill:var(--bubble); opacity:.5; }
.moab-chart-system { font-family:ui-monospace,monospace; font-size:.8rem; color:var(--muted); border:1px solid var(--line); border-radius:6px; padding:0 .4rem; }
.moab-outage-list { list-style:none; margin:.5rem 0 0; padding:0; display:flex; flex-direction:column; gap:.55rem; }
.moab-outage { border-top:1px solid var(--line); padding-top:.5rem; } .moab-outage-open { border-left:3px solid var(--bad); padding-left:.6rem; }
.moab-chart-table { margin-top:.3rem; font-size:.8rem; color:var(--muted); }
.moab-chart-table summary { cursor:pointer; }
.moab-chart-table table { border-collapse:collapse; margin-top:.3rem; }
.moab-chart-table th, .moab-chart-table td { text-align:left; padding:.1rem .8rem .1rem 0; font-weight:400; }

.report:disabled { opacity:.4; }
.report-copy { position:fixed; left:-10000px; width:700px; }
