:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --line: #e5e9f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #0f9f6e;
  --success-soft: #e8f8f1;
  --danger: #dc3f4f;
  --danger-soft: #fff0f1;
  --warning: #b7791f;
  --warning-soft: #fff8e7;
  --shadow: 0 14px 38px rgba(16, 24, 40, .08);
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input { font: inherit; }

a { color: inherit; text-decoration: none; }

.topbar {
  height: 74px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: white;
  font-weight: 800;
}

.brand strong, .brand span { display: block; }
.brand span { color: var(--muted); font-size: 12px; margin-top: 2px; }

.env-badge {
  border: 1px solid #c7d7fe;
  color: var(--primary);
  background: #eff6ff;
  font-weight: 800;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  letter-spacing: .08em;
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 42px auto 80px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  padding: 34px;
  color: white;
  border-radius: 22px;
  background: linear-gradient(130deg, #15213c, #204f9c);
  box-shadow: var(--shadow);
}

.hero h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
  margin: 8px 0 14px;
  max-width: 780px;
}

.hero-copy {
  margin: 0;
  color: rgba(255,255,255,.78);
  line-height: 1.7;
  max-width: 800px;
}

.eyebrow {
  margin: 0;
  color: #6b85ad;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
}

.hero .eyebrow { color: #a9c5ff; }

.hero-stat {
  min-width: 160px;
  background: rgba(255,255,255,.1);
  padding: 16px 18px;
  border-radius: 14px;
}
.hero-stat span, .hero-stat strong { display: block; }
.hero-stat span { color: rgba(255,255,255,.65); font-size: 12px; margin-bottom: 6px; }
.status-live { display: flex !important; align-items: center; gap: 8px; }
.status-live i { width: 8px; height: 8px; border-radius: 50%; background: #5ee7a5; }

.section {
  margin-top: 42px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 4px 0 0;
  font-size: 24px;
}

.user-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.user-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 5px 18px rgba(16,24,40,.04);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.user-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.avatar, .customer-avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #26426e;
  background: #eaf1ff;
}

.user-card h3 { margin: 0; font-size: 18px; }
.user-id { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

.status-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 6px 9px;
  border-radius: 999px;
}
.status-pill.pending { color: var(--warning); background: var(--warning-soft); }
.status-pill.verified { color: var(--success); background: var(--success-soft); }
.status-pill.rejected { color: var(--danger); background: var(--danger-soft); }

.user-meta {
  display: grid;
  gap: 9px;
  margin: 0;
}
.user-meta div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.user-meta dt { color: var(--muted); }
.user-meta dd { margin: 0; text-align: right; font-weight: 650; }

.btn {
  border: 0;
  border-radius: 10px;
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  font-weight: 750;
  transition: .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: white; background: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { color: #344054; background: white; border: 1px solid #d8dee8; }
.btn-ghost { color: #475467; background: transparent; border: 1px solid transparent; }
.btn-success { color: white; background: var(--success); }
.btn-danger { color: white; background: var(--danger); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 12px; }

.start-btn { width: 100%; margin-top: auto; }

.join-section {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.join-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 14px;
  align-items: end;
}
.join-form label {
  color: #475467;
  font-size: 12px;
  font-weight: 700;
}
.join-form input {
  display: block;
  width: 100%;
  margin-top: 7px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #d7dce5;
  border-radius: 10px;
  outline: 0;
}
.join-form input:focus { border-color: #8bb4ff; box-shadow: 0 0 0 3px #eaf2ff; }

footer {
  text-align: center;
  color: #98a2b3;
  font-size: 12px;
  padding: 26px;
}

/* Meeting */
.meeting-body {
  height: 100vh;
  overflow: hidden;
  background: #0d1118;
}

.meeting-topbar {
  position: relative;
  height: 66px;
  padding: 0 20px;
}

.brand-link { cursor: pointer; }
.meeting-header-actions { display: flex; align-items: center; gap: 8px; }

.connection-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 6px 9px;
  border-radius: 999px;
}
.connection-badge.waiting { background: var(--warning-soft); color: var(--warning); }
.connection-badge.connected { background: var(--success-soft); color: var(--success); }
.connection-badge.error { background: var(--danger-soft); color: var(--danger); }

.meeting-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  height: calc(100vh - 66px);
}

.customer-panel {
  background: #fff;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 22px;
}

.panel-block {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.customer-avatar {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  font-size: 18px;
  margin: 12px 0;
}

.customer-panel h2 { margin: 0; font-size: 20px; }
.muted { color: var(--muted); font-size: 12px; margin: 5px 0 0; }

.detail-list {
  display: grid;
  gap: 11px;
}
.detail-list div, .session-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.detail-list span, .session-row span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.detail-list strong, .session-row strong {
  font-size: 12px;
  word-break: break-word;
}
.session-row { margin-top: 10px; }
.session-row code {
  font-size: 11px;
  background: #f2f4f7;
  border-radius: 6px;
  padding: 6px;
  word-break: break-all;
}

.officer-actions { display: grid; gap: 9px; }
.action-note { color: #98a2b3; font-size: 10px; line-height: 1.5; margin: 3px 0 0; }

.result-banner {
  padding: 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
}
.result-banner.verified { color: var(--success); background: var(--success-soft); }
.result-banner.rejected { color: var(--danger); background: var(--danger-soft); }

.video-panel { min-width: 0; height: 100%; background: #0d1118; }
.jitsi-container { width: 100%; height: 100%; position: relative; }
.jitsi-container iframe { display: block !important; width: 100% !important; height: 100% !important; border: 0; }

.jitsi-loading, .fatal-message {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  color: white;
  text-align: center;
}
.jitsi-loading span { color: #8d98aa; font-size: 12px; }
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #172033;
  color: white;
  padding: 11px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: .18s ease;
  z-index: 100;
  font-size: 12px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.hidden { display: none !important; }

@media (max-width: 1000px) {
  .user-grid { grid-template-columns: repeat(2, 1fr); }
  .meeting-layout { grid-template-columns: 260px minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .topbar { padding: 0 16px; }
  .page-shell { width: min(100% - 24px, 1180px); margin-top: 20px; }
  .hero { align-items: stretch; flex-direction: column; padding: 24px; }
  .hero-stat { min-width: 0; }
  .user-grid { grid-template-columns: 1fr; }
  .join-form { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }

  .meeting-body { overflow: auto; }
  .meeting-topbar { position: sticky; }
  .meeting-header-actions .btn-secondary { display: none; }
  .meeting-layout {
    height: auto;
    min-height: calc(100vh - 66px);
    grid-template-columns: 1fr;
  }
  .customer-panel { order: 2; border-right: 0; }
  .video-panel { order: 1; height: 65vh; min-height: 430px; }
}


/* POC v2: room/link actions */
.user-meta code {
  font-size: 11px;
  background: #f2f4f7;
  border-radius: 6px;
  padding: 3px 6px;
  white-space: nowrap;
}

.card-actions {
  display: grid;
  gap: 9px;
  margin-top: auto;
}

.card-actions .start-btn {
  margin-top: 0;
}

.join-actions {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.generated-link-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.generated-link-panel label {
  color: #475467;
  font-size: 12px;
  font-weight: 700;
}

.copy-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 7px;
}

.copy-link-row input {
  min-width: 0;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #d7dce5;
  border-radius: 10px;
  background: #f8fafc;
  color: #475467;
}

@media (max-width: 760px) {
  .join-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .copy-link-row {
    grid-template-columns: 1fr;
  }
}
