/* Salon booking — mobile-first, accessible styles. No build step required. */
:root {
    --brand: #7a4b6b;
    --brand-dark: #5e3752;
    --brand-soft: #f4ebf1;
    --ink: #1f1d22;
    --muted: #5f5a66;
    --line: #e3dde5;
    --bg: #faf8f9;
    --card: #ffffff;
    --ok: #1d7a46;
    --ok-soft: #e4f4ea;
    --warn: #8a5a00;
    --warn-soft: #fff4dc;
    --err: #b3261e;
    --err-soft: #fdecea;
    --info: #1f5c99;
    --info-soft: #e7f0fa;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(30, 20, 40, .06), 0 2px 10px rgba(30, 20, 40, .05);
    --focus: 0 0 0 3px rgba(122, 75, 107, .45);
    font-size: 16px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3, .h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
code { background: #f1edf2; padding: .1em .35em; border-radius: 4px; font-size: .9em; }
code.big { font-size: 1.25rem; padding: .3em .6em; letter-spacing: .05em; user-select: all; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.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; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--brand); color: #fff; padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { left: .5rem; top: .5rem; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 1rem; }
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.narrow-form { max-width: 560px; }
.main { padding-top: 1.5rem; padding-bottom: 3rem; min-height: 60vh; }
section { margin-bottom: 1.75rem; }

/* Header / nav */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 60px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.nav-toggle { display: inline-block; background: none; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .8rem; font: inherit; cursor: pointer; }
.site-nav { display: none; width: 100%; flex-direction: column; gap: .25rem; padding-bottom: .75rem; }
.site-nav.open { display: flex; }
.site-nav a { padding: .5rem 0; text-decoration: none; color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--brand); font-weight: 600; }
.site-nav .btn { color: #fff; text-align: center; }
@media (min-width: 760px) {
    .nav-toggle { display: none; }
    .site-nav { display: flex; width: auto; flex-direction: row; align-items: center; gap: 1.1rem; padding: 0; }
}
.site-footer { border-top: 1px solid var(--line); background: var(--card); padding: 1.5rem 0; font-size: .9rem; }
.footer-inner { display: grid; gap: 1rem; }
@media (min-width: 760px) { .footer-inner { grid-template-columns: 1fr 1fr; } }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .6rem 1.1rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card);
    color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; min-height: 44px;
}
.btn:hover { border-color: var(--brand); color: var(--brand-dark); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger:hover { background: #8c1d17; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn-sm { padding: .35rem .75rem; min-height: 36px; font-size: .9rem; }
.btn-lg { padding: .8rem 1.4rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.loading { opacity: .6; cursor: not-allowed; }
.btn.loading::after { content: ""; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-button { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }
.inline-form { display: inline; margin: 0; }
.button-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.danger-link { color: var(--err); }

/* Cards / panels */
.card, .panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.grid { display: grid; gap: 1rem; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 640px) and (max-width: 899px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.grid.tight { gap: 0 1rem; }
.stack > * + * { margin-top: 1rem; }
.section-head, .page-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.page-head h1, .section-head h2 { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.empty { color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 1rem; text-align: center; }
.breadcrumbs { font-size: .9rem; color: var(--muted); margin-bottom: .75rem; }

/* Hero */
.hero { background: linear-gradient(135deg, var(--brand-soft), #fff); border-radius: 16px; padding: 2rem 1.25rem; margin-bottom: 2rem; }
.hero h1 { font-size: 2rem; }
.lead { font-size: 1.1rem; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }

/* Services / notices */
.service-card { display: flex; flex-direction: column; }
.service-card .desc { color: var(--muted); font-size: .92rem; flex: 1; }
.service-card .meta { margin-bottom: .5rem; }
.service-card h3 a { color: var(--ink); text-decoration: none; }
.service-img, .notice-img { border-radius: 8px; margin-bottom: .75rem; aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.service-hero { border-radius: 10px; max-height: 320px; width: 100%; object-fit: cover; margin-bottom: 1rem; }
.thumb { max-width: 200px; border-radius: 8px; }
.notice-body { white-space: normal; }
.hours-table th { text-align: left; padding: .3rem 1.5rem .3rem 0; font-weight: 600; }
.hours-table td { padding: .3rem 0; }

/* Forms */
.field { margin-bottom: 1rem; }
.field label, fieldset legend { display: block; font-weight: 600; margin-bottom: .3rem; }
.req { color: var(--err); }
input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"], input[type="date"],
input[type="time"], input[type="url"], input[type="search"], select, textarea {
    width: 100%; padding: .6rem .7rem; border: 1px solid #cfc7d2; border-radius: 8px; font: inherit; background: #fff; color: var(--ink); min-height: 44px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: var(--focus); outline: none; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--err); }
.error, .error-text { color: var(--err); font-size: .9rem; margin: .3rem 0 0; }
.help { color: var(--muted); font-size: .85rem; margin: .3rem 0 0; }
.field-check { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .5rem; }
.field-check input { width: 20px; height: 20px; margin-top: .15rem; flex: none; }
.field-check label { font-weight: 400; margin: 0; flex: 1; }
.field-check .help, .field-check .error { flex-basis: 100%; margin-left: 28px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; }
.check-inline { display: inline-flex; align-items: center; gap: .35rem; margin-right: .9rem; font-weight: 400; }
.checkbox-row, .checkbox-grid { display: flex; flex-wrap: wrap; gap: .5rem 0; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.code-input { font-size: 1.6rem; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.form-links { margin-top: 1rem; font-size: .92rem; }
.form-inline-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: end; }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; }
.filters label { display: flex; flex-direction: column; font-size: .85rem; font-weight: 600; gap: .25rem; }
.filters input, .filters select { min-width: 140px; width: auto; }
.filters .check-inline { flex-direction: row; }
details { margin: .75rem 0; }
summary { cursor: pointer; font-weight: 600; }

/* Alerts & badges */
.alert { padding: .8rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-success { background: var(--ok-soft); border-color: #b9e1c8; color: #145a33; }
.alert-error { background: var(--err-soft); border-color: #f3c3bf; color: #8c1d17; }
.alert-warning { background: var(--warn-soft); border-color: #f1d9a3; color: #6b4600; }
.alert-info { background: var(--info-soft); border-color: #c4d9ef; color: #16466f; }
.flash-stack { margin-bottom: 1rem; }
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #eee9ef; color: #4a4450; vertical-align: middle; white-space: nowrap; }
.badge-confirmed, .badge-n-sent, .badge-ann-live { background: var(--ok-soft); color: #145a33; }
.badge-pending, .badge-n-queued, .badge-n-sending, .badge-ann-scheduled { background: var(--warn-soft); color: #6b4600; }
.badge-cancelled, .badge-n-failed { background: var(--err-soft); color: #8c1d17; }
.badge-completed, .badge-n-logged { background: var(--info-soft); color: #16466f; }
.badge-no_show { background: #fbe3d3; color: #7a3400; }
.badge-private { background: #2e2933; color: #fff; }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; background: var(--card); }
.table th, .table td { text-align: left; padding: .6rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tr.inactive td, section.inactive { opacity: .6; }
.details-cell { max-width: 360px; word-break: break-word; }
.bar-col { width: 30%; }
.bar { display: block; height: 10px; background: var(--brand); border-radius: 4px; min-width: 2px; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0 0 1rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
@media (max-width: 480px) { .dl { grid-template-columns: 1fr; } .dl dd { margin-bottom: .4rem; } }
.plain-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.plain-list li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: .45rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.checklist { list-style: none; padding: 0; }
.checklist li { padding: .3rem 0; }
.checklist .ok span:first-child { color: var(--ok); font-weight: 700; }
.checklist .bad span:first-child { color: var(--err); font-weight: 700; }
pre.message-body, pre.debug { white-space: pre-wrap; word-break: break-word; background: #f6f3f7; padding: 1rem; border-radius: 8px; font-size: .88rem; }
.pagination { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; }
.subnav { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; }
.subnav a { padding: .55rem .9rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; }
.subnav a[aria-current="page"] { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.danger-zone { border-color: #f3c3bf; }

/* Booking flow */
.steps { display: flex; list-style: none; padding: 0; margin: 0 0 1.5rem; gap: .25rem; counter-reset: s; }
.steps li { flex: 1; display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--muted); border-top: 4px solid var(--line); padding-top: .4rem; }
.steps li.done { border-top-color: #c7a6bd; }
.steps li.current { border-top-color: var(--brand); color: var(--ink); font-weight: 700; }
.step-num { display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--line); font-size: .75rem; flex: none; }
.steps li.current .step-num { background: var(--brand); color: #fff; }
@media (max-width: 600px) { .steps li:not(.current) .step-label { display: none; } }
.choice-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .6rem; }
.choice { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.choice:hover { border-color: var(--brand); }
.choice-main { display: flex; flex-direction: column; }
.choice-side { display: flex; flex-direction: column; text-align: right; white-space: nowrap; }
.summary-line { background: var(--brand-soft); padding: .7rem 1rem; border-radius: 8px; }
.booking-summary { display: grid; gap: .5rem; background: var(--brand-soft); padding: 1rem; border-radius: var(--radius); margin-bottom: 1.25rem; }
.booking-summary span { display: block; }
@media (min-width: 700px) { .booking-summary { grid-template-columns: repeat(3, 1fr) auto; align-items: center; } }
.staff-filter { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.staff-filter label { font-weight: 600; }
.staff-filter select { width: auto; min-width: 220px; }
.date-strip-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; gap: .5rem; }
.date-strip { list-style: none; padding: 0 0 .5rem; margin: 0 0 1rem; display: flex; gap: .5rem; overflow-x: auto; scroll-snap-type: x mandatory; }
.date-strip li { flex: none; scroll-snap-align: start; }
.date-chip { display: flex; flex-direction: column; align-items: center; width: 74px; padding: .5rem .25rem; border: 1px solid var(--line); border-radius: 10px; background: var(--card); text-decoration: none; color: var(--ink); line-height: 1.2; }
.date-chip .dow { font-size: .75rem; text-transform: uppercase; color: var(--muted); }
.date-chip .dom { font-size: 1.35rem; font-weight: 700; }
.date-chip .mon { font-size: .75rem; }
.date-chip .count { font-size: .68rem; color: var(--ok); margin-top: .2rem; }
.date-chip.none { opacity: .55; }
.date-chip.none .count { color: var(--muted); }
.date-chip.selected { border-color: var(--brand); background: var(--brand); color: #fff; }
.date-chip.selected .dow, .date-chip.selected .count { color: #fff; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; }
.slot-grid.compact { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); margin-bottom: 1rem; }
.slot { padding: .7rem .5rem; border: 1px solid var(--brand); color: var(--brand-dark); background: #fff; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; min-height: 44px; }
.slot:hover, .slot:focus-visible { background: var(--brand); color: #fff; }
.slots.loading { opacity: .5; pointer-events: none; }
.review dt { min-width: 90px; }
.confirmation { text-align: center; }
.confirmation .dl { text-align: left; max-width: 480px; margin: 1rem auto; }
.confirm-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); font-size: 2rem; display: grid; place-items: center; margin: 0 auto 1rem; }
.ref { font-size: 1.3rem; letter-spacing: .08em; }
.appt-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.appt-item { display: flex; align-items: center; gap: 1rem; padding: .8rem 1rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.appt-item:hover { border-color: var(--brand); }
.appt-date { display: flex; flex-direction: column; align-items: center; min-width: 58px; line-height: 1.15; }
.appt-date .dow, .appt-date .mon { font-size: .72rem; color: var(--muted); text-transform: uppercase; }
.appt-date .dom { font-size: 1.4rem; font-weight: 700; }
.appt-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* Admin shell */
body.admin { background: #f5f3f6; }
.admin-top { display: flex; align-items: center; gap: 1rem; padding: .5rem 1rem; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 30; min-height: 56px; }
.admin-top .brand { color: #fff; flex: 1; }
.admin-top .brand .muted { color: #c9c1cd; font-weight: 400; }
.admin-top .nav-toggle { color: #fff; border-color: #555; }
.admin-user { display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.admin-user a, .admin-user .link-button { color: #fff; }
.admin-user .badge { background: #4a4350; color: #fff; }
@media (max-width: 640px) { .admin-user a, .admin-user .badge { display: none; } }
.admin-shell { display: block; }
.admin-nav { display: none; flex-direction: column; background: #fff; border-right: 1px solid var(--line); padding: .75rem 0; }
.admin-nav.open { display: flex; }
.admin-nav a { padding: .55rem 1.25rem; text-decoration: none; color: var(--ink); border-left: 3px solid transparent; }
.admin-nav a:hover { background: var(--brand-soft); }
.admin-nav a[aria-current="page"] { border-left-color: var(--brand); background: var(--brand-soft); font-weight: 600; color: var(--brand-dark); }
.admin-nav hr { border: 0; border-top: 1px solid var(--line); margin: .5rem 0; width: 100%; }
.admin-main { padding: 1.25rem 1rem 3rem; min-width: 0; }
@media (min-width: 900px) {
    .admin-top .nav-toggle { display: none; }
    .admin-shell { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 56px); }
    .admin-nav { display: flex; position: sticky; top: 56px; align-self: start; height: calc(100vh - 56px); overflow-y: auto; }
    .admin-main { padding: 1.5rem 2rem 3rem; }
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin-bottom: .5rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
a.stat:hover { border-color: var(--brand); }
.stat-num { font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: .82rem; color: var(--muted); }
.hours-editor .period { white-space: nowrap; }
.hours-editor input[type="time"] { width: 7.2rem; min-width: 0; display: inline-block; }

/* Calendar day view */
.calendar { display: grid; grid-template-columns: 64px repeat(auto-fit, minmax(170px, 1fr)); gap: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; position: relative; }
.cal-times { position: relative; margin-top: 2.6rem; height: calc(var(--hours) * 64px); border-right: 1px solid var(--line); }
.cal-hour { position: absolute; left: 0; right: 6px; font-size: .72rem; color: var(--muted); text-align: right; transform: translateY(-.5em); }
.cal-col { margin: 0; border-right: 1px solid var(--line); min-width: 170px; }
.cal-head { font-size: .9rem; margin: 0; padding: .6rem; height: 2.6rem; border-bottom: 1px solid var(--line); background: #faf8fb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-body { position: relative; height: calc(var(--hours) * 64px); background: repeating-linear-gradient(to bottom, transparent 0, transparent 63px, #f0ecf2 63px, #f0ecf2 64px); }
.cal-working { position: absolute; left: 0; right: 0; background: rgba(122, 75, 107, .06); }
.cal-blocked { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(45deg, #eee 0, #eee 6px, #f8f8f8 6px, #f8f8f8 12px); border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; font-size: .7rem; color: var(--muted); padding: 2px 4px; overflow: hidden; }
.cal-appt { position: absolute; left: 4px; right: 4px; background: var(--brand); color: #fff; border-radius: 6px; font-size: .74rem; overflow: hidden; text-decoration: none; box-shadow: 0 1px 2px rgba(0,0,0,.15); min-height: 18px; }
.cal-appt:hover { filter: brightness(1.1); color: #fff; }
.cal-appt.status-pending { background: #b07d00; }
.cal-appt.status-completed { background: #3b6e9c; }
.cal-appt.status-no_show { background: #9c5a2e; }
.cal-buffer { display: block; background: rgba(255,255,255,.3); }
.cal-appt-text { display: block; padding: 2px 5px; line-height: 1.25; }
.cal-empty { position: absolute; top: .5rem; left: 0; right: 0; text-align: center; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print {
    .site-header, .site-footer, .admin-top, .admin-nav, .actions, .filters, .btn { display: none !important; }
    .admin-shell { display: block; }
}
