:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #667085;
  --line: #e6e9ef;
  --panel: #ffffff;
  --canvas: #f5f7fb;
  --brand: #2563eb;
  --brand-dark: #183db7;
  --green: #079455;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--canvas); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
.hidden { display: none !important; }
.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); line-height: 1.6; }
.eyebrow { margin: 0 0 8px; color: #475467; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 800; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; color: white; background: linear-gradient(145deg, #4f7cff, #193cba); box-shadow: 0 12px 28px rgba(37, 99, 235, .3); font-size: 24px; font-weight: 900; }
.brand-mark.small { width: 36px; height: 36px; border-radius: 11px; font-size: 17px; }

.centered { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.auth-card { width: min(500px, 100%); padding: 40px; border: 1px solid var(--line); border-radius: 24px; background: white; box-shadow: 0 24px 60px rgba(16, 24, 40, .08); }
.auth-card .brand-mark { margin-bottom: 32px; }
.auth-card h1 { margin: 0; font-size: 30px; letter-spacing: -.04em; }
.auth-card code { padding: 2px 5px; border-radius: 5px; background: #eef2f8; }
.auth-layout { display: grid; min-height: 100vh; grid-template-columns: minmax(0, 1.15fr) minmax(400px, .85fr); background: white; }
.auth-hero { display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; padding: clamp(36px, 6vw, 80px); color: white; background: radial-gradient(circle at 88% 12%, rgba(98, 148, 255, .9), transparent 32%), radial-gradient(circle at 18% 80%, rgba(64, 224, 181, .23), transparent 27%), linear-gradient(145deg, #101d45, #142e78 58%, #2458d9); }
.auth-hero .brand-mark { background: white; color: #2458d9; box-shadow: none; }
.auth-hero h1 { max-width: 700px; margin: 0; font-size: clamp(48px, 6vw, 78px); line-height: .98; letter-spacing: -.065em; }
.auth-hero p:not(.eyebrow) { max-width: 610px; margin: 26px 0 0; color: #d6e1ff; font-size: 19px; line-height: 1.65; }
.auth-hero .eyebrow { color: #a9c3ff; }
.trust-row { display: flex; flex-wrap: wrap; gap: 26px; color: #c9d8ff; font-size: 13px; font-weight: 650; }
.trust-row span::before { content: "✓"; margin-right: 8px; color: #78ebc1; }
.auth-panel { display: grid; place-items: center; padding: 48px; }
.auth-form { width: min(390px, 100%); }
.auth-form h2 { margin: 0; font-size: 32px; letter-spacing: -.045em; }
.oauth-button { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 52px; margin-top: 14px; border: 1px solid #d0d5dd; border-radius: 12px; color: #344054; background: white; font-weight: 750; }
.oauth-button:hover { border-color: #98a2b3; background: #f9fafb; }
.oauth-button.dark { color: white; border-color: var(--ink); background: var(--ink); }
.oauth-g { color: #2563eb; font-size: 18px; font-weight: 900; }
.legal { margin-top: 24px; color: #98a2b3; font-size: 12px; line-height: 1.5; text-align: center; }

.workspace { display: grid; min-height: 100vh; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 24px 18px; color: #cdd5e5; background: #111827; z-index: 20; }
.sidebar .brand { padding: 0 8px 28px; color: white; }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 13px; min-height: 44px; padding: 0 13px; color: #aeb9cd; border: 0; border-radius: 9px; background: transparent; font-weight: 650; text-align: left; }
.nav-item span { width: 20px; color: #73829b; font-size: 19px; text-align: center; }
.nav-item:hover { color: white; background: #1f2937; }
.nav-item.active { color: white; background: #26344b; }
.nav-item.active span { color: #78a1ff; }
.sidebar-bottom { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 14px 9px 0; border-top: 1px solid #273449; color: #8794a9; font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #32d583; box-shadow: 0 0 0 4px rgba(50, 213, 131, .12); }
.main-column { min-width: 0; }
.topbar { position: sticky; top: 0; display: flex; align-items: center; min-height: 80px; padding: 13px clamp(20px, 4vw, 48px); border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .92); backdrop-filter: blur(14px); z-index: 10; }
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: -.035em; }
.topbar .eyebrow { margin-bottom: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.application-picker select, #analytics-days { min-height: 42px; max-width: 210px; padding: 0 35px 0 13px; border: 1px solid #d8dde6; border-radius: 10px; color: #344054; background: white; font-weight: 650; }
.user-chip { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 4px 10px 4px 5px; border: 0; border-radius: 11px; background: transparent; text-align: left; }
.user-chip:hover { background: #f2f4f7; }
.user-chip > span:first-child, .mini-avatar { display: grid; flex: 0 0 auto; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: #2948a9; background: #e6edff; font-size: 12px; font-weight: 850; }
.user-chip > span:last-child { display: grid; }
.user-chip strong { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.user-chip small { max-width: 170px; overflow: hidden; color: #98a2b3; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 10px; color: #475467; background: white; font-size: 18px; }
.menu-button { display: none; margin-right: 12px; }
.content { width: min(1500px, 100%); margin: 0 auto; padding: clamp(22px, 4vw, 48px); }

.loading-card, .onboarding-card { display: grid; place-items: center; min-height: 450px; text-align: center; }
.spinner { width: 32px; height: 32px; border: 3px solid #dce4f5; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.onboarding-card { width: min(590px, 100%); min-height: 0; margin: 7vh auto; padding: clamp(28px, 5vw, 54px); border: 1px solid var(--line); border-radius: 24px; background: white; box-shadow: 0 18px 45px rgba(16, 24, 40, .06); }
.onboarding-card h2 { margin: 0; font-size: 32px; letter-spacing: -.045em; }
.step-number { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 20px; border-radius: 14px; color: white; background: var(--brand); font-size: 18px; font-weight: 850; }
.stack-form { display: grid; width: 100%; gap: 16px; margin-top: 16px; text-align: left; }
label { display: grid; gap: 7px; color: #344054; font-size: 13px; font-weight: 700; }
input, textarea, select { outline: none; }
input, textarea, .form-grid select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #d0d5dd; border-radius: 9px; color: var(--ink); background: white; }
input:focus, textarea:focus, select:focus, button:focus-visible { border-color: #84adff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .13); }
textarea { min-height: 90px; resize: vertical; }
.primary-button, .secondary-button { min-height: 44px; padding: 0 17px; border-radius: 9px; font-weight: 750; }
.primary-button { color: white; border: 1px solid var(--brand); background: var(--brand); box-shadow: 0 4px 10px rgba(37, 99, 235, .2); }
.primary-button:hover { background: var(--brand-dark); }
.secondary-button { color: #344054; border: 1px solid #d0d5dd; background: white; }

.welcome-strip, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.welcome-strip { padding: 26px 30px; border: 1px solid #dbe4fb; border-radius: 18px; background: linear-gradient(105deg, white, #eff4ff); }
.welcome-strip h2, .section-heading h2 { margin: 0 0 4px; font-size: 27px; letter-spacing: -.045em; }
.welcome-strip p:last-child { margin: 6px 0 0; color: var(--muted); }
.section-heading .muted { margin: 5px 0 0; }
.application-detail { display: grid; gap: 0; margin-bottom: 20px; overflow: hidden; border: 1px solid #cbd8f7; border-radius: 17px; background: white; box-shadow: 0 12px 32px rgba(37, 99, 235, .07); }
.application-detail-heading { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 19px 21px; }
.application-detail-heading h3 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.application-detail-heading p:last-child { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.enrollment-code-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 19px 21px; border-top: 1px solid #dce5f8; background: #f7f9ff; }
.enrollment-code-panel code { display: block; margin: 3px 0 5px; color: #193c96; font-size: clamp(20px, 3vw, 27px); font-weight: 850; letter-spacing: .07em; overflow-wrap: anywhere; }
.enrollment-code-panel small { color: var(--muted); }
.code-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.metric-card { position: relative; min-height: 142px; padding: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: white; }
.metric-card::after { content: ""; position: absolute; right: -20px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--accent-soft); }
.metric-card p { margin: 0 0 13px; color: var(--muted); font-size: 13px; font-weight: 650; }
.metric-card strong { display: block; font-size: 30px; letter-spacing: -.05em; }
.metric-card > span { display: block; margin-top: 10px; color: #98a2b3; font-size: 12px; }
.metric-card.blue { --accent-soft: #e8efff; } .metric-card.green { --accent-soft: #e1f7ed; } .metric-card.purple { --accent-soft: #f0eaff; } .metric-card.amber { --accent-soft: #fff3da; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr); gap: 18px; }
.panel { padding: 22px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 22px; }
.panel-heading h3 { margin: 0; font-size: 17px; }
.period-badge { padding: 6px 9px; border-radius: 7px; color: #475467; background: #f2f4f7; font-size: 11px; font-weight: 700; }
.bar-chart { display: flex; align-items: end; gap: clamp(3px, .55vw, 8px); height: 220px; padding-top: 22px; overflow: hidden; }
.bar-chart.large { height: 330px; }
.bar-column { display: flex; flex: 1 1 0; flex-direction: column; align-items: center; justify-content: end; height: 100%; min-width: 4px; gap: 7px; }
.bar-column > span { color: #98a2b3; font-size: 9px; transform: rotate(-40deg); transform-origin: center; white-space: nowrap; }
.bar-total { position: relative; flex: 0 0 var(--bar-height, 5%); width: 70%; min-width: 4px; overflow: hidden; border-radius: 4px 4px 2px 2px; background: #dce5f8; }
.bar-answered { position: absolute; right: 0; bottom: 0; left: 0; height: var(--bar-height, 0%); background: linear-gradient(#5b83ec, #2457d6); }
.height-0 { --bar-height: 0%; } .height-5 { --bar-height: 5%; } .height-10 { --bar-height: 10%; } .height-15 { --bar-height: 15%; } .height-20 { --bar-height: 20%; }
.height-25 { --bar-height: 25%; } .height-30 { --bar-height: 30%; } .height-35 { --bar-height: 35%; } .height-40 { --bar-height: 40%; } .height-45 { --bar-height: 45%; }
.height-50 { --bar-height: 50%; } .height-55 { --bar-height: 55%; } .height-60 { --bar-height: 60%; } .height-65 { --bar-height: 65%; } .height-70 { --bar-height: 70%; }
.height-75 { --bar-height: 75%; } .height-80 { --bar-height: 80%; } .height-85 { --bar-height: 85%; } .height-90 { --bar-height: 90%; } .height-95 { --bar-height: 95%; } .height-100 { --bar-height: 100%; }
.chart-empty, .compact-empty { display: grid; width: 100%; height: 100%; place-items: center; color: #98a2b3; font-size: 13px; }
.leaderboard { display: grid; }
.leader-row { display: grid; grid-template-columns: 24px 38px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 13px 0; border-bottom: 1px solid #eef0f4; }
.leader-row:last-child { border: 0; }
.leader-row .rank { color: #98a2b3; font-size: 12px; font-weight: 800; }
.leader-row div { display: grid; }
.leader-row strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.leader-row small { color: #98a2b3; font-size: 11px; }
.leader-row b { color: #475467; font-size: 12px; }

.application-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.application-card { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto 20px; align-items: center; gap: 14px; min-height: 92px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: white; text-align: left; }
.application-card:hover, .application-card.selected { border-color: #9db9ff; box-shadow: 0 7px 20px rgba(37, 99, 235, .08); }
.app-logo { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 13px; color: white; background: #2563eb; font-weight: 850; }
.app-logo.tone-0 { background: #2563eb; } .app-logo.tone-1 { background: #6941c6; } .app-logo.tone-2 { background: #087e8b; }
.app-logo.tone-3 { background: #b54708; } .app-logo.tone-4 { background: #c11574; } .app-logo.tone-5 { background: #344054; }
.application-card > span:nth-child(2) { display: grid; min-width: 0; }
.application-card strong, .application-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.application-card small { margin-top: 3px; color: var(--muted); }
.app-stats { color: #667085; font-size: 12px; white-space: nowrap; }
.app-stats b { color: var(--ink); }
.chevron { color: #98a2b3; font-size: 25px; }
.tabs { display: flex; gap: 20px; margin-bottom: 0; padding: 0 14px; border-bottom: 1px solid var(--line); }
.tabs button { padding: 11px 2px; border: 0; border-bottom: 2px solid transparent; color: #98a2b3; background: transparent; font-size: 13px; font-weight: 750; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.table-shell { overflow-x: auto; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 14px 14px; background: white; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 16px; color: #667085; background: #f9fafb; font-size: 11px; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
td { padding: 14px 16px; border-top: 1px solid #eef0f4; color: #475467; font-size: 13px; }
td > small { display: block; margin-top: 3px; color: #98a2b3; }
.person { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.person > span:last-child { display: grid; }
.person strong { color: var(--ink); }
.person small { color: var(--muted); }
.presence, .request-status { display: inline-flex; padding: 5px 8px; border-radius: 999px; background: #f2f4f7; font-size: 11px; font-weight: 750; text-transform: capitalize; }
.presence.available, .request-status.approved { color: #067647; background: #ecfdf3; }
.presence.busy, .request-status.rejected { color: #b42318; background: #fef3f2; }
.request-status.pending { color: #b54708; background: #fffaeb; }
.row-actions { display: flex; justify-content: end; gap: 7px; }
.row-actions button { min-height: 34px; padding: 0 10px; border: 1px solid #d0d5dd; border-radius: 7px; color: #475467; background: white; font-size: 12px; font-weight: 750; }
.row-actions button.approve { color: white; border-color: var(--brand); background: var(--brand); }
.empty-state { display: grid; min-height: 280px; place-items: center; align-content: center; padding: 30px; color: var(--muted); text-align: center; }
.empty-state.wide { grid-column: 1 / -1; border: 1px dashed #cfd6e1; border-radius: 16px; background: rgba(255,255,255,.55); }
.empty-state h3 { margin: 12px 0 0; color: var(--ink); }
.empty-state p { max-width: 480px; margin: 7px auto 18px; }
.recording-icon { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; color: #6941c6; background: #f0eaff; font-size: 26px; }

dialog { width: min(640px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 20px; box-shadow: 0 28px 80px rgba(16, 24, 40, .24); }
dialog::backdrop { background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px); }
.dialog-heading, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 22px 26px; }
.dialog-heading { border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: 0; font-size: 22px; }
.dialog-actions { justify-content: flex-end; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; padding: 24px 26px; }
.form-grid .wide { grid-column: 1 / -1; }
input[type="color"] { padding: 4px; }
.code-result { display: grid; place-items: center; padding: 40px; text-align: center; }
.success-mark { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 20px; border-radius: 50%; color: white; background: var(--green); font-size: 26px; }
.code-result h2 { margin: 0; }
.code-result code { margin: 10px 0 24px; padding: 15px 20px; border: 1px dashed #9db9ff; border-radius: 10px; color: #193c96; background: #eff4ff; font-size: clamp(18px, 4vw, 26px); font-weight: 800; letter-spacing: .08em; }
.code-result button { width: min(280px, 100%); margin-top: 9px; }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: min(390px, calc(100% - 44px)); padding: 13px 17px; border-radius: 10px; color: white; background: #344054; box-shadow: 0 12px 30px rgba(16, 24, 40, .22); opacity: 0; transform: translateY(12px); transition: .2s ease; pointer-events: none; z-index: 100; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast[data-kind="error"] { background: #b42318; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .application-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-hero { min-height: 47vh; padding: 35px 28px; }
  .auth-hero h1 { font-size: clamp(40px, 11vw, 58px); }
  .trust-row { display: none; }
  .auth-panel { padding: 40px 24px 60px; }
  .workspace { display: block; }
  .sidebar { position: fixed; left: -260px; width: 248px; transition: left .2s ease; box-shadow: 10px 0 30px rgba(16, 24, 40, .22); }
  .sidebar.open { left: 0; }
  .menu-button { display: grid; }
  .user-chip span:last-child, #signout { display: none; }
  .topbar { padding: 12px 18px; }
  .content { padding: 24px 18px; }
}

@media (max-width: 560px) {
  .topbar .application-picker { display: none; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 125px; }
  .welcome-strip, .section-heading { align-items: flex-start; flex-direction: column; }
  .welcome-strip .primary-button, .section-heading .primary-button { width: 100%; }
  .application-card { grid-template-columns: 44px minmax(0, 1fr) 18px; }
  .application-card .app-stats { grid-column: 2 / 3; }
  .application-card .chevron { grid-column: 3; grid-row: 1 / 3; }
  .app-logo { width: 44px; height: 44px; }
  .form-grid { grid-template-columns: 1fr; padding: 20px; }
  .form-grid .wide { grid-column: auto; }
  .dialog-heading, .dialog-actions { padding: 18px 20px; }
  .dialog-actions button { flex: 1; }
  .auth-card { padding: 28px; }
  .application-detail-heading { grid-template-columns: auto minmax(0, 1fr); }
  .application-detail-heading > button, .application-detail-heading > .period-badge { grid-column: 1 / -1; width: 100%; }
  .enrollment-code-panel { align-items: stretch; flex-direction: column; }
  .code-actions { display: grid; grid-template-columns: 1fr; }
}
