/* NosePoke. One small stylesheet for all three surfaces. Space sites use their themes' own styles; tenants' admin theme for the console comes from /console/t/<tenant>/theme.css. */
:root, :host {
  --accent: #3b5bdb;
  --accent-contrast: #ffffff;
  --bg: #f7f7f9;
  --surface: #ffffff;
  --text: #1d2030;
  --muted: #646a80;
  --line: #e1e3ea;
  --note-bg: #fff6d6;
  --note-line: #e9c95a;
  --danger: #c92a2a;
  --ok: #2b8a3e;
  --radius: 8px;
  color-scheme: light dark;
}
/* Dark palette: used when the browser asks for it (unless the tenant forced light) or when the tenant forced dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-scheme="light"]), :host(:not([data-scheme="light"])) {
    --bg: #14161d;
    --surface: #1c1f29;
    --text: #e8eaf2;
    --muted: #9aa0b5;
    --line: #2d3140;
    --note-bg: #3a3314;
    --note-line: #8a7424;
    --danger: #ff6b6b;
    --ok: #69db7c;
  }
  :root:not([data-scheme="light"]) .brand-logo.builtin, :host(:not([data-scheme="light"])) .brand-logo.builtin { filter: invert(1) hue-rotate(180deg); }
}
:root[data-scheme="light"], :host([data-scheme="light"]) { color-scheme: light; }
:root[data-scheme="dark"], :host([data-scheme="dark"]) {
  color-scheme: dark;
  --bg: #14161d;
  --surface: #1c1f29;
  --text: #e8eaf2;
  --muted: #9aa0b5;
  --line: #2d3140;
  --note-bg: #3a3314;
  --note-line: #8a7424;
  --danger: #ff6b6b;
  --ok: #69db7c;
}
:root[data-scheme="dark"] .brand-logo.builtin, :host([data-scheme="dark"]) .brand-logo.builtin { filter: invert(1) hue-rotate(180deg); }
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.5;
  display: flex; flex-direction: column; min-height: 100vh;
}
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
p { margin: .5rem 0; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--text); font-weight: 650; }
.brand-logo { height: 28px; width: auto; max-width: 64px; }
.topnav { display: flex; gap: 1rem; flex: 1; flex-wrap: wrap; }
.topnav a { color: var(--muted); text-decoration: none; padding: .2rem 0; border-bottom: 2px solid transparent; }
.topnav a.current, .topnav a:hover { color: var(--text); border-color: var(--accent); }
.account { margin-left: auto; display: flex; align-items: center; gap: .75rem; font-size: .9rem; flex-wrap: wrap; }
.account-detail { color: var(--muted); }
.inline { display: inline; margin: 0; }
.link-button { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }
.banner { background: var(--accent); color: var(--accent-contrast); text-align: center; padding: .4rem 1rem; font-size: .9rem; }
.content { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 1rem; }

.notice { padding: .7rem 1rem; border-radius: var(--radius); margin: 0 0 1rem; border: 1px solid var(--line); background: var(--surface); }
.notice-error { border-color: var(--danger); color: var(--danger); }
.notice-ok { border-color: var(--ok); }
.page-title { margin-bottom: 1rem; }
.subtitle { color: var(--muted); margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.card > :first-child { margin-top: 0; }
.cols { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.narrow { max-width: 460px; margin: 2rem auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }

.field { margin-bottom: .9rem; }
.field label { display: block; font-weight: 600; margin-bottom: .25rem; font-size: .92rem; }
.field.check label { font-weight: 400; }
.host-choice { border: 0; padding: 0; margin: 0 0 .9rem; min-width: 0; }
.host-choice legend { font-weight: 600; font-size: .92rem; padding: 0; margin-bottom: .4rem; }
.host-option { margin-bottom: .8rem; }
.host-option > label { font-weight: 600; }
.host-input { display: flex; align-items: center; gap: .4rem; margin-top: .35rem; }
.host-input .input { flex: 1; min-width: 0; }
.input { width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea.input { resize: vertical; }
.has-error .input { border-color: var(--danger); }
.hint { color: var(--muted); font-size: .85rem; margin: .2rem 0 0; }
.error { color: var(--danger); font-size: .88rem; margin: .25rem 0 0; }
.actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; }
.button { display: inline-block; padding: .5rem 1rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-decoration: none; }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.button.danger { color: var(--danger); border-color: var(--danger); }
.button.small { padding: .25rem .6rem; font-size: .85rem; }
.button:disabled { opacity: .5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: color-mix(in srgb, var(--surface) 70%, var(--bg)); }
tr:last-child td { border-bottom: 0; }

.badge, .pill { display: inline-block; padding: 0 .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; line-height: 1.5; border: 1px solid var(--line); }
.badge-neutral { background: color-mix(in srgb, var(--muted) 18%, transparent); }
.badge-blue { background: #d0ebff; color: #1864ab; }
.badge-green { background: #d3f9d8; color: #2b8a3e; }
.badge-amber { background: #fff3bf; color: #8a6d00; }
.badge-red { background: #ffe3e3; color: #c92a2a; }
.badge-purple { background: #e5dbff; color: #5f3dc4; }
.pill-new { background: #d0ebff; color: #1864ab; }
.pill-open { background: #d3f9d8; color: #2b8a3e; }
.pill-pending-internal, .pill-pending-staff { background: #fff3bf; color: #8a6d00; }
.pill-pending-customer { background: #e5dbff; color: #5f3dc4; }
.pill-closed, .pill-archived { background: color-mix(in srgb, var(--muted) 20%, transparent); color: var(--muted); }
.flag { display: inline-block; padding: 0 .45rem; border-radius: 4px; font-size: .75rem; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); margin-right: .25rem; }
.claim { font-size: .8rem; color: #8a6d00; background: #fff3bf; padding: 0 .45rem; border-radius: 4px; }

.thread-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.thread-list li { padding: .75rem 1rem; border-bottom: 1px solid var(--line); display: grid; gap: .2rem; }
.thread-list li:last-child { border-bottom: 0; }
.thread-title { font-weight: 600; text-decoration: none; }
.thread-meta { color: var(--muted); font-size: .85rem; display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.empty { color: var(--muted); padding: 1.5rem; text-align: center; }

.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; margin-bottom: .75rem; }
.post.internal { background: var(--note-bg); border-color: var(--note-line); }
.post.hidden { opacity: .6; border-style: dashed; }
.post.staff { border-left: 4px solid var(--accent); }
.post-head { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .4rem; font-size: .9rem; }
.post-author { font-weight: 650; }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.post-actions { margin-top: .5rem; display: flex; gap: .6rem; flex-wrap: wrap; font-size: .85rem; }

.staff-form { border: 2px solid var(--accent); border-radius: var(--radius); padding: .9rem 1.1rem; background: var(--surface); margin-top: 1rem; }
.staff-form[data-mode="note"] { background: var(--note-bg); border-color: var(--note-line); }
.mode-switch { display: flex; gap: .4rem; margin-bottom: .6rem; }
.mode-switch label { padding: .3rem .8rem; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: .9rem; }
.mode-switch input { position: absolute; opacity: 0; }
.mode-switch label:has(input:checked) { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.staff-form[data-mode="note"] .mode-switch label:has(input:checked) { background: #8a6d00; border-color: #8a6d00; color: #fff; }
.audience { font-size: .85rem; margin-bottom: .5rem; }
.claim-status { min-height: 1.4rem; font-size: .9rem; }
.claim-status.blocked { color: var(--danger); font-weight: 600; }
fieldset.locked { opacity: .55; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filters .field { margin: 0; min-width: 140px; }
.qr { max-width: 220px; background: #fff; padding: 8px; border-radius: var(--radius); }
.recovery { columns: 2; font-family: ui-monospace, Menlo, monospace; list-style: none; padding: 0; }
.hero { padding: 3rem 0 2rem; text-align: center; }
.hero h1 { font-size: 2.2rem; }
.hero img { height: 120px; }

.logo-preview { max-height: 64px; max-width: 240px; display: block; margin: .25rem 0 .75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem; }
.swatch { display: inline-block; width: 1.2rem; height: 1.2rem; border-radius: 4px; vertical-align: middle; border: 1px solid var(--line); }
