/* Client Hub - phone first. One accent colour, big targets, readable outdoors. */
:root {
  --bg: #f4f6f5; --surface: #ffffff; --ink: #14201f; --muted: #5d6b69; --line: #dde3e1;
  --accent: #0f5c5c; --accent-ink: #ffffff; --accent-soft: #e2f0ee; --good: #17693a; --bad: #a23a2c; --warn-bg: #fff4d6; --warn-ink: #6b4e00;
  --radius: 16px; --shadow: 0 1px 2px rgba(20, 32, 31, .06), 0 4px 14px rgba(20, 32, 31, .06);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1514; --surface: #17211f; --ink: #eef3f2; --muted: #9fb0ad; --line: #26332f; --accent: #3fb3a8; --accent-ink: #06201e; --accent-soft: #17302d;
    --good: #6fd39a; --bad: #f09384; --warn-bg: #3a3010; --warn-ink: #f3dd9a; --shadow: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; overflow-x: hidden; background: var(--bg); color: var(--ink); font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; height: auto; display: flex; flex-direction: column; padding: env(safe-area-inset-top) 16px calc(env(safe-area-inset-bottom) + 12px); }
h1 { font-size: 19px; margin: 0; flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 6px; }
p { margin: 6px 0; }
.muted { color: var(--muted); } .small { font-size: 14px; } .center { text-align: center; } .error { color: var(--bad); min-height: 1.4em; }
.icon { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button, .chip, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.top { display: flex; align-items: center; gap: 8px; padding: 12px 0 8px; }
.top .spacer, .icon-btn { width: 44px; height: 44px; display: grid; place-items: center; color: var(--ink); flex: none; }
.link { background: none; border: 0; color: var(--accent); padding: 10px 0 10px 8px; font-size: 15px; flex: none; }
main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.hello { font-size: 21px; font-weight: 650; margin: 0 0 10px; }
.viewing { background: var(--warn-bg); color: var(--warn-ink); border-radius: 12px; padding: 8px 12px; margin-top: 10px; font-size: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.viewing .link { color: inherit; text-decoration: underline; padding: 4px 0; }
.offline-note { display: none; background: var(--warn-bg); color: var(--warn-ink); border-radius: 12px; padding: 8px 12px; font-size: 14px; margin-bottom: 8px; }
body.offline .offline-note { display: block; }

.buttons { padding-top: 6px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.buttons.count-3 .big:first-child, .buttons.count-5 .big:first-child { grid-column: span 2; }
.big { position: relative; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 14px; white-space: nowrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); color: var(--ink); text-decoration: none; font-weight: 600; }
.big .icon { color: var(--accent); flex: none; }
.big:active { transform: scale(.98); }
.big > span:not(.badge) { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.badge { position: absolute; top: -7px; right: 4px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px; border: 2px solid var(--bg); background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 15px; font-weight: 700; }

.chat { flex: 1; min-height: 120px; overflow-y: auto; margin: 12px 0 0; padding: 4px 0 8px; display: flex; flex-direction: column; gap: 10px; }
.turn { display: flex; flex-direction: column; gap: 6px; }
.turn.user { align-items: flex-end; }
.bubble { max-width: 88%; padding: 10px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.turn.user .bubble { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.bubble.pending { color: var(--muted); font-style: italic; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; width: 100%; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.row.total { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; font-weight: 700; }
.amount { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; } .amount.in { color: var(--good); } .amount.out { color: var(--bad); }
.tag { font-size: 13px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 2px 8px; white-space: nowrap; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bubble-text { white-space: pre-wrap; background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; margin: 4px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border-radius: 22px; border: 1px solid var(--accent); background: transparent; color: var(--accent); font-weight: 600; text-decoration: none; }
.chip.wide { width: 100%; margin-top: 10px; }
#alerts { min-height: 40px; font-size: 15px; padding: 4px 16px; }
.list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 24px; }
.with-action { display: flex; gap: 8px; align-items: center; } .with-action .card { flex: 1; }

.dock { flex: none; padding-top: 6px; }
.heard { min-height: 1.4em; text-align: center; color: var(--muted); font-style: italic; }
.talk-row { display: flex; align-items: center; justify-content: center; gap: 28px; }
.talk { width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 6px 20px rgba(15, 92, 92, .35); }
.talk .icon { width: 40px; height: 40px; }
.talk.listening { background: var(--bad); animation: pulse 1.2s ease-in-out infinite; }
.talk.busy { opacity: .55; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(162, 58, 44, .45); } 50% { box-shadow: 0 0 0 18px rgba(162, 58, 44, 0); } }
@media (prefers-reduced-motion: reduce) { .talk.listening { animation: none; } .big:active { transform: none; } }
.round { width: 54px; height: 54px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--ink); flex: none; }
.round.small { width: 48px; height: 48px; background: var(--accent); color: var(--accent-ink); border: 0; }
.round.ghost { visibility: hidden; }
.talk-label { text-align: center; color: var(--muted); font-size: 14px; margin: 6px 0 8px; }
.type-row { display: flex; gap: 8px; }
input[type=text], input[type=password], select { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }

.login { margin: auto 0; display: flex; flex-direction: column; gap: 8px; padding: 24px 0; }
.login .logo { width: 84px; height: 84px; border-radius: 20px; align-self: center; }
.login h1 { font-size: 26px; flex: none; } .login p.muted { text-align: center; margin-bottom: 16px; }
.login label { font-size: 14px; color: var(--muted); margin-top: 6px; }
.primary { min-height: 52px; border-radius: 16px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; margin-top: 10px; }

.admin .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0; } .admin label { font-size: 14px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.switches { display: grid; grid-template-columns: 1fr; gap: 2px; margin: 6px 0; }
.switch { flex-direction: row !important; align-items: center; gap: 10px !important; min-height: 36px; color: var(--ink) !important; font-size: 15px !important; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; } .switch.planned { color: var(--muted) !important; }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%); max-width: 90vw; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; z-index: 10; text-align: center; }

/* Home is one fixed screen: buttons on top, the conversation scrolls in the middle, the talk button stays at the bottom. */
body.home #app { height: 100dvh; overflow: hidden; }
body.home main { overflow: hidden; }
.code { display: block; font: 14px/1.4 ui-monospace, Consolas, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; overflow-wrap: anywhere; user-select: all; }
