/* ZOE Tickets — "Linen" look: warm paper, Newsreader headings, Instrument Sans body, top navigation.
   Light and dark follow the system; a toggle in the header overrides (data-theme on <html>). */
:root {
  --bg: #f7f3ec; --surface: #fffdf9; --sunken: #f0eae0; --line: #e3dccf; --line-strong: #c9bfae; --ink: #2b2621; --muted: #746c62;
  --nav-bg: #fffdf9; --nav-ink: #2b2621; --nav-dim: #8a8176; --nav-active-bg: #2b2621; --nav-active-ink: #fffdf9;
  --accent: #1e5a4b; --accent-ink: #fff; --focus: #c0642c;
  --ok: #1e5a4b; --ok-bg: #dfece6; --warn: #9a5a12; --warn-bg: #f6e8d2; --bad: #a3301f; --bad-bg: #f7e1dc; --info: #355f7a; --info-bg: #e1ebf1;
  --note-bg: #fbf3dc; --note-line: #d9b45a; --overlay: rgba(43,38,33,.3); --shadow: 0 14px 40px rgba(43,38,33,.16);
  --p1: #a3301f; --p2: #c0642c; --p3: #9a5a12; --p4: #8f877c;
  --display: 'Newsreader', Georgia, serif; --body: 'Instrument Sans', 'Segoe UI', system-ui, sans-serif; --mono: ui-monospace, Menlo, Consolas, monospace;
  --r-s: 6px; --r-m: 12px; color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #1b1815; --surface: #24201b; --sunken: #151310; --line: #352f27; --line-strong: #4d453a; --ink: #efe8dc; --muted: #a79e8f;
  --nav-bg: #24201b; --nav-ink: #efe8dc; --nav-dim: #8f8678; --nav-active-bg: #efe8dc; --nav-active-ink: #1b1815;
  --accent: #6fb59c; --accent-ink: #10201a; --focus: #e08a4e;
  --ok: #6fb59c; --ok-bg: #1d2f28; --warn: #e0a85a; --warn-bg: #352816; --bad: #e8786a; --bad-bg: #3a201c; --info: #7fb0cc; --info-bg: #1b2b35;
  --note-bg: #302916; --note-line: #8a6a2a; --overlay: rgba(0,0,0,.55); --shadow: 0 20px 60px rgba(0,0,0,.55);
  --p1: #e8786a; --p2: #e89a5a; --p3: #e0a85a; --p4: #7f786d; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #1b1815; --surface: #24201b; --sunken: #151310; --line: #352f27; --line-strong: #4d453a; --ink: #efe8dc; --muted: #a79e8f;
  --nav-bg: #24201b; --nav-ink: #efe8dc; --nav-dim: #8f8678; --nav-active-bg: #efe8dc; --nav-active-ink: #1b1815;
  --accent: #6fb59c; --accent-ink: #10201a; --focus: #e08a4e;
  --ok: #6fb59c; --ok-bg: #1d2f28; --warn: #e0a85a; --warn-bg: #352816; --bad: #e8786a; --bad-bg: #3a201c; --info: #7fb0cc; --info-bg: #1b2b35;
  --note-bg: #302916; --note-line: #8a6a2a; --overlay: rgba(0,0,0,.55); --shadow: 0 20px 60px rgba(0,0,0,.55);
  --p1: #e8786a; --p2: #e89a5a; --p3: #e0a85a; --p4: #7f786d; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--body); font-size: 14.5px; line-height: 1.45; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2 { font-family: var(--display); font-weight: 500; line-height: 1.15; margin: 0; letter-spacing: 0; text-wrap: balance; }
h1 { font-size: 36px; } h2 { font-size: 22px; }
h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: 0; }
p { margin: 0; } a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell: top navigation ---------- */
.top { background: var(--nav-bg); color: var(--nav-ink); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 6px; padding: 10px 28px; flex-wrap: wrap; }
.brand { font-family: var(--display); font-size: 22px; font-weight: 600; margin-right: 14px; white-space: nowrap; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; }
.nav a { color: var(--nav-ink); text-decoration: none; padding: 6px 11px; border-radius: 999px; display: inline-flex; gap: 6px; align-items: center; font-size: 14px; }
.nav a:hover { background: rgba(127,127,127,.12); }
.nav a[aria-current="page"] { background: var(--nav-active-bg); color: var(--nav-active-ink); font-weight: 600; }
.nav .count { font-size: 11.5px; opacity: .75; font-variant-numeric: tabular-nums; }
.top-right { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.top-right a { color: var(--muted); }
.main { max-width: 1240px; margin: 0 auto; padding: 28px 28px 56px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.sample-banner { background: var(--note-bg); border: 1px solid var(--note-line); padding: 8px 12px; border-radius: var(--r-s); margin-bottom: 14px; font-size: 13.5px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }

/* ---------- controls ---------- */
.btn { border: 1px solid var(--line-strong); background: var(--surface); padding: 6px 12px; border-radius: var(--r-s); cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap; color: var(--ink); }
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); } .btn.primary:hover { filter: brightness(1.1); }
.btn.small { padding: 3px 9px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: transparent; } .btn.ghost:hover { background: var(--sunken); border-color: transparent; }
.btn.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 400; text-decoration: underline; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-s); overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 4px 10px; cursor: pointer; font-size: 12.5px; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); font-weight: 600; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
label.field .hint { font-weight: 400; }
input[type=text], input[type=email], input[type=search], input[type=password], input[type=url], input[type=number], input[type=date], select, textarea { border: 1px solid var(--line-strong); border-radius: var(--r-s); padding: 7px 9px; background: var(--surface); font-size: 14px; font-weight: 400; width: 100%; color: var(--ink); }
textarea { min-height: 72px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 400; color: var(--ink); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type=search] { width: 240px; padding: 5px 9px; }
.toolbar select { width: auto; padding: 5px 8px; font-size: 13px; }
.form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
code, pre { font-family: var(--mono); font-size: 12px; }
pre { background: var(--sunken); border-radius: var(--r-s); padding: 10px; overflow-x: auto; margin: 0; }
.kbd { font-family: var(--mono); font-size: 11.5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; background: var(--surface); }
.sc { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; }
.err { color: var(--bad); font-size: 13.5px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 0 6px; border-radius: 999px; white-space: nowrap; line-height: 1.7; background: var(--sunken); color: var(--muted); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.t-bug { color: var(--bad); } .t-feature { color: var(--info); } .t-support { color: var(--ok); }
.pri { font-family: var(--mono); font-weight: 600; font-size: 11px; padding: 0 5px; border-radius: 3px; color: #fff; line-height: 1.6; }
.pri.P1 { background: var(--p1); } .pri.P2 { background: var(--p2); } .pri.P3 { background: var(--p3); } .pri.P4 { background: var(--p4); }
.tag { font-size: 11.5px; padding: 0 6px; border-radius: var(--r-s); background: var(--sunken); color: var(--muted); white-space: nowrap; }
.key { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .01em; }
.pill { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--sunken); white-space: nowrap; color: var(--ink); }
.pill.done { background: var(--ok-bg); color: var(--ok); } .pill.wait { background: var(--warn-bg); color: var(--warn); } .pill.new { background: var(--info-bg); color: var(--info); }
.avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 600; display: inline-grid; place-items: center; flex: none; }
.avatar.none { background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); }
.sla { color: var(--bad); font-size: 12px; font-weight: 600; }
.gh { font-size: 11.5px; font-weight: 600; padding: 0 6px; border-radius: 999px; white-space: nowrap; background: var(--sunken); color: var(--muted); }
.gh.open { background: var(--ok-bg); color: var(--ok); } .gh.merged { background: var(--info-bg); color: var(--info); }

