/* Family Tickets — visual language follows jyoungs.net (Lora + Inter, warm paper, deep teal). */
:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #1f2a2e;
  --muted: #66727a;
  --line: #e4ddd2;
  --accent: #1f5f5b;
  --accent-soft: #d8ebe8;
  --warm: #b5532a;
  --warm-soft: #f6e3d9;
  --amber: #a26a12;
  --amber-soft: #f6ebd3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  --serif: "Lora", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14191b; --surface: #1c2326; --ink: #e8e4dc; --muted: #9aa5ab;
    --line: #2d373b; --accent: #6fbdb5; --accent-soft: #1f3a38; --warm: #e08a5f; --warm-soft: #3a2a22;
    --amber: #e0b35f; --amber-soft: #3a3220;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans); }
a { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; }
h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: .2em 0 .6em; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 24px; padding-bottom: 48px; min-height: 70vh; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: .88rem; }
code { background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; font-size: .9em; word-break: break-all; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header / nav (same structure as jyoungs.net) ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font: 600 1.15rem var(--serif); color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; font: 600 .85rem var(--sans); }
.brand small { font: 500 .8rem var(--sans); color: var(--muted); margin-left: -2px; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 6px 12px; font: inherit; cursor: pointer; }
.nav-top { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.nav-item { position: relative; }
.nav-item > a { display: block; padding: 18px 12px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: .95rem; }
.nav-item.active > a { color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
.dropdown { display: none; position: absolute; right: 0; top: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; min-width: 200px; }
.dropdown ul { list-style: none; margin: 0; padding: 0; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 5px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; font: inherit; font-size: .92rem; background: none; border: 0; cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: var(--accent-soft); }
.nav-item.has-children:hover > .dropdown, .nav-item.has-children:focus-within > .dropdown { display: block; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--line); max-height: 80vh; overflow: auto; }
  .site-nav.open { display: block; }
  .nav-top { flex-direction: column; padding: 8px 16px 16px; }
  .nav-item > a { padding: 10px 0; }
  .nav-item.active > a { box-shadow: none; }
  .dropdown, .nav-item.has-children:hover > .dropdown { display: block; position: static; box-shadow: none; border: 0; padding: 0 0 8px 8px; }
}

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; padding: 20px 0; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.footer-inner a { color: var(--muted); }

