:root {
  --night: #0f1424;
  --deep: #141a2b;
  --panel: rgba(22, 29, 48, 0.88);
  --panel-solid: #182036;
  --raised: #222b45;
  --raised-hover: #29334f;
  --column: rgba(13, 18, 32, 0.9);
  --line: rgba(227, 192, 111, 0.16);
  --line-soft: rgba(255, 255, 255, 0.07);
  --ink: #f1ece4;
  --muted: #a7adbf;
  --faint: #6f7690;
  --gold: #e3c06f;
  --gold-deep: #c9a24f;
  --danger: #e07a6c;
  --ok: #8cc79a;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Hanken Grotesk", system-ui, sans-serif;
  --radius: 8px;
  --bar: 60px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--ink);
  background: var(--night);
  line-height: 1.5;
}

/* The castle at night behind every page. assets/castle.jpg, if added, takes its place. */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(15, 20, 36, 0.92) 0%, rgba(15, 20, 36, 0.55) 50%, rgba(15, 20, 36, 0.15) 100%),
    url("castle.jpg") center bottom / cover no-repeat,
    url("castle.svg") center bottom / cover no-repeat,
    var(--night);
}
body.state-app .sky {
  background:
    linear-gradient(180deg, rgba(15, 20, 36, 0.25) 0px, rgba(15, 20, 36, 0.7) 300px, rgba(15, 20, 36, 0.94) 560px, rgba(15, 20, 36, 0.97) 100%),
    url("castle.jpg") center top / cover no-repeat,
    url("castle.svg") center top / cover no-repeat,
    var(--night);
}
body.on-board .sky {
  background:
    linear-gradient(180deg, rgba(15, 20, 36, 0.72) 0%, rgba(15, 20, 36, 0.9) 100%),
    url("castle.jpg") center / cover no-repeat,
    url("castle.svg") center / cover no-repeat,
    var(--night);
}

a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; letter-spacing: 0.01em; }
.small { font-size: 12.5px; }
.caps, .eyebrow, .label-caps { font-size: 11.5px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }

/* ---- Top bar ---- */
.topbar { display: flex; align-items: center; gap: 28px; padding: 26px 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 28px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 28px; height: 28px; }
.brand-tag { font-family: var(--sans); font-size: 10px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); border: 1px solid rgba(227, 192, 111, 0.45); border-radius: 3px; padding: 1px 6px; }
.app-bar {
  position: sticky; top: 0; z-index: 15;
  height: var(--bar); padding: 0 24px; gap: 22px;
  background: rgba(11, 15, 28, 0.62);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line-soft);
}
.app-bar .brand { font-size: 23px; }
.nav { display: flex; gap: 4px; }
.nav a {
  font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; text-decoration: none;
  color: var(--muted); padding: 8px 12px; border-radius: 6px;
}
.nav a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.nav a.active { color: var(--gold); background: rgba(227, 192, 111, 0.1); }
.top-search { margin-left: auto; }
.top-search input {
  width: 240px; height: 34px; padding: 0 12px 0 32px; border-radius: 6px;
  background: rgba(255, 255, 255, 0.06) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16'%3E%3Cpath fill='%23a7adbf' d='M10 4a6 6 0 1 0 3.7 10.7l4.8 4.8 1.4-1.4-4.8-4.8A6 6 0 0 0 10 4Zm0 2a4 4 0 1 1 0 8 4 4 0 0 1 0-8Z'/%3E%3C/svg%3E") 9px center no-repeat;
  border: 1px solid transparent; transition: width 0.2s, background-color 0.2s;
}
.top-search input:focus { width: 320px; background-color: rgba(10, 14, 26, 0.9); border-color: var(--gold); outline: none; }
.icon-btn { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.07); }
.icon-btn .badge { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; }
.account { position: relative; display: flex; align-items: center; }
.me { display: flex; padding: 0; border: 2px solid transparent; border-radius: 50%; background: none; cursor: pointer; }
.me:hover { border-color: var(--gold); }
.me img, .avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--raised); }
.avatar.sm { width: 24px; height: 24px; }
.avatar.md { width: 32px; height: 32px; }
.avatar.lg { width: 96px; height: 96px; border: 2px solid var(--line); }
.menu { position: absolute; right: 0; top: 46px; min-width: 220px; background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45); padding: 6px; z-index: 30; }
.menu[hidden] { display: none; }
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
.menu-head b { display: block; }
.menu-head span { color: var(--faint); font-size: 13px; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 8px 12px; border: 0; background: none; border-radius: 5px; text-decoration: none; cursor: pointer; }
.menu a:hover, .menu button:hover { background: rgba(255, 255, 255, 0.06); }
.link { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-size: 14px; }
.link:hover { color: var(--ink); text-decoration: underline; }
.link-inline { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-decoration-color: var(--faint); cursor: pointer; }

