:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #667085;
  --line: #e4e7ec;
  --soft: #f7f8fa;
  --brand: #5b4df5;
  --brand-dark: #4034d8;
  --brand-soft: #efedff;
  --success: #087a5a;
  --success-soft: #e7f8f1;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --warning: #9a6700;
  --warning-soft: #fff7df;
  --shadow: 0 12px 36px rgb(17 24 39 / 8%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #fff; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: #fff; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }

.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; }
.shell { min-height: 100vh; background: var(--soft); }
.topbar { height: 68px; padding: 0 max(20px, calc((100vw - 1180px) / 2)); background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; letter-spacing: -.03em; font-size: 20px; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; color: #fff; font-size: 16px; box-shadow: 0 7px 16px rgb(91 77 245 / 25%); }
.brand-accent { color: var(--brand); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.role-chip { background: var(--brand-soft); color: var(--brand-dark); border-radius: 999px; padding: 7px 11px; font-size: 13px; font-weight: 800; }

.page { width: min(1180px, 100%); margin: 0 auto; padding: 28px 20px 60px; }
.page-head { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-bottom: 22px; }
.page-head h1, .page-head h2 { margin: 0 0 5px; letter-spacing: -.035em; }
.page-head p { margin: 0; color: var(--muted); }
.eyebrow { font-size: 12px; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; color: var(--brand); }
.stack { display: grid; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); gap: 20px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: 0 1px 2px rgb(16 24 40 / 3%); }
.card h2, .card h3 { margin: 0 0 6px; letter-spacing: -.025em; }
.card p { color: var(--muted); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

.btn { min-height: 44px; border: 1px solid transparent; border-radius: 11px; padding: 10px 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; text-decoration: none; transition: .16s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible, input:focus-visible, select:focus-visible, .choice:focus-visible, .slot:focus-visible { outline: 3px solid rgb(91 77 245 / 25%); outline-offset: 2px; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #242c3b; }
.btn-brand { background: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-dark); }
.btn-secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { min-height: 38px; padding: 7px 11px; font-size: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.field { display: grid; gap: 7px; }
.field label, .field-label { font-size: 14px; font-weight: 800; }
.field-hint { color: var(--muted); font-size: 13px; margin-top: -2px; }
input, select { width: 100%; min-height: 46px; border: 1px solid #cfd4dc; border-radius: 10px; padding: 10px 12px; background: #fff; color: var(--ink); }
input[type="date"], input[type="time"] { min-width: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.form-error { color: var(--danger); background: var(--danger-soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; }

.landing { min-height: 100vh; background: linear-gradient(145deg, #fff 0 55%, #f4f2ff 100%); }
.landing .topbar { position: relative; background: transparent; }
.hero { width: min(1080px, 100%); margin: 0 auto; padding: 72px 24px 80px; display: grid; grid-template-columns: 1.25fr .8fr; gap: 70px; align-items: center; }
.hero-copy h1 { font-size: clamp(42px, 6vw, 72px); line-height: .98; letter-spacing: -.062em; margin: 18px 0 22px; max-width: 780px; }
.hero-copy p { font-size: 19px; line-height: 1.55; color: var(--muted); max-width: 680px; }
.benefits { margin: 28px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.benefits li { display: flex; gap: 10px; align-items: center; font-weight: 750; }
.check { width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%; display: grid; place-items: center; background: var(--success-soft); color: var(--success); font-size: 13px; }
.auth-card { padding: 24px; border-radius: 22px; box-shadow: var(--shadow); background: rgb(255 255 255 / 92%); border: 1px solid var(--line); }
.auth-card h2 { margin: 0 0 6px; font-size: 26px; }
.auth-card > p { margin: 0 0 20px; color: var(--muted); }
.role-choices { display: grid; gap: 9px; margin-bottom: 17px; }
.choice { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 12px 13px; text-align: left; display: grid; gap: 3px; }
.choice strong { font-size: 15px; }
.choice span { color: var(--muted); font-size: 13px; }
.choice.selected { border: 2px solid var(--brand); padding: 11px 12px; background: var(--brand-soft); }
.auth-switch { margin: 15px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.auth-switch a, .auth-help a { color: var(--brand-dark); font-weight: 800; text-underline-offset: 3px; }
.auth-help { margin: -5px 0 0; text-align: right; font-size: 14px; }
.auth-page { width: min(460px, 100%); margin: 0 auto; padding: 72px 16px; }
.auth-page .auth-card h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: -.035em; }
.auth-success { display: grid; gap: 13px; text-align: center; }
.auth-success h2, .auth-success p { margin: 0; }
.auth-success .empty-icon { margin-bottom: 0; }
.link-button { padding: 0; border: 0; background: transparent; color: var(--brand-dark); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.inline-link { border: 0; padding: 0; background: transparent; color: inherit; font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
.form-error a { font-weight: 800; }

.notice { padding: 13px 15px; border-radius: 12px; display: flex; gap: 10px; align-items: flex-start; }
.notice-info { background: var(--brand-soft); color: #30268f; }
.notice-warning { background: var(--warning-soft); color: #684700; }
.notice-success { background: var(--success-soft); color: #075f48; }
.empty { text-align: center; padding: 42px 24px; }
.empty-icon { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 16px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 23px; }
.empty h2 { margin: 0 0 8px; }
.empty p { max-width: 480px; margin: 0 auto 18px; }

.tabs { display: flex; gap: 4px; padding: 4px; background: #eaecf0; border-radius: 12px; overflow-x: auto; }
.tab { min-height: 38px; padding: 8px 13px; border: 0; border-radius: 9px; background: transparent; color: #475467; font-weight: 800; white-space: nowrap; }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgb(16 24 40 / 10%); }
.select-team { max-width: 260px; }

.date-tools { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.date-tools .field { min-width: 175px; }
.calendar { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
.calendar-head { display: grid; grid-template-columns: 88px 1fr; background: var(--soft); border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 800; color: var(--muted); }
.calendar-head > div { padding: 11px 13px; }
.slot { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: #fff; display: grid; grid-template-columns: 88px 1fr auto; align-items: center; min-height: 58px; padding: 0; text-align: left; }
.slot:last-child { border-bottom: 0; }
.slot:hover { background: #fafafa; }
.slot-time { padding: 12px 13px; color: var(--muted); font-weight: 700; }
.slot-summary { padding: 12px 13px; font-weight: 900; font-size: 17px; }
.slot-status { margin-right: 13px; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 900; }
.status-ready { background: var(--success-soft); color: var(--success); }
.status-not-ready { background: var(--danger-soft); color: var(--danger); }
.status-unconfirmed { background: var(--warning-soft); color: var(--warning); }
.status-event { background: var(--brand-soft); color: var(--brand-dark); }

.list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.list-row { padding: 13px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; }
.list-row:last-child { border-bottom: 0; }
.list-row strong { display: block; }
.list-row small { color: var(--muted); }
.avatar { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; font-weight: 900; }
.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 850; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-neutral { background: #f2f4f7; color: #475467; }

.summary-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 15px; }
.summary-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.summary-card b { display: block; font-size: 24px; letter-spacing: -.04em; }
.summary-card span { color: var(--muted); font-size: 12px; font-weight: 750; }
.detail-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.detail-group { border-radius: 12px; padding: 12px; }
.detail-group h4 { margin: 0 0 9px; }
.detail-group ul { margin: 0; padding-left: 18px; }
.detail-group li { margin: 5px 0; }
.detail-available { background: var(--success-soft); }
.detail-unavailable { background: var(--danger-soft); }
.detail-unconfirmed { background: var(--warning-soft); }

.availability-legend { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin: 10px 0 14px; }
.legend-dot { width: 10px; height: 10px; display: inline-block; border-radius: 50%; margin-right: 5px; }
.availability-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.availability-cell { min-height: 58px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 8px; display: grid; place-items: center; gap: 2px; }
.availability-cell span { font-size: 12px; font-weight: 800; }
.availability-cell small { color: var(--muted); }
.availability-cell.available { background: var(--success-soft); border-color: #a9e4cf; color: var(--success); }
.availability-cell.unavailable { background: var(--danger-soft); border-color: #ffc7c2; color: var(--danger); }
.availability-cell.default { background: #fff; }
.availability-cell:disabled { cursor: wait; opacity: .6; }

.metric { border: 1px solid var(--line); border-radius: 14px; padding: 15px; }
.metric b { font-size: 27px; display: block; letter-spacing: -.04em; }
.metric span { color: var(--muted); font-size: 13px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 20px; letter-spacing: .08em; background: var(--soft); border-radius: 10px; padding: 10px 12px; text-align: center; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

.modal-backdrop { position: fixed; inset: 0; z-index: 60; padding: 20px; background: rgb(15 23 42 / 55%); display: grid; place-items: center; }
.modal { width: min(560px, 100%); max-height: min(820px, calc(100vh - 40px)); overflow: auto; background: #fff; border-radius: 20px; padding: 22px; box-shadow: 0 24px 70px rgb(0 0 0 / 25%); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.modal-head h2 { margin: 0 0 5px; }
.modal-head p { margin: 0; color: var(--muted); }
.icon-btn { width: 42px; height: 42px; flex: 0 0 42px; border: 1px solid var(--line); border-radius: 11px; background: #fff; font-size: 20px; }

.toast-region { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; gap: 8px; width: min(380px, calc(100vw - 36px)); }
.toast { background: var(--ink); color: #fff; border-radius: 12px; padding: 13px 15px; box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
.toast.error { background: #8e1b12; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.spinner { width: 34px; height: 34px; border: 3px solid #e7e5ff; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 840px) {
  .hero { grid-template-columns: 1fr; padding-top: 42px; gap: 34px; }
  .hero-copy h1 { font-size: clamp(40px, 11vw, 62px); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .detail-columns { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .topbar { height: 62px; padding: 0 16px; }
  .role-chip { display: none; }
  .page { padding: 20px 14px 40px; }
  .page-head { align-items: stretch; flex-direction: column; }
  .page-head .btn { width: 100%; }
  .page-head .top-actions { width: 100%; }
  .card { padding: 16px; border-radius: 15px; }
  .hero { padding: 34px 16px 48px; }
  .hero-copy h1 { margin-top: 12px; }
  .hero-copy p { font-size: 17px; }
  .form-row { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .tabs { margin-inline: -2px; }
  .select-team { max-width: none; }
  .date-tools { align-items: stretch; }
  .date-tools .field, .date-tools .btn { width: 100%; }
  .calendar-head { grid-template-columns: 72px 1fr; }
  .slot { grid-template-columns: 72px 1fr; min-height: 64px; }
  .slot-time { padding: 10px; font-size: 13px; }
  .slot-summary { padding: 10px; font-size: 16px; }
  .slot-status { grid-column: 2; margin: -7px 10px 9px; justify-self: start; }
  .availability-grid { grid-template-columns: repeat(3, 1fr); }
  .summary-cards { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}