/* ---------- buttons / chips / flashes ---------- */
.btn { display: inline-block; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--accent); color: var(--accent); background: none; text-decoration: none; font: 500 .92rem/1.5 var(--sans); white-space: nowrap; cursor: pointer; }
.btn:hover { background: var(--accent); color: #fff; }
.btn-solid { background: var(--accent); color: #fff; }
.btn-solid:hover { filter: brightness(1.1); }
.btn-warm { border-color: var(--warm); color: var(--warm); }
.btn-warm:hover { background: var(--warm); color: #fff; }
.btn-sm { padding: 3px 10px; font-size: .85rem; }
.btn-link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.chip { display: inline-block; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: .9rem; background: var(--surface); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill { display: inline-block; min-width: 1.8em; text-align: center; padding: 0 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font: 600 .8rem/1.6 var(--sans); }
.flashes { display: grid; gap: 8px; margin-bottom: 16px; }
.flash { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent-soft); }
.flash.error { border-color: var(--warm); background: transparent; color: var(--warm); }

/* ---------- cards / forms ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 16px; }
.card > h2 { margin: 0 0 10px; font-size: 1.12rem; }
.narrow { max-width: 560px; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field > label, .label { font-weight: 500; font-size: .9rem; }
.hint { color: var(--muted); font-size: .82rem; }
input[type=text], input[type=password], input[type=email], input[type=search], input[type=date], input[type=url], textarea, select {
  width: 100%; padding: 8px 10px; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; }
input[type=file] { font: inherit; font-size: .9rem; max-width: 100%; }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 6px; }
details.more > summary { cursor: pointer; color: var(--accent); margin: 4px 0 12px; font-weight: 500; }

/* ---------- login ---------- */
.login-wrap { max-width: 400px; margin: 6vh auto 0; }
.login-wrap h1 { text-align: center; }
.login-wrap .brand-mark { width: 52px; height: 52px; font-size: 1.1rem; margin: 0 auto 8px; display: grid; }

/* ---------- board ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; align-items: center; }
.filters input[type=search] { flex: 1 1 220px; width: auto; }
.filters select { width: auto; flex: 0 1 auto; padding: 6px 8px; font-size: .92rem; }
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 900px) { .board { grid-template-columns: 1fr; } }
.column { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.column > h2 { font-size: 1.1rem; margin: 2px 4px 12px; display: flex; align-items: center; gap: 8px; }
.column > h2::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.column.s-being-worked > h2::before { background: var(--amber); }
.column.s-done > h2::before { background: var(--muted); }
.column .empty { color: var(--muted); font-size: .92rem; margin: 4px; }
.column .more-link { display: block; text-align: center; font-size: .9rem; margin-top: 6px; }

.ticket-card { display: block; background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 8px; padding: 9px 12px; margin-bottom: 8px; text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.ticket-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.ticket-card.p-high { border-left-color: var(--amber); }
.ticket-card.p-urgent { border-left-color: var(--warm); }
.ticket-card.p-low { border-left-color: var(--accent-soft); }
.ticket-card h3 { font: 500 .98rem/1.35 var(--sans); margin: 2px 0 6px; overflow-wrap: anywhere; }
.s-done .ticket-card h3 { color: var(--muted); }
.tc-top, .tc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.tc-meta .spacer { flex: 1; }
.tkey { font-weight: 600; color: var(--accent); letter-spacing: .02em; }
.tag { display: inline-block; padding: 0 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .76rem; font-weight: 500; white-space: nowrap; }
.tag.type { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.badge { display: inline-block; padding: 0 7px; border-radius: 4px; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.badge.p-high { background: var(--amber-soft); color: var(--amber); }
.badge.p-urgent { background: var(--warm-soft); color: var(--warm); }
.badge.slack { background: transparent; border: 1px solid var(--line); color: var(--muted); text-transform: none; font-weight: 500; }
.due.overdue { color: var(--warm); font-weight: 600; }
.avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font: 600 .68rem var(--sans); flex: none; }
.avatar.lg { width: 32px; height: 32px; font-size: .8rem; }
.avatar.ext { background: var(--muted); }

/* ---------- ticket detail ---------- */
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .ticket-layout { grid-template-columns: 1fr; } }
.ticket-head .tkey { font-size: .95rem; }
.ticket-head h1 { margin: 2px 0 8px; overflow-wrap: anywhere; }
.status-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.status-badge.s-being-worked { background: var(--amber-soft); color: var(--amber); }
.status-badge.s-done { background: var(--line); color: var(--muted); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.quick form { margin: 0; }
.desc { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.byline { font-size: .85rem; color: var(--muted); margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 4px 10px; }

.comments { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.comment { display: grid; grid-template-columns: 32px 1fr; gap: 10px; }
.comment .bubble { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; min-width: 0; }
.comment .meta { font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; }
.comment .meta strong { color: var(--ink); font-weight: 600; }
.comment .body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.comment:target .bubble { border-color: var(--accent); }

.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.file { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: .85rem; text-decoration: none; color: var(--ink); background: var(--surface); max-width: 100%; }
.file:hover { border-color: var(--accent); }
.file.thumb { padding: 0; overflow: hidden; }
.file.thumb img { width: 120px; height: 90px; object-fit: cover; }

.fields .field { margin-bottom: 10px; }
.fields select, .fields input { padding: 6px 8px; font-size: .92rem; }
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: .9rem; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.history { list-style: none; margin: 0; padding: 0; font-size: .85rem; display: grid; gap: 6px; }
.history li { border-left: 2px solid var(--line); padding-left: 10px; }
.history .when { color: var(--muted); display: block; font-size: .78rem; }

/* ---------- admin ---------- */
.subnav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.list { border-collapse: collapse; width: 100%; font-size: .92rem; }
table.list th, table.list td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list thead th { font-weight: 600; color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
table.list tbody tr:last-child td { border-bottom: 0; }
table.list form { display: inline; }
.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form input[type=text] { width: auto; flex: 1 1 160px; padding: 4px 8px; }
.stat-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.ok { color: var(--accent); font-weight: 600; }
.bad { color: var(--warm); font-weight: 600; }
.err-text { color: var(--warm); font-size: .82rem; overflow-wrap: anywhere; }
pre.setup { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: .85rem; overflow: auto; white-space: pre-wrap; }
.mt { margin-top: 18px; }