/* ---------- lists ---------- */
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 680px; }
.tbl th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; text-transform: uppercase; letter-spacing: .05em; }
.tbl th[data-sort] { cursor: pointer; } .tbl th.sorted { color: var(--ink); }
.tbl td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tr.row { cursor: pointer; } .tbl tr.row:hover { background: var(--sunken); } .tbl tr.sel { background: var(--note-bg); } .tbl tr.cur td:first-child { box-shadow: inset 3px 0 var(--focus); }
.tbl .title { font-weight: 600; } .tbl .title .sub { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.tbl .who { display: inline-flex; gap: 6px; align-items: center; }
.bulkbar { position: sticky; bottom: 12px; margin-top: 12px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: var(--r-m); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13.5px; }
.bulkbar select { width: auto; background: var(--surface); color: var(--ink); padding: 3px 6px; font-size: 13px; }
.bulkbar .btn.link { color: var(--bg); }

/* ---------- kanban ---------- */
.kboard { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kcol { flex: 0 0 252px; display: flex; flex-direction: column; max-height: calc(100vh - 190px); background: var(--sunken); border-radius: var(--r-m); padding: 6px; }
.kcol.over .klist { outline: 2px dashed var(--focus); outline-offset: -2px; border-radius: var(--r-m); }
.kcol-head { padding: 4px 6px 8px; display: flex; align-items: baseline; gap: 8px; }
.kcol-head b { font-size: 13px; font-weight: 600; } .kcol-head .cnt { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; } .kcol-head .cnt.full { color: var(--bad); font-weight: 600; }
.kcol.done .kcol-head b { color: var(--muted); }
.klist { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 48px; flex: 1; padding: 2px; }
.kcard { background: var(--surface); border: 1px solid transparent; border-radius: var(--r-m); padding: 9px 10px; cursor: grab; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 1px 0 rgba(0,0,0,.03); }
.kcard:hover { border-color: var(--line-strong); } .kcard.drag { opacity: .4; }
.kcard .top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.kcard .ttl { font-weight: 600; line-height: 1.3; font-size: 13.5px; }
.kcard .meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.kcard .meta .r { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.kcard .meta .ghm { font-family: var(--mono); font-size: 11px; }
.kempty { color: var(--muted); font-size: 12px; text-align: center; padding: 12px 6px; border: 1px dashed var(--line); border-radius: var(--r-s); }

/* ---------- drawer ---------- */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%); background: var(--surface); z-index: 21; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.drawer-head { padding: 14px 20px 0; display: flex; flex-direction: column; gap: 10px; }
.drawer-head .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
input.h2 { font-family: var(--display); font-weight: 500; font-size: 22px; border: 1px solid transparent; padding: 2px 6px; margin-left: -6px; background: transparent; width: 100%; color: var(--ink); border-radius: var(--r-s); }
input.h2:hover, input.h2:focus { border-color: var(--line-strong); background: var(--surface); }
.ctl { display: inline-flex; align-items: center; font-size: 12.5px; color: var(--muted); border: 1px solid var(--line); border-radius: var(--r-s); padding-left: 8px; background: var(--surface); }
.ctl select { width: auto; border: 0; padding: 4px 6px 4px 4px; font-size: 13px; background: transparent; font-weight: 600; color: var(--ink); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 20px; margin-top: 4px; }
.tabs button { border: 0; background: none; padding: 9px 10px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 13px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.drawer-body { overflow-y: auto; padding: 16px 20px; flex: 1; display: flex; flex-direction: column; gap: 16px; }
.props { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; font-size: 13.5px; }
.props .p { display: flex; flex-direction: column; gap: 2px; min-width: 0; } .props .p .l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.props select, .props input { padding: 4px 6px; font-size: 13.5px; }
.body-text { white-space: pre-wrap; font-size: 14px; line-height: 1.5; }
textarea.body-edit { font-size: 14px; min-height: 90px; }
.req { display: flex; gap: 10px; align-items: center; font-size: 13.5px; padding: 10px 12px; background: var(--sunken); border-radius: var(--r-m); }
.req .avatar { width: 30px; height: 30px; font-size: 12px; }
details.ctx { font-size: 13px; } details.ctx summary { cursor: pointer; color: var(--muted); } details.ctx .chips { margin-top: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; } .chips input { width: 110px; padding: 2px 6px; font-size: 12.5px; }
.convo { display: flex; flex-direction: column; gap: 10px; }
.msg { border: 1px solid var(--line); border-radius: var(--r-m); padding: 10px 12px; font-size: 14px; background: var(--surface); }
.msg.internal { background: var(--note-bg); border-color: var(--note-line); }
.msg.event { border: 0; background: none; color: var(--muted); font-size: 12.5px; padding: 0 12px; }
.msg .who { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 4px; } .msg .who b { color: var(--ink); }
.reply { border: 1px solid var(--line-strong); border-radius: var(--r-m); padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.reply.internal { background: var(--note-bg); border-color: var(--note-line); }
.reply .bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.links ul, .code ul { list-style: none; margin: 0; padding: 0; }
.links li, .code li { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; } .links li:first-child, .code li:first-child { border-top: 0; }
.links .kind { font-size: 12px; color: var(--muted); min-width: 90px; }
.code { display: flex; flex-direction: column; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 14px; border-radius: var(--r-m); font-size: 13.5px; z-index: 40; box-shadow: var(--shadow); max-width: 90vw; }
.toast.err { background: var(--bad); color: #fff; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login .form { width: min(380px, 100%); }
.login h1 { font-size: 30px; }

/* ---------- admin ---------- */
.keybox { background: var(--note-bg); border: 1px solid var(--note-line); border-radius: var(--r-s); padding: 10px 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.keybox code { font-size: 13px; word-break: break-all; }

@media (max-width: 820px) {
  .top { padding: 10px 16px; } .main { padding: 18px 16px 48px; }
  .props, .form .two { grid-template-columns: 1fr; }
  .toolbar input[type=search] { width: 100%; }
}
@media (prefers-reduced-motion: no-preference) { .drawer { animation: slide .16s ease-out; } @keyframes slide { from { transform: translateX(20px); opacity: 0; } } }
