:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-soft: #f4f1e9;
  --surface-elevated: rgba(255,255,255,.96);
  --ink: #0a0a0b;
  --muted: #62636a;
  --line: #dedbd2;
  --gold: #a97920;
  --gold-bright: #cfa453;
  --gold-soft: #f4ead3;
  --success: #1f6f46;
  --danger: #9d2e2e;
  --warning: #7b5614;
  --panel-border: rgba(10,10,11,.08);
  --input-bg: #ffffff;
  --input-border: #cbc7bd;
  --shadow: 0 22px 60px rgba(25,22,15,.11);
  --topbar: rgba(251,250,247,.92);
  --primary-bg: #0a0a0b;
  --primary-text: #ffffff;
  --max: 1180px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Segoe UI", sans-serif;
  color-scheme: light;
}

body[data-theme="dark"] {
  --bg: #0f0d09;
  --surface: #17130e;
  --surface-soft: #211a12;
  --surface-elevated: rgba(22,18,13,.96);
  --ink: #f8f3e7;
  --muted: #c6beaf;
  --line: rgba(229,195,122,.20);
  --gold: #d6af61;
  --gold-bright: #e8c97f;
  --gold-soft: rgba(214,175,97,.15);
  --success: #71c99a;
  --danger: #ff9d9d;
  --warning: #f0d08c;
  --panel-border: rgba(229,195,122,.23);
  --input-bg: rgba(24,19,14,.94);
  --input-border: rgba(229,195,122,.25);
  --shadow: 0 28px 70px rgba(0,0,0,.38);
  --topbar: linear-gradient(180deg, rgba(31,24,18,.95), rgba(18,14,10,.91));
  --primary-bg: linear-gradient(180deg, #e5c273, #b88a38);
  --primary-text: #171109;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 10%, color-mix(in srgb, var(--gold-bright) 17%, transparent), transparent 25%),
    radial-gradient(circle at 83% 8%, rgba(255,255,255,.04), transparent 28%),
    radial-gradient(circle at 74% 75%, color-mix(in srgb, var(--gold) 10%, transparent), transparent 28%),
    var(--bg);
}

.fatal-banner { padding: 20px; background: #8b1f1f; color: white; text-align: center; }

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: calc(28px + env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom));
}

.auth-card {
  width: min(100%, 520px);
  background: var(--surface-elevated);
  border: 1px solid var(--panel-border);
  border-radius: 34px;
  box-shadow: var(--shadow);
  padding: clamp(28px, 6vw, 52px);
}

.brand-lockup { text-align: center; margin-bottom: 36px; }
.brand-mark { width: 112px; height: 112px; color: var(--ink); display: block; margin: 0 auto 14px; }
.brand-name { font-size: 16px; font-weight: 800; letter-spacing: .22em; }
.brand-tag { margin-top: 7px; color: var(--gold); font-size: 12px; font-weight: 850; letter-spacing: .16em; }
.auth-copy { margin-bottom: 26px; text-align: center; }
.auth-copy h1 { margin: 7px 0 12px; font-size: clamp(34px, 7vw, 48px); line-height: 1; letter-spacing: -.045em; }
.auth-copy p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 17px; }
.eyebrow { color: var(--gold); font-size: 12px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }

.stack { display: grid; gap: 17px; }
.field label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 800; }
input, textarea, select {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--input-border);
  border-radius: 15px;
  background: var(--input-bg);
  color: var(--ink);
  padding: 14px 15px;
  font-size: 17px;
}
textarea { min-height: 112px; resize: vertical; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  outline: 4px solid color-mix(in srgb, var(--gold-bright) 30%, transparent);
  outline-offset: 2px;
}
.password-wrap { position: relative; }
.password-wrap input { padding-right: 78px; }
.password-wrap .icon-button { position: absolute; top: 7px; right: 7px; }

.primary-button, .secondary-button, .ghost-button, .icon-button {
  border-radius: 15px;
  min-height: 50px;
  padding: 12px 18px;
  font-weight: 820;
  border: 1px solid transparent;
}
.primary-button { background: var(--primary-bg); color: var(--primary-text); box-shadow: 0 13px 28px rgba(0,0,0,.18); display: inline-flex; gap: 12px; align-items: center; justify-content: center; }
.primary-button:hover { transform: translateY(-1px); }
.primary-button:disabled { opacity: .58; cursor: not-allowed; transform: none; }
.secondary-button, .ghost-button, .icon-button { background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--ink); border-color: var(--line); }
.full { width: 100%; }
.compact { min-height: 42px; padding: 9px 13px; border-radius: 12px; }
.icon-button { min-height: 40px; padding: 7px 12px; border-radius: 11px; font-size: 14px; }
.security-note { margin: 24px 0 0; color: var(--muted); text-align: center; font-size: 13px; line-height: 1.45; }

