:root {
  --canvas: #e8ddd6;
  --page: #faf5f1;
  --surface: #fffaf7;
  --surface-2: #f5eae4;
  --ink: #351022;
  --ink-2: #725d66;
  --ink-3: #a68f97;
  --line: #e7d8d1;
  --accent: #b84f62;
  --accent-soft: #f7e3e2;
  --free: #247957;
  --free-soft: #e3f3e9;
  --pending: #9a6a23;
  --pending-soft: #fff0d7;
  --danger: #b53f47;
  --danger-soft: #fbe4e4;
  --shadow: 0 12px 34px rgba(72, 31, 42, .075);
  --shadow-soft: 0 5px 16px rgba(72, 31, 42, .055);
  --hairline: rgba(74, 35, 47, .075);
  --ease-out: cubic-bezier(.2, .75, .25, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--canvas); }
body { margin: 0; color: var(--ink); background: radial-gradient(120% 50% at 50% 0, #f5ede7, transparent 65%), var(--canvas); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overscroll-behavior-y: none; }
button, input, select { font: inherit; }
button { cursor: pointer; touch-action: manipulation; transition: transform .16s var(--ease-out), background-color .16s ease, color .16s ease, opacity .16s ease, box-shadow .16s ease; }
button:active { transform: scale(.97); }
button:disabled { cursor: default; opacity: .48; transform: none; box-shadow: none; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

#app { width: 100%; max-width: 480px; min-height: 100svh; margin: 0 auto; overflow: clip; background: var(--page); }
.boot { min-height: 100svh; display: grid; place-content: center; justify-items: center; color: var(--ink-2); }
.boot-mark { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 18px; color: #3b1022; background: #f0ad9f; font-weight: 900; box-shadow: var(--shadow); }
.boot p { font-size: 13px; }
.page { min-height: 100svh; padding: 0 16px calc(104px + var(--safe-bottom)); }

.hero { position: relative; min-height: calc(164px + var(--safe-top)); margin: 0 -16px 20px; padding: calc(46px + var(--safe-top)) 21px 31px; overflow: hidden; color: #fff; background: linear-gradient(145deg, #2c0919 0%, #5b1833 56%, #923252 126%); border-radius: 0 0 34px 34px; box-shadow: 0 8px 26px rgba(61, 16, 37, .12); }
.hero::before { content: ""; position: absolute; right: -55px; bottom: -90px; width: 250px; height: 250px; border: 1px solid rgba(255, 244, 232, .18); border-radius: 50%; box-shadow: 0 0 0 31px rgba(255, 244, 232, .05), 0 0 0 62px rgba(255, 244, 232, .035); }
.hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, rgba(255,255,255,.06), transparent 38%); }
.hero-row { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.eyebrow { margin: 0; color: #f5d8d1; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.hero h1 { margin: 9px 0 5px; font: 600 31px/1 Georgia, "Times New Roman", serif; letter-spacing: -1.2px; }
.hero-sub { margin: 0; max-width: 290px; color: #efd8d3; font-size: 13px; line-height: 1.4; }
.avatar { display: grid; flex: 0 0 auto; place-items: center; width: 52px; height: 52px; border: 1px solid rgba(255, 255, 255, .22); border-radius: 18px; background: rgba(255, 248, 244, .14); color: #ffd8cd; font: 600 19px Georgia, serif; box-shadow: inset 0 1px 0 rgba(255,255,255,.12); backdrop-filter: blur(14px) saturate(130%); }

.section { margin: 24px 0 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.section-kicker { margin: 0 0 5px; color: var(--ink-3); font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.section-title { margin: 0; font: 600 21px/1.15 Georgia, serif; letter-spacing: -.6px; }
.text-button { min-height: 36px; border: 0; padding: 6px 4px 6px 10px; color: var(--accent); background: transparent; font-size: 12px; font-weight: 750; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: -42px; position: relative; z-index: 2; }
.stat-card { min-width: 0; padding: 14px 11px; border: 1px solid rgba(255,255,255,.75); border-radius: 19px; background: rgba(255,250,247,.94); box-shadow: 0 7px 19px rgba(68, 25, 39, .085); backdrop-filter: blur(18px); }
.stat-card strong { display: block; font: 600 24px Georgia, serif; }
.stat-card span { display: block; margin-top: 4px; color: var(--ink-3); font-size: 9px; font-weight: 750; line-height: 1.25; }
.stat-card.pending strong { color: var(--pending); }
.stat-card.free strong { color: var(--free); }

.quick-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; }
.quick { min-height: 108px; border: 1px solid var(--hairline); border-radius: 22px; padding: 15px; text-align: left; color: var(--ink); background: #f8e9e2; box-shadow: var(--shadow-soft); }
.quick.primary-quick { color: #fff; background: linear-gradient(135deg, #351022, #732443); }
.quick.wide { grid-column: 1 / -1; min-height: 80px; display: flex; align-items: center; gap: 12px; }
.quick-icon { display: grid; flex: 0 0 auto; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: rgba(255,255,255,.6); color: var(--accent); font-size: 18px; }
.primary-quick .quick-icon { background: rgba(255,255,255,.12); color: #f0ad9f; }
.quick b { display: block; margin-top: 14px; font-size: 14px; letter-spacing: -.1px; }
.quick.wide b { margin-top: 0; }
.quick small { display: block; margin-top: 4px; color: var(--ink-2); font-size: 11px; line-height: 1.38; }
.primary-quick small { color: #e7bcc5; }

.card-list { display: grid; gap: 9px; }
.card { border: 1px solid var(--hairline); border-radius: 20px; padding: 15px; background: var(--surface); box-shadow: var(--shadow-soft); }
.appointment { position: relative; overflow: hidden; }
.appointment::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 4px; background: var(--pending); }
.appointment.confirmed::before { background: var(--free); }
.appointment.cancelled::before { background: var(--danger); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.time { font: 600 23px Georgia, serif; letter-spacing: -.6px; }
.date { color: var(--ink-2); font-size: 12px; }
.badge { border-radius: 99px; padding: 6px 9px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.badge.pending { color: var(--pending); background: var(--pending-soft); }
.badge.confirmed, .badge.free { color: var(--free); background: var(--free-soft); }
.badge.cancelled { color: var(--danger); background: var(--danger-soft); }
.card h3 { margin: 11px 0 4px; font-size: 15px; letter-spacing: -.1px; }
.meta { margin: 0; color: var(--ink-2); font-size: 12px; line-height: 1.5; }
.card-actions { display: flex; gap: 7px; margin-top: 12px; }
.action { flex: 1; min-height: 44px; border: 0; border-radius: 13px; padding: 9px 10px; font-size: 12px; font-weight: 750; }
.action.confirm { color: var(--free); background: var(--free-soft); }
.action.cancel { color: var(--danger); background: var(--danger-soft); }
.action.neutral { color: var(--ink); background: var(--surface-2); }

.empty { padding: 36px 22px; border: 1px solid var(--hairline); border-radius: 22px; text-align: center; color: var(--ink-2); background: linear-gradient(160deg, #fffdfb, #faeee8); box-shadow: var(--shadow-soft); }
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 11px; border-radius: 17px; color: var(--accent); background: #f4dfd8; font-size: 21px; }
.empty b { display: block; color: var(--ink); font-size: 15px; }
.empty p { margin: 7px 0 0; font-size: 12px; line-height: 1.48; }

.toolbar { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.toolbar::-webkit-scrollbar { display: none; }
.pill { flex: 0 0 auto; min-height: 40px; border: 1px solid var(--line); border-radius: 99px; padding: 0 14px; color: var(--ink-2); background: var(--surface); font-size: 12px; font-weight: 750; }
.pill.active { border-color: var(--ink); color: #fff; background: var(--ink); }

.service-card { display: flex; align-items: center; gap: 12px; }
.service-info { min-width: 0; flex: 1; }
.service-info h3 { margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.service-price { color: var(--accent); font: 600 18px Georgia, serif; }
.service-edit { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 14px; color: var(--accent); background: var(--accent-soft); }
.floating-add { position: fixed; z-index: 15; right: max(18px, calc(50% - 222px)); bottom: calc(88px + var(--safe-bottom)); display: grid; place-items: center; width: 56px; height: 56px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; color: #fff; background: linear-gradient(135deg, #351022, #732443); box-shadow: 0 12px 25px rgba(53,16,34,.24); }

.calendar { padding: 16px 14px 14px; border: 1px solid var(--hairline); border-radius: 24px; background: #fffdfb; box-shadow: var(--shadow-soft); }
.calendar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.calendar-head strong { font: 600 18px Georgia, serif; }
.round { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; color: var(--ink); background: var(--surface-2); font-size: 22px; }
.weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.weekdays span { padding: 4px 0 7px; text-align: center; color: var(--ink-3); font-size: 10px; font-weight: 800; }
.day { position: relative; height: 42px; border: 0; border-radius: 50%; color: var(--ink); background: transparent; font-size: 13px; }
.day.other { color: #c9babe; }
.day.selected { color: #fff; background: var(--accent); box-shadow: 0 4px 10px rgba(184,79,98,.27); }
.day.today::after { content: ""; position: absolute; bottom: 3px; left: 50%; width: 4px; height: 4px; transform: translateX(-50%); border-radius: 50%; background: var(--accent); }
.day.selected::after { background: #fff; }
.day-dot { position: absolute; top: 1px; right: 3px; width: 7px; height: 7px; border: 2px solid #fffdfb; border-radius: 50%; background: var(--free); }
.period { display: flex; align-items: center; gap: 11px; }
.period-time { flex: 1; font: 600 19px Georgia, serif; }
.period-time small { margin-left: 4px; color: var(--ink-3); font: 10px -apple-system, sans-serif; }
.template-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.template { min-height: 86px; border: 1px solid var(--hairline); border-radius: 18px; padding: 12px; text-align: left; color: var(--ink); background: #f8e9e2; font-size: 12px; font-weight: 750; box-shadow: var(--shadow-soft); }
.template:nth-child(2) { background: #eee6db; }
.template.danger { color: #fff; background: var(--ink); }
.template small { display: block; margin-top: 6px; color: var(--ink-2); font-size: 10px; font-weight: 500; line-height: 1.35; }
.template.danger small { color: #e6bac0; }

.profile-card { padding: 18px; }
.profile-name { margin: 0; font: 600 24px Georgia, serif; }
.profile-line { margin: 7px 0 0; color: var(--ink-2); font-size: 13px; }
.settings-list { overflow: hidden; padding: 0; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 64px; border: 0; border-bottom: 1px solid var(--line); padding: 12px 15px; color: var(--ink); background: transparent; text-align: left; }
.setting:last-child { border-bottom: 0; }
.setting div { min-width: 0; }
.setting b { display: block; font-size: 14px; letter-spacing: -.1px; }
.setting small { display: block; margin-top: 4px; overflow: hidden; color: var(--ink-3); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.chevron { color: var(--accent); font-size: 19px; }

.legal-footer { display: grid; justify-items: center; gap: 5px; padding: 10px 0 2px; color: var(--ink-3); font-size: 9px; }
.legal-link { border: 0; padding: 5px 8px; color: var(--ink-3); background: transparent; font-size: 10px; text-decoration: underline; text-decoration-color: rgba(108,86,93,.32); text-underline-offset: 3px; }
.legal-link:active { color: var(--accent); }

.bottom-nav { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; padding: 7px max(10px, env(safe-area-inset-right)) calc(7px + var(--safe-bottom)) max(10px, env(safe-area-inset-left)); background: rgba(255,250,247,.82); border-top: 1px solid rgba(89,44,57,.08); box-shadow: 0 -8px 26px rgba(53,16,34,.035); backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%); }
.bottom-nav-inner { display: grid; grid-template-columns: repeat(5, 1fr); max-width: 460px; margin: auto; }
.nav-item { display: grid; justify-items: center; gap: 3px; min-height: 54px; border: 0; padding: 5px 2px 3px; color: var(--ink-3); background: transparent; font-size: 10px; font-weight: 650; }
.nav-icon { display: grid; place-items: center; width: 34px; height: 28px; border-radius: 10px; }
.nav-item.active { color: var(--accent); }
.nav-item.active { font-weight: 750; }
.nav-item.active .nav-icon { color: var(--accent); background: var(--accent-soft); }
.ui-icon { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-icon .ui-icon { width: 19px; height: 19px; }
.floating-add .ui-icon { width: 24px; height: 24px; stroke-width: 2; }
.service-edit .ui-icon { width: 18px; height: 18px; }

.toast { position: fixed; z-index: 60; top: max(15px, env(safe-area-inset-top)); left: 50%; max-width: calc(100% - 32px); padding: 12px 16px; border: 1px solid rgba(255,255,255,.14); border-radius: 99px; color: #fff; background: rgba(53,16,34,.94); box-shadow: 0 12px 26px rgba(28,28,30,.2); opacity: 0; transform: translate(-50%, -10px) scale(.97); transition: .2s var(--ease-out); pointer-events: none; font-size: 12px; font-weight: 750; white-space: nowrap; backdrop-filter: blur(18px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

.sheet-backdrop { position: fixed; z-index: 50; inset: 0; display: flex; align-items: flex-end; background: rgba(46,12,27,.44); opacity: 0; transition: opacity .22s ease; backdrop-filter: blur(6px); }
.sheet-backdrop.open { opacity: 1; }
.sheet { width: 100%; max-width: 480px; max-height: 92svh; margin: auto auto 0; overflow-y: auto; overscroll-behavior: contain; padding: 9px 18px calc(24px + var(--safe-bottom)); border: 1px solid rgba(255,255,255,.7); border-bottom: 0; border-radius: 30px 30px 0 0; background: rgba(255,250,247,.98); box-shadow: 0 -14px 48px rgba(53,16,34,.14); transform: translateY(36px); transition: transform .24s var(--ease-out); }
.sheet-backdrop.open .sheet { transform: translateY(0); }
.handle { width: 36px; height: 5px; margin: 0 auto 16px; border-radius: 99px; background: #dfcbc4; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sheet h2 { margin: 0; font: 600 24px Georgia, serif; letter-spacing: -.55px; }
.sheet-sub { margin: 5px 0 0; color: var(--ink-2); font-size: 12px; line-height: 1.42; }
.close { display: grid; flex: 0 0 auto; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; color: var(--ink-2); background: #f0e3dd; font-size: 20px; }
.label { display: block; margin: 17px 0 8px; color: var(--ink-3); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.input, .select { width: 100%; height: 52px; border: 1px solid transparent; border-radius: 15px; padding: 0 13px; color: var(--ink); background: #f5ebe6; font-size: 15px; transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease; }
.input:focus, .select:focus { border-color: rgba(184,79,98,.48); outline: 0; background: #fffdfb; box-shadow: 0 0 0 3px rgba(184,79,98,.1); }
.input::placeholder { color: #b8a3aa; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choices { display: flex; flex-wrap: wrap; gap: 7px; }
.choice { min-height: 42px; border: 1px solid var(--line); border-radius: 12px; padding: 9px 13px; color: var(--ink); background: #fffdfb; font-size: 12px; font-weight: 750; }
.choice.active { border-color: var(--ink); color: #fff; background: var(--ink); }
.primary { width: 100%; min-height: 52px; margin-top: 20px; border: 0; border-radius: 16px; color: #fff; background: linear-gradient(135deg, #351022, #732443); font-size: 14px; font-weight: 750; box-shadow: 0 9px 18px rgba(53,16,34,.2); }
.secondary { width: 100%; min-height: 48px; margin-top: 9px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: rgba(255,253,251,.72); font-size: 13px; font-weight: 750; }
.danger-button { color: var(--danger); }
.form-note { margin: 10px 0 0; color: var(--ink-2); font-size: 11px; line-height: 1.48; }
.inline-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 13px; }
.inline-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.time-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.time-choice { min-height: 44px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fffdfb; font-size: 12px; font-weight: 750; }
.time-choice.active { border-color: var(--accent); color: #fff; background: var(--accent); }
.loading-line { padding: 16px; text-align: center; color: var(--ink-3); font-size: 12px; }
.agreement-copy { padding: 2px 1px 8px; color: var(--ink-2); font-size: 12px; line-height: 1.62; }
.agreement-copy h3 { margin: 25px 0 9px; color: var(--ink); font: 600 18px Georgia, serif; letter-spacing: -.25px; }
.agreement-copy h3:first-child { margin-top: 4px; }
.agreement-copy p { margin: 0 0 11px; }
.agreement-copy .agreement-clause { color: var(--ink); }
.agreement-error { margin: 10px 0 0; color: var(--danger); font-size: 12px; line-height: 1.55; }
.period-editor { display: grid; grid-template-columns: 1fr 1fr 36px; gap: 7px; align-items: end; margin-top: 8px; }
.period-editor .label { margin-top: 0; }
.remove-period { height: 48px; border: 0; border-radius: 12px; color: var(--danger); background: var(--danger-soft); }

@media (min-width: 481px) {
  #app { border-right: 1px solid var(--line); border-left: 1px solid var(--line); box-shadow: 0 0 38px rgba(28,28,30,.07); }
  .bottom-nav { right: calc(50% - 240px); left: calc(50% - 240px); }
}

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