/* Glynshire Tickets dashboard
   Welsh slate base, Glynshire blue as the working colour, Welsh red reserved for urgent/emergency. */
:root {
  --brand: #2563C9;
  --accent: #C8102E;
  --bg: #1B2029;
  --bg-2: #161A22;
  --panel: #222935;
  --panel-2: #2A3240;
  --line: #354052;
  --line-soft: #2C3544;
  --text: #E7EBF1;
  --muted: #95A0B2;
  --faint: #6D788B;
  --ok: #3FA46A;
  --warn: #E0A33A;
  --bad: #E0475B;
  --navy: #0F2447;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 10px 30px rgba(5, 10, 20, .35);
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: #8DB4F5; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-stretch: 92%; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
code, pre { font-family: 'JetBrains Mono', Consolas, monospace; font-size: .86em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .84rem; }
.center { text-align: center; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid #8DB4F5; outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--brand) 45%, transparent); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 248px 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
.sidebar { grid-row: 1 / 3; background: var(--navy); border-right: 1px solid #0a1a36; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 700; font-size: 1.05rem; font-stretch: 90%; }
.side-brand img, .mark { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; }
.mark { display: grid; place-items: center; background: var(--brand); color: #fff; font-size: .8rem; font-weight: 800; letter-spacing: .02em; box-shadow: inset 0 -3px 0 var(--accent); }
.side-brand small { display: block; font-weight: 500; font-size: .74rem; color: #93A6C6; font-stretch: 100%; }
.nav { padding: 6px 10px 20px; flex: 1; }
.nav-group { margin-top: 14px; }
.nav-group > span { display: block; padding: 0 10px 4px; font-size: .74rem; color: #7F93B5; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: #C9D5EA; font-size: .92rem; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(255,255,255,.1); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.nav a .ico { width: 18px; text-align: center; opacity: .85; }
.nav a .count { margin-left: auto; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; padding: 0 7px; border-radius: 99px; line-height: 18px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); color: #C9D5EA; font-size: .88rem; }
.side-user img { width: 30px; height: 30px; border-radius: 50%; }
.side-user .who { flex: 1; min-width: 0; }
.side-user .who b { display: block; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user a { color: #93A6C6; font-size: .8rem; }

/* Signature: control-room status strip */
.strip { grid-column: 2; display: flex; align-items: stretch; gap: 0; background: var(--bg-2); border-bottom: 1px solid var(--line-soft); min-height: 46px; position: sticky; top: 0; z-index: 20; }
.strip.emergency { box-shadow: inset 0 -3px 0 var(--accent); }
.strip .menu-btn { display: none; }
.strip-items { display: flex; flex: 1; overflow-x: auto; scrollbar-width: none; }
.strip-item { display: flex; align-items: center; gap: 8px; padding: 0 16px; border-right: 1px solid var(--line-soft); white-space: nowrap; font-size: .86rem; color: var(--muted); }
.strip-item b { color: var(--text); font-weight: 600; }
.lamp { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.lamp.open { background: var(--ok); box-shadow: 0 0 0 3px rgba(63,164,106,.18); }
.lamp.reduced { background: var(--warn); box-shadow: 0 0 0 3px rgba(224,163,58,.18); }
.lamp.closed { background: #6D788B; }
.lamp.emergency { background: var(--accent); box-shadow: 0 0 0 3px rgba(200,16,46,.25); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(200,16,46,.05); } }
.strip-live { margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 0 16px; font-size: .8rem; color: var(--faint); }
.strip-live .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.strip-live.on .dot { background: var(--ok); }

.main { grid-column: 2; padding: 26px 32px 120px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 240px; }
.page-head p { margin: 0; color: var(--muted); max-width: 70ch; }
.crumbs { font-size: .84rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* ---------------------------------------------------------------- surfaces */
.card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px 20px; }
.card + .card, .section + .section { margin-top: 16px; }
.section { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.section > header { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); }
.section > header h2, .section > header h3 { margin: 0; }
.section > header p { margin: 0; color: var(--muted); font-size: .86rem; }
.section > header .grow { flex: 1; }
.section > .body { padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; align-items: start; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row .grow { flex: 1; }
hr { border: 0; border-top: 1px solid var(--line-soft); margin: 18px 0; }

/* ---------------------------------------------------------------- figures */
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.figure { padding: 16px 20px; border-right: 1px solid var(--line-soft); }
.figure:last-child { border-right: 0; }
.figure .n { font-size: 1.9rem; font-weight: 700; font-stretch: 88%; line-height: 1.1; font-variant-numeric: tabular-nums; }
.figure .l { color: var(--muted); font-size: .86rem; }
.figure.alert .n { color: #FF8193; }

/* ---------------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: 600 .9rem var(--font); cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { border-color: #4A5870; background: #313b4b; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { background: transparent; border-color: rgba(224,71,91,.5); color: #FF8193; }
.btn.danger:hover { background: rgba(224,71,91,.12); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel-2); }
.btn.small { height: 30px; padding: 0 10px; font-size: .84rem; }
.btn.big { height: 46px; padding: 0 22px; font-size: 1rem; }
.btn.discord { background: #5865F2; color: #fff; border: 0; }
.btn.icon { width: 36px; padding: 0; }

label.field { display: block; }
label.field > span, .field-label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: 6px; color: #CBD3DF; }
.field-hint { display: block; color: var(--faint); font-size: .8rem; margin-top: 5px; font-weight: 400; }
input, select, textarea { width: 100%; background: var(--bg-2); border: 1px solid var(--line); color: var(--text); border-radius: var(--radius-sm); padding: 8px 11px; font: 400 .92rem var(--font); }
input[type=checkbox], input[type=radio] { width: auto; }
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
input[type=color] { width: 44px; height: 36px; padding: 3px; cursor: pointer; }
input[type=search] { padding-left: 34px; background: var(--bg-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2395A0B2' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3 3'/%3E%3C/svg%3E") 11px center no-repeat; }
.req { color: #FF8193; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.fields { display: grid; gap: 16px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields .full { grid-column: 1 / -1; }

.toggle { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.toggle input { display: none; }
.toggle .sw { flex: none; width: 38px; height: 22px; border-radius: 99px; background: #3A4558; position: relative; transition: background .15s; margin-top: 1px; }
.toggle .sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle input:checked + .sw { background: var(--brand); }
.toggle input:checked + .sw::after { transform: translateX(16px); }
.toggle .t b { display: block; font-weight: 600; font-size: .92rem; }
.toggle .t small { color: var(--faint); font-size: .8rem; }

.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--muted); font: 600 .84rem var(--font); padding: 5px 12px; border-radius: 4px; cursor: pointer; }
.seg button.on { background: var(--panel-2); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset; }

/* multi pickers */
.picker { position: relative; }
.picker .chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 38px; padding: 5px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: text; }
.picker .chips:focus-within { border-color: var(--brand); }
.picker .chips input { flex: 1; min-width: 120px; border: 0; background: transparent; padding: 3px 5px; box-shadow: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 99px; padding: 1px 4px 1px 10px; font-size: .84rem; }
.chip .sw { width: 9px; height: 9px; border-radius: 50%; }
.chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 4px; }
.chip button:hover { color: #FF8193; }
.chip img { width: 18px; height: 18px; border-radius: 50%; margin-left: -6px; }
.dropdown { position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; right: 0; max-height: 260px; overflow-y: auto; background: #252D3A; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 4px; }
.dropdown button { display: flex; width: 100%; align-items: center; gap: 8px; border: 0; background: transparent; color: var(--text); text-align: left; padding: 7px 9px; border-radius: 4px; font: .9rem var(--font); cursor: pointer; }
.dropdown button:hover, .dropdown button.hl { background: var(--panel-2); }
.dropdown .group { padding: 6px 9px 2px; font-size: .74rem; color: var(--faint); font-weight: 600; }
.dropdown img { width: 22px; height: 22px; border-radius: 50%; }
.dropdown .empty { padding: 8px 10px; color: var(--faint); font-size: .86rem; }

/* ---------------------------------------------------------------- tables & lists */
table.list { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.list th { text-align: left; font-weight: 600; font-size: .8rem; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: rgba(255,255,255,.025); }
table.list tr:last-child td { border-bottom: 0; }
.who { display: flex; align-items: center; gap: 9px; min-width: 0; }
.who img { width: 26px; height: 26px; border-radius: 50%; flex: none; background: var(--panel-2); }
.who span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; text-transform: capitalize; }
.pill.status-open, .pill.accepted, .pill.running { color: #7FD6A1; border-color: rgba(63,164,106,.4); background: rgba(63,164,106,.1); }
.pill.status-held, .pill.pending, .pill.reduced { color: #F1C27A; border-color: rgba(224,163,58,.4); background: rgba(224,163,58,.1); }
.pill.status-closed, .pill.ended, .pill.cancelled, .pill.closed { color: var(--muted); }
.pill.denied, .pill.urgent { color: #FF8193; border-color: rgba(224,71,91,.45); background: rgba(224,71,91,.1); }
.pill.high { color: #F4A261; border-color: rgba(244,162,97,.4); background: rgba(244,162,97,.08); }
.pill.low { color: #8FB9A8; }
.pill.normal { color: #8DB4F5; border-color: rgba(141,180,245,.35); background: rgba(141,180,245,.07); }
.pill.external { color: #B8A2F2; border-color: rgba(184,162,242,.4); background: rgba(184,162,242,.08); text-transform: none; }
.prio-bar { width: 4px; align-self: stretch; border-radius: 2px; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state h3 { color: var(--text); }
.item-list > .item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.item-list > .item:last-child { border-bottom: 0; }
.item-list > .item .grow { flex: 1; min-width: 0; }
.item-list > .item h3 { margin: 0; }
.item-list > .item p { margin: 2px 0 0; color: var(--muted); font-size: .86rem; }

/* ---------------------------------------------------------------- tickets workspace */
.desk { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 0; height: calc(100vh - 210px); min-height: 520px; border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.desk-list { border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; min-height: 0; }
.desk-filters { padding: 12px; border-bottom: 1px solid var(--line-soft); display: grid; gap: 8px; }
.desk-filters .row { gap: 6px; }
.desk-filters select { width: auto; flex: 1; padding: 6px 8px; font-size: .84rem; }
.queue { overflow-y: auto; flex: 1; }
.q { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.q:hover { background: rgba(255,255,255,.025); }
.q.active { background: color-mix(in srgb, var(--brand) 14%, transparent); }
.q .prio-bar { width: 3px; }
.q .body { flex: 1; min-width: 0; }
.q .top { display: flex; gap: 8px; align-items: baseline; }
.q .top b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q .top .t { margin-left: auto; color: var(--faint); font-size: .78rem; white-space: nowrap; }
.q .sub { color: var(--muted); font-size: .82rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 3px; }
.q .waiting { color: #F1C27A; font-weight: 600; }
.desk-view { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.desk-head { padding: 14px 18px; border-bottom: 1px solid var(--line-soft); display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.desk-head h2 { margin: 0; }
.desk-head .grow { flex: 1; min-width: 200px; }
.desk-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; min-height: 0; flex: 1; }
.desk-main { display: flex; flex-direction: column; min-height: 0; }
.convo { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 0 18px; background: #262C38; }
.desk-side { border-left: 1px solid var(--line-soft); overflow-y: auto; padding: 16px; font-size: .88rem; }
.desk-side h4 { font-size: .8rem; color: var(--muted); font-weight: 600; margin: 16px 0 6px; }
.desk-side h4:first-child { margin-top: 0; }
.desk-side .kv { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; }
.desk-side .kv span:first-child { color: var(--muted); }
.composer { border-top: 1px solid var(--line-soft); padding: 12px 16px; display: flex; gap: 10px; align-items: flex-end; background: var(--panel); }
.composer textarea { min-height: 44px; max-height: 200px; }
.log-line { font-size: .8rem; color: var(--muted); padding: 3px 0; border-left: 2px solid var(--line); padding-left: 8px; margin-bottom: 4px; }

/* Discord-style messages (dashboard + transcripts) */
.discord { background: #262C38; border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 10px 0 16px; }
.d-msg { display: flex; gap: 14px; padding: 6px 20px 2px; position: relative; }
.d-msg:not(.grouped) { margin-top: 12px; }
.d-msg:hover { background: rgba(0,0,0,.08); }
.d-msg.deleted { opacity: .55; }
.d-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; background: var(--panel-2); }
.d-gutter { width: 40px; flex: none; text-align: right; }
.d-time-hover { visibility: hidden; font-size: .68rem; color: var(--faint); }
.d-msg:hover .d-time-hover { visibility: visible; }
.d-body { flex: 1; min-width: 0; }
.d-head { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.d-name { font-weight: 600; color: #F2F3F5; }
.d-time { font-size: .74rem; color: var(--faint); }
.tag { font-size: .62rem; font-weight: 700; padding: 1px 5px; border-radius: 3px; position: relative; top: -1px; }
.tag.bot { background: #5865F2; color: #fff; }
.tag.staff { background: color-mix(in srgb, var(--brand) 30%, transparent); color: #BFD3F8; }
.tag.dash { background: rgba(63,164,106,.2); color: #8EDDAE; }
.d-content { color: #DBDEE1; overflow-wrap: anywhere; line-height: 1.45; }
.d-content pre { background: #1E222B; border: 1px solid #1a1d24; border-radius: 4px; padding: 8px; overflow-x: auto; white-space: pre-wrap; }
.d-content code { background: #1E222B; padding: 1px 4px; border-radius: 3px; }
.d-content blockquote { margin: 2px 0; border-left: 3px solid #4E5058; padding-left: 10px; }
.d-content h3, .d-content h4, .d-content h5 { margin: 6px 0 2px; }
.mention { background: rgba(88,101,242,.3); color: #C9CDFB; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.emoji { width: 22px; height: 22px; vertical-align: -5px; }
.spoiler { background: #1E1F22; color: transparent; border-radius: 3px; cursor: pointer; }
.spoiler.shown { color: inherit; background: rgba(255,255,255,.08); }
.ts { background: rgba(255,255,255,.06); border-radius: 3px; padding: 0 3px; }
.d-embed { margin-top: 6px; max-width: 520px; background: #2B2D31; border-left: 4px solid #4f5660; border-radius: 4px; padding: 10px 14px 12px; }
.d-embed-author { font-size: .84rem; font-weight: 600; margin-bottom: 4px; }
.d-embed-title { font-weight: 700; color: #fff; margin-bottom: 4px; }
.d-embed-desc { font-size: .9rem; color: #DBDEE1; overflow-wrap: anywhere; }
.d-embed-fields { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; }
.d-field { flex: 1 1 100%; min-width: 0; font-size: .88rem; }
.d-field.inline { flex: 1 1 28%; }
.d-field-name { font-weight: 700; color: #fff; margin-bottom: 2px; }
.d-field-value { color: #DBDEE1; overflow-wrap: anywhere; }
.d-embed-img { max-width: 100%; border-radius: 4px; margin-top: 10px; }
.d-embed-thumb { float: right; width: 80px; height: 80px; object-fit: cover; border-radius: 4px; margin: 0 0 8px 12px; }
.d-embed-footer { font-size: .74rem; color: #B5BAC1; margin-top: 8px; }
.d-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.d-btn { font: 500 .84rem var(--font); padding: 6px 14px; border-radius: 3px; background: #4E5058; color: #fff; display: inline-flex; gap: 6px; align-items: center; }
.d-btn.primary { background: #5865F2; } .d-btn.success { background: #248046; } .d-btn.danger { background: #DA373C; }
.d-select { margin-top: 8px; max-width: 420px; background: #1E1F22; border-radius: 4px; padding: 10px 12px; color: #949BA4; font-size: .88rem; display: flex; justify-content: space-between; }
.att-img { max-width: 360px; max-height: 280px; border-radius: 6px; margin-top: 6px; display: block; }
.att-file { display: inline-flex; gap: 8px; margin-top: 6px; background: #2B2D31; border: 1px solid #1f2126; padding: 10px 14px; border-radius: 6px; }

/* ---------------------------------------------------------------- editors */
.editor-preview { position: sticky; top: 66px; }
.preview-box { background: #313338; border-radius: var(--radius); padding: 16px; border: 1px solid #1f2126; }
.preview-box .bot { display: flex; gap: 12px; }
.preview-box .bot img, .preview-box .bot .av { width: 40px; height: 40px; border-radius: 50%; background: var(--brand); flex: none; }
.repeat { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); }
.repeat + .repeat { margin-top: 10px; }
.repeat > header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; }
.repeat > header .grow { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.repeat > .inner { padding: 4px 14px 16px; border-top: 1px solid var(--line-soft); }
.repeat.collapsed > .inner { display: none; }
.hours-grid { display: grid; grid-template-columns: 60px 1fr; gap: 8px 12px; align-items: center; }
.hours-grid .win { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.hours-grid .win input { width: 88px; }

.savebar { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 140%); display: flex; gap: 12px; align-items: center; background: #0F1A2E; border: 1px solid #2c4169; box-shadow: var(--shadow); border-radius: 12px; padding: 10px 12px 10px 18px; z-index: 80; transition: transform .2s ease; }
.savebar.show { transform: translate(-50%, 0); }
.savebar span { color: #C9D5EA; font-size: .9rem; }

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #11203A; border: 1px solid #2c4169; border-left: 4px solid var(--brand); color: var(--text); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; font-size: .9rem; }
.toast.error { border-left-color: var(--bad); }
.toast.ok { border-left-color: var(--ok); }

.modal-back { position: fixed; inset: 0; background: rgba(5,10,20,.6); display: grid; place-items: center; z-index: 90; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: min(520px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal header { padding: 18px 20px 0; }
.modal .content { padding: 14px 20px; }
.modal footer { padding: 12px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; }

.notice { border-radius: var(--radius-sm); padding: 10px 14px; margin: 12px 0; background: rgba(141,180,245,.08); border: 1px solid rgba(141,180,245,.3); font-size: .9rem; }
.notice.warn { background: rgba(224,163,58,.08); border-color: rgba(224,163,58,.35); }
.notice.error { background: rgba(224,71,91,.08); border-color: rgba(224,71,91,.4); }
.notice.ok { background: rgba(63,164,106,.08); border-color: rgba(63,164,106,.4); }

/* chart */
.chart svg { width: 100%; height: auto; display: block; }
.chart .legend { display: flex; gap: 16px; font-size: .82rem; color: var(--muted); margin-top: 8px; }
.chart .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.bars .bar-row { display: grid; grid-template-columns: 170px 1fr 40px; gap: 10px; align-items: center; font-size: .86rem; padding: 4px 0; }
.bars .track { height: 8px; background: var(--bg-2); border-radius: 4px; overflow: hidden; }
.bars .fill { height: 100%; background: var(--brand); border-radius: 4px; }
.bars .bar-row span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }

/* flow editor */
.flow-wrap { position: relative; height: 620px; background-color: #1A1F28; background-image: radial-gradient(#2D3646 1px, transparent 1px); background-size: 22px 22px; border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.flow-canvas { position: absolute; inset: 0; overflow: auto; }
.flow-inner { position: relative; width: 2400px; height: 1400px; }
.flow-inner svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.flow-inner svg path { fill: none; stroke: #6C8CC7; stroke-width: 2.2; }
.flow-inner svg path.yes { stroke: var(--ok); } .flow-inner svg path.no { stroke: var(--bad); }
.flow-inner svg path.drag { stroke-dasharray: 6 5; stroke: #A7BEE8; }
.node { position: absolute; width: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.25); user-select: none; }
.node.sel { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent); }
.node header { display: flex; gap: 8px; align-items: center; padding: 8px 10px; cursor: grab; border-bottom: 1px solid var(--line-soft); font-weight: 600; font-size: .86rem; border-radius: 10px 10px 0 0; }
.node header .k { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: .8rem; }
.node .desc { padding: 8px 10px; font-size: .8rem; color: var(--muted); min-height: 30px; overflow-wrap: anywhere; }
.node .port { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #1A1F28; border: 2px solid #6C8CC7; cursor: crosshair; }
.node .port.in { left: -8px; top: 12px; }
.node .port.out { right: -8px; }
.node .port.out.yes { border-color: var(--ok); } .node .port.out.no { border-color: var(--bad); }
.node .port-label { position: absolute; right: 12px; font-size: .7rem; color: var(--faint); }
.node.trigger header { background: color-mix(in srgb, var(--brand) 22%, transparent); }
.flow-tools { position: absolute; left: 12px; top: 12px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 5; max-width: calc(100% - 24px); }
.flow-tools .btn { background: rgba(34,41,53,.95); }
.flow-help { position: absolute; right: 12px; bottom: 10px; font-size: .78rem; color: var(--faint); z-index: 5; }

/* standalone pages */
body.standalone { background: var(--bg); }
.topbar { background: var(--navy); padding: 12px 24px; box-shadow: inset 0 -3px 0 var(--accent); }
.topbar .brand { display: inline-flex; gap: 10px; align-items: center; color: #fff; font-weight: 700; font-size: 1.05rem; text-decoration: none; }
.topbar .brand img { width: 30px; height: 30px; border-radius: 7px; }
.standalone-main { max-width: 980px; margin: 0 auto; padding: 28px 20px 80px; }
.eyebrow { color: var(--muted); font-size: .86rem; font-weight: 600; margin-bottom: 4px; }
.login-page .standalone-main { display: grid; place-items: center; min-height: calc(100vh - 60px); }
.login-card { text-align: center; max-width: 420px; width: 100%; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 16px; padding: 36px 32px; }
.login-mark span, .login-mark img { width: 64px; height: 64px; border-radius: 14px; display: inline-grid; place-items: center; background: var(--brand); color: #fff; font-weight: 800; font-size: 1.4rem; box-shadow: inset 0 -5px 0 var(--accent); margin-bottom: 14px; object-fit: cover; }
.login-card .btn { width: 100%; margin-top: 18px; }
.transcript-head .th-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 18px; margin: 16px 0; }
.meta-grid .k, .kv .k { color: var(--muted); font-size: .8rem; }
.kv { margin: 10px 0; }
.answers { margin: 12px 0; background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 10px 14px; }
.answers summary { cursor: pointer; font-weight: 600; }
.transcript-tools { display: flex; gap: 12px; align-items: center; margin: 18px 0 10px; }
.transcript-tools input { max-width: 360px; }
.apply-card, .verify-card { max-width: 680px; margin: 0 auto; }
.verify-card .stack { display: grid; justify-items: center; gap: 14px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .split { grid-template-columns: 1fr; }
  .editor-preview { position: static; }
  .desk-body { grid-template-columns: 1fr; }
  .desk-side { border-left: 0; border-top: 1px solid var(--line-soft); max-height: 240px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .strip, .main { grid-column: 1; }
  .strip .menu-btn { display: grid; place-items: center; width: 46px; border: 0; background: transparent; color: var(--text); font-size: 1.3rem; border-right: 1px solid var(--line-soft); cursor: pointer; }
  .main { padding: 18px 16px 120px; }
  .grid.two, .grid.three, .grid.four, .fields.two, .fields.three { grid-template-columns: 1fr; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figure:nth-child(2) { border-right: 0; }
  .figure:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
  .desk { grid-template-columns: 1fr; height: auto; }
  .desk-list { max-height: 360px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .convo { max-height: 60vh; }
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  table.list .hide-sm { display: none; }
}

/* layout fixes */
.grid > .section + .section, .grid > .card + .card, .grid > * { margin-top: 0; }
.strip { min-width: 0; }
@media (max-width: 900px) {
  .desk { grid-template-columns: minmax(0, 1fr); }
  .desk-body { grid-template-columns: minmax(0, 1fr); }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); }
}
.strip.bare { min-height: 0; height: 0; border: 0; overflow: hidden; }
@media (max-width: 900px) { .strip.bare { height: 46px; min-height: 46px; border-bottom: 1px solid var(--line-soft); overflow: visible; } }
.nav a .ico { display: none; }
