/* MyAgnt owner app — design tokens from Figma wXXV8wXPWGFDpa9VnZMSK3 (📱 App · FINAL, 🖥 Desktop · FINAL).
   Component CSS uses tokens only; the hex values live here, once. */
:root {
  /* brand + status */
  --brand-berry: #D6457A;            /* primary actions: Send, Publish, Approve */
  --brand-berry-deep: #A8305E;       /* links, "Ask me again", active labels */
  --brand-berry-soft: #F9E3EB;       /* selected row, active tab */
  --status-customer-waiting: #E04E0B;                 /* ONLY while a customer waits */
  --status-customer-waiting-soft: rgba(224, 78, 11, 0.12);
  --status-danger: #C42B2B;
  --status-danger-soft: #FBE9E9;
  /* agent identity */
  --agent-andy-ink: #1C1B26;
  --agent-sky: #3F8FE0;
  --agent-berry: #D6457A;
  --agent-iris: #6560EE;
  --agent-leaf: #4FA85A;
  --agent-tangerine: #F08A3C;
  /* customer tints (no border, no stripe) */
  --customer-tint-0: #E3EEF9;
  --customer-tint-1: #E4F2E6;
  --customer-tint-2: #ECE8F8;
  /* surfaces + text */
  --surface: #FFFFFF;
  --surface-sand: #F6F3EE;           /* agent bubbles, search field, composer, collapsed lines */
  --surface-sand-deep: #EEEAE4;      /* suggested-reply box, date pill */
  --surface-owner: #ECEDEF;          /* the owner's own bubbles */
  --surface-nav: #F9F7F4;
  --surface-overlay: rgba(28, 27, 38, 0.22);
  --line: #E8E3DB;
  --line-strong: #D2CCC2;
  --text: #1C1B26;
  --text-secondary: #38353D;
  --text-muted: #6E6C75;
  --text-faint: #99979F;
  --highlight: #F9E3EB;
  /* type (Rubik) */
  --font: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  --h1: 600 22px/30px var(--font);
  --h-card: 600 18px/26px var(--font);
  --h-section: 600 14px/20px var(--font);
  --body: 400 16px/24px var(--font);
  --body-strong: 600 16px/24px var(--font);
  --small: 400 14px/20px var(--font);
  --small-strong: 500 14px/20px var(--font);
  --composer: 400 18px/26px var(--font);
  /* spacing + radii */
  --s4: 4px; --s6: 6px; --s8: 8px; --s10: 10px; --s12: 12px; --s16: 16px; --s24: 24px;
  --r-card: 12px; --r-chip: 16px; --r-full: 1000px;
  --list-w: 400px; --panel-w: 400px;
  --tap: 44px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #15151B; --surface-sand: #23222A; --surface-sand-deep: #2B2A33; --surface-owner: #2A2A31; --surface-nav: #1B1B21;
    --surface-overlay: rgba(0,0,0,.5); --line: #2E2D36; --line-strong: #3B3A44;
    --text: #F3F1EC; --text-secondary: #D7D4CC; --text-muted: #A7A4AE; --text-faint: #7E7B86; --highlight: #4A2434;
    --brand-berry-soft: #3C1F2B; --status-customer-waiting-soft: rgba(224, 78, 11, 0.22);
    --customer-tint-0: #1F2A38; --customer-tint-1: #1F2D22; --customer-tint-2: #27243A;
  }
}
:root[data-theme="dark"] {
  --surface: #15151B; --surface-sand: #23222A; --surface-sand-deep: #2B2A33; --surface-owner: #2A2A31; --surface-nav: #1B1B21;
  --surface-overlay: rgba(0,0,0,.5); --line: #2E2D36; --line-strong: #3B3A44;
  --text: #F3F1EC; --text-secondary: #D7D4CC; --text-muted: #A7A4AE; --text-faint: #7E7B86; --highlight: #4A2434;
  --brand-berry-soft: #3C1F2B; --status-customer-waiting-soft: rgba(224, 78, 11, 0.22);
  --customer-tint-0: #1F2A38; --customer-tint-1: #1F2D22; --customer-tint-2: #27243A;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
/* row 011 (c): a double tap is not a zoom (pinch zoom stays: no maximum-scale, no user-scalable=no) */
html { touch-action: manipulation; }
body { background: var(--surface); color: var(--text); font: var(--body); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--brand-berry-deep); text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell ---------- */
.app { height: var(--vvh, 100dvh); display: grid; grid-template-columns: 1fr; grid-template-rows: 1fr; }
.pane-list, .pane-chat, .pane-panel { height: var(--vvh, 100dvh); display: flex; flex-direction: column; min-width: 0; background: var(--surface); }
.pane-chat { display: none; }
.pane-panel { display: none; }
@media (min-width: 900px) {
  .app { grid-template-columns: var(--list-w) 1fr; }
  .app.with-panel { grid-template-columns: var(--list-w) 1fr var(--panel-w); }
  .pane-list { border-right: 1px solid var(--line); }
  .pane-chat { display: flex; }
  .app.with-panel .pane-panel { display: flex; border-left: 1px solid var(--line); }
  .mobile-only { display: none !important; }
}
@media (max-width: 899px) {
  .app.mobile-chat .pane-list, .app.mobile-panel .pane-list { display: none; }
  .app.mobile-chat .pane-chat { display: flex; }
  .app.mobile-panel .pane-panel { display: flex; }
  .desktop-only { display: none !important; }
}

/* ---------- list pane ---------- */
.list-head { display: flex; align-items: center; justify-content: space-between; padding: 20px var(--s16) 12px; }
.list-head h1 { font: var(--h1); margin: 0; }
.list-head { min-height: 40px; box-sizing: content-box; } /* no "+": the header row keeps its 40px */
.btn-plus { width: 40px; height: 40px; border-radius: var(--r-full); background: var(--brand-berry); color: #fff; display: grid; place-items: center; }
.search { margin: 0 var(--s16) var(--s12); position: relative; }
.search input { width: 100%; height: 44px; border: 2px solid transparent; border-radius: var(--r-full); background: var(--surface-sand); padding: 0 40px 0 40px; font: var(--body); color: var(--text); outline: none; }
.search input:focus, .search.active input { border-color: var(--brand-berry); background: var(--surface); }
.search .ico { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search .clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border-radius: var(--r-full); color: var(--text-secondary); display: none; }
.search.active .clear { display: grid; place-items: center; }
.list-scroll { flex: 1; overflow-y: auto; }
.row { display: grid; grid-template-columns: 56px 1fr auto; gap: var(--s12); align-items: center; padding: var(--s12) var(--s16); width: 100%; text-align: left; min-height: 76px; position: relative; }
.row::after { content: ""; position: absolute; left: 88px; right: 16px; bottom: 0; height: 1px; background: var(--line); }
.row.selected { background: var(--brand-berry-soft); }
.row.waiting { background: var(--status-customer-waiting-soft); }
.row.waiting.selected { box-shadow: inset 4px 0 0 var(--status-customer-waiting); }
.row.waiting::after, .row.selected::after { display: none; }
.row .title { font: var(--body); }
.row .title b { font-weight: 600; }
.row .title .role { color: var(--text-muted); }
.row .title .role::before { content: " · "; color: var(--text-faint); }
.row .sub { font: var(--small); color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row > div:nth-child(2) { min-width: 0; } /* lets the subtitle ellipsis work inside the 1fr column (Andy's time stays visible) */
.row.muted-sub .sub { color: var(--text-muted); }
.row .meta { font: var(--small); color: var(--text-muted); align-self: start; padding-top: 2px; }
.row .badge { min-width: 24px; height: 24px; padding: 0 7px; border-radius: var(--r-full); background: var(--status-customer-waiting); color: #fff; font: 600 13px/24px var(--font); text-align: center; }
.row.archived { opacity: .4; }
.state { padding: 48px var(--s24); text-align: center; color: var(--text-muted); font: var(--small); }
.state b { display: block; color: var(--text); font: var(--body-strong); margin-bottom: 6px; }
.state .btn { margin-top: 12px; }
.skeleton { height: 76px; margin: 0 16px; border-bottom: 1px solid var(--line); position: relative; }
.skeleton::before { content: ""; position: absolute; left: 0; top: 16px; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-sand); }
.skeleton::after { content: ""; position: absolute; left: 72px; right: 40px; top: 22px; height: 32px; border-radius: 8px; background: var(--surface-sand); }

/* search results */
.group-title { padding: 16px 16px 6px; font: var(--h-section); color: var(--text-muted); letter-spacing: 0; }
mark { background: var(--highlight); color: inherit; font-weight: inherit; border-radius: 3px; padding: 0 1px; }
.show-all { margin: 4px 16px 8px 88px; color: var(--brand-berry-deep); font: var(--small-strong); }
.row .msg-snippet { font: var(--small); color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }

/* desktop account footer / mobile tab bar */
.list-foot { display: none; }
@media (min-width: 900px) {
  .list-foot { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); }
  .list-foot .who { flex: 1; }
  .list-foot .who b { display: block; font: var(--body-strong); }
  .list-foot .who span { font: var(--small); color: var(--text-muted); }
}
.tabbar { display: flex; margin: 8px 16px 16px; padding: 8px; border-radius: 32px; background: var(--surface-nav); box-shadow: 0 8px 24px rgba(28,27,38,.08); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 8px; border-radius: 28px; font: var(--small-strong); color: var(--text-muted); position: relative; }
.tab.active { background: var(--brand-berry-soft); color: var(--brand-berry-deep); }
.tab .tbadge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--r-full); background: var(--status-customer-waiting); color: #fff; font: 600 12px/20px var(--font); }

/* ---------- avatars ---------- */
.avatar { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; color: #fff; font: 600 18px/1 var(--font); flex: none; }
.avatar.sm { width: 36px; height: 36px; font-size: 15px; }
.avatar.lg { width: 112px; height: 112px; font-size: 40px; }
.avatar.customer { background: var(--surface-sand); color: var(--text-secondary); }
.avatar svg { width: 60%; height: 60%; }

/* ---------- chat pane ---------- */
.chat-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 76px; border-bottom: 1px solid var(--line); }
.chat-head .back { width: 40px; height: 40px; margin-left: -8px; display: grid; place-items: center; color: var(--text-secondary); }
.chat-head .who { flex: 1; min-width: 0; }
.chat-head .who b { display: block; font: var(--h-card); }
.chat-head .who span { font: var(--small); color: var(--text-muted); }
.chat-head .head-actions { display: flex; gap: 4px; }
.chat-head .head-actions button { width: 40px; height: 40px; border-radius: var(--r-full); color: var(--text-secondary); display: grid; place-items: center; }
.context-line { padding: 8px 16px; font: var(--small); color: var(--text-muted); border-bottom: 1px solid var(--line); }
.alone-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--surface-sand); font: var(--small); color: var(--text-muted); }
.alone-bar button { color: var(--brand-berry-deep); font: var(--small-strong); }
.waiting-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: var(--surface-sand); overflow-x: auto; scrollbar-width: none; }
.waiting-bar .n { font: var(--small-strong); color: var(--text-secondary); white-space: nowrap; }
.chip { height: 36px; padding: 0 14px; border-radius: 18px; background: var(--surface-sand); font: var(--small-strong); color: var(--text); white-space: nowrap; }
.chip.tint-0 { background: var(--customer-tint-0); } .chip.tint-1 { background: var(--customer-tint-1); } .chip.tint-2 { background: var(--customer-tint-2); }
.chip.outlined { background: var(--surface); border: 1px solid var(--line-strong); }
.chat-scroll > .chip { align-self: flex-start; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 8px; }
.chat-scroll.bottom { justify-content: flex-end; }
.chat-scroll > * { flex-shrink: 0; } /* an overflowing column must never squash a button or a card */
.day { align-self: center; padding: 4px 12px; border-radius: var(--r-full); background: var(--surface-sand-deep); font: var(--small); color: var(--text-secondary); margin: 8px 0; }
.bubble { max-width: min(360px, 86%); padding: 12px 16px; border-radius: 20px; background: var(--surface-sand); position: relative; font: var(--body); white-space: pre-wrap; word-wrap: break-word; }
.bubble.owner { align-self: flex-end; background: var(--surface-owner); }
.bubble .t { display: inline-block; margin-left: 8px; font: 400 12px/16px var(--font); color: var(--text-muted); vertical-align: bottom; float: right; margin-top: 10px; }
.secret .t { align-self: flex-end; font: 400 12px/16px var(--font); color: var(--text-muted); }
.caption { align-self: flex-end; font: var(--small); color: var(--text-faint); margin-top: -4px; }
.choice { display: flex; flex-wrap: wrap; gap: 8px; max-width: 360px; }
.choice button { height: 40px; padding: 0 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line-strong); font: var(--small-strong); }
.choice button.primary { background: var(--brand-berry); border-color: var(--brand-berry); color: #fff; }
.choice button:disabled { opacity: .5; cursor: default; }
.cs-link { align-self: flex-start; height: 40px; padding: 0 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line-strong); font: var(--small-strong); }
.collapsed { max-width: 360px; width: 100%; padding: 18px 16px; border-radius: var(--r-card); background: var(--surface-sand); font: var(--body); }
.reminder { max-width: 360px; padding: 12px 16px; border-radius: var(--r-card); background: var(--surface-sand); font: var(--small); color: var(--text-secondary); }
.reminder b { display: block; font: var(--body-strong); color: var(--text); margin-bottom: 2px; }

