/* Budget app. Look: GetThin MD brand (Besley + Mulish, white and soft blue panels, navy, sky blue, red pill buttons),
   layout inspired by Mercury (sidebar, welcome, balance card), Copilot (category bars, upcoming) and Monarch (donut). */

:root {
  --red: #E4332F;
  --red-dark: #c92824;
  --sky: #009EDA;
  --blue: #3B92CE;
  --navy: #051661;
  --navy-2: #0b2a8a;
  --grey: #A29A9A;
  --rule: #E6EAF0;
  --panel: #F1F7FE;
  --bg: #F5F7FA;
  --tint: #D4EDF6;
  --ink: #292929;
  --soft: #5E6475;
  --card: #ffffff;
  --good: #1B9A6B;
  --good-bg: #E5F6EF;
  --warn: #E59A1E;
  --warn-bg: #FDF3E1;
  --bad-bg: #FDE9E8;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(5, 22, 97, .04), 0 6px 20px rgba(5, 22, 97, .04);
  --serif: 'Besley', Georgia, serif;
  --sans: 'Mulish', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font: 14px/1.5 var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.cents { font-size: .55em; font-weight: 700; vertical-align: .55em; margin-left: 1px; opacity: .75; }
.muted { color: var(--soft); }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(1200px 600px at 80% -10%, var(--tint), transparent 60%), var(--panel); }
.login-card { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--rule); border-radius: 26px; padding: 48px 40px 36px; text-align: center; box-shadow: var(--shadow); }
.login-card h1 { font: 500 34px/1.15 var(--serif); color: var(--navy); margin: 18px 0 8px; }
.login-card p { color: var(--soft); margin-bottom: 26px; }
.login-card input { width: 100%; background: var(--panel); border: 1px solid transparent; border-radius: 14px; padding: 15px 18px; font-size: 16px; }
.login-card input:focus { outline: 2px solid var(--sky); background: #fff; }
.login-card .btn { width: 100%; margin-top: 14px; padding: 15px; font-size: 16px; }
.login-msg { min-height: 20px; margin-top: 12px; color: var(--red); font-size: 13px; font-weight: 600; }
.login-foot { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--rule); font-size: 12px; color: var(--grey); display: flex; justify-content: center; gap: 8px; align-items: center; }

.mark { width: 46px; height: 46px; border-radius: 14px; background: var(--navy); color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font: 500 20px var(--serif); box-shadow: 0 6px 16px rgba(5, 22, 97, .25); }
.mark.sm { width: 36px; height: 36px; border-radius: 11px; font-size: 16px; box-shadow: none; }

/* ---------- shell ---------- */
.app { display: flex; min-height: 100vh; }
.side { width: 248px; flex: none; background: #fff; border-right: 1px solid var(--rule); display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.brand b { display: block; font: 500 18px/1.1 var(--serif); color: var(--navy); }
.brand span { font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--sky); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 0; background: none; border-radius: 12px; color: var(--soft); font-weight: 600; text-align: left; transition: .12s; }
.nav button:hover { background: var(--bg); color: var(--ink); }
.nav button.on { background: var(--panel); color: var(--navy); }
.nav button.on svg { color: var(--sky); }
.nav .count { margin-left: auto; font-size: 11px; background: var(--bg); border-radius: 999px; padding: 1px 8px; color: var(--soft); }
.nav-label { margin: 22px 12px 6px; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--grey); }
.nav button.soon { opacity: .55; cursor: default; }
.nav button.soon:hover { background: none; color: var(--soft); }
.nav .chip-soon { margin-left: auto; font-size: 10px; font-weight: 700; color: var(--grey); border: 1px solid var(--rule); border-radius: 999px; padding: 0 7px; }
.side-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid var(--rule); }
.side-foot .safe { display: flex; gap: 8px; font-size: 12px; color: var(--soft); line-height: 1.4; margin-bottom: 12px; }
.side-foot .safe svg { color: var(--good); margin-top: 1px; }
.link-btn { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; color: var(--soft); font-weight: 600; padding: 6px 4px; }
.link-btn:hover { color: var(--red); }