.notice { border: 1px solid var(--line); background: var(--surface-soft); border-radius: 16px; padding: 15px 17px; line-height: 1.5; margin-bottom: 20px; }
.notice.warning { color: var(--warning); border-color: color-mix(in srgb, var(--gold) 32%, var(--line)); }
.notice.error { color: var(--danger); }
.notice.success { color: var(--success); }
.notice code { font-size: .92em; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: calc(12px + env(safe-area-inset-top)) 22px 12px;
  background: var(--topbar);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(22px);
}
.topbar-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mini-mark { width: 50px; height: 50px; color: var(--ink); flex: 0 0 auto; }
.topbar-title { font-size: 16px; font-weight: 850; }
.topbar-subtitle { color: var(--muted); font-size: 12px; margin-top: 2px; }
.topbar-actions { display: flex; gap: 9px; }
.ghost-button { border-radius: 999px; min-height: 43px; padding: 9px 14px; }

.dashboard-main { width: min(100%, var(--max)); margin: 0 auto; padding: 36px 22px 72px; }
.dashboard-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.dashboard-heading h2 { margin: 7px 0 8px; font-size: clamp(34px, 5vw, 52px); letter-spacing: -.045em; line-height: 1; }
.muted { color: var(--muted); margin: 0; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--surface-elevated); border: 1px solid var(--panel-border); border-radius: 22px; padding: 20px; box-shadow: 0 14px 34px rgba(0,0,0,.07); }
.stat-card span { color: var(--muted); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
.stat-card strong { display: block; font-size: 38px; margin: 11px 0 2px; letter-spacing: -.04em; }
.stat-card small { color: var(--muted); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(280px,.8fr); gap: 20px; align-items: start; }
.panel { background: var(--surface-elevated); border: 1px solid var(--panel-border); border-radius: 28px; box-shadow: var(--shadow); overflow: hidden; }
.panel-header-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 24px 25px 20px; border-bottom: 1px solid var(--line); }
.panel h3 { margin: 6px 0 0; font-size: 25px; letter-spacing: -.03em; }

.loading-state, .empty-state { padding: 48px 26px; text-align: center; color: var(--muted); }
.empty-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 18px; background: var(--gold-soft); color: var(--gold); margin: 0 auto 15px; font-size: 30px; font-weight: 600; }
.empty-state h4 { color: var(--ink); font-size: 20px; margin: 0 0 8px; }
.empty-state p { max-width: 440px; margin: 0 auto; line-height: 1.5; }

.appointment-list { display: grid; }
.appointment-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.appointment-row:last-child { border-bottom: 0; }
.appointment-name { font-weight: 840; font-size: 18px; }
.appointment-service { color: var(--muted); margin-top: 6px; line-height: 1.45; }
.appointment-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 11px; color: var(--muted); font-size: 13px; }
.appointment-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.status-pill { align-self: flex-end; border: 1px solid var(--line); background: var(--surface-soft); border-radius: 999px; padding: 7px 10px; color: var(--gold); font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.archive-button { min-height: 40px; border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--line)); border-radius: 12px; padding: 8px 13px; background: transparent; color: var(--danger); font-weight: 800; }
.archive-button:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.archive-button:focus-visible, .danger-button:focus-visible { outline: 4px solid color-mix(in srgb, var(--danger) 28%, transparent); outline-offset: 2px; }

