:root {
  color-scheme: light;
  --navy: #062B63;
  --ink: #172033;
  --muted: #607086;
  --line: #D8DEE6;
  --surface: #F5F7F9;
  --white: #FFFFFF;
  --accent: #F4D000;
  --danger: #A62B2B;
  --warning: #B54708;
  --warning-bg: #FFF4E5;
  --success: #17663A;
  --radius: 2px;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--surface); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}

body { display: flex; flex-direction: column; }
main { flex: 1; }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.narrow-shell { width: min(760px, calc(100% - 40px)); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.mono { font-family: Consolas, Monaco, monospace; font-size: 0.92rem; }

.site-header {
  min-height: 68px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
}

.header-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.header-tools { display: flex; align-items: center; gap: 24px; }
.language-switch { display: inline-flex; border: 1px solid #8B99AA; border-radius: var(--radius); overflow: hidden; }
.language-switch a { min-width: 38px; padding: 7px 8px; color: var(--navy); background: var(--white); font-size: 0.78rem; font-weight: 700; text-align: center; text-decoration: none; }
.language-switch a + a { border-left: 1px solid #8B99AA; }
.language-switch a.active { color: var(--white); background: var(--navy); }
.wordmark { color: var(--navy); font-size: 1.42rem; font-weight: 700; text-decoration: none; }
.header-link, .header-actions a { color: var(--ink); font-weight: 700; text-decoration: none; }
.header-link:hover, .header-actions a:hover, .back-link:hover, .row-link:hover { text-decoration: underline; }
.header-actions { display: flex; align-items: center; gap: 24px; }
.header-actions form { margin: 0; }

.site-footer { color: var(--muted); background: var(--white); border-top: 1px solid var(--line); font-size: 0.875rem; }
.footer-inner { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }

.page-band { padding: 56px 0 72px; }
.intro-band { background: var(--white); }
.intro-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(520px, 1.1fr); gap: 72px; align-items: start; }
.intro-copy { padding: 42px 0; }
.eyebrow { margin: 0 0 10px; color: var(--navy); font-weight: 700; text-transform: uppercase; font-size: 0.78rem; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { max-width: 760px; margin: 0; color: var(--navy); font-size: clamp(2rem, 4vw, 3.7rem); line-height: 1.08; letter-spacing: 0; }
.admin-band h1, .call-heading h1, .login-panel h1 { font-size: 2.15rem; }
.lede { max-width: 660px; margin: 22px 0 0; color: #354056; font-size: 1.16rem; }

.trust-list { margin: 42px 0 0; border-top: 1px solid var(--line); }
.trust-list div { display: grid; grid-template-columns: 92px 1fr; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.trust-list dt { color: var(--navy); font-weight: 700; }
.trust-list dd { margin: 0; color: var(--muted); }

.booking-panel, .login-panel {
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.section-title { margin: 0 0 22px; padding-top: 10px; border-top: 3px solid var(--accent); color: var(--navy); font-size: 1.18rem; line-height: 1.25; }
.field { margin: 0 0 18px; }
.field label { display: block; margin: 0 0 6px; color: var(--ink); font-size: 0.93rem; font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid #AAB5C2;
  border-radius: var(--radius);
}
.field textarea { min-height: 104px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .button:focus-visible, .icon-button:focus-visible, a:focus-visible {
  outline: 3px solid #7AA7D9;
  outline-offset: 2px;
}
.field-help { margin: 5px 0 0; color: var(--muted); font-size: 0.82rem; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.slot-picker { min-width: 0; margin: 0 0 22px; padding: 0; border: 0; }
.slot-picker legend { margin: 0 0 8px; color: var(--ink); font-size: 0.93rem; font-weight: 700; }
.slot-time-grid { min-height: 48px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.slot-option { position: relative; min-width: 0; cursor: pointer; }
.slot-option input { position: absolute; opacity: 0; pointer-events: none; }
.slot-option span { min-height: 42px; padding: 9px 8px; display: grid; place-items: center; color: var(--navy); background: var(--white); border: 1px solid #8B99AA; border-radius: var(--radius); font-size: 0.86rem; font-weight: 700; text-align: center; }
.slot-option input:checked + span { color: var(--white); background: var(--navy); border-color: var(--navy); }
.slot-option input:focus-visible + span { outline: 3px solid #7AA7D9; outline-offset: 2px; }
.slot-picker-message { grid-column: 1 / -1; margin: 0; padding: 12px; color: var(--muted); background: var(--white); border: 1px solid var(--line); text-align: center; }
.check-row { display: grid; grid-template-columns: 20px 1fr; gap: 10px; margin: 4px 0 22px; align-items: start; font-size: 0.91rem; }
.check-row input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--navy); }

.button {
  min-height: 42px;
  padding: 9px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.button:disabled { cursor: not-allowed; opacity: 0.55; }
.button-primary { color: var(--white); background: var(--navy); border-color: var(--navy); }
.button-primary:hover:not(:disabled) { background: #0B3A7E; }
.button-secondary { color: var(--navy); background: var(--white); border-color: #8B99AA; }
.button-secondary:hover { background: var(--surface); }
.button-danger { color: var(--white); background: var(--danger); border-color: var(--danger); }
.button-link-danger { color: var(--danger); background: var(--white); border-color: #D9A7A7; }
.button-quiet { min-height: 36px; padding: 7px 11px; color: var(--ink); background: var(--white); border-color: var(--line); }
.button-wide { width: 100%; }
.button-small { min-height: 34px; padding: 7px 11px; font-size: 0.86rem; }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.form-message { margin: 0 0 16px; padding: 10px 12px; border-left: 3px solid var(--navy); background: #EAF1F9; }
.form-message.error { color: #7D2020; border-color: var(--danger); background: #FFF0F0; }

.confirmation-block { padding: 20px 0; }
.confirmation-block h1, .message-page h1 { font-size: 2.65rem; }
.detail-list { margin: 34px 0 0; border-top: 1px solid var(--line); }
.detail-list div { display: grid; grid-template-columns: 150px 1fr; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.detail-list dt { color: var(--muted); font-size: 0.86rem; font-weight: 700; text-transform: uppercase; }
.detail-list dd { margin: 0; }
.detail-list.compact { margin-top: 0; }
.detail-list.compact div { display: block; }
.detail-list.compact dd { margin-top: 4px; }
.action-help { margin: 8px 0 0; color: var(--muted); font-size: 0.82rem; }
.presence-status { margin: 0 0 18px; padding: 9px 10px; color: var(--muted); background: var(--white); border: 1px solid var(--line); font-size: 0.84rem; font-weight: 700; }
.presence-status span { width: 8px; height: 8px; margin-right: 7px; display: inline-block; background: #8390A0; border-radius: 50%; }
.presence-waiting, .presence-joined { color: var(--success); border-color: #90C5A7; background: #EEF8F2; }
.presence-waiting span, .presence-joined span { background: var(--success); }
.client-link-block { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.client-qr { margin-bottom: 20px; text-align: center; }
.client-qr img { width: min(100%, 280px); height: auto; display: block; margin: 0 auto 8px; background: var(--white); border: 1px solid var(--line); }
.client-qr p { margin: 0 0 10px; color: var(--muted); font-size: 0.82rem; }
.client-link-block label { display: block; margin-bottom: 6px; font-size: 0.84rem; font-weight: 700; }
.client-link-block input { width: 100%; min-height: 40px; margin-bottom: 8px; padding: 8px 10px; border: 1px solid #AAB5C2; background: var(--white); }

.center-band { min-height: calc(100vh - 127px); display: grid; place-items: center; }
.login-panel { width: min(430px, calc(100% - 40px)); }
.login-panel .muted { margin: 8px 0 26px; }
.message-page { width: min(660px, calc(100% - 40px)); text-align: center; }
.message-page h1 { margin-inline: auto; }
.message-page .muted { margin: 14px 0 28px; }

.admin-band { background: var(--surface); }
.page-heading-row { margin-bottom: 42px; display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; }
.page-heading-row p { margin: 8px 0 0; }
.compact-heading { margin-top: 22px; margin-bottom: 36px; }
.live-indicator { flex: 0 0 auto; color: var(--muted); font-size: 0.84rem; }
.live-indicator span { width: 8px; height: 8px; margin-right: 6px; display: inline-block; background: var(--success); border-radius: 50%; }
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); }
table { width: 100%; min-width: 830px; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); background: var(--surface); font-size: 0.78rem; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.row-link, .back-link { color: var(--navy); font-weight: 700; }
.back-link { display: inline-block; margin-bottom: 8px; }
.status { padding: 4px 7px; display: inline-block; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); font-size: 0.78rem; font-weight: 700; text-transform: capitalize; white-space: nowrap; }
.status-in_call { color: var(--success); border-color: #90C5A7; background: #EEF8F2; }
.status-completed { color: var(--navy); border-color: #AFC5DF; background: #EEF4FA; }
.status-cancelled { color: var(--danger); background: #FFF0F0; }
.empty-state { margin: 0; padding: 20px; color: var(--muted); text-align: center; }

.detail-layout { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 48px; align-items: start; }
.detail-sidebar { padding-right: 30px; border-right: 1px solid var(--line); }
.detail-main { min-width: 0; display: grid; gap: 44px; }
.section-heading-row { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.section-heading-row .button-row { margin-top: 0; gap: 8px; }
.section-heading-row .button-row form { margin: 0; }
.summary-grid { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, max-content)); border: 1px solid var(--line); background: var(--white); }
.summary-grid div { padding: 16px; border-right: 1px solid var(--line); }
.summary-grid div:last-child { border-right: 0; }
.summary-grid dt { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; }
.summary-grid dd { margin: 4px 0 0; color: var(--navy); font-size: 1.3rem; font-weight: 700; }
.ai-summary { margin-top: 16px; padding: 18px; background: var(--white); border: 1px solid var(--line); border-left: 3px solid var(--navy); }
.ai-summary p { margin: 0 0 12px; }
.ai-summary h3 { margin: 16px 0 6px; color: var(--navy); font-size: 0.95rem; }
.ai-summary ul { margin: 0; padding-left: 20px; }
.summary-label { color: var(--muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; }
.summary-loading { margin-top: 16px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; color: var(--navy); background: var(--white); border: 1px solid var(--line); font-weight: 700; }
.summary-loading[hidden] { display: none; }
.loading-spinner { width: 18px; height: 18px; flex: 0 0 auto; border: 3px solid #C5D0DE; border-top-color: var(--navy); border-radius: 50%; animation: spin 850ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.transcript-document { margin: 0; padding: 22px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); background: var(--white); border: 1px solid var(--line); font-family: Arial, Helvetica, sans-serif; font-size: 0.95rem; line-height: 1.65; }

.calendar-layout { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 48px; align-items: start; }
.calendar-add { padding-right: 30px; border-right: 1px solid var(--line); }
.slot-list { display: grid; gap: 10px; }
.slot-row { padding: 14px; background: var(--white); border: 1px solid var(--line); }
.slot-edit-form { display: grid; grid-template-columns: 1.2fr 1.4fr 1fr auto; gap: 10px; align-items: end; }
.slot-edit-form .field { margin: 0; }
.slot-edit-form .field input, .slot-edit-form .field select { min-height: 38px; padding: 7px 8px; }
.slot-actions { min-height: 38px; display: flex; gap: 6px; align-items: stretch; }
.slot-summary > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.slot-summary p { margin: 5px 0 0; }
.slot-booked { border-left: 3px solid var(--navy); }
.status-booked { color: var(--navy); border-color: #AFC5DF; background: #EEF4FA; }

.demo-banner { padding: 10px 20px; color: #6E2C00; background: var(--warning-bg); border-bottom: 2px solid var(--warning); font-size: 0.88rem; font-weight: 700; text-align: center; }
.demo-banner[hidden] { display: none; }
.demo-banner button { margin-left: 12px; padding: 1px 7px; color: #6E2C00; background: transparent; border: 1px solid #D99A5F; border-radius: var(--radius); font-weight: 700; cursor: pointer; }
.call-page { min-height: calc(100vh - 127px); padding: 24px 0 30px; background: #E9EDF2; }
.call-shell { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; min-height: calc(100vh - 181px); }
.call-heading { min-height: 66px; margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.call-heading p { margin: 5px 0 0; color: var(--muted); }
.call-status-stack { display: grid; gap: 8px; justify-items: end; }
.call-state { flex: 0 0 auto; padding: 7px 10px; color: var(--ink); background: var(--white); border: 1px solid var(--line); font-size: 0.85rem; }
.call-timer { min-width: 120px; padding: 7px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--navy); background: var(--white); border: 1px solid var(--line); font-size: 0.8rem; }
.call-timer[hidden] { display: none; }
.call-timer span { color: var(--muted); font-weight: 700; }
.call-timer strong { font-size: 1rem; }
#connection-dot { width: 8px; height: 8px; margin-right: 7px; display: inline-block; background: #8390A0; border-radius: 50%; }
#connection-dot.connected { background: var(--success); }
.call-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; min-height: 0; }
.video-stage { position: relative; min-width: 0; min-height: 430px; height: clamp(430px, calc(100vh - 330px), 620px); background: #111722; border: 1px solid #111722; overflow: hidden; }
.remote-frame { position: absolute; inset: 0; }
.remote-frame video { width: 100%; height: 100%; display: block; object-fit: cover; }
.video-placeholder { position: absolute; inset: 0; display: grid; place-items: center; padding: 30px; color: #DCE3EC; text-align: center; }
.video-placeholder[hidden] { display: none; }
.local-frame { position: absolute; right: 16px; bottom: 16px; width: min(230px, 30%); aspect-ratio: 4 / 3; background: #2B3442; border: 1px solid #FFFFFF; }
.local-frame video { width: 100%; height: 100%; display: block; object-fit: cover; transform: scaleX(-1); }
.local-placeholder { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; color: #DCE3EC; text-align: center; }
.local-placeholder[hidden] { display: none; }
.media-status { position: absolute; top: 12px; left: 12px; max-width: calc(100% - 24px); padding: 7px 9px; color: #172033; background: rgba(255, 255, 255, 0.92); border: 1px solid #D8DEE6; font-size: 0.82rem; font-weight: 700; }
.media-status[hidden], .local-media-status[hidden] { display: none; }
.local-media-status { position: absolute; top: 8px; right: 8px; max-width: calc(100% - 16px); padding: 5px 7px; color: #FFFFFF; background: rgba(17, 23, 34, 0.86); font-size: 0.72rem; font-weight: 700; text-align: right; }
.video-label { position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); padding: 4px 6px; overflow: hidden; color: var(--white); background: #111722; font-size: 0.76rem; text-overflow: ellipsis; white-space: nowrap; }
.call-sidebar { min-width: 0; max-height: clamp(430px, calc(100vh - 330px), 620px); padding: 18px; overflow: hidden; background: var(--white); border: 1px solid var(--line); }
.call-sidebar .section-title { margin-bottom: 12px; }
.call-sidebar-client .chat-feed { height: 430px; }
.call-panel-section + .call-panel-section { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.language-note { margin: -6px 0 10px; color: var(--muted); font-size: 0.78rem; }
.transcript-feed { display: grid; align-content: start; gap: 12px; }
.call-transcript { height: 220px; overflow-y: auto; }
.transcript-line { padding: 10px 12px; background: var(--white); border-left: 3px solid var(--navy); }
.call-transcript .transcript-line { background: var(--surface); }
.transcript-line strong { color: var(--navy); font-size: 0.82rem; }
.transcript-line p { margin: 3px 0 0; }
.transcript-text p + p { margin-top: 6px; }
.transcript-line.demo-line { border-left-color: var(--warning); background: var(--warning-bg); }
.chat-feed { height: 104px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); }
.chat-feed .empty-state { padding: 16px 10px; font-size: 0.84rem; }
.chat-message { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.chat-message:last-child { border-bottom: 0; }
.chat-message-own { border-left: 3px solid var(--navy); }
.chat-message strong { color: var(--navy); font-size: 0.76rem; }
.chat-message p { margin: 2px 0 0; font-size: 0.86rem; }
.chat-form { margin-top: 8px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.chat-form input { min-width: 0; min-height: 36px; padding: 7px 9px; border: 1px solid #AAB5C2; border-radius: var(--radius); }
.chat-form input:focus { outline: 3px solid #7AA7D9; outline-offset: 2px; }
.call-controls { min-height: 58px; padding-top: 12px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.audio-meters { display: grid; grid-template-columns: repeat(2, minmax(0, 210px)); justify-content: center; gap: 12px; margin: 0 0 6px; }
.audio-meter { min-width: 0; display: grid; gap: 4px; color: var(--muted); font-size: 0.76rem; font-weight: 700; }
.meter-track { height: 9px; overflow: hidden; background: var(--white); border: 1px solid #8B99AA; }
.meter-track i { width: 0%; height: 100%; display: block; background: var(--success); transition: width 80ms linear; }
.icon-button { min-width: 90px; min-height: 42px; padding: 8px 12px; color: var(--ink); background: var(--white); border: 1px solid #8B99AA; border-radius: var(--radius); font-weight: 700; cursor: pointer; }
.icon-button:disabled { cursor: not-allowed; opacity: 0.55; }
.call-message { min-height: 24px; margin: 0; color: var(--muted); text-align: center; font-size: 0.88rem; }

@media (max-width: 900px) {
  .intro-grid { grid-template-columns: 1fr; gap: 30px; }
  .intro-copy { padding: 10px 0; }
  .call-layout { grid-template-columns: 1fr; }
  .call-sidebar { min-height: 240px; max-height: none; overflow: visible; }
  .call-transcript { height: 220px; }
  .chat-feed { height: 140px; }
  .call-sidebar-client .chat-feed { height: 180px; }
  .detail-layout { grid-template-columns: 1fr; gap: 40px; }
  .calendar-layout { grid-template-columns: 1fr; gap: 40px; }
  .calendar-add { padding-right: 0; border-right: 0; }
  .slot-edit-form { grid-template-columns: 1fr 1fr; }
  .slot-edit-form .field:first-child, .slot-actions { grid-column: 1 / -1; }
  .detail-sidebar { padding-right: 0; border-right: 0; }
}

@media (max-width: 620px) {
  .shell, .narrow-shell { width: min(1180px, calc(100% - 24px)); }
  .page-band { padding: 34px 0 48px; }
  .header-actions { gap: 12px; }
  .header-tools { gap: 10px; }
  .header-actions > a { display: none; }
  h1, .confirmation-block h1, .message-page h1 { font-size: 2.1rem; }
  .admin-band h1, .call-heading h1, .login-panel h1 { font-size: 1.8rem; }
  .booking-panel, .login-panel { padding: 20px; }
  .two-fields { grid-template-columns: 1fr; gap: 0; }
  .slot-time-grid { grid-template-columns: 1fr; }
  .footer-inner, .page-heading-row, .call-heading { align-items: flex-start; flex-direction: column; }
  .header-inner { align-items: flex-start; padding: 12px 0; flex-direction: column; gap: 12px; }
  .header-tools, .header-actions { width: 100%; justify-content: space-between; }
  .call-status-stack { justify-items: start; }
  .footer-inner { padding: 14px 0; gap: 4px; }
  .detail-list div { grid-template-columns: 1fr; gap: 5px; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-grid div { border-right: 0; border-bottom: 1px solid var(--line); }
  .summary-grid div:last-child { border-bottom: 0; }
  .video-stage { min-height: 340px; height: min(58vh, 460px); }
  .local-frame { width: min(140px, 38%); right: 10px; bottom: 10px; }
  .call-controls { position: sticky; bottom: 0; z-index: 5; flex-wrap: wrap; padding: 12px 0; background: #E9EDF2; border-top: 1px solid var(--line); }
  .call-controls .button, .call-controls .icon-button { flex: 1 1 44%; }
  .audio-meters { grid-template-columns: 1fr; }
  .section-heading-row { align-items: flex-start; flex-direction: column; }
  .slot-edit-form { grid-template-columns: 1fr; }
  .slot-edit-form .field:first-child, .slot-actions { grid-column: auto; }
  .slot-actions .button { flex: 1; }
}