.main { flex: 1; min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 16px 32px; position: sticky; top: 0; z-index: 10; background: rgba(245, 247, 250, .88); backdrop-filter: blur(10px); }
.search { flex: 1; max-width: 520px; position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--grey); }
.search input { width: 100%; padding: 11px 54px 11px 42px; border-radius: 14px; border: 1px solid var(--rule); background: #fff; }
.search input:focus { outline: 2px solid var(--sky); border-color: transparent; }
.search kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font: 700 11px var(--sans); color: var(--grey); border: 1px solid var(--rule); border-radius: 6px; padding: 1px 6px; background: var(--bg); }
.top .spacer { flex: 1; }
.monthnav { display: flex; align-items: center; background: #fff; border: 1px solid var(--rule); border-radius: 14px; }
.monthnav button { background: none; border: 0; padding: 9px 10px; color: var(--soft); display: flex; }
.monthnav button:hover { color: var(--navy); }
.monthnav span { min-width: 128px; text-align: center; font-weight: 700; color: var(--navy); }

.banner { margin: 0 32px 4px; padding: 10px 16px; border-radius: 12px; background: var(--warn-bg); color: #8a5a07; font-weight: 600; font-size: 13px; display: flex; gap: 10px; align-items: center; }

#view { padding: 8px 32px 56px; max-width: 1280px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 10px 0 22px; flex-wrap: wrap; }
.page-head h1 { font: 500 34px/1.15 var(--serif); color: var(--navy); }
.page-head p { color: var(--soft); margin-top: 4px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--red); color: #fff; border: 0; border-radius: 999px; padding: 10px 20px; font-weight: 800; transition: .12s; }
.btn:hover { background: var(--red-dark); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.navy { background: var(--navy); } .btn.navy:hover { background: var(--navy-2); }
.btn.ghost { background: #fff; color: var(--navy); border: 1px solid var(--rule); } .btn.ghost:hover { background: var(--panel); }
.btn.sm { padding: 7px 14px; font-size: 13px; }
.icon-btn { background: none; border: 0; border-radius: 10px; padding: 7px; color: var(--grey); display: inline-flex; }
.icon-btn:hover { background: var(--panel); color: var(--navy); }
.icon-btn.del:hover { background: var(--bad-bg); color: var(--red); }

/* ---------- cards ---------- */
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.g-hero { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.g-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.g-3 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.card-h h2 { font: 600 15px var(--sans); color: var(--ink); }
.card-h .more { font-size: 12px; font-weight: 800; color: var(--sky); background: none; border: 0; letter-spacing: .04em; text-transform: uppercase; }
.card-h .more:hover { color: var(--navy); }

.hero { background: linear-gradient(140deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; border: 0; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.hero::after { content: ''; position: absolute; width: 380px; height: 380px; right: -120px; top: -170px; border-radius: 50%; background: radial-gradient(circle, rgba(0, 158, 218, .45), transparent 65%); pointer-events: none; }
.hero .lbl { font-size: 13px; font-weight: 700; letter-spacing: .04em; opacity: .8; }
.hero .big { font: 500 52px/1.1 var(--serif); margin: 6px 0 10px; }
.hero .delta { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .14); }
.hero .delta.good { background: rgba(60, 220, 160, .22); color: #aef5d6; }
.hero .delta.bad { background: rgba(228, 51, 47, .3); color: #ffd0cf; }
.hero .stats { display: flex; gap: 34px; margin: 20px 0 6px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .stats div { font-size: 12px; opacity: .8; }
.hero .stats b { display: block; font: 500 21px var(--serif); opacity: 1; color: #fff; margin-top: 1px; }
.chartbox { position: relative; height: 200px; margin-top: 10px; z-index: 1; }
.hero .chartbox { flex: 1; min-height: 210px; height: auto; }
.chartbox.short { height: 220px; }

.row-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--rule); }
.row-item:first-child { border-top: 0; }
.avatar { width: 38px; height: 38px; flex: none; border-radius: 12px; display: flex; align-items: center; justify-content: center; font: 500 16px var(--serif); color: #fff; }
.row-item .grow { flex: 1; min-width: 0; }
.row-item .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .s { font-size: 12px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .amt { font-weight: 800; white-space: nowrap; }
.amt.refund { color: var(--good); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; background: var(--panel); color: var(--navy); }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: #9a6205; }
.pill.bad { background: var(--bad-bg); color: var(--red); }
.pill.grey { background: var(--bg); color: var(--soft); }
.empty { text-align: center; color: var(--soft); padding: 26px 10px; }

/* donut + legend */
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut { position: relative; width: 190px; height: 190px; flex: none; }
.donut .mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut .mid b { font: 500 24px var(--serif); color: var(--navy); }
.donut .mid span { font-size: 12px; color: var(--soft); }
.legend { flex: 1; min-width: 180px; }
.legend div { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 13px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.legend span { flex: 1; font-weight: 600; }
.legend em { font-style: normal; color: var(--soft); font-weight: 700; }

/* budget bars (Copilot style) */
.bar-row { padding: 9px 0; }
.bar-top { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; font-size: 13px; }
.bar-top i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.bar-top .n { font-weight: 700; flex: 1; }
.bar-top .v { font-weight: 800; }
.bar-top .l { color: var(--soft); }
.track { height: 9px; background: var(--bg); border-radius: 999px; overflow: hidden; position: relative; }
.track.big { height: 14px; }
.fill { height: 100%; border-radius: 999px; background: var(--sky); transition: width .5s; }
.fill.warn { background: var(--warn); } .fill.over { background: var(--red); } .fill.none { background: var(--grey); opacity: .5; }
.pace { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--navy); border-radius: 2px; }
.limit-edit { background: none; border: 0; border-bottom: 1px dashed var(--grey); color: var(--soft); padding: 0 2px; font-weight: 700; }
.limit-edit:hover { color: var(--navy); border-color: var(--navy); }
.limit-in { width: 78px; border: 1px solid var(--sky); border-radius: 8px; padding: 2px 6px; font-weight: 700; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--grey); font-weight: 800; padding: 8px 10px; border-bottom: 1px solid var(--rule); }
.tbl td { padding: 12px 10px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: #FAFCFF; }
.tbl .num { text-align: right; white-space: nowrap; font-weight: 800; }
.tbl .acts { text-align: right; white-space: nowrap; width: 84px; }
.tbl .acts .icon-btn { opacity: 0; } .tbl tr:hover .acts .icon-btn { opacity: 1; }
.tbl .item b { display: block; font-weight: 700; }
.tbl .item span { font-size: 12px; color: var(--soft); }
.cat { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13px; }
.cat i { width: 9px; height: 9px; border-radius: 50%; }
.tfoot { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; color: var(--soft); font-size: 13px; flex-wrap: wrap; gap: 8px; }
.tfoot b { color: var(--navy); font-size: 15px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters select, .filters input { border: 1px solid var(--rule); background: #fff; border-radius: 12px; padding: 9px 12px; }
.filters input { min-width: 220px; }

/* accounts */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { background: #fff; border: 1px solid var(--rule); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); }
.tile span { font-size: 12px; color: var(--soft); font-weight: 600; }
.tile b { display: block; font: 500 28px var(--serif); color: var(--navy); margin-top: 2px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.chip { border: 1px solid var(--rule); background: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 13px; color: var(--soft); }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }
.acc { background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; transition: .15s; }
.acc:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(5, 22, 97, .09); }
.acc-top { display: flex; gap: 12px; align-items: center; }
.acc-top .avatar { width: 46px; height: 46px; border-radius: 14px; font-size: 20px; }
.acc-top h3 { font: 600 16px var(--sans); line-height: 1.25; }
.acc-top .grow { flex: 1; min-width: 0; }
.acc .purpose { color: var(--soft); min-height: 21px; }
.acc .meta { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--soft); }
.acc .meta div { display: flex; gap: 8px; align-items: center; }
.acc .meta svg { color: var(--grey); width: 16px; height: 16px; }
.acc .meta .noemail { color: var(--warn); font-weight: 700; }
.acc-bot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--rule); padding-top: 12px; margin-top: auto; }
.acc-bot .cost { font: 500 20px var(--serif); color: var(--navy); }
.acc-bot .cost small { font: 600 12px var(--sans); color: var(--soft); }
.acc .acts { display: flex; gap: 2px; }
.note-safe { display: flex; gap: 10px; align-items: center; margin-top: 20px; padding: 14px 18px; border-radius: 14px; background: var(--good-bg); color: #137451; font-weight: 700; font-size: 13px; }

/* modal + toast */
.modal-bg { position: fixed; inset: 0; z-index: 60; background: rgba(5, 22, 97, .35); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 20px; overflow: auto; }
.modal { width: 100%; max-width: 520px; background: #fff; border-radius: 22px; padding: 28px; box-shadow: 0 30px 80px rgba(5, 22, 97, .3); max-height: 94vh; overflow: auto; }
.modal h2 { font: 500 26px var(--serif); color: var(--navy); margin-bottom: 4px; }
.modal .sub { color: var(--soft); margin-bottom: 16px; font-size: 13px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 800; color: var(--soft); margin-bottom: 5px; letter-spacing: .02em; }
.field input, .field select, .field textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--rule); border-radius: 12px; background: var(--bg); }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--sky); background: #fff; border-color: transparent; }
.field textarea { resize: vertical; min-height: 64px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { display: inline-flex; background: var(--bg); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: none; padding: 7px 16px; border-radius: 9px; font-weight: 800; color: var(--soft); }
.seg button.on { background: #fff; color: var(--navy); box-shadow: 0 1px 4px rgba(5, 22, 97, .12); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; align-items: center; }
.modal-err { color: var(--red); font-weight: 700; font-size: 13px; margin-right: auto; }
.warn-line { display: flex; gap: 8px; align-items: center; font-size: 12px; font-weight: 700; color: #137451; background: var(--good-bg); padding: 8px 12px; border-radius: 10px; margin-bottom: 12px; }
#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); background: var(--navy); color: #fff; padding: 11px 22px; border-radius: 999px; font-weight: 700; opacity: 0; transition: .25s; z-index: 80; pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--red); }

/* ---------- small screens ---------- */
@media (max-width: 1000px) {
  .app { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--rule); overflow-x: auto; gap: 8px; }
  .brand { padding: 0 8px 0 0; } .brand span, .nav-label, .side-foot .safe, .nav .soon { display: none; }
  .nav { flex-direction: row; } .nav button { padding: 9px 12px; white-space: nowrap; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .top { padding: 12px 16px; flex-wrap: wrap; position: static; backdrop-filter: none; background: transparent; } .top .spacer { display: none; } .search { max-width: none; flex-basis: 100%; order: 3; }
  #view { padding: 8px 16px 48px; } .banner { margin: 0 16px 4px; }
  .g-hero, .g-2, .g-3 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .hero .big { font-size: 42px; }
  .tbl .hide-s { display: none; }
}

/* ---------- chatbot ---------- */
#chatRoot.hidden { display: none; }
.chat-fab { position: fixed; right: 24px; bottom: 24px; z-index: 40; display: flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 14px 20px; background: var(--navy); color: #fff; font-weight: 800; box-shadow: 0 10px 30px rgba(5, 22, 97, .35); transition: .15s; }
.chat-fab:hover { background: var(--navy-2); transform: translateY(-2px); }
.chat-panel { position: fixed; right: 24px; bottom: 24px; z-index: 45; width: 400px; max-width: calc(100vw - 24px); height: 600px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: #fff; border: 1px solid var(--rule); border-radius: 22px; box-shadow: 0 30px 80px rgba(5, 22, 97, .28); overflow: hidden; }
.chat-panel.drop { outline: 3px dashed var(--sky); outline-offset: -8px; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: linear-gradient(140deg, var(--navy), var(--navy-2)); color: #fff; }
.chat-head b { display: block; font: 500 18px var(--serif); } .chat-head span { font-size: 12px; opacity: .75; }
.chat-head .icon-btn { color: #fff; } .chat-head .icon-btn:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.bub { max-width: 86%; padding: 10px 14px; border-radius: 16px; line-height: 1.5; font-size: 14px; word-wrap: break-word; overflow-wrap: anywhere; }
.bub.assistant { align-self: flex-start; background: #fff; border: 1px solid var(--rule); border-bottom-left-radius: 5px; }
.bub.user { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 5px; }
.bub.err { background: var(--bad-bg); border-color: #f4c3c1; color: #9b231f; }
.bub code { background: rgba(5, 22, 97, .08); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
.bub-files { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; } .bub.user .pill { background: rgba(255, 255, 255, .2); color: #fff; }
.typing { display: flex; gap: 5px; padding: 14px 16px; } .typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--grey); animation: bounce 1s infinite; } .typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.chat-files { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px; background: #fff; } .chat-files:not(:empty) { padding: 8px 14px 0; }
.chat-files .pill button { background: none; border: 0; font-weight: 800; color: var(--soft); padding: 0 0 0 4px; }
.chat-in { display: flex; align-items: flex-end; gap: 6px; padding: 10px 12px 12px; background: #fff; border-top: 1px solid var(--rule); }
.chat-in textarea { flex: 1; resize: none; border: 1px solid var(--rule); border-radius: 14px; padding: 10px 12px; background: var(--bg); max-height: 130px; line-height: 1.4; }
.chat-in textarea:focus { outline: 2px solid var(--sky); background: #fff; border-color: transparent; }
.chat-send { border: 0; border-radius: 50%; width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--red); color: #fff; }
.chat-send:hover { background: var(--red-dark); } .chat-send:disabled { opacity: .5; }
.icon-btn.rec { background: var(--bad-bg); color: var(--red); animation: pulse 1.1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(228, 51, 47, .15); } }
.chat-rec { display: none; align-items: center; gap: 8px; padding: 6px 16px; background: var(--bad-bg); color: var(--red); font-weight: 800; font-size: 13px; }
.chat-rec.on { display: flex; } .chat-rec i { width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: pulse 1.1s infinite; }
@media (max-width: 600px) { .chat-panel { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; border-radius: 0; } .chat-fab { right: 14px; bottom: 14px; } }

.chat-in textarea { font-size: 16px; }   /* 16px stops iPhones from zooming in on the box */

/* ---------- test / real mode ---------- */
.mode-pill { border: 0; border-radius: 999px; padding: 7px 14px; font-weight: 800; font-size: 11px; letter-spacing: .08em; cursor: pointer; }
.mode-pill.test { background: var(--warn-bg); color: #9a6205; } .mode-pill.real { background: var(--good-bg); color: var(--good); }
.mode-pill.sm { padding: 3px 10px; font-size: 10px; cursor: default; margin-right: 8px; }
.chat-head .mode-pill.test { background: rgba(229, 154, 30, .25); color: #ffd48a; } .chat-head .mode-pill.real { background: rgba(60, 220, 160, .22); color: #aef5d6; }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-opt { text-align: left; border: 2px solid var(--rule); background: #fff; border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 6px; transition: .12s; }
.mode-opt b { font: 600 16px var(--sans); color: var(--navy); } .mode-opt span { font-size: 12.5px; color: var(--soft); line-height: 1.4; }
.mode-opt:hover { border-color: var(--sky); }
.mode-opt.on.test { border-color: var(--warn); background: var(--warn-bg); } .mode-opt.on.real { border-color: var(--good); background: var(--good-bg); }
.keybox { font: 600 15px 'SFMono-Regular', Menlo, Consolas, monospace; letter-spacing: .04em; padding: 12px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--rule); color: var(--navy); overflow-wrap: anywhere; }
.card.danger { border-color: #f3c6c4; background: #fffafa; }
.danger-btn { background: var(--red); }
@media (max-width: 1000px) { .mode-pick { grid-template-columns: 1fr; } }

.mode-pill.bad { background: var(--bad-bg); color: var(--red); }
.chat-head .mode-pill.bad { background: rgba(228, 51, 47, .3); color: #ffd0cf; }
