:root {
  color-scheme: light;
  --ink: #112c36;
  --muted: #60727a;
  --navy: #0f2f3b;
  --navy-2: #174654;
  --teal: #2b7a78;
  --mint: #dcebe6;
  --mint-2: #eef6f2;
  --cream: #f7f3eb;
  --paper: #fffdf8;
  --line: #e3ddd3;
  --warm: #c49a60;
  --danger: #a33a3a;
  --shadow: 0 16px 45px rgba(17, 44, 54, .10);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--cream); color: var(--ink); }
body { min-height: 100dvh; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.auth-shell { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top right, #dcebe6 0, transparent 35%), var(--cream); }
.auth-card { width: min(430px, 100%); padding: 36px 30px; border: 1px solid var(--line); border-radius: 30px; background: var(--paper); box-shadow: var(--shadow); text-align: center; }
.brand-mark { width: 64px; height: 64px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 22px 22px 8px 22px; background: var(--navy); color: white; font: 700 28px Georgia, serif; }
.brand-mark.shield { background: var(--teal); }
.brand-mark.mini { width: 38px; height: 38px; margin: 0; border-radius: 14px 14px 5px 14px; font-size: 18px; flex: 0 0 auto; }
h1, h2, h3, p { margin-top: 0; }
h1 { font: 700 34px Georgia, serif; margin-bottom: 8px; }
.tagline { color: var(--muted); margin-bottom: 26px; }
.stack { display: grid; gap: 16px; text-align: left; }
label { color: var(--muted); font-size: 14px; font-weight: 600; }
input, textarea { font-size: 16px; width: 100%; min-width: 0; border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 14px; padding: 13px 14px; outline: none; }
button, a { touch-action: manipulation; }
.settings-card button { margin: 12px 8px 0 0; }
input:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(43,122,120,.12); }
.primary { border: 0; border-radius: 14px; padding: 14px 18px; background: var(--navy); color: white; font-weight: 700; }
.security-note { margin: 18px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.app-shell { min-height: 100dvh; max-width: 980px; margin: 0 auto; background: var(--paper); box-shadow: 0 0 0 1px rgba(17,44,54,.04); }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 18px 14px; background: rgba(255,253,248,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.brand-button { border: 0; background: transparent; display: flex; align-items: center; gap: 10px; color: var(--ink); padding: 0; text-align: left; }
.brand-button strong { display: block; font-family: Georgia, serif; font-size: 18px; }
.brand-button small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.status-pill { font-size: 11px; color: var(--teal); background: var(--mint-2); padding: 7px 9px; border-radius: 999px; }
.icon-button { border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); padding: 8px 10px; }
.page-panel { padding: 22px 18px 42px; }
.hero { padding: 26px 24px; border-radius: 28px; color: white; background: linear-gradient(145deg, var(--navy), var(--navy-2)); box-shadow: var(--shadow); }
.hero h2 { font: 700 30px Georgia, serif; margin-bottom: 8px; }
.hero p:last-child { margin-bottom: 0; color: #dbe8eb; }
.eyebrow { margin-bottom: 8px; font-size: 11px; letter-spacing: .16em; font-weight: 800; color: var(--warm); }
.menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-top: 16px; }
.menu-card { min-height: 108px; display: flex; align-items: center; gap: 14px; text-align: left; border: 1px solid var(--line); border-radius: 20px; padding: 18px; background: white; color: var(--ink); box-shadow: 0 6px 20px rgba(17,44,54,.04); }
.menu-card:hover { transform: translateY(-1px); border-color: #ccd9d5; }
.menu-icon { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 14px; background: var(--mint); color: var(--navy); font-size: 20px; }
.menu-card strong, .menu-card small { display: block; }
.menu-card small { margin-top: 6px; color: var(--muted); line-height: 1.35; }
.privacy-banner { margin-top: 16px; padding: 18px; border-radius: 18px; background: #f1e9dc; color: #604f3b; }
.privacy-banner strong, .privacy-banner span { display: block; }
.privacy-banner span { margin-top: 5px; font-size: 13px; }
.section-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font: 700 28px Georgia, serif; }
.back-button { width: 40px; height: 40px; border: 1px solid var(--line); background: white; border-radius: 14px; color: var(--ink); font-size: 20px; }
.list-content { display: grid; gap: 10px; }
.list-row { display: flex; align-items: center; gap: 13px; width: 100%; border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: white; color: var(--ink); text-align: left; }
.list-row .avatar { width: 44px; height: 44px; border-radius: 16px; display: grid; place-items: center; background: var(--mint); color: var(--navy); font-weight: 800; flex: 0 0 auto; }
.list-row .row-copy { min-width: 0; flex: 1; }
.list-row strong, .list-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row small { color: var(--muted); margin-top: 4px; }
.empty-state { border: 1px dashed #cfc6b8; padding: 26px; border-radius: 20px; color: var(--muted); text-align: center; }
.chat-panel { min-height: calc(100dvh - 70px); display: grid; grid-template-rows: auto auto 1fr auto; }
.chat-header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 69px; z-index: 9; }
.contact-avatar { width: 44px; height: 44px; border-radius: 16px; display: grid; place-items: center; background: var(--mint); font-weight: 800; color: var(--navy); }
.chat-person { flex: 1; min-width: 0; }
.chat-person strong, .chat-person small { display: block; }
.chat-person small { color: var(--muted); margin-top: 3px; font-size: 11px; }
.chat-actions { display: flex; gap: 6px; }
.round-button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--mint); color: var(--navy); }
.round-button:disabled { opacity: .45; cursor: default; }
.encryption-strip { justify-self: center; margin-top: 10px; padding: 6px 10px; border-radius: 999px; background: var(--mint-2); color: var(--teal); font-size: 11px; }
.messages { padding: 18px 16px 26px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.message { max-width: min(78%, 560px); padding: 11px 13px; border-radius: 18px; background: #f1eee8; align-self: flex-start; box-shadow: 0 3px 10px rgba(17,44,54,.04); }
.message.mine { align-self: flex-end; background: var(--mint); }
.message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.message time { display: block; text-align: right; color: var(--muted); font-size: 10px; margin-top: 6px; }
.attachment-card { min-width: 210px; }
.attachment-card strong { display: block; overflow-wrap: anywhere; }
.attachment-card small { color: var(--muted); display: block; margin: 5px 0 9px; }
.attachment-card button { border: 1px solid #bfd4cf; background: white; color: var(--navy); border-radius: 12px; padding: 8px 10px; }
.preview-media { display: block; max-width: 100%; max-height: 360px; border-radius: 12px; margin-top: 8px; }
.composer { position: sticky; bottom: 0; display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,253,248,.97); backdrop-filter: blur(12px); }
.composer textarea { min-height: 44px; max-height: 130px; resize: none; }
.attach-button { width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center; background: var(--mint); color: var(--navy); font-size: 25px; cursor: pointer; }
.send-button { min-height: 44px; border: 0; border-radius: 14px; background: var(--navy); color: white; font-weight: 700; padding: 0 14px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; max-width: min(90vw, 520px); padding: 12px 16px; border-radius: 14px; background: var(--navy); color: white; box-shadow: var(--shadow); }
.toast.error { background: var(--danger); }
.settings-card { padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.settings-card + .settings-card { margin-top: 10px; }
.settings-card strong { display: block; }
.settings-card p { color: var(--muted); margin: 6px 0 0; font-size: 13px; line-height: 1.45; }
@media (max-width: 640px) {
  .menu-grid { grid-template-columns: 1fr; }
  .menu-card { min-height: 86px; }
  .status-pill { display: none; }
  .page-panel { padding-left: 14px; padding-right: 14px; }
  .hero { border-radius: 22px; }
  .chat-header { top: 67px; }
}