/* approval card */
.card { width: 100%; max-width: 360px; padding: 16px; border-radius: var(--r-card); background: var(--surface-sand); display: flex; flex-direction: column; gap: 10px; }
.card.tint-0 { background: var(--customer-tint-0); } .card.tint-1 { background: var(--customer-tint-1); } .card.tint-2 { background: var(--customer-tint-2); }
.card .head { display: flex; justify-content: space-between; align-items: baseline; }
.card .head b { font: var(--body-strong); }
.card .head span { font: var(--small); color: var(--text-muted); }
.card .quote { font: var(--body); }
.card .label { font: var(--h-section); color: var(--text-muted); letter-spacing: 0; }
.card .text { padding: 12px 12px; border-radius: 10px; background: var(--surface-sand-deep); font: var(--body); white-space: pre-wrap; }
.card.tint-0 .text, .card.tint-1 .text, .card.tint-2 .text { background: rgba(255,255,255,.55); }
:root[data-theme="dark"] .card .text { background: rgba(0,0,0,.25); }
.card .by, .card .reason { font: var(--small); color: var(--text-muted); }
.card .reason.blocker { color: var(--status-danger); }
.card .amount { font: var(--h-card); }
.card .actions { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.card .actions .spacer { flex: 1; }
.card .link { font: var(--small-strong); color: var(--brand-berry-deep); text-align: left; }
.card.disabled .btn { opacity: .5; pointer-events: none; }
.card .err { font: var(--small); color: var(--status-danger); }
.btn { height: 44px; padding: 0 20px; border-radius: 22px; font: var(--body-strong); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.primary { background: var(--brand-berry); color: #fff; }
.btn.secondary { background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.btn.quiet { color: var(--text-muted); padding: 0 8px; }
.btn.danger { background: var(--status-danger); color: #fff; width: 100%; }
.btn.outline { background: var(--surface); border: 1px solid var(--line-strong); color: var(--text); width: 100%; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.busy::after { content: ""; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* proposal card */
.proposal { width: 100%; max-width: 360px; padding: 16px; border-radius: var(--r-card); background: var(--surface-sand); display: flex; flex-direction: column; gap: 12px; }
.proposal .kicker { display: flex; justify-content: space-between; font: var(--small-strong); color: var(--text-muted); }
.proposal .who { display: flex; align-items: center; gap: 10px; font: var(--body-strong); }
.proposal .who .role { font-weight: 400; color: var(--text-secondary); }
.proposal .who .role::before { content: " · "; color: var(--text-faint); }
.proposal .sub { font: var(--small); color: var(--text-muted); }
.proposal li { font: var(--body); margin: 0 0 6px; }
.proposal ul { padding: 0; margin: 0; list-style: none; }
.proposal .note { font: var(--small); color: var(--text-muted); }
.proposal .actions { display: flex; align-items: center; gap: 8px; }
.proposal .actions .spacer { flex: 1; }

/* composer */
.composer-wrap { display: flex; flex-direction: column; }
.composer { display: flex; align-items: center; gap: 12px; padding: 12px 16px 16px; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 16px 0; }
.chip.attachment { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 6px 0 12px; font: var(--small); }
.chip.attachment button { width: 24px; height: 24px; display: grid; place-items: center; color: var(--text-muted); }
.composer .mic.rec { color: #fff; background: var(--status-danger); border-radius: var(--r-full); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.composer button:disabled { opacity: .4; cursor: default; }
/* message delete (hover / focus) */
.bubble .del-msg { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--line-strong); color: var(--text-muted); display: none; place-items: center; }
.bubble .del-msg svg { width: 14px; height: 14px; }
.bubble:hover .del-msg, .bubble:focus-within .del-msg { display: grid; }
/* secure field */
.secret { max-width: 360px; width: 100%; padding: 14px 16px; border-radius: var(--r-card); background: var(--surface-sand); display: flex; flex-direction: column; gap: 8px; font: var(--body); }
.secret b { font: var(--body-strong); }
.secret .hint { font: var(--small); color: var(--text-muted); }
.secret .field { display: flex; gap: 8px; }
.secret .field input { flex: 1; min-width: 0; height: 44px; border: 1px solid var(--line-strong); border-radius: 12px; padding: 0 12px; font: var(--body); background: var(--surface); color: var(--text); }
.secret .err { font: var(--small); color: var(--status-danger); }
.secret.saved { flex-direction: row; align-items: center; gap: 10px; }
.secret .lbl { font: var(--small); color: var(--text-secondary); flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: var(--r-full); background: var(--surface-sand-deep); font: var(--small-strong); color: var(--text-secondary); white-space: nowrap; }
.pill.ok { background: var(--customer-tint-1); color: var(--agent-leaf); }
.pill svg { width: 16px; height: 16px; }
/* choice extras */
.choice button.on { background: var(--brand-berry-soft); border-color: var(--brand-berry); color: var(--brand-berry-deep); }
.free-text { display: flex; gap: 8px; max-width: 360px; }
.free-text input { flex: 1; min-width: 0; height: 44px; border: 1px solid var(--line-strong); border-radius: 22px; padding: 0 16px; font: var(--body); background: var(--surface); color: var(--text); }
/* brief body */
.brief { max-width: 360px; padding: 12px 16px; border-radius: var(--r-card); background: var(--surface-sand); font: var(--small); }
.brief h4 { margin: 8px 0 4px; font: var(--h-section); }
.brief ul { margin: 0; padding-left: 18px; }
.brief .savings { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.brief .savings b { display: block; font: var(--small-strong); margin-bottom: 4px; }
.composer .plus { width: 40px; height: 40px; display: grid; place-items: center; color: var(--text-muted); }
.composer input { flex: 1; height: 48px; border: 0; border-radius: 24px; background: var(--surface-sand); padding: 0 20px; font: var(--composer); color: var(--text); outline: none; }
.composer .mic { width: 40px; height: 40px; display: grid; place-items: center; color: var(--text-secondary); }
.chat-empty { flex: 1; display: grid; place-items: center; color: var(--text-muted); font: var(--small); text-align: center; padding: 24px; }

/* ---------- profile panel ---------- */
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px; min-height: 76px; }
.panel-head .x { width: 40px; height: 40px; display: grid; place-items: center; color: var(--text-secondary); }
.panel-head .edit { color: var(--brand-berry-deep); font: var(--body-strong); padding: 0 8px; }
.panel-scroll { flex: 1; overflow-y: auto; padding: 0 16px 24px; }
.identity { text-align: center; padding: 8px 0 20px; }
.identity .avatar { margin: 0 auto 12px; }
.identity b { display: block; font: var(--h1); }
.identity span { font: var(--body); color: var(--text-secondary); }
.iconbtns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.iconbtns button { height: 72px; border-radius: var(--r-card); background: var(--surface-sand); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font: var(--small); color: var(--text-secondary); }
.section { border-radius: var(--r-card); background: var(--surface-sand); padding: 16px; margin-bottom: 16px; }
.section > h3 { margin: 0 0 10px; font: var(--h-card); display: flex; justify-content: space-between; align-items: center; }
.section > h3 .see { color: var(--brand-berry-deep); font: var(--body-strong); }
.activity { display: flex; align-items: center; gap: 12px; padding: 10px 0; width: 100%; text-align: left; }
button.activity:hover .body div { text-decoration: underline; }
.activity .ic { width: 24px; height: 24px; display: grid; place-items: center; color: var(--text-secondary); }
.activity .ic.waiting { color: var(--brand-berry-deep); }
.activity .ic.failed { color: var(--status-danger); }
.activity .body { flex: 1; }
.activity .body div { font: var(--body); }
.activity .body span { font: var(--small); color: var(--text-muted); }
.activity .body span b { font-weight: 600; color: var(--brand-berry-deep); }
.activity .body span b.ok { color: var(--text); }
.activity .body span b.failed { color: var(--status-danger); }
.rule { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 0; }
.rule .txt { font: var(--body); }
.rule .kind { font: var(--small); color: var(--text-muted); }
.rule .del { color: var(--brand-berry-deep); font: var(--body-strong); flex: none; }
.notice { font: var(--small); color: var(--text-muted); margin-top: 8px; }
.danger-zone { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.danger-zone .btn.quiet.danger-text { color: var(--status-danger); width: 100%; }

/* ---------- dialogs, sheets, toasts ---------- */
.overlay { position: fixed; inset: 0; background: var(--surface-overlay); display: grid; place-items: center; z-index: 50; padding: 16px; }
.dialog { width: min(400px, 100%); background: var(--surface); border-radius: 20px; padding: 24px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 24px 64px rgba(0,0,0,.18); }
.dialog h2 { margin: 0; font: var(--h-card); display: flex; justify-content: space-between; align-items: center; }
.dialog p { margin: 0; font: var(--small); color: var(--text-secondary); }
.dialog textarea, .dialog input[type=text] { width: 100%; border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px; font: var(--body); background: var(--surface); color: var(--text); resize: vertical; min-height: 44px; }
.dialog textarea { min-height: 140px; }
.dialog label { font: var(--small-strong); color: var(--text-secondary); display: block; margin-bottom: 6px; }
.dialog .row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.sheet { position: fixed; inset: auto 0 0 0; background: var(--surface); border-radius: 20px 20px 0 0; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); z-index: 51; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 -12px 40px rgba(0,0,0,.18); }
@media (min-width: 900px) { .sheet { inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: 480px; border-radius: 20px; } }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(420px, calc(100% - 32px)); }
.toast { background: var(--text); color: var(--surface); padding: 12px 16px; border-radius: 12px; font: var(--small); display: flex; justify-content: space-between; align-items: center; gap: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast button { color: var(--brand-berry); font: var(--small-strong); }
.toast.error { background: var(--status-danger); color: #fff; }
.toast.error button { color: #fff; }

/* ---------- settings + login ---------- */
.settings { padding: 0 16px 24px; overflow-y: auto; flex: 1; }
.settings h2 { font: var(--h-card); margin: 20px 0 8px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); font: var(--body); }
.setting-row span { font: var(--small); color: var(--text-muted); }
.setting-row .status.ok { color: var(--agent-leaf); }
.setting-row .status.bad { color: var(--status-danger); }
.login { height: var(--vvh, 100dvh); display: grid; place-items: center; padding: 16px; }
.login form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; }
.login h1 { font: var(--h1); margin: 0 0 8px; }
.login input { height: 48px; border: 1px solid var(--line-strong); border-radius: 12px; padding: 0 14px; font: var(--body); background: var(--surface); color: var(--text); }
.login .err { color: var(--status-danger); font: var(--small); }

/* --- PR #77 (2026-10-23): Routines, payment Edit, rule Delete --- */
:root { --status-destructive: #C83A32; }
.rule .del.danger { color: var(--status-destructive); }
.activity .ic.no { color: var(--text-muted); }
.avatar.routine-ic { background: var(--surface-sand); color: var(--text-secondary); }
.row.routine { cursor: pointer; }
.row.routine.paused .sub { color: var(--text-faint); }
.text-btn { font: var(--body-strong); color: var(--brand-berry-deep); padding: 8px 4px; }
.text-btn.busy { opacity: .5; }
.routines-hint { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 20px 16px 28px; font: var(--small); color: var(--text-muted); }
.sheet label { font: var(--small-strong); color: var(--text-secondary); }
.sheet input[type=text] { height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; font: var(--body); background: var(--surface); color: var(--text); }
.sheet .money { display: flex; align-items: center; gap: 8px; }
.sheet .money input { flex: 1; }
.sheet .err { font: var(--small); color: var(--status-danger); min-height: 1em; }
/* --- Block 4: auth screens + interactive settings --- */
.login .form-like { width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; }
.login h2 { font: var(--h-card); margin: 0; }
.login .sub { font: var(--small); color: var(--text-muted); margin: 0; }
.login .auth-links { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 4px; }
.login .link { font: var(--small-strong); color: var(--brand-berry-deep); }
.setting-row { gap: 12px; }
.setting-row .grow { flex: 1; min-width: 0; }
.setting-row .grow span, .setting-row .val { font: var(--small); color: var(--text-muted); }
.setting-row .val { white-space: pre-wrap; word-break: break-word; }
.setting-row.wrap { flex-wrap: wrap; justify-content: flex-start; }
.setting-row.muted { opacity: .6; }
.setting-row .hint { font: var(--small); color: var(--text-muted); }
.setting-row select, .setting-row input[type=text], .setting-row input[type=time] { height: 40px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 10px; font: var(--body); background: var(--surface); color: var(--text); min-width: 0; }
.setting-row input[type=text] { flex: 1 1 140px; }
.setting-row label { display: inline-flex; align-items: center; gap: 6px; font: var(--small); }
.setting-row .row-inline { display: flex; align-items: center; gap: 10px; }
.btn.quiet.danger-text { color: var(--status-destructive); }
.sheet .sub { font: var(--small); color: var(--text-muted); margin: 0; }
.sheet textarea { min-height: 120px; }
/* rows with several controls wrap on a phone: the text keeps a readable width, the buttons go under it */
.setting-row { flex-wrap: wrap; }
.setting-row .grow { flex: 1 1 55%; }