/* ---- Landing and waiting pages ---- */
.hero { padding: 9vh 56px 0; max-width: 900px; }
.eyebrow { color: var(--gold); display: flex; align-items: center; gap: 18px; margin: 0 0 14px; }
.eyebrow::before { content: ""; width: 48px; height: 1px; background: var(--gold); }
.hero h1 { font-size: clamp(54px, 8vw, 104px); line-height: 0.98; margin-bottom: 28px; }
.lede { font-size: 22px; color: #dcd7cf; max-width: 640px; margin: 0 0 36px; }
.hero-actions { display: flex; gap: 14px; }
.hero .btn { padding: 18px 44px; font-size: 18px; }

/* ---- Buttons and fields ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04); font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--gold); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #1a1a1a; }
.btn-gold:hover { background: #ecce86; }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn.ghost { background: rgba(255, 255, 255, 0.06); border-color: transparent; }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.12); }
.btn.ghost.on { background: rgba(227, 192, 111, 0.18); color: var(--gold); }
.btn.icon { padding: 5px 10px; font-size: 16px; line-height: 1; }
.btn.danger { border-color: rgba(224, 122, 108, 0.45); color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: default; }

input[type=text], input[type=search], input[type=date], input:not([type]), textarea, select {
  background: rgba(10, 14, 26, 0.75); border: 1px solid var(--line-soft); border-radius: 6px; padding: 8px 10px; width: 100%;
}
input[type=color] { padding: 2px; height: 36px; width: 56px; background: none; border: 1px solid var(--line-soft); border-radius: 6px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold); }
input:disabled { opacity: 0.4; }
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
input[type=checkbox] { accent-color: var(--gold); width: 16px; height: 16px; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spacer { margin-left: auto; }

/* ---- Pages ---- */
.view { padding: 26px 56px 60px; }
body.on-board .view { padding: 0; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin: 10px 0 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 50px; line-height: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.empty { color: var(--muted); padding: 26px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; background: rgba(15, 20, 36, 0.5); }
.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px; backdrop-filter: blur(6px); }
.panel.list { padding: 6px 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.section-title { font-family: var(--serif); font-size: 26px; margin: 30px 0 12px; }
.section-title .faint { font-size: 20px; }

/* Team tiles */
.team-tile { display: block; text-decoration: none; border-radius: var(--radius); overflow: hidden; background: var(--panel); border: 1px solid var(--line-soft); transition: transform 0.15s, border-color 0.15s; }
.team-tile:hover { transform: translateY(-2px); border-color: rgba(227, 192, 111, 0.4); }
.team-band { height: 64px; background: linear-gradient(135deg, var(--tile, var(--gold)) 0%, color-mix(in srgb, var(--tile, var(--gold)) 35%, #0f1424) 100%); }
.team-body { padding: 14px 16px 16px; }
.team-body h3 { font-size: 24px; margin-bottom: 2px; }
.team-body p { margin: 0; }
.tile-foot { margin-top: 14px; }
.progress { flex: 1; height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 3px; overflow: hidden; margin: 12px 0 10px; }
.progress > i { display: block; height: 100%; background: var(--gold); transition: width 0.3s; }
.progress.full > i { background: var(--ok); }
.faces { display: flex; align-items: center; }
.faces img { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--panel-solid); margin-left: -6px; object-fit: cover; background: var(--raised); }
.faces img:first-child { margin-left: 0; }
.faces .more { font-size: 11.5px; color: var(--muted); margin-left: 4px; }

.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-top: 1px solid var(--line-soft); text-decoration: none; }
.list-row:first-child { border-top: 0; }
a.list-row:hover .title { color: var(--gold); }
.list-row .title { font-weight: 600; }
.list-row select { width: auto; }
.check-box { width: 14px; height: 14px; border: 1.5px solid var(--muted); border-radius: 3px; flex: none; }
.tag { font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; padding: 2px 7px; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); }
.tag.gold { color: var(--gold); border-color: rgba(227, 192, 111, 0.5); }
.tag.warn { color: var(--danger); border-color: rgba(224, 122, 108, 0.5); }
.project-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; flex: none; }
.project-dot.big { width: 14px; height: 14px; margin: 0; }

/* People */
.grid.people { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.person-tile { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line-soft); text-decoration: none; }
.person-tile:hover { border-color: rgba(227, 192, 111, 0.4); }
.person-tile .title { font-weight: 600; }

/* ---- Board ---- */
.board-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 24px; background: rgba(11, 15, 28, 0.45); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.board-bar h1 { font-size: 28px; margin-right: 8px; }
.tabs { display: flex; gap: 2px; background: rgba(255, 255, 255, 0.05); padding: 3px; border-radius: 7px; }
.tabs button { border: 0; background: none; padding: 5px 12px; border-radius: 5px; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { background: rgba(227, 192, 111, 0.16); color: var(--gold); }
.board-area { height: calc(100vh - var(--bar) - 59px); overflow: auto; }
.board { display: flex; gap: 12px; align-items: flex-start; padding: 14px 24px 24px; height: 100%; box-sizing: border-box; }
.column {
  flex: 0 0 272px; max-height: 100%; min-height: 0;
  background: var(--column); border-radius: 12px;
  display: flex; flex-direction: column;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}
.column.drop-target { outline: 2px solid rgba(227, 192, 111, 0.35); }
.column-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 6px 14px; cursor: grab; }
.column-head h3 { font-family: var(--sans); font-size: 14px; font-weight: 700; letter-spacing: 0; }
.column-head .count { color: var(--faint); font-size: 12.5px; }
.auto-dots { display: inline-flex; gap: 3px; }
.sort-tag { border: 0; background: rgba(255, 255, 255, 0.07); color: var(--muted); font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.sort-tag:hover { color: var(--ink); }
.auto-faces .faces img { width: 18px; height: 18px; border-width: 1px; }
.auto-dots i { width: 8px; height: 8px; border-radius: 2px; }
.done-mark { color: var(--ok); font-size: 13px; }
.col-menu { padding: 2px 8px; border-radius: 5px; font-size: 16px; }
.col-menu:hover { background: rgba(255, 255, 255, 0.08); text-decoration: none; }
.column-cards { padding: 4px 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 8px; flex: 1 1 auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
/* A full column scrolls; its cards keep their own height instead of being squashed to fit. */
.column-cards > * { flex-shrink: 0; }
.add-card { margin: 4px 8px 8px; text-align: left; color: var(--muted); background: none; border: 0; padding: 7px 8px; cursor: pointer; border-radius: 6px; font-size: 14px; }
.add-card:hover { background: rgba(255, 255, 255, 0.07); color: var(--ink); }
.add-form { padding: 4px 8px 10px; display: flex; flex-direction: column; gap: 8px; }
.card-input { min-height: 64px; background: var(--raised); border: 0; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); resize: none; }
.add-column { flex: 0 0 272px; }
.add-column-btn { width: 100%; text-align: left; padding: 12px 14px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, 0.1); cursor: pointer; font-weight: 600; }
.add-column-btn:hover { background: rgba(255, 255, 255, 0.16); }
.column-form { background: var(--column); border-radius: 12px; padding: 10px; }

.card {
  position: relative; background: var(--raised); border-radius: 8px; cursor: pointer; overflow: hidden;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.35); outline: 1px solid transparent;
}
.card:hover { background: var(--raised-hover); outline-color: rgba(227, 192, 111, 0.55); }
.card .cover { height: 32px; }
.card .cover.img { height: 130px; background-size: cover; background-position: center; }
.card-inner { padding: 8px 10px 8px; }
.card-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.chip { display: inline-block; min-width: 40px; max-width: 100%; padding: 0 8px; height: 18px; line-height: 18px; border-radius: 4px; font-size: 11.5px; font-weight: 700; color: #11131c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.big { height: 30px; line-height: 30px; padding: 0 12px; font-size: 13px; }
.chip.wide { flex: 1; height: 30px; line-height: 30px; font-size: 13px; }
.card-title { font-size: 14px; word-break: break-word; padding-right: 18px; }
.card.done .card-title { color: var(--muted); }
.card.done .card-labels .chip { opacity: 0.45; filter: saturate(0.55) brightness(0.8); }
.card.done .cover { opacity: 0.45; }
.card.done { background: rgba(34, 43, 69, 0.7); }
.status-chip { display: inline-flex; align-items: center; gap: 5px; height: 18px; padding: 0 7px; border-radius: 4px; font-size: 11px; font-weight: 700; color: var(--status); background: color-mix(in srgb, var(--status) 18%, transparent); border: 1px solid color-mix(in srgb, var(--status) 45%, transparent); white-space: nowrap; }
.status-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--status); }
.status-chip.big { height: 30px; padding: 0 12px; font-size: 13px; }
.status-btn { border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.card-status { margin-top: 6px; }
.creator { color: var(--faint); font-size: 11px; }
.complete-badge { background: rgba(31, 132, 90, 0.85); color: #fff; font-weight: 700; padding: 0 6px; border-radius: 4px; }
.column.done-col { background: rgba(14, 26, 24, 0.9); }
.card-meta { display: flex; align-items: center; gap: 6px 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; margin-top: 6px; }
.card-meta .faces { margin-left: auto; }
.card-meta .key { color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; }
.badge-ok { background: rgba(140, 199, 154, 0.2); color: var(--ok); padding: 0 5px; border-radius: 3px; }
.quick { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(10, 14, 26, 0.75); color: var(--ink); cursor: pointer; opacity: 0; transition: opacity 0.1s; }
.card:hover .quick { opacity: 1; }
.quick:hover { background: var(--gold); color: #111; }
.card, .column-head { user-select: none; -webkit-user-select: none; }
.card img, .column img { -webkit-user-drag: none; }
.column.in-section { border-top: 3px solid var(--accent); }
.divider-col { flex: 0 0 52px; align-self: stretch; max-height: none; background: none; box-shadow: none; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 6px 0; position: relative; }
.divider-col .divider-head { flex-direction: column; padding: 0; gap: 2px; cursor: grab; }
.divider-col .fold { width: 30px; height: 30px; border-radius: 8px; border: 0; background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); font-size: 18px; font-weight: 700; cursor: pointer; }
.divider-col .fold:hover { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.divider-label { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 12px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); white-space: nowrap; cursor: default; }
.divider-count { font-size: 11px; color: var(--faint); }
.divider-line { flex: 1; width: 2px; min-height: 40px; background: linear-gradient(var(--accent), transparent); opacity: 0.6; border-radius: 1px; }
.divider-col.shut { flex-basis: 52px; background: color-mix(in srgb, var(--accent) 8%, rgba(13, 18, 32, 0.9)); border-radius: 12px; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; margin: 0; will-change: transform; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55); }
.card.drag-ghost { outline: 2px solid rgba(227, 192, 111, 0.7); }
.card-holder { flex: none; border-radius: 8px; background: rgba(255, 255, 255, 0.06); border: 2px dashed rgba(227, 192, 111, 0.35); }
.column-holder { flex: 0 0 272px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 2px dashed rgba(227, 192, 111, 0.35); }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }
body.is-dragging .card:hover { outline-color: transparent; }