.security-panel { padding: 25px; }
.security-list { list-style: none; padding: 0; margin: 23px 0; display: grid; gap: 14px; }
.security-list li { display: grid; grid-template-columns: 25px 1fr; gap: 10px; align-items: start; line-height: 1.45; }
.check { color: var(--success); font-weight: 900; }
.pending { color: var(--gold); font-size: 22px; line-height: 17px; }
.session-card { display: flex; justify-content: space-between; gap: 10px; border: 1px solid var(--line); background: var(--surface-soft); border-radius: 16px; padding: 15px; }
.session-card span { color: var(--muted); }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.62); backdrop-filter: blur(9px); display: grid; place-items: center; padding: 18px; }
.modal { width: min(100%, 900px); max-height: calc(100vh - 36px); overflow: auto; background: var(--surface); border: 1px solid var(--panel-border); border-radius: 28px; box-shadow: 0 30px 90px rgba(0,0,0,.45); }
.modal-header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding: 24px 25px 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.modal-header h2 { margin: 7px 0 0; font-size: 34px; letter-spacing: -.04em; }
.modal-body { padding: 24px 25px 28px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 17px; }
.field.full { grid-column: 1/-1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 26px; }
.archive-modal { width: min(100%, 580px); }
.archive-explanation { color: var(--muted); line-height: 1.6; margin: 0 0 20px; }
.archive-summary { display: grid; gap: 7px; padding: 18px; border: 1px solid var(--line); background: var(--surface-soft); border-radius: 18px; }
.archive-summary span { color: var(--muted); font-size: 12px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.archive-summary strong { font-size: 20px; }
.archive-summary small { color: var(--muted); font-size: 15px; line-height: 1.45; }
.danger-button { min-height: 50px; border: 1px solid color-mix(in srgb, var(--danger) 58%, var(--line)); border-radius: 14px; padding: 12px 18px; background: var(--danger); color: #fff; font-weight: 850; }
.danger-button:hover { filter: brightness(.94); }
.danger-button:disabled { opacity: .6; cursor: wait; }

.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 100; transform: translate(-50%, 18px); opacity: 0; pointer-events: none; background: #0a0a0b; color: #fff; padding: 13px 17px; border-radius: 999px; font-weight: 760; box-shadow: 0 16px 36px rgba(0,0,0,.28); transition: .2s ease; max-width: calc(100vw - 34px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%,0); }

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

@media (max-width: 620px) {
  .topbar { align-items: flex-start; padding-left: 14px; padding-right: 14px; }
  .topbar-subtitle { display: none; }
  .topbar-actions { flex-direction: column; }
  .ghost-button { min-height: 38px; padding: 7px 11px; font-size: 13px; }
  .dashboard-main { padding: 25px 13px 54px; }
  .dashboard-heading { align-items: stretch; flex-direction: column; }
  .dashboard-heading .primary-button { width: 100%; }
  .stats-grid { gap: 10px; }
  .stat-card { padding: 16px; border-radius: 18px; }
  .stat-card strong { font-size: 32px; }
  .appointment-row { grid-template-columns: 1fr; }
  .appointment-actions { align-items: flex-start; flex-direction: row; justify-content: space-between; }
  .status-pill { align-self: center; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { max-height: 94vh; border-radius: 28px 28px 0 0; }
  .modal-header, .modal-body { padding-left: 18px; padding-right: 18px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* --------------------------------------------------------------------------
   Production customer-flow milestone 1
   -------------------------------------------------------------------------- */
.workspace-main { width: min(100%, var(--max)); margin: 0 auto; padding: 34px 22px 72px; }
.workspace-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.workspace-heading h2 { margin: 7px 0 8px; font-size: clamp(34px, 5vw, 50px); letter-spacing: -.045em; line-height: 1; }
.workspace-heading-actions { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; justify-content: flex-end; }
.workspace-grid { display: grid; grid-template-columns: minmax(300px,.8fr) minmax(0,1.35fr); gap: 20px; align-items: start; }
.overview-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; padding: 22px 24px 26px; }
.overview-item { min-height: 92px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface-soft); padding: 16px; }
.overview-item.wide { grid-column: 1/-1; }
.overview-item span { display: block; color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; margin-bottom: 8px; }
.overview-item strong { display: block; font-size: 17px; line-height: 1.45; overflow-wrap: anywhere; }
.preparation-form { padding: 23px 25px 28px; }
.workspace-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.optional-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.field-help { display: block; margin-top: 7px; color: var(--muted); line-height: 1.4; }
.open-appointment-button { white-space: nowrap; }

.customer-experience-view { min-height: 100vh; }
.customer-toolbar { position: sticky; top: 0; z-index: 30; display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: calc(11px + env(safe-area-inset-top)) 18px 11px; background: var(--topbar); border-bottom: 1px solid var(--line); backdrop-filter: blur(22px); }
.customer-mode-label { display: inline-flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--gold-bright); font-size: 12px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; background: var(--gold-soft); }
.mode-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold-bright); box-shadow: 0 0 0 4px color-mix(in srgb,var(--gold-bright) 15%,transparent); }
.customer-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.customer-main { width: min(100%, 1020px); margin: 0 auto; padding: 28px 18px calc(50px + env(safe-area-inset-bottom)); }
.customer-screen { min-height: calc(100vh - 115px); display: grid; align-content: center; }
.customer-card { width: 100%; background: var(--surface-elevated); border: 1px solid var(--panel-border); border-radius: 34px; box-shadow: var(--shadow); padding: clamp(28px,5vw,58px); }
.centered-card { text-align: center; }
.customer-brand-lockup { text-align: center; margin-bottom: 26px; }
.customer-brand-lockup.compact-brand { margin-bottom: 19px; }
.customer-brand-mark { width: 110px; height: 110px; color: var(--ink); display: block; margin: 0 auto 13px; }
.customer-brand-name { font-size: 15px; font-weight: 820; letter-spacing: .24em; color: var(--gold-bright); }
.customer-card h1 { margin: 28px auto 17px; max-width: 800px; font-size: clamp(42px,7vw,68px); line-height: .98; letter-spacing: -.05em; }
.customer-card h2 { text-align: center; margin: 6px auto 13px; max-width: 850px; font-size: clamp(34px,5vw,50px); line-height: 1.02; letter-spacing: -.045em; }
.customer-message, .customer-intro { max-width: 760px; margin: 0 auto; color: var(--muted); font-size: 20px; line-height: 1.58; text-align: center; }
.customer-promise { display: inline-flex; align-items: center; gap: 10px; margin: 30px auto 0; padding: 13px 18px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-bright); font-weight: 820; }
.customer-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 34px; }
.customer-primary { min-width: 245px; font-size: 18px; }
.split-actions { justify-content: space-between; }
.customer-progress { width: 100%; margin: 22px auto 0; }
.customer-progress-labels { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 750; margin-bottom: 9px; }
.customer-progress-labels .active { color: var(--gold-bright); }
.progress-track { height: 6px; border-radius: 99px; background: color-mix(in srgb,var(--line) 75%,transparent); overflow: hidden; }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg,#a97920,#e8c97f); box-shadow: 0 0 18px color-mix(in srgb,var(--gold-bright) 20%,transparent); }
.customer-info-grid, .pricing-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; margin-top: 28px; }
.customer-info-item, .pricing-item { min-height: 102px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-soft); padding: 17px; }
.customer-info-item.wide, .pricing-item.wide { grid-column: 1/-1; }
.customer-info-item span, .pricing-item span, .summary-label { display: block; color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; margin-bottom: 8px; }
.customer-info-item strong, .pricing-item strong { display: block; font-size: 20px; line-height: 1.35; overflow-wrap: anywhere; }
.customer-notice { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; margin-top: 20px; padding: 17px; border-radius: 17px; background: var(--surface-soft); border: 1px solid var(--line); }
.customer-notice > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--primary-bg); color: var(--primary-text); font-weight: 900; }
.customer-notice p { margin: 1px 0 0; line-height: 1.5; color: var(--muted); }
.service-summary-card { margin-top: 27px; padding: 22px; border: 1px solid var(--panel-border); border-radius: 20px; background: var(--gold-soft); }
.service-summary-card strong { display: block; font-size: 24px; line-height: 1.35; }
.service-summary-card p { margin: 12px 0 0; color: var(--muted); line-height: 1.45; }
.expectation-list { display: grid; gap: 12px; margin: 23px 0; }
.expectation-list > div { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; padding: 14px 15px; border: 1px solid var(--line); border-radius: 15px; line-height: 1.5; color: var(--muted); }
.customer-check { display: grid; grid-template-columns: 30px 1fr; align-items: start; gap: 12px; margin-top: 13px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-soft); font-size: 17px; line-height: 1.45; }
.customer-check input { width: 25px; height: 25px; min-height: 0; margin: 0; accent-color: var(--gold); }
.customer-warning { margin-top: 14px; padding: 13px 15px; border-radius: 14px; color: var(--danger); border: 1px solid color-mix(in srgb,var(--danger) 38%,var(--line)); background: color-mix(in srgb,var(--danger) 7%,transparent); }
.stage-complete-card { max-width: 760px; margin: 0 auto; }
.stage-check { width: 82px; height: 82px; display: grid; place-items: center; margin: 0 auto 24px; border-radius: 50%; background: color-mix(in srgb,var(--success) 16%,var(--surface)); color: var(--success); font-size: 38px; font-weight: 900; }
.unlock-modal { width: min(100%,540px); }
.large-customer-text .customer-message, .large-customer-text .customer-intro { font-size: 26px; }
.large-customer-text .customer-info-item strong, .large-customer-text .pricing-item strong { font-size: 25px; }
.large-customer-text .customer-check { font-size: 21px; }

@media (max-width: 900px) {
  .workspace-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
  .workspace-main { padding: 24px 13px 55px; }
  .workspace-heading { align-items: stretch; flex-direction: column; }
  .workspace-heading-actions { justify-content: flex-start; }
  .overview-grid, .customer-info-grid, .pricing-grid { grid-template-columns: 1fr; }
  .overview-item.wide, .customer-info-item.wide, .pricing-item.wide { grid-column: auto; }
  .workspace-actions { flex-direction: column; }
  .workspace-actions button { width: 100%; }
  .customer-toolbar { align-items: flex-start; }
  .customer-toolbar-actions { max-width: 65%; }
  .customer-toolbar .ghost-button { min-height: 38px; padding: 7px 10px; font-size: 12px; }
  .customer-main { padding: 16px 10px 42px; }
  .customer-card { border-radius: 25px; padding: 27px 19px; }
  .customer-card h1 { font-size: 43px; }
  .customer-card h2 { font-size: 34px; }
  .customer-message, .customer-intro { font-size: 18px; }
  .customer-progress-labels span:not(.active) { display: none; }
  .customer-progress-labels { justify-content: center; }
  .split-actions { flex-direction: column; }
  .split-actions button { width: 100%; }
}
