:root {
  --bg: #f5f5f3;
  --surface: #ffffff;
  --surface-alt: #ececea;
  --dark: #111111;
  --text: #171715;
  --muted: #73736e;
  --line: #deded9;
  --success: #16623d;
  --danger: #a32626;
  --warning: #8a5700;
  --shadow: 0 18px 42px rgba(0,0,0,.10);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { display: flex; justify-content: center; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(17,17,17,.18); outline-offset: 2px; }
[hidden] { display: none !important; }

.app-shell { width: 100%; max-width: 720px; min-height: 100vh; padding-bottom: 92px; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 58px 1fr auto;
  align-items: center; gap: 11px; padding: calc(10px + env(safe-area-inset-top)) 15px 10px;
  background: rgba(245,245,243,.92); backdrop-filter: blur(20px); border-bottom: 1px solid rgba(222,222,217,.8);
}
.brand-button { width: 54px; height: 46px; border: 0; border-radius: 14px; padding: 8px; background: #fff; box-shadow: 0 5px 18px rgba(0,0,0,.06); }
.brand-button img { width: 100%; height: 100%; object-fit: contain; }
.page-heading { min-width: 0; }
.eyebrow { margin: 0 0 2px; color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .15em; }
h1 { margin: 0; font-size: 23px; line-height: 1.05; letter-spacing: -.025em; }
.install-button { border: 1px solid var(--line); background: white; min-height: 38px; padding: 8px 11px; border-radius: 11px; font-size: 11px; font-weight: 850; }
.content { padding: 17px 14px 30px; }
.bottom-nav {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 30; width: 100%; max-width: 720px;
  display: grid; grid-template-columns: repeat(4,1fr); padding: 8px 9px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.96); backdrop-filter: blur(20px); border-top: 1px solid var(--line);
}
.nav-item { border: 0; background: transparent; color: var(--muted); padding: 7px 3px; border-radius: 13px; display: grid; gap: 3px; justify-items: center; font-size: 10px; font-weight: 820; }
.nav-item svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item.active { background: var(--dark); color: white; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 5px 18px rgba(0,0,0,.035); }
.card + .card { margin-top: 12px; }
.hero { position: relative; overflow: hidden; min-height: 205px; padding: 22px; background: var(--dark); color: white; border: 0; }
.hero::after { content: "A"; position: absolute; right: -18px; bottom: -58px; font-family: Georgia, serif; font-size: 192px; color: rgba(255,255,255,.045); transform: rotate(-4deg); }
.hero > * { position: relative; z-index: 1; }
.hero-label { color: rgba(255,255,255,.67); font-size: 12px; }
.hero h2 { margin: 11px 0 5px; font-size: 32px; letter-spacing: -.04em; }
.hero p { margin: 0; color: rgba(255,255,255,.68); }
.hero-next { margin-top: 18px; padding: 13px; border-radius: 14px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12); }
.hero-next strong { display: block; margin-bottom: 4px; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 2px 10px; }
.section-header h2 { margin: 0; font-size: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.stat-value { display: block; margin-top: 12px; font-size: 29px; font-weight: 900; letter-spacing: -.04em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.primary, .secondary, .danger { min-height: 44px; border: 0; border-radius: 12px; padding: 11px 14px; font-weight: 850; }
.primary { background: var(--dark); color: white; }
.secondary { background: var(--surface-alt); color: var(--text); }
.danger { background: #f6dfdf; color: var(--danger); }
.full { width: 100%; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions > button { flex: 1 1 120px; }

.appointment-list, .cut-list { display: grid; gap: 9px; }
.appointment-row { display: flex; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--line); background: white; border-radius: 15px; }
.time-pill { min-width: 60px; text-align: center; padding: 9px 7px; background: var(--dark); color: white; border-radius: 11px; font-size: 13px; font-weight: 900; }
.flex-1 { min-width: 0; flex: 1; }
.title-line { font-weight: 850; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.status { padding: 5px 7px; border-radius: 999px; font-size: 9px; font-weight: 900; text-transform: uppercase; }
.status.confirmed { color: var(--success); background: #dff1e8; }
.status.pending { color: var(--warning); background: #fff0d4; }
.status.completed { color: #555; background: #e8e8e5; }
.status.cancelled { color: var(--danger); background: #f6dfdf; }
.status.no_show { color: #694190; background: #ece3f6; }

.last-cut { display: grid; grid-template-columns: 115px 1fr; gap: 14px; align-items: stretch; }
.last-cut img, .photo-placeholder { width: 115px; height: 132px; border-radius: 14px; object-fit: cover; background: var(--dark); color: white; display: grid; place-items: center; font-size: 34px; }
.last-cut h3 { margin: 3px 0 7px; font-size: 19px; }
.last-cut p { margin: 0; white-space: pre-wrap; }

.form-grid { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 11px; font-weight: 850; color: #3f3f3b; }
.field input, .field select, .field textarea { width: 100%; min-height: 45px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--text); }
.field textarea { min-height: 90px; resize: vertical; }
.choice-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.choice-card { min-height: 72px; padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: white; text-align: left; }
.choice-card strong, .choice-card span { display: block; }
.choice-card span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.choice-card.active { background: var(--dark); color: white; border-color: var(--dark); }
.choice-card.active span { color: rgba(255,255,255,.68); }
.slot-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.slot { min-height: 49px; border: 1px solid #b9d8c8; border-radius: 12px; background: white; color: var(--success); font-weight: 900; font-size: 12px; }
.slot span { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; font-weight: 700; }
.slot.active { background: var(--dark); color: white; border-color: var(--dark); }
.slot.active span { color: rgba(255,255,255,.66); }
.step { display: inline-flex; padding: 5px 8px; border-radius: 999px; background: var(--surface-alt); color: var(--muted); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.notice { padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #f0f0ed; color: #555550; font-size: 11px; line-height: 1.5; }
.empty { padding: 27px 15px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); background: rgba(255,255,255,.45); }

.auth-root { width: 100%; min-height: 100vh; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top)) 15px calc(24px + env(safe-area-inset-bottom)); background: radial-gradient(circle at 14% 10%, rgba(0,0,0,.08), transparent 35%), var(--bg); }
.login-card { width: min(100%,430px); padding: 27px 21px; background: white; border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); }
.login-logo { width: 180px; height: 78px; object-fit: contain; display: block; margin: 0 auto 23px; }
.login-card h1 { margin: 0 0 8px; font-size: 29px; }
.login-copy { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 15px; border-radius: 14px; background: var(--surface-alt); }
.auth-tabs button { min-height: 39px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 850; }
.auth-tabs button.active { background: white; color: var(--text); box-shadow: 0 3px 10px rgba(0,0,0,.06); }
.auth-error, .auth-success { margin-bottom: 12px; padding: 11px 12px; border-radius: 12px; font-size: 11px; font-weight: 750; line-height: 1.45; }
.auth-error { color: var(--danger); background: #f6dfdf; border: 1px solid #ecc3c3; }
.auth-success { color: var(--success); background: #dff1e8; border: 1px solid #b9d8c8; }

.profile-header { display: grid; justify-items: center; text-align: center; gap: 9px; }
.avatar { width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; background: var(--dark); color: white; font-size: 24px; font-weight: 900; }
.profile-header h2 { margin: 0; }
.profile-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.profile-row span { color: var(--muted); }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.52); }
.modal { width: 100%; max-width: 720px; max-height: 92vh; overflow: auto; padding: 18px 15px calc(22px + env(safe-area-inset-bottom)); background: var(--bg); border-radius: 25px 25px 0 0; }
.modal-header { position: sticky; top: -18px; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 6px 0 13px; background: rgba(245,245,243,.96); backdrop-filter: blur(12px); }
.modal-header h2 { margin: 0; font-size: 21px; }
.close { width: 39px; height: 39px; border: 0; border-radius: 50%; background: var(--surface-alt); font-size: 20px; }
.toast { position: fixed; left: 50%; bottom: 98px; z-index: 80; transform: translate(-50%,20px); max-width: calc(100vw - 28px); padding: 11px 14px; border-radius: 999px; background: var(--dark); color: white; font-size: 11px; font-weight: 850; opacity: 0; pointer-events: none; transition: .2s ease; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.loading { min-height: 170px; display: grid; place-items: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid #ddd; border-top-color: #111; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 390px) {
  .grid-2, .choice-grid { grid-template-columns: 1fr; }
  .slot-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .last-cut { grid-template-columns: 94px 1fr; }
  .last-cut img, .photo-placeholder { width: 94px; height: 116px; }
  .install-button { display: none !important; }
}

/* v0.2 · acciones y reprogramación */
.appointment-actions {
  display: grid;
  justify-items: stretch;
  gap: 6px;
  min-width: 102px;
}
.appointment-actions .status { justify-self: end; }
.compact { min-height: 34px; padding: 7px 9px; border-radius: 10px; font-size: 10px; }
.confirmation-copy { display: inline-block; margin-top: 5px; color: var(--success); font-weight: 850; }

@media (max-width: 480px) {
  .appointment-row { align-items: flex-start; flex-wrap: wrap; }
  .appointment-row .flex-1 { min-width: calc(100% - 82px); }
  .appointment-actions {
    width: 100%;
    min-width: 0;
    grid-template-columns: auto 1fr 1fr;
    align-items: center;
  }
  .appointment-actions .status { justify-self: start; }
}
