/* Hekim Hattı — one stylesheet, phone first. Touch targets ≥ 44px, text ≥ 12px, inputs 16px (no iOS zoom). */
:root {
  /* Hekim Hattı identity: indigo → violet, calm lavender surfaces. Red is only for emergencies. */
  /* Health theme (28 Kasım 2026): petrol blue to turquoise; white text stays above 5:1 on all of it. */
  --brand: #0b6578;
  --brand-600: #0e7490;
  --brand-700: #0b4f5f;
  --brand-50: #ebf8fa;
  --brand-100: #d4f1f6;
  --violet: #0f766e;
  --grad: linear-gradient(135deg, #0b4f5f 0%, #0e7490 50%, #0f766e 100%);
  --grad-soft: linear-gradient(135deg, #ebf8fa 0%, #eefaf6 100%);
  --ink: #10252c;
  --ink-2: #27393f;
  --muted: #50646c;
  --bg: #f3f6f7;
  --card: #ffffff;
  --line: #e1e8eb;
  --line-2: #d1dce0;
  --red: #dc2626;
  --red-700: #b91c1c;
  --red-bg: #fdeeee;
  --amber: #b45309;
  --amber-bg: #fff4e5;
  --green: #15803d;
  --green-600: #15803d;
  --green-bg: #e9f8ef;
  --blue: #0b4f5f;
  --blue-bg: #ebf8fa;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(16, 37, 44, .05), 0 8px 24px -12px rgba(16, 37, 44, .14);
  --shadow-lg: 0 24px 60px -20px rgba(16, 37, 44, .35);
  --tabbar-h: 66px;
  --sidebar-w: 268px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink); background: radial-gradient(1200px 600px at 100% -10%, #d8f3ee 0%, rgba(216, 243, 238, 0) 60%), radial-gradient(900px 500px at -10% 10%, #d4f1f6 0%, rgba(212, 241, 246, 0) 55%), var(--bg); background-attachment: fixed;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 750; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0 0 10px; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 10px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid #7fd0de; outline-offset: 2px; }
.icon { width: 22px; height: 22px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.error { color: var(--red); font-size: 14px; min-height: 0; margin: 6px 0 0; }
.error:empty { display: none; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
#app { min-height: 100vh; min-height: 100dvh; outline: none; }
.page { max-width: 760px; margin: 0 auto; padding: 16px 16px 28px; }
.page.wide { max-width: 1080px; }
body.has-tabbar .page { padding-bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); }
.page-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; }
.page-head h1 { margin: 0; flex: 1; min-width: 0; }
.back { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; flex: none; }
.back .icon { width: 20px; height: 20px; transform: rotate(180deg); }
.boot { display: grid; place-items: center; min-height: 60vh; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--brand-100); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 48px 0; }

/* ---------- Top bar & tab bar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .94); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top);
}
.topbar-in { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 8px 16px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand-mark { width: 36px; height: 36px; border-radius: 12px; background: var(--grad); display: grid; place-items: center; color: #fff; flex: none; }
.brand-mark .icon { width: 20px; height: 20px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 16px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-nav { display: none; gap: 4px; margin-left: 12px; }
.top-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; height: 44px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 15px; position: relative; }
.top-nav a:hover { background: var(--bg); }
.top-nav a.active { color: var(--brand); background: var(--brand-50); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.badge { min-width: 20px; height: 20px; border-radius: 10px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; padding: 0 6px; line-height: 1; }
.badge.soft { background: var(--brand); }
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(255, 255, 255, .97); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom);
}
#tabbar[hidden] { display: none; }
#tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--tabbar-h); text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 600; position: relative; min-width: 0; }
#tabbar a .icon { width: 24px; height: 24px; }
#tabbar a.active { color: var(--brand-600); }
#tabbar a.active::before { content: ""; position: absolute; top: 8px; width: 54px; height: 32px; border-radius: 16px; background: linear-gradient(135deg, #d4f1f6, #d8f3ee); z-index: -1; }
#tabbar a { z-index: 0; }
#tabbar a .badge { position: absolute; top: 6px; left: calc(50% + 6px); }
#tabbar a.tab-ask .tab-ask-dot { width: 44px; height: 44px; border-radius: 14px; background: var(--grad); color: #fff; display: grid; place-items: center; margin-top: -2px; box-shadow: 0 4px 12px rgba(11, 101, 120, .35); }
#tabbar a.tab-ask .tab-ask-dot .icon { width: 24px; height: 24px; }
#tabbar a.tab-ask span:last-child { margin-top: 1px; }
@media (min-width: 900px) {
  .top-nav { display: flex; }
  #tabbar { display: none !important; }
  body.has-tabbar .page { padding-bottom: 40px; }
}

/* Availability switch (doctor) */
.avail { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px 0 10px; border-radius: 22px; border: 1px solid var(--line-2); background: #fff; cursor: pointer; font-weight: 650; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.avail .dot { width: 10px; height: 10px; border-radius: 50%; background: #9aa8b5; box-shadow: 0 0 0 3px rgba(154, 168, 181, .25); }
.avail.on { border-color: #9fd8b4; background: var(--green-bg); color: var(--green); }
.avail.on .dot { background: var(--green-600); box-shadow: 0 0 0 3px rgba(25, 145, 74, .22); }
@media (max-width: 420px) { .avail .avail-long { display: none; } }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card, .card + .section, .section + .card, .section + .section { margin-top: 14px; }
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; margin: 0 0 10px; }
.card-title .icon { color: var(--brand); width: 20px; height: 20px; }
.card.flat { box-shadow: none; }
.card.tint { background: linear-gradient(135deg, #ebf8fa, #effbf8); border-color: #bfe6ec; box-shadow: none; }
.card.warn { background: var(--amber-bg); border-color: #f3d39b; box-shadow: none; }
.card.danger { background: var(--red-bg); border-color: #f2c2c2; box-shadow: none; }
.card.ok { background: var(--green-bg); border-color: #b9e2c7; box-shadow: none; }
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 22px 4px 8px; display: flex; align-items: center; gap: 8px; }
.section-title a { margin-left: auto; text-transform: none; letter-spacing: 0; font-size: 14px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.kv { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 6px 12px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }

/* ---------- Buttons ---------- */
.btn, .btn-secondary, .btn-ghost, .btn-danger, .btn-call, .btn-emergency, .btn-light {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: var(--radius-sm);
  font-weight: 650; font-size: 16px; text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: background .15s, border-color .15s, transform .05s; text-align: center; line-height: 1.2;
}
.btn:active, .btn-secondary:active, .btn-call:active, .btn-emergency:active, .btn-danger:active { transform: scale(.985); }
.btn { background: var(--grad); color: #fff; box-shadow: 0 8px 18px -8px rgba(14, 116, 144, .75); }
.btn:hover { filter: brightness(1.08); }
.btn-secondary { background: #fff; color: var(--brand); border-color: var(--brand-100); }
.btn-secondary:hover { border-color: var(--brand); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line-2); }
.btn-ghost:hover { background: #fff; }
.btn-light { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .28); }
.btn-danger { background: #fff; color: var(--red); border-color: #efc2c2; }
.btn-danger-solid { background: var(--red); color: #fff; }
.btn-call { background: #15803d; color: #fff; }
.btn-call:hover { background: #166534; }
.btn-emergency { background: var(--red); color: #fff; font-size: 18px; min-height: 58px; box-shadow: 0 6px 18px rgba(196, 43, 43, .28); }
.btn-emergency:hover { background: var(--red-700); }
.btn-block { width: 100%; }
.btn-small { min-height: 44px; padding: 0 14px; font-size: 15px; }
.btn-lg { min-height: 58px; font-size: 18px; border-radius: 14px; }
button:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
button[aria-busy="true"] { position: relative; color: transparent !important; }
button[aria-busy="true"]::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn-secondary[aria-busy="true"]::after, .btn-ghost[aria-busy="true"]::after, .btn-danger[aria-busy="true"]::after { border-color: var(--brand-100); border-top-color: var(--brand); }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: #fff; display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); flex: none; }
.icon-btn:hover { border-color: var(--line-2); }
.link-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--brand); font-weight: 650; cursor: pointer; padding: 0 4px; min-height: 44px; font-size: 15px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-row > * { min-width: 0; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field > label, .field > .label { display: block; font-weight: 650; font-size: 15px; margin-bottom: 6px; color: var(--ink-2); }
.field .optional { font-weight: 500; color: var(--muted); font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=search], input[type=time], input[type=date], select, textarea {
  width: 100%; min-height: 48px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; padding: 11px 14px; font-size: 16px; color: var(--ink);
  transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a6180' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 40px; }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-600); box-shadow: 0 0 0 4px rgba(14, 116, 144, .14); }
input::placeholder, textarea::placeholder { color: #8796a5; }
.input-unit { display: flex; align-items: stretch; }
.input-unit input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-unit span { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line-2); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--bg); color: var(--muted); font-size: 14px; white-space: nowrap; }
.code-input { text-align: center; font-size: 26px !important; letter-spacing: .3em; font-weight: 700; text-transform: uppercase; min-height: 60px !important; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; cursor: pointer; min-height: 44px; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.check span { flex: 1; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { min-height: 44px; padding: 8px 14px; border-radius: 22px; border: 1px solid var(--line-2); background: #fff; cursor: pointer; font-weight: 600; font-size: 15px; color: var(--ink-2); text-align: left; }
.pill[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.seg { display: inline-flex; background: #eef2f6; border-radius: 12px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { min-height: 44px; border: 0; background: transparent; padding: 0 14px; border-radius: 10px; font-weight: 650; font-size: 15px; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.switch-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.switch-row:first-child { border-top: 0; }
.switch-row .text { flex: 1; min-width: 0; }
.switch-row .text strong { display: block; font-size: 15px; }
.switch-row .text span { display: block; font-size: 13px; color: var(--muted); }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 16px; background: #cbd5df; transition: background .2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked + .track { background: var(--brand-600); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid #7fd0de; outline-offset: 2px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }

/* ---------- Chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 13px; font-weight: 650; background: #eef2f6; color: var(--ink-2); white-space: nowrap; }
.chip .icon { width: 14px; height: 14px; }
.chip.emergency { background: var(--red); color: #fff; }
.chip.priority { background: var(--amber-bg); color: var(--amber); }
.chip.routine { background: #eef2f6; color: var(--muted); }
.chip.ok { background: var(--green-bg); color: var(--green); }
.chip.info { background: var(--blue-bg); color: var(--blue); }
.chip.brand { background: linear-gradient(135deg, #d4f1f6, #d8f3ee); color: #0b6578; }
.chip.sample { background: #e3f4f0; color: #115e59; }
.online-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green-600); display: inline-block; flex: none; }

/* ---------- Lists ---------- */
.list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; text-decoration: none; color: inherit; border-top: 1px solid var(--line); position: relative; min-height: 64px; background: #fff; }
.list-item:first-child { border-top: 0; }
a.list-item:hover, button.list-item:hover { background: #fafcfd; }
button.list-item { width: 100%; text-align: left; border-left: 0; border-right: 0; border-bottom: 0; font: inherit; cursor: pointer; }
.list-item .main { flex: 1; min-width: 0; }
.list-item .title { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.list-item .title > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .sub { color: var(--muted); font-size: 14px; margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.list-item .meta { font-size: 13px; color: var(--muted); white-space: nowrap; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.list-item .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.list-item.unread .title::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); flex: none; }
.list-item.u-emergency { box-shadow: inset 4px 0 0 var(--red); }
.list-item.u-priority { box-shadow: inset 4px 0 0 #e59a2c; }
.lead-ic { width: 42px; height: 42px; border-radius: 14px; background: linear-gradient(135deg, #d4f1f6, #d8f3ee); color: #0e7490; display: grid; place-items: center; flex: none; }
.lead-ic.red { background: linear-gradient(135deg, #fee2e2, #ffe4e6); color: #dc2626; }
.lead-ic.green { background: linear-gradient(135deg, #dcfce7, #ccfbf1); color: #059669; }
.lead-ic.amber { background: linear-gradient(135deg, #fef3c7, #ffedd5); color: #d97706; }
.lead-ic.gray { background: #eef2f6; color: var(--muted); }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 750; font-size: 17px; flex: none; letter-spacing: .02em; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.sm { width: 40px; height: 40px; font-size: 15px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .icon { width: 40px; height: 40px; margin: 0 auto 10px; color: #a9b6c2; }
.empty p { margin: 0 auto 14px; max-width: 360px; }

/* Tabs (filters) */
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 12px; padding: 2px 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--line-2); background: #fff; text-decoration: none; color: var(--ink-2); font-weight: 650; font-size: 15px; cursor: pointer; }
.tabs a.active, .tabs button.active { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 14px -8px rgba(14, 116, 144, .8); }
.tabs .count { font-size: 12px; background: rgba(0, 0, 0, .08); border-radius: 10px; padding: 1px 7px; }
.tabs a.active .count, .tabs button.active .count { background: rgba(255, 255, 255, .22); }
.tabs .count.hot { background: var(--red); color: #fff; }
.search { position: relative; margin-bottom: 12px; }
.search .icon { position: absolute; left: 12px; top: 13px; color: var(--muted); width: 20px; height: 20px; pointer-events: none; }
.search input { padding-left: 42px; }

/* ---------- Home (patient) ---------- */
.doctor-card { display: flex; gap: 14px; align-items: center; }
.doctor-card .who { min-width: 0; flex: 1; }
.doctor-card .name { font-size: 18px; font-weight: 750; line-height: 1.25; }
.doctor-card .clinic { color: var(--muted); font-size: 14px; }
.hero-ask { display: flex; align-items: center; gap: 14px; width: 100%; padding: 18px; border-radius: 18px; background: var(--grad); color: #fff; border: 0; text-decoration: none; cursor: pointer; box-shadow: 0 8px 22px rgba(11, 101, 120, .28); text-align: left; }
.hero-ask .ic { width: 52px; height: 52px; border-radius: 16px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; flex: none; }
.hero-ask .ic .icon { width: 28px; height: 28px; }
.hero-ask strong { display: block; font-size: 19px; }
.hero-ask span { display: block; font-size: 14px; opacity: .9; }
.hero-ask .go { margin-left: auto; }
.emergency-strip { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; border-radius: 14px; background: #fff; border: 1px solid #f0c4c4; }
.emergency-strip .em-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; color: var(--red); text-decoration: none; min-height: 44px; }
.emergency-strip .em-main > span { min-width: 0; }
.emergency-strip strong { display: block; color: var(--red-700); }
.emergency-strip .em-main span span { display: block; font-size: 13px; color: var(--muted); }
.emergency-strip .call112 { margin-left: auto; background: var(--red); color: #fff; border-radius: 12px; min-height: 44px; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px; font-weight: 750; text-decoration: none; white-space: nowrap; }

/* ---------- Wizard ---------- */
.wizard-head { margin: 2px 0 14px; }
.progress { height: 6px; border-radius: 3px; background: #e2e8ee; overflow: hidden; margin: 10px 0 4px; }
.progress span { display: block; height: 100%; background: var(--brand); border-radius: 3px; transition: width .25s; }
.step-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.topic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.topic { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; min-height: 124px; border-radius: 20px; border: 1px solid var(--line); background: #fff; cursor: pointer; text-align: left; box-shadow: var(--shadow); color: var(--ink); transition: transform .12s, box-shadow .12s; }
.topic:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -16px rgba(14, 116, 144, .45); }
.topic .ic { width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, #d4f1f6, #d8f3ee); color: #0e7490; display: grid; place-items: center; }
/* Every topic its own colour (cycled), so the list is quick to scan. */
.topic:nth-child(8n+2) .ic { background: linear-gradient(135deg, #fce7f3, #ffe4e6); color: #db2777; }
.topic:nth-child(8n+3) .ic { background: linear-gradient(135deg, #dcfce7, #ccfbf1); color: #059669; }
.topic:nth-child(8n+4) .ic { background: linear-gradient(135deg, #e0f2fe, #dbeafe); color: #0284c7; }
.topic:nth-child(8n+5) .ic { background: linear-gradient(135deg, #fef3c7, #ffedd5); color: #d97706; }
.topic:nth-child(8n+6) .ic { background: linear-gradient(135deg, #e0f2fe, #dbeafe); color: #0369a1; }
.topic:nth-child(8n+7) .ic { background: linear-gradient(135deg, #ccfbf1, #cffafe); color: #0d9488; }
.topic:nth-child(8n+8) .ic { background: linear-gradient(135deg, #ffedd5, #fee2e2); color: #ea580c; }
.topic strong { font-size: 15.5px; line-height: 1.25; }
.topic span { font-size: 13px; color: var(--muted); line-height: 1.35; }
@media (max-width: 360px) { .topic-grid { grid-template-columns: 1fr; } .topic { min-height: 0; } }
.flag { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; margin-bottom: 8px; min-height: 56px; }
.flag input { width: 24px; height: 24px; margin: 0; accent-color: var(--red); flex: none; }
.flag span { flex: 1; font-weight: 600; font-size: 15.5px; line-height: 1.4; }
.flag.on { border-color: #e9a3a3; background: var(--red-bg); }
.wizard-foot { position: sticky; bottom: 0; padding: 12px 0 4px; background: linear-gradient(to top, var(--bg) 70%, rgba(243, 246, 249, 0)); margin-top: 8px; z-index: 2; }
body.has-tabbar .wizard-foot { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { body.has-tabbar .wizard-foot { bottom: 0; } }
details.faq { background: #fff; border: 1px solid var(--line); border-radius: 16px; margin-bottom: 8px; overflow: hidden; }
details.faq summary { list-style: none; cursor: pointer; padding: 14px 16px; font-weight: 650; display: flex; align-items: center; gap: 10px; min-height: 52px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary .icon { margin-left: auto; transition: transform .2s; color: var(--muted); }
details.faq[open] summary .icon { transform: rotate(180deg); }
details.faq .faq-body { padding: 0 16px 14px; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.q-block { padding: 14px 0; border-top: 1px solid var(--line); }
.q-block:first-child { border-top: 0; padding-top: 0; }
.q-block > .label { font-weight: 700; margin-bottom: 10px; display: block; }
.attach-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.attach { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 14px; }
.attach .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---------- Result & emergency ---------- */
.result-ic { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 8px auto 14px; }
.result-ic .icon { width: 36px; height: 36px; }
.result-ic.ok { background: var(--green-bg); color: var(--green); }
.result-ic.brand { background: var(--brand-50); color: var(--brand); }
.result-ic.amber { background: var(--amber-bg); color: var(--amber); }
.emergency { background: linear-gradient(180deg, #b71c1c 0%, #c62828 55%, #d03a3a 100%); color: #fff; border-radius: 20px; padding: 22px 18px; box-shadow: var(--shadow-lg); }
.emergency h1 { color: #fff; font-size: 26px; }
.emergency p { color: rgba(255, 255, 255, .92); }
.emergency .big-call { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 68px; border-radius: 16px; background: #fff; color: var(--red-700); font-size: 22px; font-weight: 800; text-decoration: none; margin: 16px 0 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.emergency .big-call .icon { width: 28px; height: 28px; }
.emergency ul { margin: 14px 0 0; padding-left: 20px; }
.emergency li { margin-bottom: 8px; }
.emergency .src { font-size: 12.5px; opacity: .85; margin-top: 14px; }
.notice { display: flex; gap: 12px; padding: 14px; border-radius: 14px; background: var(--blue-bg); color: #1d3f75; font-size: 15px; align-items: flex-start; }
.notice .icon { flex: none; margin-top: 1px; }
.notice.warn { background: var(--amber-bg); color: #6d3c05; }
.notice.danger { background: var(--red-bg); color: var(--red-700); }
.notice.ok { background: var(--green-bg); color: #0f5a2c; }
.notice p:last-child { margin-bottom: 0; }

/* ---------- Conversation ---------- */
.thread-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.thread-head .grow h1 { font-size: 20px; margin: 0; overflow-wrap: anywhere; }
.thread-head .grow .sub { color: var(--muted); font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.messages { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.msg { display: flex; flex-direction: column; max-width: 86%; }
.msg .bubble { padding: 10px 14px; border-radius: 18px; font-size: 15.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .when { font-size: 12px; color: var(--muted); margin: 3px 8px 0; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.mine .bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 6px; }
.msg.theirs { align-self: flex-start; }
.msg.theirs .bubble { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.auto .bubble { background: #f2faf5; border: 1px solid #bfe3cc; border-bottom-left-radius: 6px; }
.msg .label { font-size: 12.5px; font-weight: 700; color: var(--green); margin: 0 8px 4px; display: flex; align-items: center; gap: 5px; }
.msg .label.doc { color: var(--brand); }
.msg .label .icon { width: 14px; height: 14px; }
.msg.system { align-self: center; max-width: 92%; }
.msg.system .bubble { background: #e9eef3; color: var(--ink-2); font-size: 13.5px; padding: 7px 12px; border-radius: 12px; text-align: center; }
.msg.system.danger .bubble { background: var(--red-bg); color: var(--red-700); }
.msg .file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .18); color: inherit; border: 1px solid rgba(255, 255, 255, .35); cursor: pointer; font: inherit; font-size: 14px; text-decoration: none; max-width: 100%; min-height: 44px; }
.msg.theirs .file-chip { background: var(--bg); border-color: var(--line); }
.msg .file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seen { font-size: 12px; color: var(--muted); align-self: flex-end; margin-top: -4px; display: flex; gap: 4px; align-items: center; }
.seen .icon { width: 14px; height: 14px; color: var(--brand); }
.composer { position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 85%, rgba(243, 246, 249, 0)); padding: 10px 0 4px; z-index: 3; }
body.has-tabbar .composer { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { body.has-tabbar .composer { bottom: 0; } }
.composer .box { background: #fff; border: 1px solid var(--line-2); border-radius: 18px; padding: 8px; box-shadow: var(--shadow); }
.composer textarea { border: 0; min-height: 52px; max-height: 220px; padding: 8px 10px; box-shadow: none !important; }
.composer .tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.composer .tools .grow { min-width: 8px; }
.intake { font-size: 15px; }
.intake .qa { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 8px 0; border-top: 1px dashed var(--line); }
.intake .qa:first-child { border-top: 0; }
.intake .qa span:first-child { color: var(--muted); }
.intake .qa span:last-child { font-weight: 650; text-align: right; overflow-wrap: anywhere; }
.ai-card { border: 1px solid #cfe6ea; background: linear-gradient(180deg, #f6fbfc, #fff); }
.ai-card .card-title .icon { color: #0e7490; }
.draft { background: #fff; border: 1px dashed #b9dfe6; border-radius: 12px; padding: 12px; white-space: pre-wrap; font-size: 15px; margin: 8px 0; overflow-wrap: anywhere; }
.reasons { margin: 6px 0 0; padding-left: 18px; font-size: 14.5px; }
.reasons li { margin: 2px 0; }
.call-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.call-box .grow { min-width: 180px; }
.two-col { display: grid; gap: 14px; }
@media (min-width: 900px) { .two-col { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } .two-col > aside { position: sticky; top: 76px; } }

/* ---------- Stats ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 14px 14px 14px 18px; box-shadow: var(--shadow); min-width: 0; position: relative; overflow: hidden; }
.tile::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: #0891b2; }
.tile:nth-child(6n+2)::before { background: #0ea5e9; }
.tile:nth-child(6n+3)::before { background: #f59e0b; }
.tile:nth-child(6n+4)::before { background: #10b981; }
.tile:nth-child(6n+5)::before { background: #ec4899; }
.tile:nth-child(6n+6)::before { background: #ef4444; }
.tile .v { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.tile .l { font-size: 13.5px; color: var(--muted); margin-top: 4px; line-height: 1.3; }
.tile.hl { background: linear-gradient(135deg, #ecfdf5, #f0fdfa); border-color: #a7f3d0; }
.tile.hl::before { background: #059669; }
.tile.hl .v { color: #047857; }
.chart { width: 100%; height: auto; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Settings editors ---------- */
.editor-item { border: 1px solid var(--line); border-radius: 14px; background: #fff; margin-bottom: 10px; overflow: hidden; }
.editor-item > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; min-height: 56px; }
.editor-item > summary::-webkit-details-marker { display: none; }
.editor-item > summary strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-body { padding: 4px 14px 14px; border-top: 1px solid var(--line); }
.q-editor { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; background: #fafcfd; }
.opt-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.opt-row input[type=text] { flex: 1; min-width: 0; }
.opt-row label { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; white-space: nowrap; min-height: 44px; cursor: pointer; }
.opt-row label input { width: 20px; height: 20px; accent-color: var(--amber); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 > * { min-width: 0; }
.sticky-save { position: sticky; bottom: 0; padding: 12px 0 4px; background: linear-gradient(to top, var(--bg) 75%, rgba(243, 246, 249, 0)); z-index: 3; }
body.has-tabbar .sticky-save { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { body.has-tabbar .sticky-save { bottom: 0; } }
.code-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.code-box .code { font-size: 28px; font-weight: 800; letter-spacing: .18em; color: var(--brand); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.day-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.day-pills .pill { min-width: 52px; text-align: center; padding: 8px 10px; }

/* ---------- Auth ---------- */
.auth { max-width: 460px; margin: 0 auto; padding: calc(28px + env(safe-area-inset-top)) 18px 32px; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.auth-logo { width: 68px; height: 68px; border-radius: 22px; background: var(--grad); display: grid; place-items: center; color: #fff; margin: 12px 0 18px; box-shadow: 0 14px 30px -8px rgba(11, 101, 120, .55); }
.auth-logo .icon { width: 36px; height: 36px; }
.auth h1 { font-size: 28px; }
.auth .lead { color: var(--muted); font-size: 16.5px; margin-bottom: 22px; }
.auth .stack-btns { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.auth .foot { margin-top: auto; padding-top: 22px; font-size: 13px; color: var(--muted); text-align: center; }
.features { display: grid; gap: 10px; margin: 6px 0 22px; }
.feature { display: flex; gap: 12px; align-items: flex-start; }
.feature .lead-ic { width: 38px; height: 38px; border-radius: 11px; }
.feature strong { display: block; font-size: 15px; }
.feature div > span { display: block; font-size: 14px; color: var(--muted); }
.demo-box { margin-top: 18px; padding: 12px; border: 1px dashed var(--line-2); border-radius: 14px; background: #fff; }
.demo-box .row { gap: 8px; }
.demo-box button { flex: 1; min-width: 96px; }

/* ---------- Modal & toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 22, 34, .5); z-index: 60; display: flex; align-items: flex-end; justify-content: center; padding: 0; animation: fade .15s; }
.modal { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); animation: rise .2s ease-out; }
.modal h2 { margin-bottom: 6px; }
@media (min-width: 640px) { .modal-backdrop { align-items: center; padding: 24px; } .modal { border-radius: 20px; padding-bottom: 20px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: .6; } }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; z-index: 70; max-width: calc(100vw - 32px); font-size: 15px; font-weight: 550; box-shadow: var(--shadow-lg); text-align: center; }
#toast[data-kind="error"] { background: var(--red-700); }
@media (min-width: 900px) { #toast { bottom: 24px; } }
.picker-list { max-height: 50vh; overflow-y: auto; margin: 10px 0; }

/* ---------- Call screen ---------- */
#call-layer { position: fixed; inset: 0; z-index: 80; background: radial-gradient(120% 90% at 50% 0%, #0e7490 0%, #0a3d4a 52%, #061f26 100%); color: #fff; display: flex; flex-direction: column; padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom)); }
#call-layer[hidden] { display: none; }
.call-top { text-align: center; margin-top: 4vh; }
.call-top .avatar { width: 108px; height: 108px; font-size: 36px; margin: 0 auto 16px; background: rgba(255, 255, 255, .14); box-shadow: 0 0 0 10px rgba(255, 255, 255, .06); }
.call-top .avatar.ringing { animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .35); } 100% { box-shadow: 0 0 0 26px rgba(255, 255, 255, 0); } }
.call-top h2 { color: #fff; font-size: 26px; margin-bottom: 4px; }
.call-top .state { font-size: 16px; opacity: .85; }
.call-top .timer { font-variant-numeric: tabular-nums; font-size: 18px; margin-top: 6px; font-weight: 650; }
.call-context { margin: 22px auto 0; width: 100%; max-width: 520px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16); border-radius: 16px; padding: 14px; font-size: 15px; max-height: 34vh; overflow-y: auto; }
.call-context .chip { margin-right: 6px; }
.call-context .qa { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid rgba(255, 255, 255, .12); padding: 6px 0; }
.call-context .qa span:first-child { opacity: .8; }
.call-actions { margin-top: auto; display: flex; justify-content: center; gap: 28px; padding-top: 20px; flex-wrap: wrap; }
.call-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; background: none; border: 0; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.call-btn .round { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .16); }
.call-btn .round .icon { width: 30px; height: 30px; }
.call-btn.hang .round { background: #e53935; }
.call-btn.hang .round .icon { transform: rotate(135deg); }
.call-btn.answer .round { background: #16a34a; }
.call-btn.on .round { background: #fff; color: #0a3d4a; }
.call-note { text-align: center; margin-top: 18px; font-size: 15px; opacity: .92; max-width: 460px; margin-left: auto; margin-right: auto; }

/* ---------- Dictation (voice typing) ---------- */
.dictate-bar { margin-top: 6px; }
.btn-mic { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); font-weight: 650; font-size: 15px; cursor: pointer; }
.btn-mic .icon { width: 18px; height: 18px; }
.btn-mic.starting { border-color: #e7b65c; color: var(--amber); }
.btn-mic.listening { background: var(--red); border-color: var(--red); color: #fff; }
.composer .dictate-bar { margin-top: 0; }

/* ---------- Print & motion ---------- */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- QR (pairing) ---------- */
.qr-box { width: min(78vw, 300px); margin: 6px auto 10px; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.qr-box svg { width: 100%; height: auto; }
.scanner { position: fixed; inset: 0; z-index: 85; background: #000; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 18px; padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom)); }
.scanner-top { text-align: center; }
.scanner-top strong { display: block; font-size: 19px; }
.scanner-top span { display: block; opacity: .8; font-size: 15px; margin-top: 4px; }
.scanner-view { position: relative; width: min(86vw, 420px); aspect-ratio: 1; border-radius: 22px; overflow: hidden; background: #111; }
.scanner-view video { width: 100%; height: 100%; object-fit: cover; }
.scanner-frame { position: absolute; inset: 14%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }
.scanner .btn-light { margin-top: auto; width: min(86vw, 420px); }
.joined-list { margin-top: 12px; }
.joined-list .item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--green-bg); color: #0f5a2c; font-weight: 650; margin-top: 6px; animation: rise .25s ease-out; }

/* ---------- Chat (WhatsApp-like) ---------- */
body.chat-mode { background: #edf3f4; }
@media (max-width: 899px) { body.chat-mode #tabbar, body.chat-mode #topbar { display: none !important; } }
.chat-page { max-width: 880px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: #edf3f4; }
@media (min-width: 900px) { .chat-page { min-height: calc(100vh - 59px); border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }
.chat-head { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 10px 8px; background: var(--grad); color: #fff; box-shadow: 0 6px 18px -10px rgba(11, 79, 95, .6); }
@media (min-width: 900px) { .chat-head { top: 59px; padding-top: 8px; } }
.chat-head .back { background: transparent; border-color: rgba(255, 255, 255, .25); color: #fff; }
.chat-head .icon-btn { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .22); color: #fff; }
.chat-head .icon-btn:disabled { opacity: .45; }
.chat-head .icon-btn.call-green { background: #16a34a; border-color: #16a34a; }
.chat-peer { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: #fff; text-decoration: none; min-height: 44px; }
.chat-peer .avatar { background: rgba(255, 255, 255, .18); }
.chat-peer strong { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peer-sub { display: block; font-size: 13px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 12px; background: #fff3f3; color: var(--red-700); font-size: 13.5px; font-weight: 650; border-bottom: 1px solid #f2caca; }
.chat-banner span { display: inline-flex; align-items: center; gap: 6px; }
.chat-banner .icon { width: 16px; height: 16px; }
.call112-sm { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 22px; background: var(--red); color: #fff; text-decoration: none; font-weight: 750; }
.chat-body { flex: 1; padding: 10px 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.day-sep { display: flex; justify-content: center; margin: 10px 0 6px; }
.day-sep span { background: #fff; color: var(--muted); font-size: 12.5px; font-weight: 650; padding: 4px 12px; border-radius: 10px; box-shadow: 0 1px 1px rgba(0, 0, 0, .06); }
.sys-pill { align-self: center; max-width: 92%; background: #fdf6d8; color: #5c4d10; font-size: 13px; padding: 6px 12px; border-radius: 10px; text-align: center; margin: 4px 0; box-shadow: 0 1px 1px rgba(0, 0, 0, .05); }
.sys-pill.danger { background: #fde4e4; color: var(--red-700); }
.seg-card { align-self: center; width: min(100%, 560px); background: #fff; border-radius: 16px; padding: 10px 12px; margin: 6px 0; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); font-size: 14.5px; border-left: 4px solid var(--brand-100); }
.seg-card.warn { border-left-color: #e59a2c; }
.seg-card.danger { border-left-color: var(--red); background: #fff7f7; }
.seg-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.seg-title .icon { width: 18px; height: 18px; color: var(--brand); }
.seg-card .qa { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-top: 1px dashed var(--line); }
.seg-card .qa span:first-child { color: var(--muted); }
.seg-card .qa span:last-child { font-weight: 650; text-align: right; }
.ai-mini { display: flex; gap: 8px; margin-top: 6px; padding: 8px; border-radius: 10px; background: #f2fafb; border: 1px solid #d4eef2; }
.ai-mini .icon { width: 18px; height: 18px; color: #0e7490; flex: none; margin-top: 2px; }
.bubble-row { display: flex; }
.bubble-row[hidden] { display: none; }
.bubble-row.out { justify-content: flex-end; }
.bubble-row .bubble { position: relative; max-width: min(80%, 520px); padding: 8px 12px 7px; border-radius: 18px; font-size: 15.5px; line-height: 1.4; box-shadow: 0 1px 2px rgba(16, 37, 44, .08); overflow-wrap: anywhere; }
.bubble-row.in .bubble { background: #fff; border-bottom-left-radius: 6px; }
.bubble-row.out .bubble { background: linear-gradient(135deg, #0e7490, #0f766e); color: #fff; border-bottom-right-radius: 6px; }
.bubble-row.out .b-meta, .bubble-row.out .ticks .icon { color: rgba(255, 255, 255, .9); }
.bubble-row.out .ticks.seen .icon { color: #a7f3d0; }
.bubble-row.out .file-chip { background: rgba(255, 255, 255, .16); }
.bubble-row.auto .bubble { background: #ecfdf3; border: 1px solid #bbf0d0; }
.b-label { font-size: 12.5px; font-weight: 700; color: var(--green); display: flex; align-items: center; gap: 4px; margin-bottom: 2px; }
.b-label.doc { color: var(--brand); }
.b-label .icon { width: 13px; height: 13px; }
.b-text { white-space: pre-wrap; }
.b-meta { float: right; margin: 6px 0 -2px 10px; font-size: 12px; color: #54656f; display: inline-flex; align-items: center; gap: 3px; line-height: 1; }
.ticks .icon { width: 15px; height: 15px; color: #8696a0; }
.ticks.seen .icon { color: #0e7490; }
.b-files { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.bubble-row .file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: rgba(0, 0, 0, .05); border: 0; cursor: pointer; font: inherit; font-size: 14px; color: inherit; min-height: 44px; max-width: 100%; text-align: left; }
.bubble-row .file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bubble-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 2px 0 6px; }
.bubble-actions.in { justify-content: flex-start; }
.typing { display: inline-flex !important; gap: 4px; align-items: center; padding: 12px 14px !important; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: #8696a0; animation: blink 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-empty { margin: auto; text-align: center; color: #54656f; padding: 30px 20px; max-width: 360px; }
.chat-empty .icon { width: 44px; height: 44px; margin: 0 auto 10px; color: #8696a0; }
.chat-compose { position: sticky; bottom: 0; z-index: 10; background: rgba(245, 246, 251, .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.compose-row { display: flex; align-items: flex-end; gap: 8px; }
.compose-box { flex: 1; min-width: 0; background: #fff; border-radius: 24px; padding: 4px 6px 4px 14px; display: flex; align-items: flex-end; border: 1px solid var(--line); }
.compose-box textarea { border: 0 !important; box-shadow: none !important; min-height: 44px !important; max-height: 140px; padding: 11px 4px !important; resize: none; background: transparent; line-height: 1.35; }
.icon-btn.round { border-radius: 50%; background: #fff; border: 0; color: #54656f; cursor: pointer; }
.send-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--grad); color: #fff; box-shadow: 0 6px 16px -6px rgba(14, 116, 144, .8); display: grid; place-items: center; cursor: pointer; flex: none; }
.send-btn .icon { width: 22px; height: 22px; }
.compose-tools { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.compose-tools::-webkit-scrollbar { display: none; }
.compose-tools .pill { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; background: #fff; }
.compose-tools .pill .icon { width: 16px; height: 16px; }
.compose-mode { display: flex; align-items: center; gap: 8px; background: var(--amber-bg); color: #6d3c05; border-radius: 10px; padding: 4px 10px; margin-bottom: 6px; }
.compose-note { text-align: center; color: var(--muted); font-size: 14px; padding: 10px; }
/* Chat list rows */
.chat-row .avatar { position: relative; }
.av-dot { position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--green-600); border: 2px solid #fff; }
.unread-badge { min-width: 22px; height: 22px; border-radius: 11px; background: var(--brand-600); color: #fff; font-size: 12.5px; font-weight: 750; display: inline-grid; place-items: center; padding: 0 6px; }
.time-unread { color: var(--brand-600); font-weight: 700; }
/* Home: call / message */
.home-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.home-action { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 96px; padding: 10px; text-align: center; border-radius: 18px; border: 0; color: #fff; font-weight: 750; font-size: 17px; text-decoration: none; cursor: pointer; box-shadow: 0 6px 18px rgba(15, 31, 46, .14); }
.home-action .icon { width: 30px; height: 30px; }
.home-action.call { background: linear-gradient(135deg, #15803d, #16a34a); }
.home-action.message { background: var(--grad); }
.home-action small { font-size: 12.5px; font-weight: 600; opacity: .9; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #9aa8b5; margin-right: 6px; }
.status-dot.on { background: var(--green-600); }

/* ---------- Shell: names, doctor side panel ---------- */
.avatar.me { width: 38px; height: 38px; font-size: 14px; }
.me-chip { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); min-height: 44px; padding: 0 4px; border-radius: 22px; }
.me-chip .me-name { font-weight: 650; font-size: 14.5px; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .me-chip .me-name { display: none; } }
#sidebar { display: none; }
@media (min-width: 900px) {
  body.has-sidebar #topbar { display: none !important; }
  body.has-sidebar #sidebar:not([hidden]) { display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 25; padding: 22px 16px 16px; background: linear-gradient(180deg, #072a33 0%, #0a4351 55%, #0c5a63 100%); color: #d4f1f6; }
  body.has-sidebar #app { margin-left: var(--sidebar-w); }
  body.has-sidebar #toast { left: calc(50% + var(--sidebar-w) / 2); }
  body.has-sidebar.chat-mode .chat-head { top: 0; }
  body.has-sidebar .chat-page { min-height: 100vh; }
  body.has-sidebar #call-layer { left: 0; }
}
.side-me { display: flex; gap: 12px; align-items: center; padding: 4px 6px 16px; border-bottom: 1px solid rgba(212, 241, 246, .14); }
.side-me .avatar { background: rgba(255, 255, 255, .16); box-shadow: 0 0 0 3px rgba(255, 255, 255, .12); }
.side-me strong { display: block; color: #fff; font-size: 16px; line-height: 1.25; }
.side-me div > span { display: block; font-size: 13px; color: #b3e5ee; }
.side-avail { padding: 14px 4px 6px; }
.side-avail .avail { width: 100%; justify-content: center; background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2); color: #d4f1f6; }
.side-avail .avail.on { background: #dcfce7; border-color: #86efac; color: #166534; }
.side-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.side-nav a { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 14px; color: #d4f1f6; text-decoration: none; font-weight: 650; font-size: 15px; position: relative; }
.side-nav a .icon { width: 20px; height: 20px; opacity: .85; }
.side-nav a:hover { background: rgba(255, 255, 255, .08); }
.side-nav a.active { background: #fff; color: #0a4351; box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .5); }
.side-nav a .badge { margin-left: auto; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid rgba(212, 241, 246, .14); }
.side-logout { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 14px; background: transparent; color: #b3e5ee; font: inherit; font-weight: 650; cursor: pointer; }
.side-logout:hover { background: rgba(255, 255, 255, .08); }
.side-logout .icon { width: 20px; height: 20px; }
.side-brand { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #7fd0de; padding: 0 12px; }
.side-brand .icon { width: 16px; height: 16px; }

/* ---------- Greetings (home hero, doctor's day) ---------- */
.home-hero { background: var(--grad); color: #fff; border-radius: 26px; padding: 20px 18px 18px; box-shadow: 0 20px 40px -22px rgba(11, 101, 120, .75); position: relative; overflow: hidden; }
.home-hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.home-hero .hello { font-size: 15px; opacity: .9; }
.home-hero .hello strong { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.02em; opacity: 1; margin-top: 2px; }
.hero-doc { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px; border-radius: 18px; background: rgba(255, 255, 255, .12); position: relative; z-index: 1; }
.hero-doc .avatar { background: rgba(255, 255, 255, .2); }
.hero-doc strong { display: block; font-size: 16.5px; }
.hero-doc .grow > span { display: block; font-size: 13.5px; opacity: .9; }
.hero-doc .status { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-weight: 650; }
.home-hero .home-actions { position: relative; z-index: 1; }
.home-hero .home-action { box-shadow: none; }
.home-hero .home-action.message { background: rgba(255, 255, 255, .95); color: var(--brand-700); }
.day-card { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: 22px; background: var(--grad); color: #fff; margin-bottom: 14px; box-shadow: 0 18px 36px -22px rgba(11, 101, 120, .8); }
.day-card .avatar { background: rgba(255, 255, 255, .18); }
.day-card .hello { font-size: 14px; opacity: .9; }
.day-card strong { display: block; font-size: 20px; letter-spacing: -.01em; }
.day-card .facts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.day-card .facts span { background: rgba(255, 255, 255, .16); border-radius: 12px; padding: 4px 10px; font-size: 13px; font-weight: 650; }
/* Pairing code input */
.otp { text-align: center; font-size: 30px !important; letter-spacing: .45em; font-weight: 800; font-variant-numeric: tabular-nums; min-height: 64px !important; padding-left: .45em !important; }
.pair-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 24px; font-weight: 800; letter-spacing: .12em; color: var(--brand-700); background: var(--brand-50); border-radius: 12px; padding: 4px 12px; display: inline-block; }

/* ---------- Voice note & AI summary ---------- */
.voice-btn { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px 18px; border: 0; border-radius: 22px; background: linear-gradient(135deg, #0b4f5f 0%, #0e7490 55%, #0f766e 100%); color: #fff; text-align: left; cursor: pointer; font: inherit; box-shadow: 0 16px 30px -18px rgba(147, 51, 234, .9); margin-bottom: 14px; }
.voice-btn .icon { width: 30px; height: 30px; flex: none; padding: 10px; box-sizing: content-box; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.voice-btn strong { display: block; font-size: 17px; }
.voice-btn small { display: block; font-size: 13.5px; opacity: .92; }
.mic-big .dictate-bar { margin: 0; }
.mic-big .btn-mic { width: 100%; justify-content: center; min-height: 64px; border-radius: 20px; border: 0; font-size: 17px; background: linear-gradient(135deg, #d4f1f6, #d8f3ee); color: #0b6578; }
.mic-big .btn-mic .icon { width: 24px; height: 24px; }
.mic-big .btn-mic.listening { background: linear-gradient(135deg, #0e7490, #0f766e); color: #fff; animation: pulse-mic 1.4s ease-out infinite; }
@keyframes pulse-mic { 0% { box-shadow: 0 0 0 0 rgba(219, 39, 119, .45); } 100% { box-shadow: 0 0 0 18px rgba(219, 39, 119, 0); } }
.ai-card { border: 1px solid #bfe6ec; background: linear-gradient(135deg, #f0fafb 0%, #ffffff 60%); margin-bottom: 14px; }
/* Mic next to the chat box: a round button */
.mic-slot .dictate-bar { margin: 0; }
.mic-slot .btn-mic { width: 48px; height: 48px; padding: 0; border-radius: 50%; justify-content: center; border: 0; background: #fff; color: #0f766e; box-shadow: 0 1px 2px rgba(16, 37, 44, .08); }
.mic-slot .btn-mic span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mic-slot .btn-mic.listening { background: linear-gradient(135deg, #0e7490, #0f766e); color: #fff; animation: pulse-mic 1.4s ease-out infinite; }
/* Removable measurement chips (voice note preview) stay on one line with their ×. */
#vn-preview .pill { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
#vn-preview .pill .icon { width: 16px; height: 16px; flex: none; }
.call-btn:focus-visible { outline: none; }
.call-btn:focus-visible .round { outline: 3px solid #b3e5ee; outline-offset: 4px; }
/* Pictures */
.avatar.has-photo { background: #fff; overflow: hidden; padding: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.xl { width: 88px; height: 88px; font-size: 30px; }
.av-wrap { position: relative; display: inline-flex; flex: none; }
.photo-row { display: flex; gap: 16px; align-items: center; }
.chat-peer .avatar.has-photo, .hero-doc .avatar.has-photo, .day-card .avatar.has-photo, .side-me .avatar.has-photo { background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .35); }
.call-top .avatar.has-photo { background: rgba(255, 255, 255, .9); }
/* Same shell for patients: 112 pill, doctors in the side panel */
.sos-pill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 54px; height: 44px; padding: 0 14px; border-radius: 22px; background: var(--red); color: #fff; font-weight: 800; text-decoration: none; letter-spacing: .02em; box-shadow: 0 6px 14px -8px rgba(220, 38, 38, .8); }
.side-docs { padding: 14px 0 6px; display: flex; flex-direction: column; gap: 4px; }
.side-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #7fd0de; padding: 0 12px 4px; }
.side-doc { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 6px 10px; border: 0; border-radius: 14px; background: transparent; color: #d4f1f6; text-align: left; cursor: pointer; font: inherit; }
.side-doc:hover { background: rgba(255, 255, 255, .08); }
.side-doc.active { background: rgba(255, 255, 255, .14); box-shadow: inset 3px 0 0 #7fd0de; }
.side-doc strong { display: block; font-size: 14px; color: #fff; }
.side-doc small { display: block; font-size: 12.5px; color: #b3e5ee; }
.side-doc.add .avatar { background: rgba(255, 255, 255, .14); }
.side-sos { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 14px; background: #dc2626; color: #fff; font-weight: 750; text-decoration: none; }
/* Patient: doctors row on the home page */
.doc-switch { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -2px 12px; padding: 2px; position: relative; z-index: 1; }
.doc-switch::-webkit-scrollbar { display: none; }
.doc-chip { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 14px 4px 4px; border-radius: 24px; border: 0; background: rgba(255, 255, 255, .14); color: #fff; font: inherit; font-weight: 650; font-size: 14px; cursor: pointer; }
.doc-chip .avatar { width: 34px; height: 34px; font-size: 13px; }
.doc-chip.active { background: #fff; color: var(--brand-700); }
.doc-chip.add { padding: 4px 14px; }
.side-me .avatar:not(.has-photo) { background: #fff; color: var(--brand-700); box-shadow: 0 0 0 3px rgba(255, 255, 255, .3); }
@media (max-width: 520px) { .doc-chip.add .t { display: none; } .doc-chip.add { padding: 4px 12px; } }
/* Trust note at the top of every chat (like a messenger's, without claiming end-to-end encryption) */
.chat-trust { display: flex; gap: 8px; align-items: flex-start; max-width: 380px; margin: 4px auto 12px; padding: 8px 12px; border-radius: 12px; background: #fef9c3; color: #713f12; font-size: 12.5px; line-height: 1.45; box-shadow: 0 1px 0 rgba(0, 0, 0, .04); }
.chat-trust .icon { flex: none; width: 16px; height: 16px; margin-top: 1px; }
/* The logo (two people joined by a heartbeat line) */
.logo { display: block; flex: none; }
.auth-logo .logo { width: 46px; height: 46px; }
.brand-mark .logo { width: 24px; height: 24px; }
.side-brand .logo { width: 18px; height: 18px; }

/* ---------- Photos, documents and voice messages in the chat ---------- */
.send-btn[hidden], .send-btn.voice[hidden] { display: none !important; }
.cam-btn { flex: none; width: 40px; height: 44px; display: grid; place-items: center; color: #54656f; cursor: pointer; border-radius: 50%; }
.cam-btn:hover { color: var(--brand); }
.cam-btn .icon { width: 22px; height: 22px; }
/* Photo inside a bubble: placeholder keeps its shape while it loads (the chat does not jump). */
.b-photo { display: block; position: relative; width: min(280px, 66vw); max-height: 380px; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: #dfe3ec; cursor: zoom-in; }
.b-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.b-photo img:not([src]) { visibility: hidden; }
.b-photo.broken::after { content: 'Fotoğraf açılamadı'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: #475569; }
.bubble.media { padding: 4px; }
.bubble.media .b-files { margin: 0; gap: 4px; }
.bubble.media .b-meta { position: absolute; right: 10px; bottom: 9px; margin: 0; padding: 3px 7px; border-radius: 10px; background: rgba(15, 23, 42, .55); color: #fff; float: none; }
.bubble.media { position: relative; }
.bubble.media .b-meta .icon { color: #fff; }
/* Voice message player */
.b-voice { display: flex; align-items: center; gap: 10px; min-width: min(240px, 58vw); padding: 2px 0; }
.b-voice audio { display: none; }
.voice-play { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--brand); color: #fff; cursor: pointer; }
.bubble-row.out .voice-play { background: #fff; color: var(--brand-700); }
.voice-play:disabled { opacity: .5; cursor: progress; }
.voice-play .icon { width: 20px; height: 20px; }
.voice-track { flex: 1; height: 4px; border-radius: 2px; background: rgba(100, 116, 139, .3); overflow: hidden; }
.bubble-row.out .voice-track { background: rgba(255, 255, 255, .35); }
.voice-track i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 2px; transition: width .2s linear; }
.bubble-row.out .voice-track i { background: #fff; }
.voice-time { font-size: 12.5px; font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; opacity: .85; }
.b-voice.broken .voice-play { opacity: .4; }
/* Recording bar (replaces the reply box while recording) */
.rec-row { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 28px; padding: 4px 4px 4px 6px; }
.rec-del { color: #dc2626; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #dc2626; animation: rec-blink 1s ease-in-out infinite; }
@keyframes rec-blink { 50% { opacity: .25; } }
.rec-time { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 42px; }
.rec-label { color: #64748b; font-size: 14px; }
.rec-hint { margin: 6px 12px 0; font-size: 12.5px; color: #b91c1c; }
/* Before sending: the chosen photos and documents */
.send-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.send-item { position: relative; margin: 0; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: #eef0f6; }
.send-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.send-item.doc { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px; text-align: center; color: #334155; }
.send-item.doc .icon { width: 28px; height: 28px; color: var(--brand); }
.send-item.doc figcaption { font-size: 12px; line-height: 1.3; word-break: break-word; display: flex; flex-direction: column; }
.send-item.doc small { font-size: 12px; color: #64748b; }
.send-rm { position: absolute; top: 0; right: 0; width: 44px; height: 44px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; }
.send-rm .icon { width: 26px; height: 26px; padding: 5px; border-radius: 50%; background: rgba(15, 23, 42, .65); color: #fff; }
/* Dropping files on the chat (computer) */
.chat-page.drop { outline: 3px dashed var(--brand); outline-offset: -10px; }
/* Full-screen photo viewer */
.viewer { position: fixed; inset: 0; z-index: 400; background: rgba(2, 6, 23, .95); display: flex; flex-direction: column; }
.viewer-bar { display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top, 0px) + 8px) 10px 8px; }
.viewer-btn { display: inline-flex; align-items: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 22px; background: rgba(255, 255, 255, .12); color: #fff; font: inherit; font-weight: 600; cursor: pointer; justify-content: center; }
.viewer-btn .icon { width: 22px; height: 22px; }
.viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 8px calc(env(safe-area-inset-bottom, 0px) + 12px); overflow: hidden; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; border-radius: 4px; }
.viewer-stage.zoomed { overflow: auto; align-items: flex-start; justify-content: flex-start; }
.viewer-stage.zoomed img { max-width: none; max-height: none; cursor: zoom-out; }
.viewer-error { color: #e2e8f0; }

/* ---------- Welcome page ---------- */
.welcome .welcome-hero { position: relative; text-align: center; padding: 8px 4px 2px; }
.welcome .welcome-hero::before { content: ''; position: absolute; inset: -30px 0 auto; height: 260px; background: radial-gradient(75% 70% at 50% 30%, rgba(34, 166, 192, .24), transparent 72%); z-index: -1; pointer-events: none; }
.welcome .auth-logo { margin: 14px auto 16px; width: 84px; height: 84px; border-radius: 26px; box-shadow: 0 18px 36px -10px rgba(11, 101, 120, .6), inset 0 1px 0 rgba(255, 255, 255, .25); }
.welcome .auth-logo .logo { width: 58px; height: 58px; }
.welcome h1 { font-size: 32px; letter-spacing: -.02em; }
.welcome .tagline { margin: 4px 0 10px; font-size: 17px; font-weight: 700; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome .lead { margin: 0 auto 20px; max-width: 380px; }
.welcome .features { grid-template-columns: 1fr; gap: 8px; margin: 4px 0 22px; }
.welcome .feature { padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, .75); border: 1px solid rgba(8, 145, 178, .12); box-shadow: 0 1px 2px rgba(16, 37, 44, .04); }
.welcome .feature strong { font-size: 15.5px; }
.lead-ic.violet { background: linear-gradient(135deg, #e0f2fe, #dbeafe); color: #0369a1; }
@media (min-width: 720px) { .welcome { max-width: 640px; } .welcome .features { grid-template-columns: 1fr 1fr; } .welcome .stack-btns { max-width: 420px; width: 100%; margin-left: auto; margin-right: auto; } }
/* Maker's signature: small and quiet */
.credit { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 10px; margin-top: 6px; border-radius: 999px; color: #64748b; font-size: 12.5px; text-decoration: none; }
.credit:hover { color: #334155; background: rgba(15, 23, 42, .04); }
.credit .gem { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #6b6b6b, #0b0b0b 60%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); flex: none; }
.credit b { font-weight: 700; color: #334155; }
.auth .foot { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.side-foot .credit { color: #7fd0de; padding: 0 12px; margin: 0; }
.side-foot .credit b { color: #d4f1f6; }
.side-foot .credit:hover { background: rgba(255, 255, 255, .06); color: #b3e5ee; }
.page-credit { display: flex; justify-content: center; margin-top: 18px; }

/* ---------- Breathing room (checked by the crowding test in scripts/ui-kit.js) ---------- */
/* Boxes stacked on a page always have air between them (a list right above a card was touching). */
:is(.card, .list, .notice, .emergency-strip, .stack-btns, .tile-grid) + :is(.card, .list, .notice, .emergency-strip, form, .stack-btns) { margin-top: 16px; }
.notice + :is(.switch-row, .field, .row, p) { margin-top: 12px; }
.section-title + :is(.list, .card) { margin-top: 0; }
.day-pills { gap: 8px; }
.flag { margin-bottom: 10px; }
.welcome .features { gap: 10px; }
/* Topic editor: each question in its own box with room around its buttons */
.q-editor { margin-top: 14px; padding: 14px; }
.q-editor > .row { gap: 8px; }
.q-editor .field { margin-bottom: 12px; }
.opt-row { margin-top: 10px; gap: 10px; }
.q-editor > .link-btn { margin-top: 10px; }
.editor-body .card.flat { margin: 6px 0 4px; }
.chat-compose { padding-left: 12px; padding-right: 12px; }
.qa + .ai-mini, .ai-mini { margin-top: 12px; }
.composer { padding-top: 16px; }
/* The person's initials in the side panel stay centred (the panel's text rule must not reach the avatar). */
.side-me span.avatar { display: grid; place-items: center; font-size: 16px; line-height: 1; }
/* Maker's signature: smaller still (asked 28 Kasım 2026). */
.credit { font-size: 12px; gap: 5px; min-height: 30px; padding: 0 8px; margin-top: 2px; }
.credit .gem { width: 10px; height: 10px; }
.credit b { font-weight: 600; }
.page-credit { margin-top: 10px; }
/* The question card sits on the side of whoever wrote it (like the bubbles): the patient's card on the
   left in the doctor's view and on the right in the patient's own view. */
.seg-card.in { align-self: flex-start; width: min(88%, 560px); }
.seg-card.out { align-self: flex-end; width: min(88%, 560px); }

/* Live camera (computer): take a photo now */
.camera { position: fixed; inset: 0; z-index: 420; background: #000; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: calc(20px + env(safe-area-inset-top, 0px)) 16px calc(20px + env(safe-area-inset-bottom, 0px)); }
.camera-top { text-align: center; }
.camera-top strong { display: block; font-size: 19px; }
.camera-top span { display: block; opacity: .85; font-size: 15px; margin-top: 4px; }
.camera-view { flex: 1; min-height: 0; width: min(100%, 960px); display: flex; align-items: center; justify-content: center; border-radius: 18px; overflow: hidden; background: #111; }
.camera-view video { width: 100%; height: 100%; object-fit: contain; }
.camera-actions { width: min(100%, 520px); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.camera-actions .btn-light { justify-self: start; }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; background: transparent; padding: 5px; cursor: pointer; }
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; transition: transform .1s; }
.shutter:active span { transform: scale(.9); }
.shutter:disabled { opacity: .4; cursor: progress; }
button.cam-btn { border: 0; background: transparent; padding: 0; }

/* Icon tiles and avatars always centre what is inside them (whatever card they sit in). */
.lead-ic, .avatar { display: grid !important; place-items: center; }
/* ---------- Side panel (same structure for doctor and patient) ---------- */
.side-top { display: flex; align-items: center; gap: 10px; padding: 2px 6px 16px; color: #fff; text-decoration: none; font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.side-logo { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, #0891b2, #14b8a6); box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .5); color: #fff; flex: none; }
.side-logo .logo { width: 24px; height: 24px; }
a.side-me { color: inherit; text-decoration: none; border-radius: 14px; padding: 8px 8px 16px; margin: 0 -2px; }
a.side-me:hover { background: rgba(255, 255, 255, .06); }
.side-big { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 48px; border: 0; border-radius: 14px; font: inherit; font-weight: 750; font-size: 15px; text-decoration: none; cursor: pointer; }
.side-big.sos { background: #dc2626; color: #fff; }
.side-big.calls { background: rgba(255, 255, 255, .1); color: #d4f1f6; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); }
.side-big.calls.on { background: #16a34a; color: #fff; box-shadow: none; }
.side-big .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; opacity: .85; flex: none; }

/* ---------- Ready answers on the doctor's side ---------- */
/* The doctor sees the ready answers sent for them on their own (right) side, in the same light green. */
.bubble-row.out.auto .bubble { color: inherit; }
.bubble-row.out.auto .b-meta { color: #54656f; }
.bubble-row.out.auto .ticks .icon { color: #64748b; }
.bubble-row.out.auto .ticks.seen .icon { color: #0e7490; }
.bubble-actions.out { justify-content: flex-end; }
/* "Güncellenmiş cevap" on the doctor's own (purple) bubble. */
.bubble-row.out .b-label.doc { color: #d4f1f6; }

/* ---------- Health lists: the patient adds each item on its own ---------- */
.h-intro { margin: 0 4px 16px; }
.h-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.h-head h2 { margin: 0; flex: 1; min-width: 0; font-size: 17px; font-weight: 750; }
.h-count { min-width: 30px; height: 30px; padding: 0 9px; border-radius: 15px; background: var(--brand-50); color: var(--brand-700); font-weight: 750; font-size: 14px; display: grid; place-items: center; }
.h-list { box-shadow: none; }
.h-item { width: 100%; align-items: center; min-height: 56px; padding: 10px 14px; background: #fff; border-left: 0; border-right: 0; border-bottom: 0; font: inherit; text-align: left; cursor: pointer; }
.h-item:first-child { border-top: 0; }
.h-item:hover { background: #f8fafc; }
.h-item .title { font-size: 15.5px; font-weight: 650; }
.h-item .meta .icon { width: 18px; height: 18px; }
.h-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.h-card .switch-row { border-top: 0; padding-top: 4px; }
.h-add-btn { margin-top: 12px; }
.h-add { margin-top: 12px; padding: 14px; border-radius: 14px; background: #f8fafc; border: 1px solid var(--line); }
.h-add .field:last-of-type { margin-bottom: 0; }
.h-updated { margin: 14px 4px 0; }
.h-edit-actions .h-del { margin-right: auto; color: var(--red); }
/* The doctor's view: four short bullet lists. */
.h-doc { display: grid; gap: 16px 28px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.h-sec h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 14.5px; font-weight: 750; }
.h-sec h3 .icon { width: 18px; height: 18px; color: var(--brand); }
.h-bullets { margin: 0; padding-left: 20px; }
.h-bullets li { margin: 5px 0; line-height: 1.4; }
.h-bullets li::marker { color: var(--brand); }
.h-bullets .n { font-weight: 600; }
.h-bullets .d { color: var(--muted); }
.h-bullets .d::before { content: ' · '; }
.h-none { display: flex; align-items: center; gap: 6px; margin: 0; color: #047857; font-size: 14.5px; }
.h-none .icon { width: 16px; height: 16px; }
.h-empty { margin: 0; color: var(--muted); font-size: 14.5px; }

/* The summary page's "Takip edilecekler" (emergencies, check-ups due), moved off the chats page. */
.follow-up { margin-bottom: 18px; }

/* Every 112 button carries the phone icon (top bar, side panel, emergency card). */
.sos-pill .icon { width: 18px; height: 18px; flex: none; }
.side-big .icon { width: 20px; height: 20px; flex: none; }

/* "Doktor beni arasın": its own button under "Doktoru ara" and "Mesaj yaz" on the patient's home. */
.home-callme { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 10px 14px; border-radius: 18px; border: 1px solid rgba(255, 255, 255, .45); background: rgba(6, 40, 50, .28); color: #fff; font: inherit; font-weight: 750; font-size: 16px; cursor: pointer; }
.home-callme:hover { background: rgba(6, 40, 50, .4); }
.home-callme .icon { width: 20px; height: 20px; flex: none; }

/* Side panel signature: "Hekim Hattı" small at the very bottom (the person stays on top). */
.side-brand { display: flex; align-items: center; gap: 9px; margin-top: 12px; padding: 12px 6px 2px; border-top: 1px solid rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .82); text-decoration: none; font-weight: 750; font-size: 14.5px; letter-spacing: -.01em; }
.side-brand .side-logo { width: 30px; height: 30px; border-radius: 9px; }
.side-brand .side-logo .logo { width: 22px; height: 22px; }
a.side-me { margin-top: 2px; }
/* Shown only where there is no side panel (phones). */
@media (min-width: 900px) { body.has-sidebar .phone-only { display: none !important; } }
/* ---------- Documents in the patient file (doctor only) ---------- */
.doc-pills { margin-top: 8px; }
.doc-files { display: flex; flex-direction: column; gap: 10px; }
.doc-file { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 50px; padding: 6px 8px 6px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font: inherit; color: inherit; text-align: left; }
button.doc-file { cursor: pointer; }
.doc-file > .icon { color: var(--brand); flex: none; }
.doc-file .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14.5px; }
.doc-lock { display: flex; align-items: center; gap: 6px; }
.doc-lock .icon { width: 15px; height: 15px; flex: none; }
.field label.doc-add { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: auto; margin: 10px 0 0; cursor: pointer; }

/* Owner's summary (Özet): sub-line in tiles, three small charts, device meters, table view */
.tile .s { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.3; }
.chart-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 14px; }
@media (min-width: 720px) { .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .chart-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.chart-card { min-width: 0; }
.chart-grid > .card + .card { margin-top: 0; }
.chart-wrap { position: relative; }
.chart-tip { position: absolute; pointer-events: none; padding: 8px 10px; font-size: 13px; box-shadow: var(--shadow-lg); min-width: 130px; z-index: 2; }
.table-view { margin-top: 12px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
.data-table th { text-align: right; color: var(--muted); font-weight: 600; padding: 6px 4px; }
.data-table td { text-align: right; padding: 6px 4px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.meters { display: flex; flex-direction: column; gap: 12px; }
.meter { display: grid; grid-template-columns: minmax(120px, 36%) minmax(0, 1fr) 40px; align-items: center; gap: 10px; font-size: 14.5px; }
.m-track { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.m-track i { display: block; height: 100%; border-radius: 5px; background: #0e7490; }
.m-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Doctors' applications (owner) */
.link-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px dashed #b9c9cf; border-radius: 12px; background: var(--bg); }
.link-text { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; }
.sheet-label { font-weight: 700; font-size: 14.5px; margin: 18px 0 8px; color: var(--ink-2); }
.verify-list { display: grid; gap: 10px; }
.check.verify { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.check.verify .hint { display: block; margin: 3px 0 0; }
.app-note { background: var(--bg); border-radius: 12px; padding: 10px 12px; margin: 0 0 4px; white-space: pre-wrap; }

/* Doctor application page (guest) */
.apply-steps { margin: 4px 0 18px; padding-left: 22px; display: grid; gap: 6px; color: var(--ink-2); font-size: 15px; }
.doctor-apply { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding: 12px 14px; min-height: 56px; border-radius: 14px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: inherit; }
.doctor-apply > .icon:first-child { color: var(--brand); flex: none; }
.doctor-apply > span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.doctor-apply > span > span { font-size: 13.5px; color: var(--muted); }
.doctor-apply > .icon:last-child { color: var(--muted); flex: none; }
.done-mark { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--green-bg); color: var(--green); margin: 18px auto 8px; }
.done-mark .icon { width: 32px; height: 32px; }
.apply-done h1, .apply-done .lead { text-align: center; }
.text-danger { color: var(--red-700); }

/* Local demo: the server still runs old code (see outdatedNotice in app.js) */
.outdated { position: fixed; z-index: 80; top: calc(10px + env(safe-area-inset-top)); left: 12px; right: 12px; max-width: 560px; margin: 0 auto; display: flex; gap: 10px; align-items: flex-start; padding: 12px 10px 12px 14px; border-radius: 14px; background: var(--amber-bg); color: #6d3c05; border: 1px solid #f1c27d; box-shadow: var(--shadow-lg); font-size: 15px; }
.outdated > .icon { flex: none; margin-top: 2px; }
.outdated p { margin: 0; flex: 1; }
.outdated .icon-btn { background: transparent; border-color: transparent; color: inherit; margin: -8px -4px -8px 0; }

/* Branch picker: the text field for a branch that is not on the list */
.spec-other { margin-top: 12px; }

/* The owner's Mesajlar page: feedback cards and sent announcements */
.fb-item + .fb-item { margin-top: 12px; }
.fb-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.fb-head .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.fb-text { margin: 10px 0; }
.fb-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.announcement-text { margin: 0; }

/* Voice typing in Chrome: while listening, the ring around the microphone follows the voice
   (--level 0…1 is set from the microphone), so the person sees at once that they are heard. */
.btn-mic.listening.has-level, .mic-big .btn-mic.listening.has-level, .mic-slot .btn-mic.listening.has-level { animation: none; box-shadow: 0 0 0 calc(2px + var(--level, 0) * 6px) var(--mic-ring, rgba(220, 38, 38, .38)); }
.mic-big .btn-mic, .mic-slot .btn-mic { --mic-ring: rgba(14, 116, 144, .45); }
/* Voice message: the row appears on the tap; the dot turns red when recording starts. */
.rec-row.opening .rec-dot { animation: none; background: #cbd5e1; }

/* Public demo site only (js/demo.js, meta.sandbox): what this is, one-tap sample accounts, and opening the
   same demo copy on another device. In the page flow above everything, so it scrolls away. */
.demo-bar { background: linear-gradient(90deg, #072a33 0%, #0a4351 55%, #072a33 100%); color: #fff; font-size: 13px; line-height: 1.45; }
.demo-bar[hidden] { display: none; }
.demo-in { max-width: 1180px; margin: 0 auto; padding: calc(4px + env(safe-area-inset-top)) 16px 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.demo-text, .demo-acts { display: contents; }
.demo-tag { order: 1; display: inline-flex; align-items: center; gap: 8px; flex: none; min-height: 44px; padding: 0; border: 0; background: none; color: #fff; font: inherit; font-weight: 700; cursor: default; }
.demo-tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #f5b83d; box-shadow: 0 0 0 3px rgba(245, 184, 61, .25); flex: none; }
.demo-tag .icon { display: none; width: 16px; height: 16px; opacity: .85; transition: transform .15s; }
.desc-open .demo-tag .icon { transform: rotate(180deg); }
.demo-desc { order: 2; flex: 1 1 320px; min-width: 0; color: #cfe7ec; }
.demo-roles { order: 3; display: flex; align-items: center; gap: 8px; flex: none; }
.demo-roles button, .demo-share { font: inherit; font-size: 13px; font-weight: 700; min-height: 44px; padding: 0 14px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .35); background: transparent; color: #fff; cursor: pointer; white-space: nowrap; }
.demo-roles button:hover, .demo-share:hover { background: rgba(255, 255, 255, .12); }
.demo-roles button[aria-pressed=true] { background: #fff; border-color: #fff; color: var(--brand-700); }
.demo-roles button:disabled { cursor: progress; }
.demo-share { order: 4; display: inline-flex; align-items: center; gap: 8px; flex: none; }
.demo-share .icon { width: 18px; height: 18px; }
@media (min-width: 900px) { body.has-sidebar .demo-bar { margin-left: var(--sidebar-w); } }
@media (max-width: 760px) {
  .demo-in { padding: calc(4px + env(safe-area-inset-top)) 12px 4px; gap: 0 8px; }
  .demo-tag { cursor: pointer; }
  .demo-tag .icon { display: block; }
  .demo-roles { order: 2; margin-left: auto; }
  .demo-roles button { padding: 0 12px; }
  .demo-desc { display: none; order: 3; flex-basis: 100%; padding: 2px 0 6px; }
  .demo-share { display: none; order: 4; margin: 0 0 8px; }
  .desc-open .demo-desc { display: block; }
  .desc-open .demo-share { display: inline-flex; }
}
/* Phones: "Tanıtım" alone, so the tag and the three accounts fit on one line. */
@media (max-width: 440px) { .demo-tag-more { display: none; } }
@media (max-width: 374px) { .demo-roles button { padding: 0 9px; } }
