/* AURE Kanban — design tokens and components. Light and dark, no build step. */
:root {
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #f8f9fb;
  --border: #e4e7ec;
  --border-strong: #cfd4dc;
  --text: #111827;
  --text-2: #4b5563;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: #e8efff;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --col: #eceef2;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .22);
  --r: 8px;
  --r-lg: 12px;
  --p0: #dc2626; --p1: #ea580c; --p2: #2563eb; --p3: #6b7280;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --panel: #171a21; --panel-2: #1d212a; --border: #2a2f3a; --border-strong: #3a4150;
    --text: #e5e7eb; --text-2: #c3c8d1; --muted: #8b92a0; --accent: #60a5fa; --accent-soft: #1e2a44;
    --ok: #4ade80; --ok-soft: #14351f; --bad: #f87171; --bad-soft: #3b1414; --warn: #fbbf24; --warn-soft: #3b2a08;
    --col: #1b1f27; --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 20px 50px rgba(0,0,0,.6);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); background: var(--bg); color: var(--text); display: flex; flex-direction: column; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.grow, .spacer { flex: 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }

/* ---------- controls ---------- */
input, select, textarea, button { font: inherit; color: var(--text); }
input[type=text], input[type=search], input[type=date], select, textarea {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--r); background: var(--panel); outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
label.field > input, label.field > select, label.field > textarea { font-size: 14px; color: var(--text); }
.btn, button { cursor: pointer; border: 1px solid var(--border); background: var(--panel); border-radius: var(--r); padding: 7px 12px; font-weight: 500; line-height: 1.2; transition: background .12s, border-color .12s, transform .05s; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover, button:hover { border-color: var(--border-strong); background: var(--panel-2); }
.btn:active, button:active { transform: translateY(1px); }
.btn:disabled, button:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--col); border-color: transparent; }
.btn-danger { color: var(--bad); border-color: #fecaca; }
.btn-danger:hover { background: var(--bad-soft); }
.btn-ok { color: var(--ok); border-color: #bbf7d0; }
.btn-ok:hover { background: var(--ok-soft); }
.btn-sm { padding: 3px 8px; font-size: 12px; }
.icon-btn { padding: 4px 8px; font-size: 16px; line-height: 1; border-color: transparent; background: transparent; color: var(--muted); }
.icon-btn:hover { background: var(--col); color: var(--text); border-color: transparent; }
.chk { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-size: 13px; color: var(--text-2); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--col); color: var(--text-2); white-space: nowrap; font-weight: 500; }
.chip.draft { background: var(--col); }
.chip.frozen { background: var(--accent-soft); color: var(--accent); }
.chip.beta { background: var(--warn-soft); color: var(--warn); }
.chip.store_review { background: #fde68a; color: #78350f; }
.chip.released { background: var(--ok-soft); color: var(--ok); }
.chip.cancelled, .chip.warn { background: var(--bad-soft); color: var(--bad); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.prio { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; color: #fff; }
.prio.P0 { background: var(--p0); } .prio.P1 { background: var(--p1); } .prio.P2 { background: var(--p2); } .prio.P3 { background: var(--p3); }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 999px; background: var(--col); color: var(--muted); }
.tag.bug { background: var(--bad-soft); color: var(--bad); }
.tag.owner { background: var(--accent-soft); color: var(--accent); }
.tag.release { background: var(--ok-soft); color: var(--ok); }
.tag.store { background: var(--warn-soft); color: var(--warn); }
.seg { display: inline-flex; background: var(--col); border-radius: var(--r); padding: 2px; }
.seg-b, .tabs button { border: 0; background: transparent; padding: 4px 10px; border-radius: 6px; color: var(--muted); font-weight: 500; }
.seg-b.active, .tabs button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.tabs { display: inline-flex; gap: 2px; background: var(--col); border-radius: var(--r); padding: 2px; }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; color: var(--muted); }

/* ---------- topbar ---------- */
.topbar { display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--border); flex-wrap: wrap; position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; white-space: nowrap; }
.logo { background: var(--text); color: var(--bg); padding: 2px 7px; border-radius: 5px; font-size: 12px; letter-spacing: .06em; }
.filters { display: flex; gap: 8px; align-items: center; flex: 1; flex-wrap: wrap; }
.filters input[type=search] { min-width: 220px; }
.user { display: flex; align-items: center; gap: 8px; margin-left: auto; white-space: nowrap; }
.user img { width: 26px; height: 26px; border-radius: 50%; }
.client-badge { background: var(--ok-soft); color: var(--ok); font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.banner { padding: 8px 16px; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid #fcd34d; }

/* ---------- task board ---------- */
.board { flex: 1; display: flex; gap: 10px; padding: 12px 16px; overflow-x: auto; align-items: flex-start; }
.column { background: var(--col); border-radius: var(--r-lg); min-width: 268px; width: 268px; min-height: 240px; max-height: calc(100vh - 90px); display: flex; flex-direction: column; flex-shrink: 0; transition: box-shadow .1s; }
.column.collapsed { width: 200px; min-width: 200px; min-height: 0; }
.column.collapsed .sub { display: none; }
.column.can-drop { box-shadow: 0 0 0 2px var(--ok) inset; }
.column.no-drop { box-shadow: 0 0 0 2px var(--bad) inset; opacity: .6; }
.column.over.can-drop { background: var(--ok-soft); }
.column.over.no-drop { background: var(--bad-soft); }
.col-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 10px 12px 6px; font-weight: 600; font-size: 12px; }
.col-head .lbl { display: flex; align-items: baseline; gap: 6px; min-width: 0; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; overflow: hidden; }
.col-head .sub { font-weight: 400; font-size: 11px; color: var(--muted); text-transform: none; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; }
.col-head .count { font-weight: 400; color: var(--muted); }
.col-head button { padding: 1px 6px; font-size: 12px; flex-shrink: 0; }
.col-body { flex: 1; overflow-y: auto; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 6px; min-height: 40px; }
.task { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); padding: 9px 11px; cursor: grab; user-select: none; box-shadow: var(--shadow); }
.task:hover { border-color: var(--accent); }
.task.dragging { opacity: .4; }
.task .head { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 4px; }
.task .id { font-weight: 600; }
.task .title { font-size: 13px; line-height: 1.35; }
.task .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

/* ---------- releases list ---------- */
.rel-list { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 40px; max-width: 1140px; width: 100%; margin: 0 auto; }
.pinned { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; margin-bottom: 6px; }
.slot { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 14px; box-shadow: var(--shadow); }
.slot h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.slot .ver { font-size: 18px; font-weight: 700; }
.slot .none { color: var(--muted); font-size: 13px; }
.slot.clickable { cursor: pointer; }
.slot.clickable:hover { border-color: var(--accent); }
.rel-row { display: grid; grid-template-columns: 160px 1fr 24px; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 16px; cursor: pointer; box-shadow: var(--shadow); }
.rel-row:hover { border-color: var(--accent); }
.rel-row .ver { font-weight: 700; font-size: 15px; }
.rel-row .ver small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.rel-row .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.rel-row .title { font-size: 14px; }
.rel-row .arrow { color: var(--muted); font-size: 18px; text-align: right; }
.progress { height: 5px; background: var(--col); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--ok); transition: width .2s; }
.rel-warn { background: var(--warn-soft); color: var(--warn); border: 1px solid #fcd34d; border-radius: var(--r); padding: 8px 12px; font-size: 13px; }
.search-results { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 10px 14px; }
.search-results .hit { display: grid; grid-template-columns: 150px 90px 1fr; gap: 10px; padding: 6px 4px; font-size: 13px; cursor: pointer; border-radius: 6px; }
.search-results .hit:hover { background: var(--col); }
.empty-hint { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 16px; color: var(--muted); max-width: 520px; box-shadow: var(--shadow-lg); }

/* ---------- drawers ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 17, 21, .45); z-index: 20; display: flex; justify-content: flex-end; }
.drawer { width: min(980px, 100%); height: 100%; background: var(--panel); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .16s ease-out; }
.overlay.second .drawer { width: min(880px, 100%); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { padding: 14px 22px 10px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.drawer-head .titles { flex: 1; min-width: 0; }
.drawer-head .eyebrow { font-family: var(--mono); font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.drawer-head h2 { font-size: 19px; line-height: 1.3; margin-top: 2px; }
.drawer-head h2[contenteditable] { outline: none; border-radius: 4px; padding: 0 4px; margin-left: -4px; }
.drawer-head h2[contenteditable]:focus { box-shadow: 0 0 0 2px var(--accent-soft); }
.drawer-head .actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.drawer-sub { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 22px; border-bottom: 1px solid var(--border); background: var(--panel-2); font-size: 13px; }
.drawer-body { flex: 1; overflow: auto; padding: 6px 22px 40px; }
.drawer-body section { margin-top: 20px; }
.drawer-body h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.drawer-body h3 .count { text-transform: none; letter-spacing: 0; font-weight: 400; }
.drawer-body h3 .grow { flex: 1; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px 14px; }
.meta-grid .kv { font-size: 12px; color: var(--muted); }
.meta-grid .kv b { display: block; color: var(--text); font-weight: 500; font-size: 13px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.readonly-note { background: var(--panel-2); color: var(--muted); font-size: 12px; padding: 6px 10px; border-radius: var(--r); }
.card-box { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 14px; }

/* bullets */
.cat { margin-top: 12px; }
.cat h4 { font-size: 13px; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.cat h4 .count { color: var(--muted); font-weight: 400; font-size: 12px; }
.bullets { display: flex; flex-direction: column; gap: 2px; }
.bullet { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: start; padding: 7px 8px; border-radius: var(--r); }
.bullet:hover { background: var(--panel-2); }
.bullet.done .txt { color: var(--text-2); }
.bullet .mark { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; color: transparent; margin-top: 1px; }
.bullet.done .mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.bullet .txt { line-height: 1.4; }
.bullet .task-ref { font-family: var(--mono); font-size: 11px; color: var(--accent); cursor: pointer; margin-left: 6px; padding: 0 4px; border-radius: 4px; background: var(--accent-soft); }
.bullet .who { font-size: 11px; color: var(--muted); display: block; }
.bullet .acts { display: flex; gap: 4px; opacity: 0; transition: opacity .1s; }
.bullet:hover .acts, .bullet:focus-within .acts { opacity: 1; }
.bullet .task-inline { grid-column: 2 / span 2; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); padding: 10px 14px; margin-top: 6px; font-size: 13px; max-height: 40vh; overflow: auto; }
.cat-empty { color: var(--muted); font-size: 12px; padding: 4px 8px; }
.add-row { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
.add-row input[type=text] { flex: 1; min-width: 200px; }
.suggest { position: relative; flex: 1; min-width: 220px; }
.suggest input { width: 100%; }
.suggest .list { position: absolute; z-index: 5; left: 0; right: 0; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); max-height: 240px; overflow: auto; box-shadow: var(--shadow-lg); }
.suggest .item { padding: 6px 10px; font-size: 13px; cursor: pointer; display: flex; gap: 8px; }
.suggest .item:hover { background: var(--col); }
.suggest .item .mono { color: var(--accent); }

/* comments, attachments */
.comments { display: flex; flex-direction: column; gap: 8px; }
.comment { display: grid; grid-template-columns: 30px 1fr; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; text-transform: uppercase; }
.comment .bubble { background: var(--panel-2); border-radius: var(--r-lg); padding: 8px 12px; font-size: 13px; }
.comment .by { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.attach-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.attach-grid a { display: block; width: 150px; }
.attach-grid img { width: 150px; height: 104px; object-fit: cover; border-radius: var(--r); border: 1px solid var(--border); }
.attach-grid .cap { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone { border: 2px dashed var(--border); border-radius: var(--r-lg); padding: 14px; text-align: center; color: var(--muted); font-size: 13px; margin-top: 8px; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
details.tech { margin-top: 18px; color: var(--muted); font-size: 13px; }
details.tech summary { cursor: pointer; }
.task-list .task-row { display: grid; grid-template-columns: 110px 100px 1fr; gap: 8px; padding: 5px 6px; margin: 0 -6px; border-radius: 6px; font-size: 13px; color: var(--text); text-decoration: none; }
.task-list .task-row:hover { background: var(--col); text-decoration: none; }
.task-list .task-row.done { color: var(--muted); }
.task-list .status { font-size: 11px; color: var(--muted); }
body.client .tech-only { display: none !important; }

/* ---------- markdown editor ---------- */
.md-editor { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.md-editor.drag { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.md-toolbar { display: flex; gap: 2px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--border); background: var(--panel-2); flex-wrap: wrap; }
.md-toolbar .tb { border: 0; background: transparent; padding: 3px 8px; border-radius: 6px; font-size: 13px; color: var(--text-2); min-width: 30px; justify-content: center; }
.md-toolbar .tb:hover { background: var(--col); }
.md-body { display: flex; }
.md-editor.split .md-body > * { width: 50%; }
.md-editor.split .md-preview { border-left: 1px solid var(--border); }
.md-text { width: 100%; min-height: 160px; border: 0; border-radius: 0; padding: 12px 14px; font-family: var(--mono); font-size: 13px; line-height: 1.55; resize: none; background: var(--panel); }
.md-text:focus { box-shadow: none; }
.md-preview { width: 100%; padding: 10px 14px; overflow: auto; max-height: 60vh; }
.md-foot { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-top: 1px solid var(--border); background: var(--panel-2); font-size: 12px; }
.md-hint { color: var(--muted); }
.md-status { color: var(--warn); }

/* ---------- markdown render ---------- */
.md { font-size: 13.5px; line-height: 1.55; }
.md h1 { font-size: 18px; margin: 18px 0 8px; }
.md h2 { font-size: 15px; margin: 20px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.md h3 { font-size: 14px; margin: 14px 0 4px; }
.md h4, .md h5, .md h6 { font-size: 13px; margin: 12px 0 4px; }
.md p { margin: 6px 0; }
.md ul, .md ol { margin: 4px 0; padding-left: 22px; }
.md li { margin: 2px 0; }
.md input[type=checkbox] { vertical-align: -2px; margin: 0 4px 0 -2px; }
.md code { font-family: var(--mono); font-size: 12px; background: var(--col); padding: 1px 4px; border-radius: 4px; }
.md pre { background: var(--col); padding: 10px 12px; border-radius: var(--r); overflow: auto; margin: 8px 0; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 8px 0; padding: 2px 12px; border-left: 3px solid var(--border-strong); color: var(--muted); }
.md table { border-collapse: collapse; margin: 8px 0; font-size: 12.5px; }
.md th, .md td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; vertical-align: top; }
.md th { background: var(--panel-2); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.md img { max-width: 100%; border-radius: var(--r); border: 1px solid var(--border); }
.md a { word-break: break-all; }

/* ---------- misc ---------- */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login .card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 32px; max-width: 420px; text-align: center; box-shadow: var(--shadow-lg); }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 40; max-width: 460px; }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: var(--r); box-shadow: var(--shadow-lg); font-size: 13px; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.warn { background: var(--warn); color: #fff; }
.toast a { color: inherit; text-decoration: underline; }
.form { display: flex; flex-direction: column; gap: 10px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.stale-filter { white-space: nowrap; }
@media (max-width: 700px) {
  .rel-row { grid-template-columns: 1fr; }
  .drawer { width: 100%; }
  .drawer-body { padding: 6px 14px 40px; }
}
.btn.disabled { opacity: .55; pointer-events: none; }
.attach-grid a .icon-btn { position: absolute; top: 4px; right: 4px; background: var(--panel); }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(10, 12, 16, .88); display: flex; align-items: center; justify-content: center; animation: fade .12s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.lightbox figure { margin: 0; max-width: 94vw; max-height: 92vh; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lightbox img { max-width: 94vw; max-height: 84vh; object-fit: contain; border-radius: var(--r); box-shadow: var(--shadow-lg); background: #fff; }
.lightbox figcaption { color: #e5e7eb; font-size: 13px; }
.lightbox .icon-btn { position: absolute; color: #fff; font-size: 30px; padding: 6px 14px; background: rgba(255,255,255,.08); }
.lightbox .icon-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.lightbox .lb-close { top: 14px; right: 18px; }
.lightbox .lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 18px; top: 50%; transform: translateY(-50%); }