.badge-date { display: inline-flex; align-items: center; padding: 1px 6px; border-radius: 4px; font-size: 12px; border: 0; background: none; color: inherit; }
.badge-date.soon { background: #f5cd47; color: #1d1a10; }
.badge-date.late { background: #c9372c; color: #fff; }
.badge-date.met { background: #1f845a; color: #fff; }
button.badge-date { cursor: pointer; }

.pr { display: inline-flex; align-items: center; gap: 6px; padding: 1px 7px; border-radius: 10px; font-size: 11.5px; font-weight: 700; text-decoration: none; border: 1px solid; white-space: nowrap; }
.pr.open { color: #4bce97; border-color: rgba(75, 206, 151, 0.45); }
.pr.draft { color: var(--muted); border-color: var(--line-soft); }
.pr.merged { color: #b392f0; border-color: rgba(179, 146, 240, 0.5); }
.pr.linked { color: #9cc4ff; border-color: rgba(87, 157, 255, 0.45); }
.pr.closed { color: var(--danger); border-color: rgba(224, 122, 108, 0.45); }
.pr-title { font-weight: 500; color: var(--ink); white-space: normal; }
.pr-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; flex-wrap: wrap; }

/* ---- Table, calendar, timeline ---- */
.table-view, .calendar-view, .timeline-view { padding: 14px 24px 24px; }
.table-wrap { background: var(--column); border-radius: 12px; overflow: auto; }
.grid-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.grid-table th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding: 12px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; position: sticky; top: 0; background: #11172a; }
.grid-table th.sortable { cursor: pointer; }
.grid-table th.on { color: var(--gold); }
.grid-table td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.grid-table tbody tr { cursor: pointer; }
.grid-table tbody tr:hover { background: rgba(255, 255, 255, 0.04); }
.grid-table tr.done .title { color: var(--muted); text-decoration: line-through; }
.grid-table td.title { font-weight: 600; min-width: 220px; }
.grid-table .chip { margin: 0 4px 2px 0; }

.cal-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal-bar h2 { font-size: 26px; min-width: 220px; text-align: center; }
.cal-wrap { display: flex; gap: 14px; align-items: flex-start; }
.cal-grid { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line-soft); border-radius: 12px; overflow: hidden; }
.cal-head { background: #11172a; padding: 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.cal-day { background: var(--column); min-height: 112px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal-day.other { opacity: 0.45; }
.cal-day.today .cal-num { background: var(--gold); color: #111; }
.cal-day.over { background: rgba(227, 192, 111, 0.12); }
.cal-num { align-self: flex-start; font-size: 12px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }
.cal-chip { text-align: left; border: 0; border-left: 3px solid; background: var(--raised); border-radius: 4px; padding: 3px 6px; font-size: 12px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip:hover { background: var(--raised-hover); }
.cal-chip.done { opacity: 0.55; text-decoration: line-through; }
.cal-side { width: 220px; background: var(--column); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.cal-side h4 { margin: 0 0 6px; color: var(--muted); }

.tl-wrap { background: var(--column); border-radius: 12px; overflow: auto; max-height: calc(100% - 52px); }
.tl-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--line-soft); }
.tl-top { position: sticky; top: 0; z-index: 2; background: #11172a; }
.tl-name { flex: 0 0 260px; padding: 8px 12px; font-size: 13px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; position: sticky; left: 0; background: #121828; z-index: 1; border-right: 1px solid var(--line-soft); }
.tl-name:hover { color: var(--gold); }
.tl-head { display: flex; }
.tl-day { flex: none; text-align: center; font-size: 11px; color: var(--muted); padding: 6px 0; border-left: 1px solid rgba(255, 255, 255, 0.03); }
.tl-day b { display: block; color: var(--gold); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }
.tl-day.weekend { background: rgba(255, 255, 255, 0.025); }
.tl-day.today { color: var(--gold); font-weight: 700; }
.tl-track { position: relative; flex: none; height: 36px; }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(227, 192, 111, 0.5); }
.tl-bar { position: absolute; top: 6px; height: 24px; border: 0; border-radius: 6px; color: #11131c; font-size: 12px; font-weight: 700; padding: 0 8px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.tl-bar.done { opacity: 0.5; }
.tl-bar.late { outline: 2px solid var(--danger); }
.tl-group { padding: 8px 12px; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); background: rgba(227, 192, 111, 0.06); position: sticky; left: 0; }

/* ---- Dialogs ---- */
.modal { position: fixed; inset: 0; background: rgba(5, 8, 16, 0.72); display: flex; align-items: flex-start; justify-content: center; padding: 48px 20px; overflow-y: auto; z-index: 20; }
.modal[hidden] { display: none; }
.dialog { width: min(980px, 100%); background: var(--panel-solid); border: 1px solid var(--line-soft); border-radius: 12px; padding: 24px 26px; position: relative; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); }
.dialog.narrow { width: min(540px, 100%); }
.dialog .close { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border-radius: 50%; font-size: 24px; line-height: 1; z-index: 2; }
.dialog .close:hover { background: rgba(255, 255, 255, 0.08); text-decoration: none; }
.dialog-h { font-size: 30px; margin-bottom: 16px; }
.dialog h4.caps { color: var(--muted); margin: 18px 0 8px; }
.label-edit { padding: 10px 0; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 8px; }

.card-dialog { padding: 0 0 24px; overflow: hidden; }
.card-dialog.file-over { outline: 2px dashed var(--gold); outline-offset: -8px; }
.dialog-cover { height: 116px; position: relative; background-size: cover; background-position: center; }
.dialog-cover.img { height: 180px; background-color: #0a0e1a; background-size: contain; background-repeat: no-repeat; }
.cover-btn { position: absolute; right: 56px; bottom: 12px; background: rgba(10, 14, 26, 0.7); }
.card-head { display: flex; gap: 12px; padding: 22px 60px 6px 24px; }
.sec-icon { width: 24px; flex: none; text-align: center; color: var(--muted); font-size: 16px; }
.sec-icon.big { font-size: 20px; padding-top: 6px; }
.dialog-title { font-family: var(--serif); font-size: 30px; font-weight: 500; line-height: 1.15; background: transparent; border: 1px solid transparent; padding: 2px 6px; margin-left: -7px; width: 100%; resize: none; overflow: hidden; min-height: 0; }
.dialog-title:hover { border-color: var(--line-soft); }
.dialog-title:focus { background: rgba(10, 14, 26, 0.75); }
.in-list { margin-top: 2px; }
.key-tag { font-weight: 700; color: var(--gold); letter-spacing: 0.04em; }
.dialog-body { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 22px; padding: 0 24px; }
.card-main > section { margin-top: 24px; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.section-head h3 { font-family: var(--sans); font-size: 16px; font-weight: 700; flex: 1; }
.section-head .list-title { flex: 1; font-weight: 700; font-size: 16px; background: transparent; border-color: transparent; padding: 4px 6px; }
.section-head .list-title:hover { border-color: var(--line-soft); }
.metas { display: flex; flex-wrap: wrap; gap: 18px 24px; margin: 14px 0 0 36px; }
.meta-block h4 { margin: 0 0 6px; color: var(--muted); }
.meta-block .row { gap: 6px; }
.round-add { width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.08); cursor: pointer; font-size: 18px; }
.round-add:hover { background: rgba(255, 255, 255, 0.16); }
.date-btn { display: inline-flex; align-items: center; gap: 8px; border: 0; padding: 6px 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); cursor: pointer; }
.date-btn .state { font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 3px; }
.date-btn.late .state { background: #c9372c; color: #fff; }
.date-btn.soon .state { background: #f5cd47; color: #1d1a10; }
.date-btn.met .state { background: #1f845a; color: #fff; }
.card-main > section > :not(.section-head) { margin-left: 36px; }
.description { padding: 2px 0; cursor: text; border-radius: 6px; }
.description.empty { background: rgba(255, 255, 255, 0.06); padding: 12px; min-height: 56px; color: var(--muted); }
.description.empty:hover { background: rgba(255, 255, 255, 0.1); }
.md-input { min-height: 200px; font-family: var(--sans); }
.md p { margin: 0 0 8px; }
.md p:last-child { margin-bottom: 0; }
.md h3, .md h4, .md h5 { font-family: var(--sans); font-weight: 700; margin: 12px 0 6px; }
.md h3 { font-size: 18px; } .md h4 { font-size: 16px; } .md h5 { font-size: 14.5px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 22px; }
.md code { background: rgba(255, 255, 255, 0.08); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.md pre { background: rgba(5, 8, 16, 0.7); border: 1px solid var(--line-soft); padding: 10px 12px; border-radius: 6px; overflow-x: auto; margin: 0 0 8px; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 0 0 8px; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
.md a { color: var(--gold); }
.mention { background: rgba(87, 157, 255, 0.18); color: #9cc4ff; padding: 0 4px; border-radius: 4px; font-weight: 600; }
.mention.me { background: rgba(227, 192, 111, 0.22); color: var(--gold); }
.key-link { color: var(--gold); font-weight: 700; text-decoration: none; }
.mention-wrap { position: relative; }
.mention-list { position: absolute; left: 0; top: 100%; margin-top: 4px; min-width: 260px; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 8px; padding: 4px; z-index: 40; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); }
.mention-list[hidden] { display: none; }
.mention-list button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 6px 8px; border-radius: 5px; cursor: pointer; text-align: left; }
.mention-list button.on, .mention-list button:hover { background: rgba(227, 192, 111, 0.14); }

.checklist .progress-row { display: flex; align-items: center; gap: 10px; }
.checklist .progress-row .small { width: 32px; }
.checklist .progress { margin: 6px 0; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 5px 6px; margin-left: -6px; border-radius: 6px; }
.check-item:hover { background: rgba(255, 255, 255, 0.05); }
.check-item .body { flex: 1; word-break: break-word; }
.check-item.done .body { color: var(--muted); text-decoration: line-through; }
.item-who { border: 0; background: none; padding: 0; cursor: pointer; display: flex; }
.item-tools { display: flex; gap: 8px; visibility: hidden; }
.check-item:hover .item-tools { visibility: visible; }
.item-tools .link { text-decoration: none; font-size: 13px; }
.add-item { margin-top: 6px; }

.file { display: flex; align-items: flex-start; gap: 14px; padding: 8px 0; }
.thumb { flex: none; width: 112px; height: 76px; border-radius: 6px; background: rgba(255, 255, 255, 0.06) center / cover no-repeat; display: grid; place-items: center; text-decoration: none; }
.thumb.icon { color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 15px; }
.file-name { font-weight: 600; text-decoration: none; word-break: break-all; }
.file-name:hover { text-decoration: underline; }
.file .row { margin-top: 4px; gap: 14px; }

.comment { display: flex; gap: 12px; padding: 8px 0; }
.comment.new { padding-top: 0; }
.comment-input { min-height: 44px; }
.comment-body { background: rgba(255, 255, 255, 0.06); padding: 8px 12px; border-radius: 8px; margin-top: 4px; word-break: break-word; }
.comment-tools { gap: 12px; margin-top: 4px; }
.comment-tools .link { font-size: 12.5px; }
.activity { font-size: 13px; color: var(--muted); padding: 6px 0 6px 36px; }
.activity b { color: var(--ink); }

.card-side { padding-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.card-side h4 { color: var(--muted); margin: 10px 0 2px; }
.card-side h4:first-child { margin-top: 0; }
.side-btn { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: 6px; background: rgba(255, 255, 255, 0.07); cursor: pointer; font-weight: 600; font-size: 13.5px; }
.side-btn span { width: 18px; text-align: center; }
.side-btn:hover { background: rgba(255, 255, 255, 0.13); }
.side-btn.danger { background: rgba(201, 55, 44, 0.75); color: #fff; }

/* ---- Popovers ---- */
.pop { position: fixed; z-index: 35; width: 304px; max-height: calc(100vh - 16px); overflow-y: auto; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55); }
.pop[hidden] { display: none; }
.pop.wide { width: 380px; }
.pop-head { display: flex; align-items: center; justify-content: center; position: relative; padding: 10px 36px; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.pop-head .link { position: absolute; right: 8px; top: 4px; font-size: 20px; width: 30px; height: 30px; border-radius: 6px; }
.pop-head .link:hover { background: rgba(255, 255, 255, 0.08); text-decoration: none; }
.pop-body { padding: 4px 12px 12px; }
.pop-body h4.caps { color: var(--muted); margin: 14px 0 6px; }
.pop-body textarea { min-height: 60px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 7px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; }
.menu-item:hover { background: rgba(255, 255, 255, 0.07); }
.menu-item.on { background: rgba(227, 192, 111, 0.1); }
.menu-item .tick { color: var(--gold); }
.label-pick { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 8px; }
.swatch { height: 28px; border-radius: 4px; border: 2px solid transparent; cursor: pointer; }
.swatch.on { border-color: #fff; }
.cover-picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cover-pick { height: 54px; border-radius: 4px; border: 2px solid transparent; background: center / cover no-repeat; cursor: pointer; }
.cover-pick.on { border-color: var(--gold); }
.pick { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.notes { display: flex; flex-direction: column; }
.note { display: flex; gap: 10px; text-align: left; border: 0; background: none; padding: 9px 8px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.note:hover { background: rgba(255, 255, 255, 0.06); }
.note.unread { background: rgba(227, 192, 111, 0.07); }
.note.unread::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; margin-top: 6px; }
.note-icon { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.08); font-size: 12px; }

/* ---- Profile ---- */
.profile-head { display: flex; gap: 26px; align-items: center; }
.profile-head h1 { font-size: 48px; line-height: 1.05; }
.stats { display: flex; gap: 14px; margin-top: 20px; flex-wrap: wrap; }
.stat { padding: 14px 20px; border: 1px solid var(--line); border-radius: var(--radius); min-width: 130px; background: var(--panel); }
.stat b { display: block; font-family: var(--serif); font-size: 34px; font-weight: 600; line-height: 1; }
.stat span { font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--panel-solid); border: 1px solid var(--gold); padding: 10px 18px; border-radius: 8px; z-index: 50; }
.toast[hidden] { display: none; }
.toast.error { border-color: var(--danger); }

/* Touch screens have no hover: keep the hidden tools showing, and stop the long press from selecting or calling up a menu. */
.grip { display: none; }
@media (hover: none) {
  .grip { display: flex; align-items: center; justify-content: center; position: absolute; left: 0; top: 0; bottom: 0; width: 24px; color: var(--faint); font-size: 16px; touch-action: none; }
  .card .card-inner { padding-left: 26px; }
  .card .cover { margin-left: 0; }
  .column-head, .divider-head { touch-action: none; }
  .quick { opacity: 1; background: rgba(10, 14, 26, 0.55); }
  .item-tools { visibility: visible; }
  .card, .column-head { -webkit-touch-callout: none; }
}

@media (max-width: 1000px) {
  .top-search input, .top-search input:focus { width: 150px; }
  .app-bar .brand-tag { display: none; }
}

@media (max-width: 800px) {
  body { font-size: 15px; }
  /* iOS zooms into any field under 16px. */
  input[type=text], input[type=search], input[type=date], input:not([type]), textarea, select { font-size: 16px; }
  .topbar { padding: 18px 20px; }
  .app-bar { height: auto; padding: 8px 12px 0; flex-wrap: wrap; gap: 4px 10px; }
  .app-bar .brand { font-size: 19px; gap: 8px; margin-right: auto; }
  .brand-mark { width: 24px; height: 24px; }
  .top-search { margin-left: 0; order: 2; }
  .top-search input { width: 120px; height: 34px; }
  .top-search input:focus { width: 180px; }
  .bell { order: 3; }
  .account { order: 4; }
  .nav { order: 5; width: 100%; margin: 0 -4px; overflow-x: auto; scrollbar-width: none; }
  .nav a { padding: 10px 12px; }
  .menu { position: fixed; top: 56px; right: 8px; left: auto; }
  .view, .hero { padding-left: 16px; padding-right: 16px; }
  .view { padding-top: 16px; }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 36px; }
  .section-title { font-size: 22px; margin-top: 24px; }
  .hero h1 { font-size: 50px; }
  .lede { font-size: 18px; }
  .list-row { flex-wrap: wrap; }
  .list-row .grow { min-width: 60%; }

  /* Board: one bar that scrolls sideways, and columns that snap one at a time. */
  .board-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 10px 12px; gap: 8px; }
  .board-bar::-webkit-scrollbar, .nav::-webkit-scrollbar { display: none; }
  .board-bar h1 { font-size: 22px; white-space: nowrap; }
  .board-bar > * { flex: none; }
  .board-bar .spacer { display: none; }
  .board-area { height: calc(100vh - 156px); height: calc(100dvh - 156px); }
  .board { padding: 12px; gap: 10px; scroll-snap-type: x mandatory; scroll-padding: 12px; }
  .column, .add-column, .column-holder { flex-basis: min(86vw, 320px); scroll-snap-align: start; }
  .divider-col { scroll-snap-align: start; }
  .table-view, .calendar-view, .timeline-view { padding: 12px; }
  .tl-name { flex-basis: 150px; }
  .cal-bar h2 { font-size: 20px; min-width: 0; flex: 1; }
  .cal-side { display: none; }

  /* An open project fills the screen. */
  .modal { padding: 0; }
  .dialog { border-radius: 0; min-height: 100vh; min-height: 100dvh; border: 0; padding: 20px 16px; }
  .dialog.narrow { width: 100%; }
  .card-dialog { padding: 0 0 40px; }
  .card-head { padding: 18px 52px 4px 14px; }
  .dialog-title { font-size: 26px; }
  .dialog-body { grid-template-columns: 1fr; padding: 0 14px; gap: 10px; }
  /* The project's buttons: one row that scrolls sideways, under the title. */
  .card-side { order: -1; display: flex; flex-direction: row; gap: 6px; padding: 10px 0 4px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding-left: 14px; padding-right: 14px; }
  .card-side::-webkit-scrollbar { display: none; }
  .card-side h4 { display: none; }
  .side-btn { flex: none; width: auto; white-space: nowrap; font-size: 13px; padding: 8px 12px; border-radius: 18px; }
  .metas { margin-left: 0; gap: 14px 18px; }
  .card-main > section > :not(.section-head) { margin-left: 0; }
  .activity { padding-left: 0; }
  .sec-icon { display: none; }
  .section-head { flex-wrap: wrap; }
  .thumb { width: 84px; height: 60px; }
  .dialog-cover.img { height: 140px; }
  .cover-btn { right: 12px; }

  /* Pop-ups rise from the bottom of the screen. */
  .pop, .pop.wide { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; max-height: 75vh; border-radius: 14px 14px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .menu-item, .note { padding: 11px 10px; }
  .toast { bottom: 16px; width: calc(100% - 32px); text-align: center; }
}

/* A narrow calendar becomes a list of the month's days that have something on them. */
.agenda { display: flex; flex-direction: column; gap: 10px; }
.agenda-day { background: var(--column); border-radius: 12px; padding: 10px 12px; }
.agenda-day.today { outline: 2px solid var(--gold); }
.agenda-day h4 { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.agenda-day .cal-chip { display: block; width: 100%; margin-bottom: 4px; padding: 8px 10px; font-size: 14px; white-space: normal; }

/* Sub-cards (v4.5) */
.card.nest-target { outline: 2px dashed var(--gold); outline-offset: -2px; background: var(--raised-hover); }
.card.nest-target::after { content: "Drop to add as a sub-card"; position: absolute; inset: auto 8px 8px auto; background: rgba(10, 14, 26, 0.9); color: var(--gold); font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 4px; pointer-events: none; }
.sub-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; }
.sub-row:hover { background: rgba(255, 255, 255, 0.05); }
.sub-row .sub-title { flex: 1; text-align: left; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-row.done .sub-title { color: var(--muted); text-decoration: line-through; }
.sub-row .faces img { width: 20px; height: 20px; }

/* Collapsed columns (v4.7): same width and header; the cards fold up behind one bar. */
.column-cards.folded { padding: 2px 8px 10px; }
.fold-bar { width: 100%; text-align: left; border: 1px dashed rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.04); color: var(--muted); padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
.fold-bar:hover { color: var(--ink); border-color: rgba(227, 192, 111, 0.5); background: rgba(227, 192, 111, 0.06); }

/* ---------- Forms ---------- */
input[type=number], input[type=datetime-local], input[type=password] { width: 100%; font: inherit; color: var(--ink); background: rgba(10, 14, 26, 0.6); border: 1px solid var(--line-soft); border-radius: 6px; padding: 8px 10px; color-scheme: dark; }
.q-help-wrap { margin: -2px 0 10px; }
.q-help-wrap .link { font-size: 12.5px; color: var(--faint); }
.q-help-wrap .link:hover { color: var(--gold); }
label.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); cursor: pointer; white-space: nowrap; }
label.check input[type=text] { min-width: 0; }
.forms-perm { padding: 4px 10px; border: 1px solid var(--line-soft); border-radius: 6px; }
.forms-perm:has(input:checked) { border-color: rgba(227, 192, 111, 0.5); color: var(--gold); }
.form-row .grow { min-width: 0; }
.form-count { display: flex; flex-direction: column; align-items: center; min-width: 64px; text-decoration: none; line-height: 1.1; }
.form-count b { font: 600 24px var(--serif); color: var(--gold); }
.form-count span { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.1em; }
.tag.form-status.open { color: var(--ok); border-color: rgba(140, 199, 154, 0.5); }
.tag.form-status.draft { color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line-soft); border-radius: 7px; overflow: hidden; }
.seg button { font: 600 13px var(--sans); color: var(--muted); background: none; border: 0; padding: 7px 14px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-soft); }
.seg button.on { background: rgba(227, 192, 111, 0.16); color: var(--gold); }
.form-head .eyebrow a { text-decoration: none; }
.save-state { font-size: 13px; color: var(--faint); }
.save-state.dirty, .save-state.saving { color: var(--muted); }
.save-state.saved::before { content: "✓ "; color: var(--ok); }
.save-state.error { color: var(--danger); max-width: 360px; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.form-side { position: sticky; top: calc(var(--bar) + 16px); }
.form-side .side-foot { display: flex; gap: 8px; justify-content: space-between; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.form-side label.check { white-space: normal; align-items: flex-start; }
.form-intro { border-top: 3px solid var(--gold); margin-bottom: 14px; }
.form-title-input { font: 600 30px var(--serif) !important; background: transparent !important; border-color: transparent !important; padding: 4px 6px !important; margin-bottom: 6px; }
.form-title-input:hover, .form-title-input:focus { border-color: var(--line-soft) !important; }
.form-intro textarea { min-height: 50px; }
.q-list { display: grid; gap: 12px; }
.q-card { padding: 14px 16px 16px; border-left: 3px solid transparent; transition: border-color .15s; }
.q-card:focus-within { border-left-color: var(--gold); }
.q-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.q-num { font: 600 18px var(--serif); color: var(--gold); min-width: 20px; }
.q-kind { width: auto !important; }
.q-title { font-weight: 600; font-size: 15.5px; margin-bottom: 6px; }
.q-help { min-height: 34px !important; font-size: 13.5px; color: var(--muted); margin-bottom: 10px; overflow: hidden; }
.btn.icon.danger { border-color: transparent; }
.opt-list { display: grid; gap: 6px; }
.opt-row { display: flex; align-items: center; gap: 10px; }
.opt-mark { width: 15px; height: 15px; flex: none; border: 1.5px solid var(--faint); border-radius: 50%; }
.opt-mark.multi { border-radius: 3px; }
.opt-mark.dropdown { border: 0; font-size: 12px; }
.opt-x { font-size: 18px; color: var(--faint); padding: 0 6px; }
.opt-x:disabled { visibility: hidden; }
.opt-tools { flex-wrap: wrap; margin-top: 4px; gap: 14px; }
input.tiny, select.tiny { width: 64px !important; padding: 4px 6px; }
input.tiny.wide { width: 110px !important; }
.scale-edit label.grow input { flex: 1; }
.scale-preview { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.scale-preview span, .preview-pair span { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 10px; border: 1px solid var(--line-soft); border-radius: 6px; color: var(--faint); font-size: 13px; }
.preview-line { height: 34px; border-bottom: 1px dashed var(--line-soft); color: var(--faint); font-size: 13px; padding-top: 8px; max-width: 60%; }
.preview-line.tall { height: 64px; max-width: none; }
.preview-line.short { max-width: 180px; }
.add-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--radius); }
.results-bar { margin: -6px 0 18px; flex-wrap: wrap; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-tile { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.stat-tile b { font: 600 30px/1.1 var(--serif); color: var(--ink); }
.chart-card, .result-card { margin-bottom: 14px; }
.chart-card h3 { margin: 0 0 10px; font-size: 15px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: rgba(255, 255, 255, 0.06); stroke-width: 1; }
.chart .base { stroke: rgba(255, 255, 255, 0.22); stroke-width: 1; }
.chart .axis { fill: var(--faint); font: 9.5px var(--sans); }
.chart .axis.strong { fill: var(--muted); font-weight: 600; font-size: 12.5px; }
.chart .value { fill: var(--ink); font: 600 12px var(--sans); }
.chart .mark { fill: var(--gold); }
.chart .hit-area { fill: transparent; }
.chart .hit { cursor: default; outline: none; }
.chart .hit:hover .mark, .chart .hit:focus .mark { fill: #f2d690; }
.chart .hit:hover .hit-area, .chart .hit:focus .hit-area { fill: rgba(255, 255, 255, 0.035); }
.scale-chart { max-width: 560px; }
.chart-tip { position: fixed; z-index: 90; pointer-events: none; background: #0b0f1c; border: 1px solid var(--line); color: var(--ink); font-size: 12.5px; padding: 6px 10px; border-radius: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45); white-space: nowrap; }
.result-head { display: flex; align-items: baseline; gap: 10px; }
.result-head h3 { margin: 0; font-size: 16px; flex: 1; }
.hbars { display: grid; gap: 10px; margin: 10px 0 6px; max-width: 680px; }
.hbar { outline: none; border-radius: 4px; }
.hbar-label { display: flex; justify-content: space-between; gap: 14px; font-size: 14px; margin-bottom: 4px; }
.hbar-num { color: var(--muted); white-space: nowrap; }
.hbar-num b { color: var(--ink); }
.hbar-track { height: 10px; background: rgba(255, 255, 255, 0.05); border-radius: 0 5px 5px 0; }
.hbar-fill { height: 100%; min-width: 2px; background: rgba(227, 192, 111, 0.55); border-radius: 0 4px 4px 0; transition: width .4s; }
.hbar.lead .hbar-fill { background: var(--gold); }
.hbar:hover .hbar-fill, .hbar:focus .hbar-fill { background: #f2d690; }
.stat-inline { gap: 28px; margin: 8px 0 6px; }
.fig { display: flex; flex-direction: column; line-height: 1; }
.fig b { font: 600 46px var(--serif); color: var(--gold); }
.fig.small b { font-size: 28px; color: var(--ink); }
.fig span { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.scale-ends { max-width: 560px; }
.eyebrow.sub { font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; margin: 16px 0 8px; }
.eyebrow.sub::before { width: 20px; }
.said { display: inline-flex; gap: 4px; padding: 4px 10px; border: 1px solid var(--line-soft); border-radius: 14px; font-size: 13px; }
.said b { color: var(--gold); }
.answers { display: grid; gap: 8px; max-height: 520px; overflow: auto; }
.answer { padding: 10px 12px; background: rgba(255, 255, 255, 0.03); border-radius: 6px; border-left: 2px solid var(--line); }
.answer p { margin: 0 0 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.response { margin-bottom: 12px; }
.response-head { margin-bottom: 10px; }
.qa { margin: 0; display: grid; grid-template-columns: minmax(160px, 34%) 1fr; gap: 8px 18px; }
.qa dt { color: var(--muted); font-size: 13.5px; }
.qa dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.pager { justify-content: center; margin: 18px 0; }
.link.danger { color: var(--danger); }
@media (max-width: 900px) {
  .form-layout { grid-template-columns: 1fr; }
  .form-side { position: static; order: -1; }
  .qa { grid-template-columns: 1fr; gap: 2px; }
  .qa dd { margin-bottom: 10px; }
  .form-row { flex-wrap: wrap; }
}

/* ---------- Roles ---------- */
.role-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px 2px 7px; border-radius: 10px; color: var(--ink);
  background: color-mix(in srgb, var(--role) 18%, transparent); border: 1px solid color-mix(in srgb, var(--role) 55%, transparent); white-space: nowrap; }
.role-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--role); }
.role-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.role-dot.big { width: 13px; height: 13px; margin-right: 10px; }
.role-pick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.role-pick.vertical { display: grid; gap: 2px; min-width: 200px; }
.role-toggle { font: 600 12.5px var(--sans); padding: 5px 11px; border-radius: 14px; cursor: pointer; color: var(--muted); background: transparent; border: 1px solid var(--line-soft); }
.role-toggle:hover { border-color: var(--role); color: var(--ink); }
.role-toggle.on { color: var(--ink); background: color-mix(in srgb, var(--role) 22%, transparent); border-color: var(--role); }
.role-note { margin-left: 4px; }
.field-label { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.pick-list { max-height: 300px; overflow: auto; margin-top: 8px; }

/* ---------- Admin ---------- */
.admin-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 22px; align-items: start; }
.admin-side { position: sticky; top: calc(var(--bar) + 16px); display: grid; gap: 2px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 8px; }
.side-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; font: 500 14px var(--sans); color: var(--muted); background: none; border: 0; border-radius: 6px; padding: 8px 10px; cursor: pointer; }
.side-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--ink); }
.side-item.on { background: rgba(227, 192, 111, 0.14); color: var(--gold); }
.side-item .count { margin-left: auto; font-size: 12px; color: var(--faint); }
.side-item.add { color: var(--faint); }
.side-label { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); margin: 12px 10px 4px; }
.admin-top { margin-bottom: 12px; flex-wrap: wrap; }
.admin-title { font-size: 28px; margin: 0; display: flex; align-items: center; }
.admin-search { width: 280px !important; }
.admin-row .who { min-width: 160px; }
.admin-row .who .tag { margin-left: 8px; vertical-align: middle; }
.role-cell { display: flex; flex-wrap: wrap; gap: 4px; max-width: 320px; background: none; border: 1px dashed transparent; border-radius: 6px; padding: 4px 6px; cursor: pointer; }
.role-cell:hover { border-color: var(--line); }
.menu-teams:empty { display: none; }
.menu-teams { border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; padding-bottom: 6px; max-height: 50vh; overflow: auto; }
.menu-label { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); margin: 4px 12px 4px; }
.menu a.menu-team { display: flex; align-items: center; gap: 9px; }

/* ---------- Docs ---------- */
.board-area.docs-area { overflow: hidden; }
.docs-wrap { display: grid; grid-template-columns: 260px minmax(0, 1fr); height: 100%; }
.docs-side { border-right: 1px solid var(--line-soft); background: rgba(13, 18, 32, 0.82); overflow: auto; padding: 14px 10px 30px; }
.side-top { display: flex; gap: 6px; margin-bottom: 12px; }
.docs-search { flex: 1; min-width: 0; padding-left: 30px !important; background: rgba(10, 14, 26, 0.75) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='8.5' cy='8.5' r='5.5' fill='none' stroke='%236f7690' stroke-width='1.8'/%3E%3Cpath d='m13 13 4 4' stroke='%236f7690' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") 9px center / 15px no-repeat !important; }
.docs-results { display: grid; gap: 4px; }
.docs-hit { text-align: left; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line-soft); border-radius: 6px; padding: 8px 10px; cursor: pointer; color: var(--ink); display: grid; gap: 2px; }
.docs-hit:hover { border-color: var(--line); }
.docs-hit .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-tree { display: grid; gap: 1px; }
.tree-label { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); margin: 14px 6px 4px 8px; }
.tree-none { margin: 4px 8px; }
.tree-row { --depth: 0; display: flex; align-items: center; gap: 7px; width: 100%; min-height: 30px; text-align: left; background: none; border: 0; border-radius: 6px; padding: 4px 6px 4px calc(6px + var(--depth) * 16px); cursor: pointer; color: var(--muted); font: 500 13.5px var(--sans); }
.tree-row:hover { background: rgba(255, 255, 255, 0.05); color: var(--ink); }
.tree-row.on { background: rgba(227, 192, 111, 0.13); color: var(--gold); }
.tree-row.home { color: var(--ink); font-weight: 600; padding-left: 10px; }
.tree-row.folder { color: var(--ink); font-weight: 600; padding-left: calc(2px + var(--depth) * 16px); }
.tree-row.doc { padding-left: calc(24px + var(--depth) * 16px); }
.tree-row.drop, .folder-tile.drop { background: rgba(227, 192, 111, 0.2); outline: 1px dashed var(--gold); }
.tree-row.doc[draggable=true] { cursor: grab; }
.tree-empty { --depth: 0; padding: 3px 0 5px calc(28px + var(--depth) * 16px); font-size: 12.5px; color: var(--faint); }
.tree-toggle { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; background: none; border: 0; color: var(--faint); cursor: pointer; padding: 0; flex: none; transition: transform .12s; }
.tree-toggle.open { transform: rotate(90deg); }
.tree-toggle:hover { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
.ico { display: inline-grid; place-items: center; flex: none; color: var(--faint); }
.ico.folder { color: var(--folder, var(--gold)); }
.tree-row.doc.on .ico { color: var(--gold); }
.tree-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-tag { flex: none; font-size: 11px; color: var(--faint); }
.tree-lock { font-size: 10.5px; opacity: 0.6; }
.tree-acts { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.tree-row:hover .tree-acts, .tree-row:focus-within .tree-acts { opacity: 1; }
.tree-act { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; background: none; border: 0; color: var(--muted); cursor: pointer; font: 600 15px var(--sans); padding: 0; }
.tree-act:hover { background: rgba(255, 255, 255, 0.1); color: var(--gold); }
.docs-main { overflow: auto; padding: 26px 40px 80px; }
.wiki-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 34px; align-items: start; max-width: 1320px; }
.wiki-main { min-width: 0; }
.wiki-rail { position: sticky; top: 0; display: grid; gap: 14px; }
.rail-new { width: 100%; }
.rail-box { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 12px 12px 10px; display: grid; gap: 1px; }
.rail-title { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0 4px 6px; }
.rail-row { display: grid; gap: 1px; text-align: left; background: none; border: 0; border-radius: 5px; padding: 6px; cursor: pointer; color: var(--ink); }
.rail-row:hover { background: rgba(255, 255, 255, 0.05); }
.rail-row:hover .rail-name, .rail-row.on .rail-name { color: var(--gold); }
.rail-name { font: 500 13.5px var(--sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-count { margin: 4px 6px 0; }
.docs-hero { border-left: 3px solid var(--team); padding: 2px 0 2px 22px; margin-bottom: 8px; }
.docs-hero h1 { font-size: 48px; line-height: 1.05; margin: 0 0 10px; }
.docs-hero .lede { color: var(--muted); max-width: 720px; margin: 0 0 10px; white-space: pre-wrap; }
.docs-hero.has-doc { border-left: 0; padding: 0; }
.home-doc-head h1 { font-size: 46px; margin: 0 0 12px; }
.wiki-h-row { margin-top: 30px; }
.wiki-h { font-family: var(--serif); font-size: 26px; margin: 30px 0 12px; }
.wiki-h-row .wiki-h { margin: 0 0 12px; }
.wiki-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.wiki-card { display: flex; flex-direction: column; text-align: left; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 10px; overflow: hidden; cursor: pointer; color: var(--ink); padding: 0; transition: border-color .15s, transform .15s; }
.wiki-card:hover { border-color: var(--line); transform: translateY(-2px); }
.wiki-cover { height: 110px; background: center / cover no-repeat #0c1120; }
.wiki-cover.blank { display: grid; place-items: center; height: 54px; background: linear-gradient(135deg, color-mix(in srgb, var(--folder, var(--gold)) 22%, #0f1424), #0f1424); color: color-mix(in srgb, var(--folder, var(--gold)) 70%, white); }
.wiki-text { display: grid; gap: 4px; padding: 12px 14px 14px; }
.wiki-text b { font-size: 15px; }
.wiki-lead { color: var(--muted); font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.folder-tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-bottom: 18px; }
.folder-tile { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; padding: 14px 16px; border-radius: 10px; cursor: pointer;
  background: linear-gradient(135deg, color-mix(in srgb, var(--folder) 12%, var(--panel-solid)), var(--panel-solid)); border: 1px solid color-mix(in srgb, var(--folder) 30%, transparent); color: var(--ink); transition: border-color .15s, transform .15s; }
.folder-tile:hover { border-color: var(--folder); transform: translateY(-2px); }
.folder-tile .ico.big { grid-row: span 2; }
.folder-tile .ico.big svg { width: 30px; height: 30px; }
.ft-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ft-meta { font-size: 12.5px; color: var(--muted); }
.folder-head { display: flex; align-items: center; gap: 16px; margin: 6px 0 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.folder-head h1 { font-size: 40px; margin: 0 0 6px; }
.folder-head .ico.huge svg { width: 46px; height: 46px; }
.access { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; }
.doc-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.doc-crumbs .link { color: var(--muted); }
.doc-crumbs .link:hover { color: var(--gold); }
.doc-banner { height: 220px; border-radius: 12px; background: center / cover no-repeat #0c1120; margin: 4px 0 20px; border: 1px solid var(--line-soft); }
.doc-head { display: flex; align-items: flex-start; gap: 16px; justify-content: space-between; }
.doc-head h1 { font-size: 44px; line-height: 1.08; margin: 0; overflow-wrap: anywhere; }
.doc-meta { display: flex; align-items: center; gap: 4px; margin: 10px 0 22px; padding-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.doc-meta .avatar { width: 18px; height: 18px; }
.doc-body { font-size: 15.5px; line-height: 1.7; max-width: 860px; }
.doc-body::after { content: ""; display: block; clear: both; }
.doc-body h3 { font: 600 28px/1.2 var(--serif); margin: 30px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line-soft); scroll-margin-top: 20px; overflow: hidden; }
.doc-body h4 { font-size: 18px; margin: 22px 0 8px; scroll-margin-top: 20px; }
.doc-body h5 { font-size: 15.5px; margin: 18px 0 6px; }
.doc-body p { margin: 0 0 14px; }
.doc-body ul, .doc-body ol { margin: 0 0 14px; }
.doc-body li { margin-bottom: 4px; }
.doc-toc .toc-row { text-align: left; background: none; border: 0; color: var(--muted); font: 13px var(--sans); padding: 4px 6px; cursor: pointer; border-radius: 4px; }
.doc-toc .toc-row:hover { color: var(--gold); background: rgba(255, 255, 255, 0.04); }
.doc-toc .toc-row.h4 { padding-left: 18px; font-size: 12.5px; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; clear: both; }
.md-table { overflow-x: auto; margin: 0 0 14px; }
.md table { border-collapse: collapse; min-width: 50%; font-size: 14px; }
.md th, .md td { border: 1px solid var(--line-soft); padding: 7px 12px; text-align: left; vertical-align: top; }
.md th { background: rgba(227, 192, 111, 0.08); font-weight: 700; color: var(--ink); }
.md figure.md-img { margin: 6px 0 18px; }
.md .md-img img { display: block; max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line-soft); cursor: zoom-in; background: #0c1120; }
.md figure.md-img figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; font-style: italic; }
.md figure.md-img.center { text-align: center; }
.md figure.md-img.center img { margin: 0 auto; max-width: min(100%, 560px); }
.md figure.md-img.left { float: left; width: min(45%, 340px); margin: 4px 22px 12px 0; }
.md figure.md-img.right { float: right; width: min(45%, 340px); margin: 4px 0 12px 22px; }
.md figure.md-img.small img { max-width: 220px; }
.md figure.md-img.wide img { width: 100%; max-height: 300px; object-fit: cover; }
.md .md-img.inline { display: inline-block; vertical-align: middle; }
.md .md-img.inline img { max-height: 1.6em; border: 0; border-radius: 3px; }
.md .md-img.broken img { min-height: 60px; min-width: 120px; opacity: 0.4; }
.editor-page { max-width: 1320px; }
.doc-title-input { font: 600 36px var(--serif) !important; flex: 1; background: transparent !important; border-color: var(--line-soft) !important; }
.cover-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; margin: 12px 0 0; }
.cover-row .field-label { margin: 0; }
.doc-tools { display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 0 8px; align-items: center; }
.doc-tools .tool { min-width: 34px; height: 32px; padding: 0 8px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-soft); border-radius: 6px; color: var(--ink); cursor: pointer; font-weight: 700; }
.doc-tools .tool:hover { border-color: var(--gold); color: var(--gold); }
.tool-select { width: auto !important; height: 32px; padding: 0 8px !important; margin-left: 6px; }
.doc-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.doc-input { font: 14px/1.6 ui-monospace, "SFMono-Regular", Consolas, monospace !important; min-height: 420px; resize: vertical; }
.doc-preview { border: 1px solid var(--line-soft); border-radius: 6px; padding: 14px 18px; min-height: 420px; background: rgba(255, 255, 255, 0.02); overflow: auto; font-size: 14.5px; }
.history-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; margin-top: 20px; align-items: start; }
.history-list { display: grid; gap: 2px; max-height: 70vh; overflow: auto; }
.history-row { display: flex; align-items: center; gap: 8px; text-align: left; background: none; border: 0; border-radius: 6px; padding: 7px 9px; color: var(--muted); cursor: pointer; font: 13.5px var(--sans); }
.history-row:hover { background: rgba(255, 255, 255, 0.05); }
.history-row.on { background: rgba(227, 192, 111, 0.14); color: var(--gold); }
.history-row .avatar { width: 20px; height: 20px; }
.history-view { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px 22px; }
.history-bar { margin-bottom: 12px; }
.history-title { font-size: 26px; margin: 0 0 12px; }
.hook-events { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.menu-item.danger { color: var(--danger); }
@media (max-width: 1100px) {
  .wiki-layout { grid-template-columns: 1fr; }
  .wiki-rail { position: static; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}
@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { position: static; display: flex; overflow-x: auto; }
  .admin-side .side-item { width: auto; white-space: nowrap; }
  .side-label { display: none; }
  .admin-search { width: 100% !important; }
  .docs-wrap { grid-template-columns: 1fr; height: auto; }
  .board-area.docs-area { overflow: auto; }
  .docs-side { border-right: 0; border-bottom: 1px solid var(--line-soft); max-height: 40vh; }
  .docs-main { padding: 20px 18px 60px; }
  .doc-editor { grid-template-columns: 1fr; }
  .doc-preview { display: none; }
  .history-layout { grid-template-columns: 1fr; }
  .md figure.md-img.left, .md figure.md-img.right { float: none; width: auto; margin: 6px 0 16px; }
  .hook-events { grid-template-columns: 1fr; }
  .tree-acts { opacity: 1; }
}
}
div.field { margin-bottom: 14px; }
