:root {
  --onyx: #08070b;
  --ink: #121017;
  --panel: #17141d;
  --raise: #1f1b27;
  --line: rgba(217, 180, 90, .22);
  --line-soft: rgba(245, 240, 231, .08);
  --gold: #d9b45a;
  --gold-hi: #f7e6a6;
  --ivory: #f5f0e7;
  --muted: #a49c96;
  --turq: #31e3d3;
  --fuchsia: #ff2e9a;
  --danger: #ff6b7d;
  --accent: var(--gold);
  --display: 'Bodoni Moda', 'Bodoni 72', Didot, Georgia, serif;
  --body: 'Jost', 'Futura', 'Avenir Next', system-ui, sans-serif;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--onyx); color: var(--ivory); font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold); }

/* buttons & fields */
.btn { border: 1px solid var(--line); background: var(--raise); padding: 9px 16px; border-radius: 999px; cursor: pointer; white-space: nowrap; transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--gold); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.gold { background: linear-gradient(135deg, var(--gold-hi), var(--gold) 55%, #a9842f); color: #1a1205; border: 0; font-weight: 500; }
.btn.turq { background: transparent; border-color: var(--turq); color: var(--turq); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: rgba(255, 107, 125, .5); color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=password], input[type=search], select, textarea {
  width: 100%; background: var(--ink); border: 1px solid var(--line-soft); border-radius: 10px; padding: 9px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
textarea { resize: vertical; min-height: 90px; }
.eyebrow { font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); margin: 0; }
.script { font-family: var(--display); font-style: italic; font-size: 26px; color: var(--gold-hi); margin: 0 0 6px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at 30% 10%, rgba(255, 46, 154, .12), transparent 55%), radial-gradient(ellipse at 80% 90%, rgba(49, 227, 211, .10), transparent 55%), var(--onyx); }
.login-card { width: min(380px, 100%); display: grid; gap: 18px; padding: 36px 28px; border: 1px solid var(--line); border-radius: 22px; background: rgba(23, 20, 29, .85); text-align: center; }
.login-card h1 { font-family: var(--display); font-weight: 500; font-size: 40px; margin: -6px 0 6px; color: var(--gold-hi); }
.login-card .field { text-align: left; }
.login-msg { min-height: 1.5em; margin: 0; color: var(--fuchsia); font-size: 14px; }

/* app shell */
.app { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); }
.top { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--ink); }
.brand { font-family: var(--display); font-size: 21px; color: var(--ivory); text-decoration: none; white-space: nowrap; }
.brand em { color: var(--gold); }
.spaces { display: flex; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; contain: inline-size; }
.space { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--muted); white-space: nowrap; }
.space i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.space b { font-weight: 400; font-size: 12px; opacity: .7; }
.space[aria-current=true] { color: var(--ivory); border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); }

.body { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; min-height: 0; }
.list-pane { border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; min-height: 0; }
.list-head { padding: 14px 16px 10px; display: grid; gap: 10px; border-bottom: 1px solid var(--line-soft); }
.filters { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.filters select { padding: 6px 8px; font-size: 13px; }
.list-actions { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.count { font-size: 13px; color: var(--muted); }
.select-bar { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.select-bar label { display: flex; gap: 8px; align-items: center; cursor: pointer; }

.rows { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.row:hover { background: var(--panel); }
.row[aria-selected=true] { background: var(--raise); box-shadow: inset 3px 0 0 var(--accent); }
.row input { margin: 0; }
.row .who { min-width: 0; }
.row .name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .when { font-size: 12px; color: var(--muted); text-align: right; }
.row .stage-dot { display: block; margin-top: 2px; font-size: 11px; color: var(--accent); }
.more { margin: 12px auto; display: block; }
.empty-list { padding: 40px 20px; text-align: center; color: var(--muted); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line-soft); color: var(--ivory); background: var(--ink); }
.chip.stage { border-color: var(--accent); color: var(--accent); }
.chip.warn { border-color: var(--fuchsia); color: var(--fuchsia); }
.chip button { background: none; border: 0; padding: 0 0 0 4px; cursor: pointer; color: var(--muted); }

/* detail */
.detail-pane { overflow-y: auto; min-height: 0; }
.empty { height: 100%; display: grid; place-content: center; text-align: center; color: var(--muted); padding: 24px; }
.detail { max-width: 860px; padding: 28px 32px 60px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 26px; }
.back { display: none; }
.d-head { display: grid; gap: 10px; }
.d-head h2 { font-family: var(--display); font-weight: 500; font-size: 34px; margin: 0; line-height: 1.15; }
.d-head .meta { color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; }
.d-head .meta a { color: var(--ivory); }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card { border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px 20px; background: var(--panel); }
.card h3 { margin: 0 0 12px; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); font-weight: 500; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 20px; margin: 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.about { white-space: pre-wrap; margin: 0; }
.tag-add { display: flex; gap: 6px; margin-top: 10px; }
.tag-add input { max-width: 240px; padding: 6px 10px; font-size: 13px; }

.composer { display: grid; gap: 10px; }
.composer .row2 { display: flex; gap: 8px; align-items: center; }
.composer select { width: auto; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.act { position: relative; padding: 12px 0 12px 22px; border-left: 1px solid var(--line-soft); margin-left: 6px; }
.act::before { content: ""; position: absolute; left: -5px; top: 18px; width: 9px; height: 9px; border-radius: 50%; background: var(--k, var(--gold)); }
.act .a-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.act .a-kind { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--k, var(--gold)); }
.act .a-title { font-weight: 500; }
.act .a-when { font-size: 12px; color: var(--muted); margin-left: auto; }
.act .a-body { white-space: pre-wrap; margin: 6px 0 0; color: #ddd6cf; overflow-wrap: anywhere; }
.act .a-del { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0; opacity: 0; }
.act:hover .a-del, .act .a-del:focus { opacity: 1; }
.extra { font-size: 13px; color: var(--muted); }
.extra summary { cursor: pointer; }

/* modal */
.modal { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--ivory); padding: 0; width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
.modal::backdrop { background: rgba(0, 0, 0, .65); backdrop-filter: blur(3px); }
.m-inner { padding: 24px; display: grid; gap: 14px; }
.m-inner h2 { font-family: var(--display); font-weight: 500; margin: 0; font-size: 26px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.m-foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.m-foot .note { margin-right: auto; font-size: 13px; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.notice { border: 1px solid rgba(255, 46, 154, .4); background: rgba(255, 46, 154, .07); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.results { max-height: 220px; overflow-y: auto; font-size: 13px; margin: 0; padding-left: 18px; }
.preview { font-size: 13px; border-collapse: collapse; width: 100%; }
.preview td, .preview th { border-bottom: 1px solid var(--line-soft); padding: 4px 6px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--raise); border: 1px solid var(--gold); padding: 10px 18px; border-radius: 999px; z-index: 10; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }

/* phones */
@media (max-width: 820px) {
  .top { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .spaces { order: 3; flex-basis: 100%; }
  .brand { flex: 1; }
  .body { grid-template-columns: minmax(0, 1fr); }
  .app.showing-detail .list-pane { display: none; }
  .app:not(.showing-detail) .detail-pane { display: none; }
  .detail { padding: 18px 16px 48px; }
  .back { display: inline-flex; justify-self: start; }
  .d-head h2 { font-size: 28px; }
  .grid2 { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters select:last-child { grid-column: span 2; }
}
