[hidden] { display: none !important; }
:root {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #1d1f24;
  --muted: #6c6f76;
  --line: #e6e3dd;
  --him: #23324f;
  --him-ink: #ffffff;
  --her: #ecebe7;
  --accent: #c2513a;
  --accent-ink: #ffffff;
  --good: #2f7d4f;
  --mid: #b07a12;
  --bad: #b23a2c;
  --radius: 14px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; height: 100vh; display: flex; flex-direction: column; }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 10px; padding: 8px 14px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.small { padding: 5px 10px; font-size: 13px; }
button.ghost { background: transparent; }
button.danger { color: var(--bad); }
button.link { border: 0; background: none; color: var(--muted); padding: 4px; }
button.wide { width: 100%; }
.icon-btn { border: 0; background: none; font-size: 26px; line-height: 1; padding: 0 8px 0 0; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 2px; }
.badge { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: #fbe9d7; color: #8a4b16; }
.badge.muted { background: #eeece7; color: var(--muted); }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; display: flex; align-items: center; gap: 10px; }
.brand-mark { background: var(--him); color: #fff; font-size: 12px; border-radius: 7px; padding: 4px 6px; letter-spacing: .5px; }
.top-right { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.debug-toggle { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; }

.layout { flex: 1; display: flex; min-height: 0; }
.sidebar { width: 290px; padding: 14px; border-right: 1px solid var(--line); background: var(--panel); overflow-y: auto; }
.match-list { list-style: none; padding: 0; margin: 12px 0 0; }
.match-list li { display: flex; gap: 10px; padding: 10px; border-radius: 12px; cursor: pointer; align-items: center; }
.match-list li:hover { background: #f4f2ee; }
.match-list li.active { background: #efece6; }
.match-list li.ended { opacity: .6; }
.match-list .meta { flex: 1; min-width: 0; }
.match-list .name { font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.match-list .last { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-list .tag { font-size: 11px; color: var(--muted); font-weight: 500; }
.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 16px 4px 4px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex-shrink: 0; }

.main { flex: 1; display: flex; min-width: 0; }
.empty { margin: auto; max-width: 460px; text-align: center; padding: 24px; }
.empty h1 { font-size: 28px; margin-bottom: 8px; }
.empty p { color: var(--muted); line-height: 1.5; }

.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--panel); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.who { flex: 1; min-width: 0; }
.who-name { font-weight: 700; font-size: 17px; }
.who-sub { color: var(--muted); font-size: 13px; }
.meter { width: 150px; text-align: right; }
.meter-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.meter-row { display: flex; justify-content: flex-end; align-items: baseline; gap: 6px; }
.meter-num { font-size: 22px; font-weight: 700; }
.meter-avg { font-size: 12px; color: var(--muted); }
.meter-bar { height: 5px; background: #eeece7; border-radius: 99px; overflow: hidden; margin-top: 3px; }
#meter-fill { height: 100%; width: 0; background: var(--mid); transition: width .4s, background .4s; }

.profile { padding: 8px 18px; border-bottom: 1px solid var(--line); font-size: 14px; }
.profile summary { cursor: pointer; color: var(--muted); }
.profile ul { margin: 8px 0 4px; padding-left: 18px; line-height: 1.6; }

.plan-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: #eef3ea; color: #24502f; padding: 8px 18px; font-size: 14px; border-bottom: 1px solid #dbe6d4; }

.thread { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; flex-direction: column; max-width: 75%; }
.row.him { align-self: flex-end; align-items: flex-end; }
.row.her { align-self: flex-start; align-items: flex-start; }
.bubble { padding: 9px 13px; border-radius: 18px; line-height: 1.35; white-space: pre-wrap; word-wrap: break-word; }
.him .bubble { background: var(--him); color: var(--him-ink); border-bottom-right-radius: 6px; }
.her .bubble { background: var(--her); border-bottom-left-radius: 6px; }
.stamp { font-size: 11px; color: var(--muted); margin: 10px 0 2px; align-self: center; }
.sys { align-self: center; font-size: 13px; color: var(--muted); background: #f3f1ec; border-radius: 99px; padding: 5px 12px; margin: 8px 0; }
.sys.event { background: #fff4e0; color: #8a5a10; }
.sys.pending { border: 1px dashed var(--line); background: transparent; }
.grade { margin-top: 3px; font-size: 12px; display: flex; gap: 6px; align-items: center; cursor: pointer; color: var(--muted); }
.chip { font-weight: 700; border-radius: 99px; padding: 1px 8px; color: #fff; font-size: 12px; }
.chip.good { background: var(--good); } .chip.mid { background: var(--mid); } .chip.bad { background: var(--bad); }
.grade-detail { font-size: 12px; color: var(--ink); background: #faf8f4; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 4px; max-width: 360px; text-align: left; }
.grade-detail .ids { margin-top: 4px; }
.rid { display: inline-block; font-family: ui-monospace, monospace; font-size: 11px; border-radius: 6px; padding: 1px 5px; margin: 2px 3px 0 0; }
.rid.hit { background: #e3f1e7; color: var(--good); } .rid.break { background: #f8e2df; color: var(--bad); }
.adj { color: var(--muted); margin-top: 4px; font-family: ui-monospace, monospace; font-size: 11px; }

.controls { border-top: 1px solid var(--line); padding: 10px 18px 14px; }
.clock-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.clock { font-size: 13px; color: var(--muted); margin-right: auto; }
.skip { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.skip-hours { display: flex; gap: 4px; }
.composer { display: flex; gap: 8px; }
.composer input { flex: 1; font: inherit; padding: 11px 14px; border: 1px solid var(--line); border-radius: 22px; outline: none; }
.composer input:focus { border-color: var(--him); }
.composer button { border-radius: 22px; }
.count { font-size: 12px; color: var(--muted); margin-top: 6px; text-align: right; }

.read { border-top: 1px solid var(--line); padding: 18px; overflow-y: auto; max-height: 55vh; background: #fbfaf7; }
.read h2 { margin: 0 0 4px; font-size: 19px; }
.read h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 6px; }
.read .moment { border-left: 3px solid var(--line); padding: 4px 0 4px 12px; margin: 8px 0; }
.read .quote { font-weight: 600; }
.read .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.read ul { padding-left: 18px; margin: 4px 0; line-height: 1.5; }
.read .practice { background: #eef3ea; border-radius: 10px; padding: 10px 12px; margin-top: 12px; }
.rating { display: flex; gap: 6px; margin: 8px 0; }
.rating button.on { background: var(--him); color: #fff; border-color: var(--him); }
.read textarea { width: 100%; min-height: 64px; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.loading { color: var(--muted); font-style: italic; }

.debug-panel { width: 300px; border-left: 1px solid var(--line); background: #fcfbf8; padding: 14px; overflow-y: auto; font-size: 13px; }
.debug-panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; }
.debug-panel table { width: 100%; border-collapse: collapse; }
.debug-panel td { padding: 3px 0; border-bottom: 1px solid #efede8; }
.debug-panel td:last-child { text-align: right; font-weight: 600; }
.bar { height: 6px; background: #eeece7; border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); }

dialog { border: 0; border-radius: 16px; padding: 24px; width: min(380px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.2); }
dialog input { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 8px 0 14px; }
dialog h2 { margin-top: 0; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 10; }
.mobile-only { display: none; }

@media (max-width: 820px) {
  .sidebar { width: 100%; border-right: 0; }
  .layout.in-chat .sidebar { display: none; }
  .layout:not(.in-chat) .main { display: none; }
  .mobile-only { display: inline-block; }
  .meter { width: 96px; }
  .row { max-width: 88%; }
  .debug-panel { display: none; }
  .read .cols { grid-template-columns: 1fr; }
}
.badge { white-space: nowrap; }
@media (max-width: 820px) {
  .topbar { padding: 10px 12px; }
  #difficulty, .debug-toggle { display: none !important; }
}

/* Her profile as dating-app prompt cards */
.profile ul { list-style: none; padding-left: 0; display: grid; gap: 8px; }
.profile li { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.profile .prompt-q { display: block; font-size: 12px; color: var(--muted); }
.profile .prompt-a { display: block; font-size: 15px; font-weight: 600; }

/* Dating app vs. phone texts */
.channels { display: flex; gap: 6px; padding: 8px 18px 0; }
.channels .ch { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 14px; font-size: 13px; cursor: pointer; color: var(--muted); position: relative; }
.channels .ch.active { background: var(--ink, #222); color: #fff; border-color: transparent; }
.channels .ch:disabled { opacity: .45; cursor: not-allowed; }
.channels .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #e0453a; margin-left: 4px; vertical-align: middle; }
.number-status { margin: 8px 18px 0; padding: 7px 12px; border-radius: 8px; font-size: 13px; background: #f3f1ec; color: #555; }
.number-status.waiting { background: #fff6e0; color: #7a5a00; }
.number-status.not_texted { background: #fbe9e7; color: #8a2c1d; }
.number-status.texting { background: #e6f4ea; color: #1e6b34; }
.thread.sms .row.him .bubble { background: #1f7ae0; color: #fff; }
.thread.sms .row.her .bubble { background: #e9e9eb; color: #111; }

.decision { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 8px 0; font-size: 14px; }
.decision ul { margin: 6px 0 0; padding-left: 18px; }
.decision li.up { color: #1e6b34; }
.decision li.down { color: #8a2c1d; }

/* ---- drills ---- */
.drill-open { margin-top: 8px; }
.drill-dialog { width: min(640px, calc(100vw - 32px)); max-height: 80vh; border: 1px solid var(--line, #ddd); border-radius: 12px; padding: 16px; }
.drill-head { display: flex; justify-content: space-between; align-items: center; }
.drill-list { display: grid; gap: 8px; margin-top: 8px; }
.drill-item { text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line, #ddd); background: transparent; cursor: pointer; }
.drill-item:hover { border-color: currentColor; }
.drill-item .t { font-weight: 600; }
.drill-item .s { opacity: .75; font-size: 13px; margin-top: 2px; }
.drill-cat { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; opacity: .6; margin-top: 10px; }
.drill-banner { margin: 8px 12px; padding: 8px 12px; border-radius: 10px; background: rgba(120,120,255,.1); font-size: 14px; }
.drill-banner .left { opacity: .7; font-size: 12px; }
#wait-btn { margin-top: 6px; }
.row.him.silence .bubble { background: transparent; border: 1px dashed currentColor; opacity: .7; font-style: italic; }
.next-text { margin: 12px 0; padding: 12px; border-radius: 10px; border: 1px solid var(--good, #2f7d4f); }
.next-text .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; opacity: .7; }
.next-text .txt { font-size: 17px; margin: 4px 0; }
.read .cost { margin: 8px 0; }

.ai-error { margin: 8px 12px; padding: 8px 12px; border-radius: 10px; background: rgba(200,40,40,.12); color: #a12; font-size: 13px; }
.ai-error[hidden] { display: none; }

/* ---- fuller profiles ---- */
.profile li.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-b { font-size: 13px; padding: 3px 10px; border-radius: 999px; border: 1px solid rgba(127,127,127,.35); }
.profile li.photo-card { display: flex; gap: 10px; align-items: center; font-style: italic; opacity: .85; }
.photo-ph { font-style: normal; }

.sys.date-card { margin: 12px auto; max-width: 560px; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(47,125,79,.5); background: rgba(47,125,79,.08); text-align: left; font-size: 14px; line-height: 1.45; }
