:root {
  color-scheme: light;
  --ink: #243238;
  --muted: #66767c;
  --line: #dce7e4;
  --surface: #ffffff;
  --soft: #f5f8f7;
  --brand: #176d71;
  --brand-strong: #0d5155;
  --accent: #c89845;
  --danger: #a53f3f;
  --ok: #327a50;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
}

.topbar {
  min-height: 160px;
  padding: 28px clamp(18px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(90deg, #0d5155, #176d71);
  color: #fff;
}

.brand-logo {
  width: clamp(110px, 16vw, 180px);
  height: auto;
  padding: 10px;
  background: rgba(255,255,255,0.94);
  border-radius: 8px;
  flex: 0 0 auto;
}

.hero-copy {
  flex: 1;
}

.eyebrow {
  margin: 0 0 8px;
  color: #f0d59a;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(30px, 5vw, 52px); line-height: 1; letter-spacing: 0; max-width: 760px; }
h2 { font-size: 18px; margin-bottom: 0; }
h3 { font-size: 14px; margin-bottom: 10px; color: var(--brand-strong); }

.status-pill {
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.portal {
  display: grid;
  grid-template-columns: 210px 1fr;
  min-height: calc(100vh - 160px);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: calc(100vh - 160px);
  padding: 22px 16px;
  background: #ffffff;
  border-right: 1px solid var(--line);
}

.nav-group + .nav-group {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.nav-title {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.sidebar a {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 750;
  font-size: 14px;
}

.sidebar a:hover,
.sidebar a.active {
  background: #edf5f3;
  color: var(--brand-strong);
}

.content {
  min-width: 0;
  padding: 24px clamp(14px, 3vw, 40px) 44px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.page-view {
  display: none;
}

.page-view.active {
  display: block;
}

.summary-grid article, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-grid article {
  padding: 18px;
}

.summary-grid span {
  display: block;
  color: var(--brand);
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
}

.summary-grid p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.portal-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(320px, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.script {
  background: #f7f2e8;
  border-left: 4px solid var(--accent);
  padding: 12px;
  border-radius: 6px;
  color: #4b4437;
  line-height: 1.45;
}

form, .two-col {
  display: grid;
  gap: 12px;
}

.two-col {
  grid-template-columns: 1fr 1fr;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

input, select, textarea {
  width: 100%;
  border: 1px solid #cad9d6;
  border-radius: 6px;
  padding: 10px 11px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

textarea { resize: vertical; }
textarea[name="googleServiceAccountJson"],
textarea[name="googlePrivateKey"] {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.checks {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.checks input { width: auto; }

button {
  border: 1px solid #bed0cd;
  background: #fff;
  color: var(--brand-strong);
  border-radius: 6px;
  padding: 9px 12px;
  font-weight: 800;
  cursor: pointer;
}

button:hover { border-color: var(--brand); }
.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.records-panel { min-width: 0; }
.records-panel input { max-width: 340px; }
.wide-panel { grid-column: 1 / -1; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar select {
  width: auto;
  min-width: 150px;
}

.subtle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.availability-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.availability-list.compact {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.slot {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px;
  background: #fbfdfc;
}

.slot strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.slot span {
  color: var(--muted);
  font-size: 12px;
}

.attention-list,
.transcript-list,
.calendar-bookings {
  display: grid;
  gap: 10px;
}

.attention-item,
.transcript-item,
.calendar-booking {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fbfdfc;
  cursor: pointer;
}

.attention-item strong,
.transcript-item strong,
.calendar-booking strong {
  display: block;
  margin-bottom: 4px;
}

.attention-item p,
.transcript-item p,
.calendar-booking p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.transcript-page-list .transcript-item {
  gap: 6px;
}

.recording-player {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfc;
}

.recording-player audio {
  width: 100%;
}

.calendar-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
  align-items: start;
}

.calendar-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.metric-chip {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #fbfdfc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.calendar-agenda {
  display: grid;
  gap: 8px;
}

.calendar-agenda-list {
  display: grid;
  gap: 8px;
}

.agenda-row {
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fbfdfc;
}

.agenda-row-clickable {
  cursor: pointer;
}

.agenda-row strong,
.agenda-row span {
  display: block;
}

.agenda-row strong {
  margin-bottom: 2px;
  font-size: 14px;
}

.agenda-row div > span {
  color: var(--muted);
  font-size: 12px;
}

.setup-form {
  display: grid;
  gap: 16px;
}

.wizard-progress {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.wizard-progress button {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  min-height: 44px;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  background: #f8faf9;
}

.wizard-progress button.active {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

.wizard-progress span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.8);
  color: var(--brand-strong);
  font-weight: 900;
}

.setup-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.setup-group {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.setup-group:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.setup-group h4 {
  margin: 0;
  color: var(--brand-strong);
  font-size: 13px;
}

.wizard-step {
  display: none;
}

.wizard-step.active {
  display: grid;
}

.step-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.setup-copy {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 14px;
}

.handoff-box {
  padding: 14px;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #f7f2e8;
}

.handoff-box p {
  margin: 6px 0 0;
  color: #4b4437;
  font-size: 13px;
}

.setup-actions,
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th, td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  background: #edf5f3;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 800;
}

.tag.danger { background: #faeeee; color: var(--danger); }
.tag.ok { background: #edf7f0; color: var(--ok); }
.tag.warn { background: #fff6e5; color: #8a5a12; }
.tag.urgent { background: #ffe8e8; color: #8f2424; margin-left: 6px; }

.detail-panel { margin-top: 18px; }
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

dl {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 12px;
  margin: 0;
}

dt { color: var(--muted); font-size: 13px; }
dd { margin: 0; font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }

pre {
  margin: 0;
  white-space: pre-wrap;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--ink);
  background: #f8faf9;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

ol {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 980px) {
  .topbar { align-items: start; flex-direction: column; }
  .portal { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 14px;
    overflow-x: auto;
  }
  .nav-group {
    display: flex;
    gap: 6px;
    align-items: center;
  }
  .nav-group + .nav-group {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }
  .nav-title { display: none; }
  .sidebar a { white-space: nowrap; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-grid, .detail-grid, .wizard-progress { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .summary-grid, .two-col { grid-template-columns: 1fr; }
  .panel-heading { align-items: stretch; flex-direction: column; }
  .records-panel input { max-width: none; }
  .agenda-row { grid-template-columns: 1fr; }
  .agenda-row .tag { justify-self: start; }
  dl { grid-template-columns: 1fr; }
}
