/* Auth pages */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; background: radial-gradient(circle at 20% 0%, var(--rose-light), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 2rem 1.5rem; display: flex; flex-direction: column; gap: .9rem; animation: fadeUp .4s var(--ease); }
.auth-logo { width: 120px; margin: 0 auto .4rem; }
.auth-title { font-size: 1.9rem; text-align: center; }
.auth-card > .muted { text-align: center; margin: 0; }
.form-stack { display: flex; flex-direction: column; gap: .9rem; }
.back-link { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); text-decoration: none; font-size: .85rem; margin: .2rem 0 1rem; align-self: center; }
.alert { padding: .8rem 1rem; border-radius: var(--r-sm); font-size: .9rem; font-weight: 500; animation: fadeUp .3s var(--ease); }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-danger { background: var(--danger-bg); color: var(--danger); }
.check { display: flex; align-items: center; gap: .6rem; font-size: .9rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--terra); }

/* Layout */
body.admin { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.side-nav { display: none; }
.admin-main { max-width: 880px; margin: 0 auto; padding: 0 1rem 2rem; }
.admin-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .5rem; padding: .9rem 0 .8rem; padding-top: max(.9rem, env(safe-area-inset-top)); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); margin: 0 -1rem 1rem; padding-left: 1rem; padding-right: 1rem; border-bottom: 1px solid var(--border); }
.admin-top h1 { font-size: 1.9rem; margin-right: auto; }
.icon-btn.sm { width: 40px; height: 40px; text-decoration: none; }
.admin-main > .alert { margin-bottom: 1rem; }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--border); padding: .35rem .3rem; padding-bottom: max(.35rem, env(safe-area-inset-bottom)); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .35rem 0; font-size: .68rem; font-weight: 600; text-decoration: none; color: var(--muted); transition: color .2s; }
.bn-icon { position: relative; width: 52px; height: 30px; display: grid; place-items: center; border-radius: 999px; transition: background-color .25s; }
.bottom-nav a.on { color: var(--espresso); }
.bottom-nav a.on .bn-icon { background: var(--rose); }
.badge-dot { position: absolute; top: -2px; right: 6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--lip); color: #fff; font-size: .65rem; display: grid; place-items: center; }
.badge-count { margin-left: auto; background: var(--lip); color: #fff; font-size: .7rem; border-radius: 9px; padding: 0 .45rem; }

/* Dashboard */
.hello-date { margin: -.6rem 0 1rem; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 1rem; text-decoration: none; display: flex; flex-direction: column; transition: transform .2s var(--ease), box-shadow .2s; }
a.stat:active { transform: scale(.98); }
.stat strong { font-family: var(--font-h); font-size: 2rem; line-height: 1; color: var(--espresso); }
.stat span { font-size: .78rem; color: var(--muted); font-weight: 500; margin-top: .3rem; }
.stat-warn { background: var(--warning-bg); border-color: #FCD34D; }
.stat-warn strong { color: var(--warning); }
.quick-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1.5rem; }
.quick-row .btn { padding: 0 .6rem; font-size: .85rem; }
.block { margin-bottom: 1.8rem; }
.block-title { display: flex; align-items: center; gap: .5rem; font-size: 1.45rem; margin-bottom: .8rem; }
.block-title svg { color: var(--terra); }
.count { font-family: var(--font-b); font-size: .75rem; background: var(--lip); color: #fff; border-radius: 999px; padding: .1rem .55rem; }

/* Appointment cards */
.appt-list { display: grid; gap: .7rem; }
.appt-card { display: flex; gap: .9rem; background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--border-dark); border-radius: var(--r-md); padding: 1rem; animation: fadeUp .35s var(--ease); }
.appt-card.status-pending { border-left-color: #F59E0B; }
.appt-card.status-confirmed { border-left-color: var(--success); }
.appt-card.status-cancelled, .appt-card.status-refused { opacity: .7; border-left-color: var(--danger); }
.appt-time { display: flex; flex-direction: column; align-items: center; min-width: 54px; }
.appt-time strong { font-family: var(--font-h); font-size: 1.45rem; color: var(--espresso); line-height: 1; }
.appt-time small { font-size: .72rem; color: var(--muted); margin-top: .2rem; }
.appt-body { flex: 1; min-width: 0; }
.appt-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.appt-head h4 { font-family: var(--font-b); font-size: .98rem; font-weight: 700; }
.appt-svc { margin: .2rem 0 .5rem; font-size: .85rem; color: var(--espresso-2); }
.appt-date { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-size: .8rem; }
.appt-date svg { width: 14px; height: 14px; }
.appt-notes { font-size: .82rem; font-style: italic; color: var(--muted); margin: 0 0 .5rem; }
.appt-contact { display: flex; flex-wrap: wrap; gap: .4rem; }
.appt-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.appt-actions form { display: contents; }
.chip { display: inline-flex; align-items: center; gap: .35rem; min-height: 36px; padding: 0 .85rem; border-radius: 999px; border: 1.5px solid var(--border); background: var(--bg); font: 600 .8rem var(--font-b); color: var(--espresso); text-decoration: none; cursor: pointer; transition: background-color .2s, border-color .2s, transform .15s; white-space: nowrap; }
.chip:active { transform: scale(.96); }
.chip svg { width: 15px; height: 15px; }
.chip-danger { color: var(--danger); border-color: #FCA5A5; }
.badge { display: inline-block; font-size: .68rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px; white-space: nowrap; border: 1px solid; }
.badge-pending { background: #FEF3C7; color: #B45309; border-color: #FCD34D; }
.badge-confirmed { background: #D1FAE5; color: #065F46; border-color: #6EE7B7; }
.badge-cancelled, .badge-refused { background: #FEE2E2; color: #991B1B; border-color: #FCA5A5; }

/* Planning */
.plan-toolbar { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-bottom: .9rem; }
.week-label { font-family: var(--font-h); font-size: 1.2rem; min-width: 7.5rem; text-align: center; }
.seg { display: inline-flex; background: var(--subtle); border-radius: 999px; padding: 3px; margin-left: auto; }
.seg a { padding: .45rem .9rem; border-radius: 999px; font-size: .8rem; font-weight: 600; text-decoration: none; color: var(--muted); transition: background-color .2s, color .2s; }
.seg a.on { background: var(--card); color: var(--espresso); box-shadow: var(--shadow-sm); }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; margin-bottom: 1.1rem; }
.wday { position: relative; display: flex; flex-direction: column; align-items: center; padding: .5rem 0 .45rem; border-radius: var(--r-sm); background: var(--card); border: 1.5px solid var(--border); text-decoration: none; color: var(--espresso); transition: background-color .2s, transform .15s; }
.wday small { font-size: .66rem; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.wday strong { font-family: var(--font-h); font-size: 1.35rem; line-height: 1.1; }
.wday-info { font-size: .62rem; color: var(--success); font-weight: 700; }
.wday-rdv { position: absolute; top: -6px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--terra); color: #fff; font-size: .62rem; display: grid; place-items: center; padding: 0 4px; }
.wday.today { border-color: var(--terra); }
.wday.on { background: var(--espresso); border-color: var(--espresso); color: #fff; }
.wday.on small { color: var(--rose); }
.wday.on .wday-info { color: #A7F3D0; }
.day-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .7rem; }
.day-head h2 { font-size: 1.5rem; }
.presets { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; margin-bottom: .5rem; scrollbar-width: none; align-items: center; }
.presets::-webkit-scrollbar { display: none; }
.presets-label { font-size: .75rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.hint { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--muted); margin: .3rem 0 .8rem; }
.hint svg { width: 15px; height: 15px; }
.cells { display: flex; flex-direction: column; gap: 6px; margin-bottom: 1.5rem; }
.cell-row { display: flex; gap: .6rem; align-items: flex-start; }
.cell-time { width: 44px; flex-shrink: 0; font-size: .8rem; font-weight: 600; color: var(--muted); padding-top: .9rem; text-align: right; font-variant-numeric: tabular-nums; }
.cell { flex: 1; min-height: 50px; border-radius: var(--r-sm); border: 1.5px solid var(--border); display: flex; align-items: center; padding: 0 1rem; font: 600 .85rem var(--font-b); cursor: pointer; text-align: left; text-decoration: none; transition: background-color .2s, border-color .2s, color .2s, transform .15s; -webkit-tap-highlight-color: transparent; }
.cell.closed { background: repeating-linear-gradient(135deg, var(--subtle) 0 8px, #EDE5DA 8px 16px); color: var(--muted); }
.cell.open { background: var(--success-bg); border-color: #86C49F; color: var(--success); }
.cell.open .cell-state::before { content: '● '; }
.cell.past { opacity: .5; }
.cell.pulse { transform: scale(.98); }
.cell.booked { min-height: calc(var(--span, 1) * 50px + (var(--span, 1) - 1) * 6px); flex-direction: column; align-items: flex-start; justify-content: center; gap: .15rem; padding: .7rem 1rem; }
.cell.booked strong { font-size: .92rem; }
.cell.booked span { font-weight: 500; font-size: .8rem; }
.booked-pending { background: var(--warning-bg); border-color: #FCD34D; color: #92400E; }
.booked-confirmed { background: var(--espresso); border-color: var(--espresso); color: #fff; }
.booked-confirmed .badge { background: rgba(255, 255, 255, .15); color: var(--rose); border-color: transparent; }
.tools { display: grid; gap: .6rem; margin-bottom: 1.5rem; }
.tool { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.tool summary { list-style: none; display: flex; align-items: center; gap: .6rem; padding: 1rem; min-height: 54px; font-weight: 600; cursor: pointer; color: var(--espresso); }
.tool summary::-webkit-details-marker { display: none; }
.tool summary::after { content: '+'; margin-left: auto; font-size: 1.3rem; color: var(--terra); transition: transform .25s; }
.tool[open] summary::after { transform: rotate(45deg); }
.tool summary svg { color: var(--terra); }
.tool-body { padding: 0 1rem 1rem; display: flex; flex-direction: column; gap: .8rem; }
.tool-body p { margin: 0; }
.pt0 { padding-top: 0; }
.tool-accent { border-color: var(--terra); margin-bottom: 1rem; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.row-btns { display: flex; gap: .5rem; flex-wrap: wrap; }
.row-btns .btn { flex: 1; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .75rem; color: var(--muted); margin: .5rem 0 1rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.lg { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid var(--border); }
.lg-open { background: var(--success-bg); border-color: #86C49F; }
.lg-closed { background: repeating-linear-gradient(135deg, var(--subtle) 0 3px, #E2D7CB 3px 6px); }
.lg-pending { background: var(--warning-bg); border-color: #FCD34D; }
.lg-confirmed { background: var(--espresso); }
.week-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--card); max-height: 70vh; }
.week-grid { border-collapse: separate; border-spacing: 2px; width: 100%; min-width: 420px; }
.week-grid thead th { position: sticky; top: 0; z-index: 2; background: var(--card); padding: .4rem 0; }
.week-grid thead a { display: flex; flex-direction: column; align-items: center; text-decoration: none; font-family: var(--font-h); font-size: 1.15rem; font-weight: 700; color: var(--espresso); line-height: 1.1; }
.week-grid thead small { font-family: var(--font-b); font-size: .62rem; color: var(--muted); text-transform: uppercase; }
.week-grid thead th.today a { color: var(--terra); }
.week-grid tbody th { position: sticky; left: 0; z-index: 1; background: var(--card); font-size: .68rem; color: var(--muted); font-weight: 600; padding-right: .3rem; text-align: right; vertical-align: top; width: 40px; }
.week-grid td { padding: 0; }
.wc { display: block; width: 100%; height: 26px; border-radius: 5px; border: 1px solid transparent; cursor: pointer; font: 600 .62rem var(--font-b); text-decoration: none; overflow: hidden; white-space: nowrap; padding: 0 3px; line-height: 26px; transition: background-color .15s; }
.wc.closed { background: var(--subtle); }
.wc.open { background: #BFE3CC; border-color: #86C49F; }
a.wc.booked-pending { background: #FCD34D; color: #78350F; }
a.wc.booked-confirmed { background: var(--espresso); color: #fff; }

/* RDV list */
.rdv-top { display: flex; gap: .5rem; margin-bottom: .8rem; }
.rdv-top .btn { flex-shrink: 0; }
.search { flex: 1; min-width: 0; display: flex; align-items: center; gap: .5rem; background: var(--card); border: 1.5px solid var(--border); border-radius: 999px; padding: 0 1rem; min-height: 44px; }
.search svg { color: var(--muted); }
.search input { flex: 1; width: 100%; border: 0; background: none; font: 1rem var(--font-b); outline: none; min-width: 0; color: var(--espresso); }
.tabs { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; margin-bottom: 1rem; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { white-space: nowrap; padding: .5rem 1rem; border-radius: 999px; font-size: .82rem; font-weight: 600; text-decoration: none; color: var(--espresso-2); background: var(--card); border: 1.5px solid var(--border); transition: background-color .2s, color .2s; }
.tabs a.on { background: var(--espresso); color: #fff; border-color: var(--espresso); }
.date-sep { font-size: 1.15rem; margin: 1.3rem 0 .6rem; color: var(--espresso-2); }
.date-sep.is-today { color: var(--terra); }
.detail-meta { margin-top: .7rem; line-height: 1.7; }
.mt { margin-top: .7rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 1.2rem; margin-bottom: 1rem; }
.card-title { display: flex; align-items: center; gap: .5rem; font-size: 1.35rem; }
.card-title svg { color: var(--terra); }
.code { display: block; background: var(--subtle); padding: .7rem .9rem; border-radius: var(--r-sm); font: .75rem 'JetBrains Mono', ui-monospace, monospace; word-break: break-all; color: var(--espresso); }

/* Services admin */
.svc-admin-list { display: grid; gap: .6rem; }
.svc-item summary { gap: .8rem; }
.svc-item-main { display: flex; align-items: center; gap: .7rem; min-width: 0; flex: 1; }
.svc-item-main > span { display: flex; flex-direction: column; min-width: 0; }
.svc-thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.img-field { display: flex; gap: .8rem; align-items: flex-start; }
.img-field > img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; flex-shrink: 0; }
.img-field .form-stack { flex: 1; min-width: 0; }
.img-field input[type=file], .card input[type=file] { min-height: 0; padding: .6rem; font-size: .85rem; }
.img-preview { width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--r-md); }
.reset-form { margin: -.4rem 0 1rem; }
.mb { margin-bottom: 1rem; }
.svc-item-main small { font-weight: 500; color: var(--muted); font-size: .78rem; }
.svc-item-price { font-family: var(--font-h); font-size: 1.3rem; font-weight: 700; }
.svc-item.inactive { opacity: .6; }

/* Dialog & toast */
.sheet { border: 0; padding: 1.4rem 1.2rem; padding-bottom: max(1.4rem, env(safe-area-inset-bottom)); border-radius: var(--r-lg) var(--r-lg) 0 0; width: 100%; max-width: 520px; margin: auto auto 0; background: var(--card); box-shadow: var(--shadow-lg); color: var(--text); }
.sheet[open] { animation: sheetUp .3s var(--ease); }
.sheet::backdrop { background: rgba(44, 29, 24, .45); backdrop-filter: blur(3px); }
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100; background: var(--espresso); color: #fff; padding: .75rem 1.2rem; border-radius: 999px; font-size: .88rem; font-weight: 600; box-shadow: var(--shadow-lg); animation: fadeUp .3s var(--ease); transition: opacity .3s; }
.toast.bad { background: var(--danger); }
.toast.out { opacity: 0; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }

@media (min-width: 960px) {
  body.admin { padding-bottom: 0; padding-left: 240px; }
  .bottom-nav { display: none; }
  .side-nav { display: flex; flex-direction: column; gap: .3rem; position: fixed; left: 0; top: 0; bottom: 0; width: 240px; padding: 1.4rem 1rem; background: var(--card); border-right: 1px solid var(--border); }
  .side-brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; margin-bottom: 1.4rem; }
  .side-brand img { width: 48px; }
  .side-brand span { font-family: var(--font-h); font-size: 1.3rem; font-style: italic; font-weight: 600; color: var(--espresso); }
  .side-nav a:not(.side-brand) { display: flex; align-items: center; gap: .7rem; padding: .75rem .9rem; border-radius: var(--r-sm); text-decoration: none; color: var(--espresso-2); font-weight: 600; transition: background-color .2s; }
  .side-nav a:not(.side-brand):hover { background: var(--subtle); }
  .side-nav a.on { background: var(--rose-light); color: var(--espresso); }
  .side-site { margin-top: auto; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .quick-row { display: flex; }
  .sheet { border-radius: var(--r-lg); margin: auto; }
  .toast { bottom: 2rem; }
}
