/* CIT Chat Log Splitter */
@font-face { font-family: Anton; src: url("/CITtools/assets/hub/anton.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: HubBody; src: url("/CITtools/assets/hub/roboto-condensed.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: HubBody; src: url("/CITtools/assets/hub/roboto-condensed-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f5f5f5;
  --panel: #fff;
  --panel-2: #fafbfc;
  --head: #152f4b;
  --text: #10172f;
  --muted: #52647e;
  --quiet: #7b8aa0;
  --line: #d9e0e8;
  --line-strong: #9fb1c6;
  --soft: #eef2f6;
  --accent: #152f4b;
  --on-accent: #fff;
  --gold: #e2b44b;
  --safe: #1d6a44;
  --safe-soft: #e8f4ed;
  --safe-line: #b9dcc7;
  --error: #a3321f;
  --name-light: 34%;
  --name-sat: 55%;
  --mono: Consolas, "Cascadia Mono", "Courier New", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f1724;
    --panel: #1b293c;
    --panel-2: #16222f;
    --head: #0b1622;
    --text: #f1f5fc;
    --muted: #b1bfd2;
    --quiet: #8797ab;
    --line: #36485f;
    --line-strong: #5a7291;
    --soft: #22334a;
    --accent: #e2b44b;
    --on-accent: #14100a;
    --safe: #8fdcad;
    --safe-soft: #15322a;
    --safe-line: #2c5a45;
    --error: #ff9c85;
    --name-light: 72%;
    --name-sat: 65%;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { min-height: 100vh; background: var(--bg); color: var(--text); font: 15px/1.45 HubBody, "Arial Narrow", Arial, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
code { font: 13px/1.4 var(--mono); background: var(--soft); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; overflow-wrap: anywhere; }
kbd { font: 700 12px/1 var(--mono); background: var(--panel); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 2px 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Top bar, like the other CIT tools */
.topbar { background: var(--head); color: #fff; }
.topbar-inner { max-width: 1440px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.brand-mark { width: 40px; height: 40px; border-radius: 9px; background: var(--gold); color: #152f4b; display: grid; place-items: center; font: 21px/1 Anton, Impact, sans-serif; letter-spacing: .5px; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.brand-copy strong { font: 25px/1 Anton, Impact, sans-serif; letter-spacing: .6px; text-transform: uppercase; font-weight: 400; }
.brand-copy span { font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: #b9c7d8; margin-top: 3px; }
.nav { display: flex; gap: 16px; }
.nav a { color: #dfe7f1; text-decoration: none; font-size: 14px; }
.nav a:hover { color: var(--gold); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-weight: 700; font-size: 14px; white-space: nowrap; cursor: pointer; }
.btn:hover { border-color: var(--line-strong); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Paste screen */
.intro { max-width: 980px; margin: 0 auto; padding: 40px 24px 60px; }
.intro h1 { font: 42px/1.05 Anton, Impact, sans-serif; text-transform: uppercase; letter-spacing: .4px; margin: 0 0 10px; font-weight: 400; text-wrap: balance; }
.lede { color: var(--muted); font-size: 18px; margin: 0 0 20px; max-width: 66ch; }
.saved-note { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 22px; padding: 14px 16px; border: 1px solid var(--safe-line); background: var(--safe-soft); color: var(--text); border-radius: 12px; font-size: 16px; }
.saved-note svg { flex: 0 0 auto; color: var(--safe); margin-top: 1px; }
.saved-note strong { color: var(--safe); display: block; font-size: 17px; }
.paste-label { display: block; font-weight: 700; margin: 0 0 8px; }
.paste { display: block; width: 100%; height: 230px; resize: vertical; padding: 16px; border: 2px dashed var(--line-strong); border-radius: 14px; background: var(--panel); font: 13px/1.5 var(--mono); }
.paste::placeholder { font: 20px/1.4 HubBody, Arial, sans-serif; color: var(--quiet); }
.paste:focus { border-style: solid; border-color: var(--accent); outline: none; }
.paste-error { margin: 10px 0 0; color: var(--error); font-weight: 700; }
.how { margin-top: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; }
.how h2 { margin: 0 0 10px; font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.how ol { margin: 0; padding-left: 20px; }
.how li { margin: 8px 0; }
.note { color: var(--muted); font-size: 14px; margin: 12px 0 0; }

/* Viewer */
.summary { background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px 24px; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; row-gap: 4px; align-items: center; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: baseline; }
.facts b { font-size: 17px; }
.facts span { color: var(--muted); }
.summary-actions { display: flex; gap: 8px; align-items: center; }
.paste-more { width: 220px; height: 36px; min-height: 36px; resize: none; padding: 7px 10px; border: 1px dashed var(--line-strong); border-radius: 8px; background: var(--panel-2); font: 14px/1.4 HubBody, Arial, sans-serif; overflow: hidden; }
.paste-more:focus { border-style: solid; border-color: var(--accent); outline: none; }
.saved-line { grid-column: 1 / -1; margin: 0; display: flex; align-items: center; gap: 6px; color: var(--safe); font-size: 13px; font-weight: 700; }

.app { display: grid; grid-template-columns: 280px minmax(0, 1fr); align-items: start; }
.side { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; border-right: 1px solid var(--line); background: var(--panel-2); padding: 12px 12px 24px; min-height: calc(100vh - 124px); }
.group-label { font-size: 12px; letter-spacing: 1.3px; text-transform: uppercase; color: var(--muted); margin: 14px 10px 4px; }
.group-label:first-child { margin-top: 4px; }
.chat { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; min-height: 32px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; text-align: left; cursor: pointer; font-size: 15px; }
.chat:hover { background: var(--soft); }
.chat .n { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.chat[aria-current="true"] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.chat[aria-current="true"] .n { color: inherit; opacity: .8; }
.chat-select { display: none; }

.main { min-width: 0; }
.bar { display: flex; align-items: center; gap: 10px; padding: 16px 24px 10px; flex-wrap: wrap; }
.bar h2 { margin: 0; font: 30px/1 Anton, Impact, sans-serif; text-transform: uppercase; letter-spacing: .4px; font-weight: 400; }
.count { color: var(--muted); font-size: 14px; }
.grow { flex: 1; }
.filters { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 24px 12px; background: var(--bg); border-bottom: 1px solid var(--line); }
.search { display: flex; align-items: center; gap: 8px; height: 36px; width: 300px; max-width: 100%; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--quiet); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--text); }
#day { height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 30px; padding: 0 11px; border-radius: 15px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--soft); border-color: var(--line-strong); color: var(--text); }
.player-chip { min-height: 30px; padding: 0 11px; border-radius: 15px; border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); font-size: 13px; font-weight: 700; cursor: pointer; }
.hint { margin-left: auto; color: var(--muted); font-size: 13px; }

.messages, .thread { list-style: none; margin: 0; padding: 4px 24px 40px; }
.day { display: flex; align-items: center; gap: 12px; margin: 16px 0 6px; color: var(--muted); font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; font-weight: 700; }
.day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { position: relative; display: grid; grid-template-columns: 76px 64px minmax(0, 1fr); align-items: baseline; gap: 10px; padding: 6px 70px 6px 10px; border-radius: 8px; }
.msg:hover { background: var(--soft); }
.time { font: 13px var(--mono); color: var(--quiet); font-variant-numeric: tabular-nums; }
.tag { justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 700; letter-spacing: .5px; border-radius: 5px; padding: 1px 6px; background: var(--soft); color: var(--muted); border: 1px solid var(--line); }
.tag:empty { visibility: hidden; }
.line { min-width: 0; overflow-wrap: anywhere; }
.name { border: 0; background: none; padding: 0; margin-right: 6px; font-weight: 700; cursor: pointer; color: hsl(var(--h, 210) var(--name-sat) var(--name-light)); }
.name:hover { text-decoration: underline; }
.name.said::after { content: ":"; }
.text { unicode-bidi: plaintext; }
.msg.notice .text { color: var(--muted); font-style: italic; }
.msg.plain { grid-template-columns: 76px minmax(0, 1fr); }
.msg.plain .tag { display: none; }
.msg.plain .text { font: 13.5px/1.5 var(--mono); }
.copy-line { position: absolute; right: 8px; top: 4px; min-height: 26px; padding: 0 9px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); font-size: 12px; font-weight: 700; cursor: pointer; opacity: 0; }
.msg:hover .copy-line, .copy-line:focus-visible { opacity: 1; }
.more { text-align: center; padding: 16px 0; }
.empty { padding: 30px 24px; color: var(--muted); }

/* SMS conversations */
.sms { display: grid; grid-template-columns: 260px minmax(0, 1fr); align-items: start; }
.people { position: sticky; top: 58px; max-height: calc(100vh - 58px); overflow-y: auto; border-right: 1px solid var(--line); padding: 10px 12px; }
.person { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; background: transparent; text-align: left; cursor: pointer; }
.person:hover { background: var(--soft); }
.person[aria-current="true"] { background: var(--soft); box-shadow: inset 3px 0 0 var(--accent); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; background: hsl(var(--h, 210) 45% 40%); }
.person b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person small { display: block; color: var(--muted); font-size: 12px; }
.person .n { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.thread { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; }
.thread .day { align-self: stretch; }
.bubble { align-self: flex-start; max-width: min(620px, 78%); padding: 8px 13px; border-radius: 14px; border-bottom-left-radius: 4px; background: var(--panel); border: 1px solid var(--line); overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--accent); border-color: var(--accent); color: var(--on-accent); border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
.bubble small { display: block; font: 11px var(--mono); color: var(--quiet); margin-top: 3px; }
.bubble.me small { color: inherit; opacity: .75; text-align: right; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 10px; background: var(--head); color: #fff; font-weight: 700; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; }
.toast.show { opacity: 1; }

@media (max-width: 900px) {
  .topbar-inner { padding: 10px 16px; }
  .brand-copy strong { font-size: 21px; }
  .nav { display: none; }
  .intro { padding: 26px 16px 40px; }
  .intro h1 { font-size: 34px; }
  .summary { grid-template-columns: 1fr; padding: 10px 16px; }
  .summary-actions { flex-wrap: wrap; }
  .paste-more { width: 100%; }
  .app { display: block; }
  .side { display: none; }
  .chat-select { display: block; width: calc(100% - 32px); margin: 12px 16px 0; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 0 10px; font-weight: 700; }
  .bar { padding: 12px 16px 8px; }
  .bar h2 { font-size: 24px; flex-basis: 100%; }
  .filters { padding: 8px 16px 10px; }
  .search { width: 100%; }
  .hint { display: none; }
  .messages, .thread { padding: 4px 12px 30px; }
  .msg { grid-template-columns: 64px minmax(0, 1fr); padding: 6px 8px; row-gap: 2px; }
  .msg .tag { grid-column: 2; grid-row: 1; }
  .msg .line { grid-column: 1 / -1; }
  .copy-line { display: none; }
  .sms { display: block; }
  .people { position: static; max-height: 190px; border-right: 0; border-bottom: 1px solid var(--line); }
  .bubble { max-width: 88%; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
