/* Murmo: calm, quiet and trustworthy: deep petrol on cool neutrals. Light and dark follow the system. */

:root {
  color-scheme: light dark;
  --bg: #f5f7f8;
  --sidebar: #edf1f3;
  --panel: #ffffff;
  --text: #141c22;
  --muted: #56636c;
  --faint: #86929a;
  --line: #dfe5e9;
  --bubble: #e7eef0;
  --accent: #1d5c6e;
  --accent-hover: #174b5a;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --ok: #2a7a52;
  --focus: #1d5c6e59;
  --shadow: 0 1px 2px #0000000d, 0 4px 16px #0000000a;
  --serif: ui-serif, "Iowan Old Style", "Charter", Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #10171b;
    --sidebar: #0b1216;
    --panel: #18222a;
    --text: #e6edf0;
    --muted: #9fadb5;
    --faint: #6f7e87;
    --line: #26343d;
    --bubble: #20303a;
    --accent: #5fb4c4;
    --accent-hover: #7cc4d1;
    --accent-text: #0b1216;
    --danger: #f2867e;
    --ok: #7fc59b;
    --focus: #5fb4c466;
    --shadow: 0 1px 2px #00000040, 0 4px 16px #00000033;
  }
}

:root[data-theme="light"] { color-scheme: light; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10171b;
  --sidebar: #0b1216;
  --panel: #18222a;
  --text: #e6edf0;
  --muted: #9fadb5;
  --faint: #6f7e87;
  --line: #26343d;
  --bubble: #20303a;
  --accent: #5fb4c4;
  --accent-hover: #7cc4d1;
  --accent-text: #0b1216;
  --danger: #f2867e;
  --ok: #7fc59b;
  --focus: #5fb4c466;
  --shadow: 0 1px 2px #00000040, 0 4px 16px #00000033;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
/* In the app (body.in-app) the window is the app; on the start page (body.landing) the page scrolls. */
body.in-app, body.in-app #app { height: 100%; overflow: hidden; }
@supports (height: 100dvh) { body.in-app, body.in-app #app { height: 100dvh; } }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hidden { display: none !important; }

/* ── buttons and fields ───────────────────────────────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--panel); border-radius: 10px;
  padding: 8px 14px; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--bubble); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bubble); }
.btn.danger { color: var(--danger); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.small { padding: 4px 10px; font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); }
.input {
  border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 10px 12px; width: 100%;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.hint { font-size: 13px; color: var(--muted); }
.error { color: var(--danger); font-size: 14px; min-height: 1.2em; }

/* ── auth ─────────────────────────────────────────────────────────────────────────────────────────────────────── */

.center { height: 100%; overflow-y: auto; display: grid; place-items: center; padding: 24px; }
.auth { width: min(420px, 100%); }
.brand { font-family: var(--serif); font-size: 40px; letter-spacing: -.5px; margin: 0 0 4px; display: flex; align-items: center; gap: 12px; }
.brand img { width: 36px; height: 36px; }
.tagline { color: var(--muted); margin: 0 0 28px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.tabs { display: flex; gap: 4px; background: var(--sidebar); padding: 4px; border-radius: 10px; margin-bottom: 18px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 7px; border-radius: 8px; color: var(--muted); }
.tabs button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.accounts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; background: var(--bg); font-size: 13px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 16px; font-size: 14px; }
.check input { margin-top: 3px; accent-color: var(--accent); }
pre.cardtext {
  font: 13px/1.5 var(--mono); background: var(--bg); border: 1px dashed var(--line); border-radius: 10px;
  padding: 14px; white-space: pre-wrap; word-break: break-all; margin: 12px 0;
}
.seg, .theme { display: flex; gap: 4px; background: var(--sidebar); padding: 4px; border-radius: 10px; }
.seg button, .theme button { flex: 1; border: 0; background: transparent; padding: 6px 8px; border-radius: 8px; color: var(--muted); font-size: 14px; }
.seg button.on, .theme button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.auth-foot { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 16px; }
.auth-foot .theme { width: 240px; }
.topbar .title .home { color: var(--faint); font-weight: 400; font-size: 13px; }
.code { font: 600 22px/1.4 var(--mono); letter-spacing: 1px; text-align: center; padding: 16px; background: var(--bg); border-radius: 10px; margin: 14px 0; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── layout ───────────────────────────────────────────────────────────────────────────────────────────────────── */

.shell { display: grid; grid-template-columns: 280px 1fr; height: 100%; }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-top { padding: 12px 12px 6px; display: flex; align-items: center; justify-content: space-between; }
.side-top .logo { font-family: var(--serif); font-size: 22px; display: flex; gap: 8px; align-items: center; padding-left: 6px; }
.side-top .logo img { width: 22px; height: 22px; }
.side-list { overflow-y: auto; padding: 0 8px 12px; flex: 1; }
.side-head { font-size: 12px; color: var(--faint); padding: 14px 10px 6px; }
.conv { width: 100%; text-align: left; border: 0; background: transparent; border-radius: 9px; padding: 8px 10px; display: flex; align-items: center; gap: 10px; color: var(--text); }
.avatar.small { width: 28px; height: 28px; font-size: 13px; background: var(--line); color: var(--muted); }
.unread { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }
.empty { padding: 4px 10px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.empty p { margin: 0; }
.conv:hover { background: var(--bubble); }
.conv.on { background: var(--bubble); }
.conv .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .tag { color: var(--faint); }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: var(--accent-text); }
.badge.muted { background: var(--line); color: var(--muted); }
.side-foot { border-top: 1px solid var(--line); padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; gap: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-weight: 600; flex: none; }
.me { flex: 1; min-width: 0; }
.me .h { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; cursor: copy; }
.me .s { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.dot.on { background: var(--ok); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 20px; min-height: 56px; }
.topbar .title { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .title .tag { color: var(--faint); font-weight: 400; }
.icon-btn.back-btn { display: none; }
.banner { margin: 0 auto 8px; width: min(768px, calc(100% - 32px)); border-radius: 10px; padding: 10px 14px; font-size: 14px; background: var(--bubble); }
.banner.warn { background: #b3261e1a; color: var(--danger); }

.scroll { flex: 1; overflow-y: auto; }
.thread { width: min(768px, calc(100% - 32px)); margin: 0 auto; padding: 12px 0 24px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.in { align-self: flex-start; }
.msg .body, .msg .fn { unicode-bidi: isolate; } /* text from others cannot reorder what is around it */
.msg.out { align-self: flex-end; background: var(--bubble); padding: 10px 14px; border-radius: 16px 16px 4px 16px; }
.msg.in .body { padding: 2px 0; }
.msg.out.media { background: transparent; padding: 0; }
.msg .meta { font-size: 11px; color: var(--faint); margin-top: 4px; }
.msg.out .meta { text-align: right; }
.day { align-self: center; font-size: 12px; color: var(--faint); }
.msg img.inline { display: block; max-width: min(420px, 100%); max-height: 420px; border-radius: 12px; border: 1px solid var(--line); cursor: zoom-in; }
.filecard { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--panel); white-space: normal; }
.filecard .ico { width: 36px; height: 36px; border-radius: 8px; background: var(--bubble); display: grid; place-items: center; font-size: 12px; color: var(--muted); flex: none; }
.filecard .fi { flex: 1; min-width: 0; }
.filecard .fn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filecard .fs { font-size: 12px; color: var(--muted); }

.welcome { flex: 1; overflow-y: auto; padding: 8px 16px 24px; }
.welcome-inner { width: min(460px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.newconv h1 { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
.newconv p { margin: 0 0 16px; }
.newconv .btn { width: 100%; }
.card.mine, .card.offer { display: flex; align-items: center; gap: 10px; padding: 14px 16px; box-shadow: none; }
.card.mine > div, .card.offer > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.msg .meta .pending { color: var(--danger); }
.msg .meta .delivery { display: inline-flex; vertical-align: -3px; margin-left: 5px; color: var(--muted); }
.msg .meta .delivery.ok { color: var(--ok); }
.link { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; font-size: inherit; }

/* the composer: one rounded box, like a prompt field */
.composer-wrap { padding: 0 16px 18px; }
.composer {
  text-align: left;
  width: min(768px, 100%); margin: 0 auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow); padding: 10px 10px 8px 16px;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.composer textarea { width: 100%; border: 0; outline: none; resize: none; background: transparent; max-height: 240px; padding: 6px 0; display: block; }
.composer .row { display: flex; align-items: center; gap: 8px; }
.composer .row .grow { flex: 1; font-size: 12px; color: var(--faint); }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: transparent; display: grid; place-items: center; }
.icon-btn:hover { background: var(--bubble); }
.send { width: 34px; height: 34px; border-radius: 9px; border: 0; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; }
.send[disabled] { opacity: .4; cursor: default; }
.foot-note { text-align: center; font-size: 12px; color: var(--faint); margin-top: 8px; }

.request-box { width: min(768px, calc(100% - 32px)); margin: 8px auto 18px; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--panel); }
.request-box .actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ── dialogs and toasts ───────────────────────────────────────────────────────────────────────────────────────── */

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); padding: 22px; width: min(460px, calc(100% - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: #0000004d; }
dialog h2 { font-family: var(--serif); font-weight: 400; margin: 0 0 10px; font-size: 24px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dev { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dev:last-child { border-bottom: 0; }
.dev .l { flex: 1; }
.dev .id { font: 12px var(--mono); color: var(--faint); }
dialog.wide { width: min(640px, calc(100% - 24px)); max-height: calc(100dvh - 32px); }
.help h3 { font-size: 15px; margin: 16px 0 6px; }
.help ul, .about ul { margin: 0; padding-left: 18px; }
.help li { margin: 4px 0; font-size: 14px; }
.version { margin-top: 16px; font-variant-numeric: tabular-nums; }
.version a { color: inherit; }
.about { font-size: 13px; color: var(--muted); padding: 4px 4px 0; }
.about li { margin: 3px 0; }
.about .link { margin-top: 8px; font-size: 13px; }
.auth .about { margin-top: 18px; }
.empty .about { padding: 6px 0 0; }
dialog.viewer { width: fit-content; max-width: 95vw; padding: 0; border: 0; background: transparent; box-shadow: none; overflow: visible; cursor: zoom-out; }
dialog.viewer::backdrop { background: #000000b3; }
dialog.viewer img { max-width: 92vw; max-height: 86dvh; display: block; border-radius: 10px; }
dialog.viewer .close {
  position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: #000000a6; color: #fff; display: grid; place-items: center; z-index: 1;
}
dialog.viewer .close svg { width: 22px; height: 22px; }

.update {
  position: fixed; top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 11;
  width: max-content; max-width: calc(100% - 24px); display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px 8px 14px;
  font-size: 14px; box-shadow: var(--shadow);
}
.toasts { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 10; }
.toast { background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); }

.drop { outline: 2px dashed var(--accent); outline-offset: -8px; }

/* Narrow screens: the list of conversations is the start page; an open conversation covers it. */
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; }
  .shell:not(.chat) .main, .shell.chat .sidebar { display: none; }
  .icon-btn.back-btn { display: grid; }
  .topbar { padding: 10px 12px; }
  .topbar .wide { display: none; }
  .conv { padding: 12px 10px; font-size: 16px; }
  .avatar.small { width: 36px; height: 36px; font-size: 15px; }
  .input, .composer textarea { font-size: 16px; } /* no zoom on focus in iOS */
}

/* ── start page: the product page around the login card (index.html) ─────────────────────────────────────────── */

body.in-app .site-head, body.in-app .site-foot, body.in-app main > section:not(.hero), body.in-app .hero-text { display: none; }
body.in-app main, body.in-app .hero, body.in-app .hero-app { display: block; height: 100%; margin: 0; padding: 0; max-width: none; }

.landing { scroll-behavior: smooth; }
.landing a { color: var(--accent); }
.landing a.btn { color: var(--text); text-decoration: none; }
.site-head {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 24px;
  padding: 12px max(24px, calc((100% - 1120px) / 2)); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.site-head .logo { display: flex; align-items: center; gap: 9px; font: 22px var(--serif); color: var(--text); text-decoration: none; }
.site-head nav { display: flex; gap: 20px; margin-left: auto; }
.site-head nav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.site-head nav a:hover { color: var(--text); }
.landing main > section { max-width: 1120px; margin: 0 auto; padding: 72px 24px; scroll-margin-top: 64px; }
.landing main > section.band { max-width: none; background: var(--sidebar); padding-left: max(24px, calc((100% - 1072px) / 2)); padding-right: max(24px, calc((100% - 1072px) / 2)); }
.hero { display: grid; grid-template-columns: 1fr minmax(320px, 420px); gap: 56px; align-items: start; }
.landing main > section.hero { padding-top: 56px; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-weight: 600; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.hero h1 { font: 46px/1.12 var(--serif); letter-spacing: -.8px; margin: 0 0 18px; }
.lead { font-size: 18px; color: var(--muted); margin: 0 0 22px; max-width: 34em; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checks li { position: relative; padding-left: 30px; }
.checks li::before {
  content: ""; position: absolute; left: 0; top: 3px; width: 19px; height: 19px; border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 10.5l3 3 6-7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 15px no-repeat;
}
.hero-app { scroll-margin-top: 80px; min-height: 420px; }
.landing h2 { font: 32px/1.2 var(--serif); letter-spacing: -.4px; margin: 0 0 14px; }
.landing h3 { font-size: 16px; margin: 0 0 6px; }
.landing main p { margin: 0 0 12px; }
.section-lead { color: var(--muted); max-width: 40em; margin-bottom: 28px !important; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step); display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 12px;
  border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 600;
}
.steps p, .grid p, .faq p { color: var(--muted); }
.landing code { font: 14px var(--mono); background: var(--bubble); padding: 1px 6px; border-radius: 6px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid article { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.split ul { padding-left: 20px; margin: 0; display: grid; gap: 6px; color: var(--muted); }
.facts { list-style: none; padding: 20px !important; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); gap: 12px !important; }
.facts strong { color: var(--text); }
.faq { display: grid; gap: 10px; max-width: 800px; }
.faq details { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details[open] summary { margin-bottom: 8px; }
.site-foot { border-top: 1px solid var(--line); padding: 28px 24px 40px; text-align: center; color: var(--muted); font-size: 14px; }
.site-foot p { margin: 4px 0; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .landing main > section.hero { padding-top: 32px; }
  .hero h1 { font-size: 36px; }
  .steps, .grid, .split { grid-template-columns: 1fr; }
  .site-head nav { display: none; }
  .site-head .btn { margin-left: auto; }
  .landing main > section { padding-top: 48px; padding-bottom: 48px; }
}
