/* MedNest design system — "clean space / future".
   Pearly gradient, glass panels, thin large headings, mono labels.
   No inline styles anywhere (CSP: style-src 'self'). */

:root {
  --ink: #0E1638;
  --ink-2: #2B3560;
  --ink-3: #3E4A72;
  --line: rgba(255, 255, 255, 0.75);
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.8);
  --glass-soft: rgba(255, 255, 255, 0.4);
  --shadow: 0 20px 50px rgba(46, 56, 140, 0.12);
  --primary: linear-gradient(120deg, #4338CA 0%, #6D28D9 55%, #B8418A 100%);
  --dark: radial-gradient(300px 200px at 100% 0%, rgba(236, 72, 153, 0.45) 0%, rgba(236, 72, 153, 0) 70%),
          linear-gradient(140deg, #1E1B4B 0%, #312E81 55%, #4C1D95 100%);
  --wa: #15803D; --ig: #A21CAF; --vb: #6D28D9; --em: #1D4ED8; --web: #9D174D;
  --red: #BE123C; --red-bg: rgba(255, 228, 230, 0.92);
  --amber: #92400E; --amber-bg: rgba(254, 243, 199, 0.95);
  --green: #166534; --green-bg: rgba(220, 252, 231, 0.95);
  --violet: #312E81; --violet-bg: rgba(224, 231, 255, 0.95);
  --radius: 24px;
  --font: "Inter Tight", Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: linear-gradient(165deg, #A7B9EA 0%, #C7D3F3 50%, #97ACE4 100%); min-height: 100%; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(900px 600px at 90% -10%, rgba(244, 170, 214, 0.85) 0%, rgba(244, 170, 214, 0) 60%),
    radial-gradient(900px 700px at 0% 105%, rgba(108, 118, 236, 0.75) 0%, rgba(108, 118, 236, 0) 60%),
    linear-gradient(165deg, #A7B9EA 0%, #C7D3F3 50%, #97ACE4 100%);
  background-attachment: fixed;
}
a { color: #4338CA; }
a:hover { color: #312E81; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; }
:focus-visible { outline: 2px solid #6D28D9; outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- type helpers ---- */
.mono { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.h1 { font-size: 48px; font-weight: 300; letter-spacing: -.045em; line-height: 1; margin: 6px 0 0; }
.h2 { font-size: 26px; font-weight: 300; letter-spacing: -.03em; line-height: 1.1; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; }
.gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---- shell ---- */
.shell { display: flex; gap: 16px; padding: 16px; min-height: 100vh; }
.sidebar {
  flex: 0 0 228px; display: flex; flex-direction: column; gap: 4px; padding: 22px 14px 16px;
  border-radius: 26px; background: rgba(255, 255, 255, .5); border: 1px solid var(--line);
  backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 0 24px 60px rgba(46, 56, 140, .16); position: sticky; top: 16px; height: calc(100vh - 32px);
}
.logo { display: flex; flex-direction: column; gap: 4px; padding: 0 12px 22px; text-decoration: none; color: var(--ink); }
.logo b { font-size: 26px; font-weight: 300; letter-spacing: -.045em; line-height: 1; }
.logo b span { font-weight: 600; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px;
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.nav-link:hover { background: rgba(255, 255, 255, .45); color: var(--ink); }
.nav-link.active { background: rgba(255, 255, 255, .88); box-shadow: 0 6px 18px rgba(46, 56, 140, .12); color: var(--ink); font-weight: 600; }
.nav-link .count { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.nav-link .count.hot { color: #fff; background: linear-gradient(120deg, #BE123C, #B8418A); border-radius: 999px; padding: 1px 8px; }
.nav-sep { margin: 14px 14px 4px; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 18px; background: rgba(255, 255, 255, .6); border: 1px solid rgba(255, 255, 255, .9); }
.me-name { font-weight: 600; font-size: 13px; }
.me form { margin-left: auto; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 8px 8px 0; }
.tabbar { display: none; }

/* ---- surfaces ---- */
.glass {
  border-radius: var(--radius); background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: var(--shadow); padding: 18px;
}
.glass.tight { padding: 10px; }
.card { border-radius: 18px; background: rgba(255, 255, 255, .7); border: 1px solid rgba(255, 255, 255, .95); padding: 12px 14px; }
.dark { border-radius: var(--radius); color: #fff; background: var(--dark); box-shadow: 0 24px 60px rgba(49, 46, 129, .35); padding: 18px; }
.dark .mono, .dark .muted { color: rgba(255, 255, 255, .78); }
.cols { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.cols > * { min-width: 0; }
.col-1 { flex: 1 1 320px; } .col-2 { flex: 2 1 520px; }

/* ---- controls ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-decoration: none;
  border-radius: 999px; padding: 10px 16px; font-weight: 600; border: 1px solid rgba(255, 255, 255, .95);
  background: rgba(255, 255, 255, .7); color: var(--ink);
}
.btn:hover { background: rgba(255, 255, 255, .92); color: var(--ink); }
.btn.primary { border: 0; color: #fff; background: var(--primary); box-shadow: 0 8px 22px rgba(109, 40, 217, .35); }
.btn.primary:hover { filter: brightness(1.06); color: #fff; }
.btn.light { border: 0; background: #fff; color: #312E81; }
.btn.outline-light { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .4); }
.btn.danger { border: 0; color: #fff; background: linear-gradient(120deg, #9F1239, #BE123C); }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }
.btn.wide { width: 100%; }
.link { border: 0; background: none; padding: 0; color: #4338CA; cursor: pointer; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.link.red { color: var(--red); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 600;
  border: 1px solid rgba(255, 255, 255, .95); background: rgba(255, 255, 255, .65); color: var(--ink-2); text-decoration: none; cursor: pointer;
}
.chip:hover { background: rgba(255, 255, 255, .9); color: var(--ink); }
.chip.on, .chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .n { font-family: var(--mono); font-size: 10.5px; opacity: .75; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 2px 9px; background: rgba(241, 245, 249, .95); color: #475569; white-space: nowrap; }
.pill.red { background: var(--red-bg); color: #9F1239; }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.violet { background: var(--violet-bg); color: var(--violet); }
.pill.flag { background: linear-gradient(120deg, #FFEDD5, #FCE7F3); color: #9A3412; }
.badge { font-family: var(--mono); font-size: 11px; color: #fff; background: linear-gradient(120deg, #4338CA, #6D28D9); border-radius: 999px; padding: 1px 8px; }
.lang { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; border-radius: 6px; padding: 1px 5px; border: 1px solid rgba(14, 22, 56, .2); color: var(--ink-2); }

.ch { font-size: 11.5px; font-weight: 700; }
.ch-whatsapp { color: var(--wa); } .ch-instagram { color: var(--ig); } .ch-viber { color: var(--vb); } .ch-email { color: var(--em); } .ch-web { color: var(--web); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: #94A3B8; }
.dot.ch-whatsapp { background: var(--wa); } .dot.ch-instagram { background: var(--ig); } .dot.ch-viber { background: var(--vb); } .dot.ch-email { background: var(--em); } .dot.ch-web { background: var(--web); }
.from { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: #fff; border-radius: 999px; padding: 4px 11px; }
.from.ch-whatsapp { background: var(--wa); } .from.ch-instagram { background: var(--ig); } .from.ch-viber { background: var(--vb); } .from.ch-email { background: var(--em); } .from.ch-web { background: var(--web); }
.from::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; }

input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel], input[type=date],
input[type=time], input[type=number], input[type=url], input:not([type]), select, textarea {
  width: 100%; border-radius: 14px; padding: 10px 14px; border: 1px solid rgba(255, 255, 255, .95);
  background: rgba(255, 255, 255, .82); color: var(--ink); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #6D28D9; }
textarea { resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 .span2 { grid-column: 1 / -1; }
.search { display: flex; align-items: center; gap: 8px; border-radius: 999px; padding: 4px 6px 4px 14px; background: rgba(255, 255, 255, .78); border: 1px solid rgba(255, 255, 255, .95); }
.search input { border: 0; background: transparent; padding: 6px 0; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }

.toggle { width: 46px; height: 26px; border-radius: 999px; border: 0; cursor: pointer; position: relative; background: rgba(148, 163, 184, .6); padding: 0; flex: none; }
.toggle span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: left .15s; }
.toggle.on { background: linear-gradient(120deg, #4338CA, #6D28D9); }
.toggle.on span { left: 23px; }
.toggle:disabled { opacity: .5; cursor: not-allowed; }

.flashes { display: flex; flex-direction: column; gap: 8px; }
.flash { border-radius: 16px; padding: 10px 14px; background: rgba(255, 255, 255, .85); border: 1px solid rgba(255, 255, 255, .95); }
.flash.error { background: var(--red-bg); color: #9F1239; }
.flash.ok { background: var(--green-bg); color: var(--green); }
.flash.secret { background: #1E1B4B; color: #fff; font-family: var(--mono); font-size: 12.5px; }

/* ---- tables ---- */
.table { width: 100%; border-collapse: separate; border-spacing: 0 4px; }
.table th { text-align: left; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); font-weight: 500; padding: 6px 12px; }
.table td { background: rgba(255, 255, 255, .55); padding: 11px 12px; vertical-align: middle; }
.table td:first-child { border-radius: 14px 0 0 14px; } .table td:last-child { border-radius: 0 14px 14px 0; }
.table tr.off td { opacity: .55; }
.table a.rowlink { color: var(--ink); text-decoration: none; font-weight: 600; }
.scroll-x { overflow-x: auto; }
.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; color: var(--ink);
  background: radial-gradient(circle at 30% 25%, #FFFFFF 0%, #E0E7FF 40%, #C4B5FD 75%, #F5C2E0 100%); }
.avatar.lg { width: 52px; height: 52px; font-size: 15px; }
.empty { padding: 28px; text-align: center; color: var(--ink-2); }

/* ---- inbox ---- */
.inbox { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr) minmax(260px, 300px); gap: 16px; height: calc(100vh - 32px - 90px); min-height: 560px; }
.inbox .glass { display: flex; flex-direction: column; min-height: 0; }
.list-pane { padding: 14px; gap: 10px; }
.conv-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.conv { display: flex; gap: 10px; padding: 11px 12px; border-radius: 18px; text-decoration: none; color: var(--ink); border: 1px solid transparent; position: relative; }
.conv:hover { background: rgba(255, 255, 255, .5); color: var(--ink); }
.conv.sel { background: rgba(255, 255, 255, .95); box-shadow: 0 6px 18px rgba(46, 56, 140, .1); }
.conv.urgent { border-color: #FDA4AF; }
.conv .avatar { position: relative; }
.conv .avatar .dot { position: absolute; right: -1px; bottom: -1px; border: 2px solid #fff; width: 12px; height: 12px; }
.conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; }
.conv-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.unread .conv-name::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #6D28D9; margin-left: 6px; vertical-align: middle; }
.conv-time { font-family: var(--mono); font-size: 10.5px; color: var(--ink-2); flex: none; }
.conv-prev { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-tags { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.filter-label { margin-right: 2px; }

.chat-pane { padding: 0; overflow: hidden; }
.chat-head { padding: 16px 18px; border-bottom: 1px solid rgba(255, 255, 255, .8); display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.chat-name { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.chat-sub { font-size: 12.5px; color: var(--ink-2); }
.back { display: none; font-size: 26px; text-decoration: none; color: var(--ink); line-height: 1; }
.thread { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.day { align-self: center; margin: 6px 0; }
.msg { max-width: 76%; display: flex; flex-direction: column; gap: 3px; }
.msg .body { padding: 10px 14px; border-radius: 18px; background: rgba(255, 255, 255, .9); white-space: pre-wrap; word-wrap: break-word; }
.msg.in { align-self: flex-start; } .msg.in .body { border-top-left-radius: 6px; }
.msg.out { align-self: flex-end; } .msg.out .body { background: linear-gradient(120deg, #4338CA, #6D28D9); color: #fff; border-top-right-radius: 6px; }
.msg.out.bot .body { background: #312E81; }
.msg .meta { font-family: var(--mono); font-size: 10px; color: var(--ink-2); padding: 0 6px; }
.msg.out .meta { text-align: right; }
.att { font-size: 12.5px; padding: 8px 12px; border-radius: 14px; background: rgba(255, 255, 255, .7); }
.ds-failed { color: var(--red); font-weight: 700; }
.ai-draft { margin: 0 14px 10px; }
.ai-draft .text { font-size: 15px; line-height: 1.5; white-space: pre-wrap; margin: 8px 0 12px; }
.ai-draft .en { font-size: 12.5px; opacity: .8; border-left: 2px solid rgba(255, 255, 255, .4); padding-left: 10px; margin-bottom: 12px; white-space: pre-wrap; }
.composer { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.composer textarea { border-radius: 18px; }
.composer-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.composer-bar select { width: auto; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.warn { border-radius: 14px; padding: 9px 12px; background: var(--amber-bg); color: var(--amber); font-size: 12.5px; }
.presence { font-size: 12.5px; color: #6D28D9; }

.side-pane { padding: 18px; gap: 14px; overflow-y: auto; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.kv .k { font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.kv .v { font-weight: 500; overflow-wrap: anywhere; }
.note { padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, .6); font-size: 13px; }
.flags { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- doctor queue ---- */
.q-item { display: flex; flex-direction: column; gap: 10px; }
.q-item .summary { font-size: 17px; font-weight: 500; line-height: 1.35; }

/* ---- calendar ---- */
.cal { display: grid; gap: 8px; min-width: 640px; }
.cal-hours, .cal-col { position: relative; height: 700px; }
.cal-col { border-radius: 16px; background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .55) 0, rgba(255, 255, 255, .55) 1px, rgba(255, 255, 255, .18) 1px, rgba(255, 255, 255, .18) 70px); }
.cal-hour { position: absolute; left: 0; font-family: var(--mono); font-size: 10.5px; color: var(--ink-2); }
.cal-head { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 14px; background: rgba(255, 255, 255, .7); }
.appt { position: absolute; left: 4px; right: 4px; border-radius: 12px; padding: 6px 10px; overflow: hidden; text-decoration: none; display: flex; flex-direction: column; gap: 1px; font-size: 12px; }
.appt b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt.src-bot { background: linear-gradient(140deg, #312E81, #6D28D9); color: #fff; }
.appt.src-web { background: linear-gradient(140deg, #9D174D, #B8418A); color: #fff; }
.appt.src-staff, .appt.src-assistant, .appt.src-manual { background: rgba(255, 255, 255, .95); color: var(--ink); }
.appt.src-gcal { background: repeating-linear-gradient(135deg, rgba(100, 116, 139, .18) 0, rgba(100, 116, 139, .18) 6px, rgba(255, 255, 255, .4) 6px, rgba(255, 255, 255, .4) 12px); color: #334155; border: 1px dashed rgba(71, 85, 105, .5); }
.appt.urgent { background: linear-gradient(140deg, #BE123C, #E11D48); color: #fff; }
.appt.cancelled { opacity: .45; text-decoration: line-through; }

/* ---- questionnaire (patient-facing, phone first) ---- */
.qn { max-width: 560px; margin: 0 auto; padding: 18px 16px 120px; display: flex; flex-direction: column; gap: 14px; }
.qn-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.qn-logo { width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(140deg, #312E81, #6D28D9 60%, #B8418A); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.langs { display: flex; gap: 2px; background: rgba(255, 255, 255, .6); border-radius: 999px; padding: 3px; }
.langs a { font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 5px 10px; text-decoration: none; color: var(--ink-2); }
.langs a.on { background: var(--ink); color: #fff; }
.qn-section { display: flex; flex-direction: column; gap: 12px; }
.q { display: flex; flex-direction: column; gap: 8px; }
.q-label { font-weight: 600; font-size: 15px; }
.q-hint { font-size: 12.5px; color: var(--ink-2); }
.opts { display: flex; gap: 6px; flex-wrap: wrap; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.opt span { display: inline-block; border-radius: 999px; padding: 10px 16px; background: rgba(255, 255, 255, .8); border: 1px solid rgba(255, 255, 255, .95); font-weight: 600; }
.opt input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.opt input:focus-visible + span { outline: 2px solid #6D28D9; outline-offset: 2px; }
.qn-submit { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px 18px; display: flex; justify-content: center; background: linear-gradient(180deg, rgba(167, 185, 234, 0), rgba(151, 172, 228, .95) 40%); }
.qn-submit .btn { max-width: 528px; width: 100%; padding: 14px; }
.qr-box { display: flex; justify-content: center; padding: 14px; background: #fff; border-radius: 18px; }
.qr-box svg { width: 220px; height: 220px; }

/* ---- forms editor ---- */
.qrow { display: grid; grid-template-columns: 1fr 120px 90px 70px; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .6); }
.qrow.hidden-q { opacity: .5; }
.qedit { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

/* ---- auth ---- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; }

/* ---- responsive ---- */
@media (max-width: 1180px) {
  .inbox { grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); }
  .inbox .side-pane { display: none; }
}
@media (max-width: 900px) {
  .shell { padding: 12px 12px 96px; gap: 12px; }
  .sidebar { display: none; }
  .h1 { font-size: 34px; }
  .page-head { padding: 4px 4px 0; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 12px; right: 12px; bottom: 14px; height: 64px; z-index: 50;
    border-radius: 26px; background: rgba(255, 255, 255, .8); backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, .95); box-shadow: 0 16px 40px rgba(46, 56, 140, .22);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--ink-3); font-size: 10.5px; font-weight: 600; position: relative; }
  .tabbar a .ic { width: 40px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 999px; }
  .tabbar a.active { color: var(--ink); font-weight: 700; }
  .tabbar a.active .ic { background: var(--primary); color: #fff; }
  .tabbar a .count { position: absolute; top: 6px; right: calc(50% - 22px); font-family: var(--mono); font-size: 9.5px; color: #fff; background: #BE123C; border-radius: 999px; padding: 0 5px; }
  .inbox { display: block; height: auto; min-height: 0; }
  .inbox .list-pane { min-height: calc(100vh - 140px); }
  .inbox.has-selected .list-pane { display: none; }
  .inbox:not(.has-selected) .chat-pane { display: none; }
  .inbox .chat-pane { height: calc(100vh - 120px); }
  .back { display: inline; }
  .msg { max-width: 88%; }
  .grid2 { grid-template-columns: 1fr; }
  .qrow { grid-template-columns: 1fr 80px; }
  .qedit { grid-template-columns: 1fr; }
  .glass { padding: 14px; }
}

/* calendar geometry: 08:00–18:00, 70px per hour, 15-minute steps (generated) */
.t-0 { top: 0.0px; }
.t-1 { top: 17.5px; }
.t-2 { top: 35.0px; }
.t-3 { top: 52.5px; }
.t-4 { top: 70.0px; }
.t-5 { top: 87.5px; }
.t-6 { top: 105.0px; }
.t-7 { top: 122.5px; }
.t-8 { top: 140.0px; }
.t-9 { top: 157.5px; }
.t-10 { top: 175.0px; }
.t-11 { top: 192.5px; }
.t-12 { top: 210.0px; }
.t-13 { top: 227.5px; }
.t-14 { top: 245.0px; }
.t-15 { top: 262.5px; }
.t-16 { top: 280.0px; }
.t-17 { top: 297.5px; }
.t-18 { top: 315.0px; }
.t-19 { top: 332.5px; }
.t-20 { top: 350.0px; }
.t-21 { top: 367.5px; }
.t-22 { top: 385.0px; }
.t-23 { top: 402.5px; }
.t-24 { top: 420.0px; }
.t-25 { top: 437.5px; }
.t-26 { top: 455.0px; }
.t-27 { top: 472.5px; }
.t-28 { top: 490.0px; }
.t-29 { top: 507.5px; }
.t-30 { top: 525.0px; }
.t-31 { top: 542.5px; }
.t-32 { top: 560.0px; }
.t-33 { top: 577.5px; }
.t-34 { top: 595.0px; }
.t-35 { top: 612.5px; }
.t-36 { top: 630.0px; }
.t-37 { top: 647.5px; }
.t-38 { top: 665.0px; }
.t-39 { top: 682.5px; }
.h-1 { height: 14.5px; }
.h-2 { height: 32.0px; }
.h-3 { height: 49.5px; }
.h-4 { height: 67.0px; }
.h-5 { height: 84.5px; }
.h-6 { height: 102.0px; }
.h-7 { height: 119.5px; }
.h-8 { height: 137.0px; }
.h-9 { height: 154.5px; }
.h-10 { height: 172.0px; }
.h-11 { height: 189.5px; }
.h-12 { height: 207.0px; }
.h-13 { height: 224.5px; }
.h-14 { height: 242.0px; }
.h-15 { height: 259.5px; }
.h-16 { height: 277.0px; }
.h-17 { height: 294.5px; }
.h-18 { height: 312.0px; }
.h-19 { height: 329.5px; }
.h-20 { height: 347.0px; }
.h-21 { height: 364.5px; }
.h-22 { height: 382.0px; }
.h-23 { height: 399.5px; }
.h-24 { height: 417.0px; }
.h-25 { height: 434.5px; }
.h-26 { height: 452.0px; }
.h-27 { height: 469.5px; }
.h-28 { height: 487.0px; }
.h-29 { height: 504.5px; }
.h-30 { height: 522.0px; }
.h-31 { height: 539.5px; }
.h-32 { height: 557.0px; }
.h-33 { height: 574.5px; }
.h-34 { height: 592.0px; }
.h-35 { height: 609.5px; }
.h-36 { height: 627.0px; }
.h-37 { height: 644.5px; }
.h-38 { height: 662.0px; }
.h-39 { height: 679.5px; }
.h-40 { height: 697.0px; }
.hr-0 { top: 0px; }
.hr-1 { top: 64px; }
.hr-2 { top: 134px; }
.hr-3 { top: 204px; }
.hr-4 { top: 274px; }
.hr-5 { top: 344px; }
.hr-6 { top: 414px; }
.hr-7 { top: 484px; }
.hr-8 { top: 554px; }
.hr-9 { top: 624px; }
.hr-10 { top: 694px; }

/* calendar grid columns (CSP: no inline styles, so a class per column count) */
.cal-1 { grid-template-columns: 56px repeat(1, minmax(0, 1fr)); }
.cal-2 { grid-template-columns: 56px repeat(2, minmax(0, 1fr)); }
.cal-3 { grid-template-columns: 56px repeat(3, minmax(0, 1fr)); }
.cal-4 { grid-template-columns: 56px repeat(4, minmax(0, 1fr)); }
.cal-5 { grid-template-columns: 56px repeat(5, minmax(0, 1fr)); }
.cal-6 { grid-template-columns: 56px repeat(6, minmax(0, 1fr)); }
.appt-key { width: 14px; height: 14px; border-radius: 5px; display: inline-block; }
.appt-key.src-bot { background: linear-gradient(140deg, #312E81, #6D28D9); }
.appt-key.src-web { background: linear-gradient(140deg, #9D174D, #B8418A); }
.appt-key.src-staff { background: #fff; border: 1px solid #CBD5E1; }
.appt-key.src-gcal { background: repeating-linear-gradient(135deg, rgba(100, 116, 139, .3) 0, rgba(100, 116, 139, .3) 3px, #fff 3px, #fff 6px); }
.q.err .q-label, label.err { color: var(--red); }
.secret-key { font-size: 15px; letter-spacing: .12em; cursor: copy; }
.dark .field { color: #fff; }
.dark select, .dark input { background: rgba(255, 255, 255, .92); }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details[open] > form { margin-top: 10px; }
fieldset.q { border: 0; padding: 0; margin: 0; }
legend.q-label { padding: 0; margin-bottom: 8px; }

.dark .link { color: #fff; }
