/* Ledyn Booking — one stylesheet for the public pages, dashboard and admin.
   --brand is the business's own colour on its booking page and dashboard. */
:root {
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f6f7f9;
  --card: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --surface-3: #eef0f3;
  --input-line: #d1d5db;
  --faint: #c0c4cc;
  --on-ink: #ffffff;
  --info: #3730a3;
  --info-bg: #eef2ff;
  --bad-line: #fecaca;
  --warn-line: #fcd34d;
  color-scheme: light;
  --ledyn: #4f46e5;
  --brand: var(--ledyn);
  --ok: #047857;
  --ok-bg: #ecfdf5;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --bad: #b91c1c;
  --bad-bg: #fef2f2;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 1px 3px rgb(0 0 0 / 0.06);
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  line-height: 1.5;
}
/* Dark theme: chosen with the toggle (data-theme="dark"), or the system setting when nothing was chosen. */
:root[data-theme='dark'] {
  --ink: #e5e7eb;
  --ink-2: #cbd5e1;
  --muted: #94a3b8;
  --line: #263244;
  --bg: #0b1120;
  --card: #111827;
  --surface: #111827;
  --surface-2: #1a2436;
  --surface-3: #243046;
  --input-line: #334155;
  --faint: #475569;
  --on-ink: #0b1120;
  --info: #c7d2fe;
  --info-bg: #1e1b4b;
  --bad-line: #7f1d1d;
  --warn-line: #92400e;
  --ledyn: #818cf8;
  --ok: #6ee7b7;
  --ok-bg: #052e22;
  --warn: #fcd34d;
  --warn-bg: #2b1d05;
  --bad: #fca5a5;
  --bad-bg: #2a0f12;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --ink: #e5e7eb;
    --ink-2: #cbd5e1;
    --muted: #94a3b8;
    --line: #263244;
    --bg: #0b1120;
    --card: #111827;
    --surface: #111827;
    --surface-2: #1a2436;
    --surface-3: #243046;
    --input-line: #334155;
    --faint: #475569;
    --on-ink: #0b1120;
    --info: #c7d2fe;
    --info-bg: #1e1b4b;
    --bad-line: #7f1d1d;
    --warn-line: #92400e;
    --ledyn: #818cf8;
    --ok: #6ee7b7;
    --ok-bg: #052e22;
    --warn: #fcd34d;
    --warn-bg: #2b1d05;
    --bad: #fca5a5;
    --bad-bg: #2a0f12;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
    color-scheme: dark;
  }
}
/* Red buttons keep white text on a strong red in both themes. */
.btn-danger { --bad: #dc2626; }

/* Light/dark toggle (top right). Hidden until JavaScript can make it work. */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; flex: none; }
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle svg { width: 1.1rem; height: 1.1rem; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme='dark'] .theme-toggle .icon-sun { display: inline; }
:root[data-theme='dark'] .theme-toggle .icon-moon { display: none; }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; margin: -0.75rem 0 0.75rem; }
.biz-actions { display: flex; align-items: center; gap: 0.5rem; }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
body > main { flex: 1; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5rem; }
h1 { font-size: 1.75rem; }
.h2 { font-size: 1.4rem; }
.h3 { font-size: 1.1rem; margin-top: 1.75rem; }
.h4 { font-size: 0.95rem; margin-top: 1.25rem; }
p { margin: 0 0 1rem; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.block { display: block; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.cap::first-letter { text-transform: uppercase; }
.grow { flex: 1; min-width: 0; }
.lead { font-size: 1.125rem; }
.eyebrow { display: inline-block; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.25rem; }
.danger-text { color: var(--bad); }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 0.25rem 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 1rem; }
.narrow { max-width: 640px; }
.center-page { padding: 4rem 1rem; text-align: center; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; border: 1px solid var(--ink); background: var(--ink); color: var(--on-ink); font: inherit; font-weight: 600; font-size: 0.95rem; padding: 0.55rem 1rem; border-radius: 10px; cursor: pointer; text-decoration: none; transition: filter 0.15s, background 0.15s; }
.btn:hover { filter: brightness(1.15); text-decoration: none; }
.btn-sm { font-size: 0.85rem; padding: 0.35rem 0.7rem; border-radius: 8px; }
.btn-lg { font-size: 1.05rem; padding: 0.75rem 1.4rem; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); filter: none; }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.disabled { opacity: 0.35; pointer-events: none; }
.link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* Cards, forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.callout { border-left: 4px solid var(--brand); }
.callout.success { border-left-color: var(--ok); background: var(--ok-bg); }
.form { display: flex; flex-direction: column; gap: 1rem; }
.form > .card { margin: 0; }
.field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; font-weight: 500; border: 0; padding: 0; margin: 0; }
.field > span, .field > legend { color: var(--ink-2); }
.field small { font-weight: 400; }
input, select, textarea { font: inherit; font-size: 0.95rem; color: var(--ink); background: var(--surface); border: 1px solid var(--input-line); border-radius: 8px; padding: 0.5rem 0.65rem; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
input[type='checkbox'] { width: auto; accent-color: var(--brand); }
input[type='color'] { padding: 0.15rem; height: 2.5rem; width: 4rem; }
input[type='file'] { padding: 0.4rem; }
.check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-top: 0.4rem; }
.row-2, .row-3 { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
.row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-actions { display: flex; gap: 0.5rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 10rem; }
.inline-form.search { margin-bottom: 1rem; max-width: 28rem; }
.prefixed { display: flex; align-items: stretch; }
.prefixed span { display: flex; align-items: center; padding: 0 0.6rem; background: var(--surface-2); border: 1px solid var(--input-line); border-right: 0; border-radius: 8px 0 0 8px; color: var(--muted); font-weight: 400; white-space: nowrap; }
.prefixed input { border-radius: 0 8px 8px 0; }
.preview { max-width: 200px; border-radius: 8px; border: 1px solid var(--line); }
.danger-zone { display: flex; gap: 0.75rem; align-items: center; margin-top: 1rem; }
.errors { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad-line); border-radius: 10px; padding: 0.75rem 1rem; margin-bottom: 1rem; }
.errors ul { margin: 0; padding-left: 1.2rem; }
.flash-wrap { max-width: 1080px; margin: 1rem auto 0; padding: 0 1rem; }
.main .flash-wrap { padding: 0; margin: 0 0 1rem; max-width: none; }
.flash { border-radius: 10px; padding: 0.7rem 1rem; margin-bottom: 0.5rem; background: var(--info-bg); color: var(--info); }
.flash-success { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--bad-bg); color: var(--bad); }

/* Tables, pills */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); margin-bottom: 1rem; }
.table-wrap.flat { border: 0; box-shadow: none; margin: 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-2); }
th, td { padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.empty { text-align: center; color: var(--muted); padding: 2rem; }
td.actions { white-space: nowrap; text-align: right; }
td.actions form { display: inline-block; margin-left: 0.25rem; }
tr.inactive td, .inactive { opacity: 0.6; }
.pill { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 99px; font-size: 0.75rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); }
.pill-confirmed { background: var(--ok-bg); color: var(--ok); }
.pill-pending { background: var(--warn-bg); color: var(--warn); }
.pill-cancelled { background: var(--bad-bg); color: var(--bad); }
.pill-completed { background: var(--info-bg); color: var(--info); }
.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.chip { padding: 0.35rem 0.8rem; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink-2); font-size: 0.85rem; }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.chip:hover { text-decoration: none; }
.pager { display: flex; gap: 0.5rem; justify-content: space-between; }

/* Logo */
.logo { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--ink); font-size: 1.05rem; }
.logo:hover { text-decoration: none; }
.logo-mark { color: var(--ledyn); flex: none; }
.logo-text strong { font-weight: 700; }
/* Language dropdown (<details>, so it works without JavaScript). */
.lang-menu { position: relative; }
.lang-menu summary { display: inline-flex; align-items: center; gap: 0.35rem; height: 2.25rem; padding: 0 0.6rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink-2); font-size: 0.85rem; font-weight: 600; cursor: pointer; list-style: none; user-select: none; }
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover { background: var(--surface-2); }
.lang-menu summary svg { width: 1rem; height: 1rem; }
.lang-menu summary .chevron { width: 0.85rem; height: 0.85rem; transition: transform 0.15s; }
.lang-menu[open] summary .chevron { transform: rotate(180deg); }
.lang-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 11rem; margin: 0; padding: 0.3rem; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.12); }
.lang-list a { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0.65rem; border-radius: 7px; color: var(--ink); font-size: 0.9rem; }
.lang-list a:hover { background: var(--surface-2); text-decoration: none; }
.lang-list a.active { font-weight: 600; color: var(--brand); }
.lang-menu.up .lang-list { top: auto; bottom: calc(100% + 6px); right: auto; left: 0; }

/* Public site */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.nav-actions { display: flex; align-items: center; gap: 0.5rem; }
.hero { background: linear-gradient(180deg, var(--surface), var(--bg)); padding: 5rem 0 3rem; }
.hero-inner { max-width: 760px; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.02em; }
.hero-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; padding-bottom: 4rem; }
.feature h3 { font-size: 1rem; }
.feature p { margin: 0; font-size: 0.92rem; }
.auth { display: flex; justify-content: center; padding: 3rem 1rem; }
.auth-card { width: 100%; max-width: 440px; padding: 2rem; }
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 1.25rem 0; font-size: 0.85rem; color: var(--muted); }
.site-footer.slim { background: transparent; }
.footer-row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* Booking page */
.biz-header { background: var(--surface); border-bottom: 1px solid var(--line); border-top: 4px solid var(--brand); }
.biz-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1rem; padding-bottom: 1rem; }
.biz-id { display: flex; align-items: center; gap: 0.8rem; color: var(--ink); }
.biz-id:hover { text-decoration: none; }
.biz-name { font-weight: 700; font-size: 1.2rem; }
.biz-logo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; border: 1px solid var(--line); }
.biz-logo.lg { width: 56px; height: 56px; }
.biz-initial { display: inline-flex; align-items: center; justify-content: center; background: var(--brand); color: #fff; font-weight: 700; border: 0; }
.biz-logo.lg.biz-initial { font-size: 1.4rem; }
.booking { padding-top: 1.5rem; padding-bottom: 3rem; }
.steps { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; list-style: none; padding: 0; margin: 0 0 1.5rem; font-size: 0.85rem; color: var(--muted); }
.steps li { display: flex; align-items: center; gap: 0.4rem; }
.steps li span { display: inline-flex; width: 1.6rem; height: 1.6rem; border-radius: 50%; align-items: center; justify-content: center; background: var(--line); color: var(--muted); font-weight: 600; font-size: 0.78rem; }
.steps li.current { color: var(--ink); font-weight: 600; }
.steps li.current span, .steps li.done span { background: var(--brand); color: #fff; }
.service-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); align-items: start; }
.service-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; color: var(--ink); transition: border-color 0.15s, transform 0.15s; }
.service-card:hover { border-color: var(--brand); text-decoration: none; transform: translateY(-1px); }
.service-card img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.service-body { display: flex; flex-direction: column; gap: 0.3rem; padding: 1rem; }
.service-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 0.25rem; }
.price { font-weight: 700; color: var(--brand); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chosen { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.book-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.calendar { margin: 0; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.25rem; text-align: center; }
.cal-wd { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; padding: 0.25rem 0; }
.cal-day { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 0.9rem; color: var(--faint); }
.cal-day.open { color: var(--ink); font-weight: 600; background: color-mix(in srgb, var(--brand) 8%, transparent); }
.cal-day.open:hover { background: color-mix(in srgb, var(--brand) 18%, transparent); text-decoration: none; }
.cal-day.today { outline: 1px solid var(--line); }
.cal-day.selected { background: var(--brand); color: #fff; }
.times .card { margin: 0; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 0.5rem; }
.slot { display: block; text-align: center; padding: 0.55rem 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.slot:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.slot.selected { background: var(--brand); border-color: var(--brand); color: #fff; }
.details { margin-top: 1.5rem; scroll-margin-top: 1rem; }
.confirm-card { text-align: center; padding: 2rem; }
.confirm-icon { width: 4rem; height: 4rem; border-radius: 50%; margin: 0 auto 1rem; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.summary { text-align: left; margin: 1.25rem 0; border-top: 1px solid var(--line); }
.summary div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }

/* App shell (dashboard + admin) */
body.app { display: block; }
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin .sidebar { background: #0f172a; color: #e5e7eb; }
.admin .sidebar .logo, .admin .side-nav a { color: #e5e7eb; }
.admin .side-nav a.active { background: #1e293b; color: #fff; }
.admin .eyebrow { color: #94a3b8; }
.biz-card { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem; border: 1px solid var(--line); border-radius: 10px; }
.biz-meta { display: flex; flex-direction: column; min-width: 0; }
.biz-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav { display: flex; flex-direction: column; gap: 0.15rem; }
.side-nav a { padding: 0.5rem 0.7rem; border-radius: 8px; color: var(--ink-2); font-size: 0.92rem; font-weight: 500; }
.side-nav a:hover { background: var(--surface-2); text-decoration: none; }
.side-nav a.active { background: color-mix(in srgb, var(--brand) 16%, var(--surface)); color: var(--brand); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.6rem; align-items: flex-start; }
.main { padding: 2rem; max-width: 1100px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head p { margin: 0.25rem 0 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 0.5rem; }
.stat { display: flex; flex-direction: column; gap: 0.25rem; color: var(--ink); }
.stat strong { font-size: 1.8rem; }
a.stat:hover { text-decoration: none; border-color: var(--brand); }
.stat.attention { border-color: var(--warn-line); background: var(--warn-bg); }
.copy-link { display: flex; gap: 0.4rem; min-width: min(100%, 420px); }
.copy-link input { font-size: 0.85rem; background: var(--surface-2); }
.activity { list-style: none; padding: 0.5rem 1.25rem; }
.activity li { padding: 0.45rem 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.activity li:last-child { border-bottom: 0; }
.service-list { display: flex; flex-direction: column; gap: 0.5rem; }
.service-row { display: flex; align-items: center; gap: 1rem; margin: 0; padding: 0.8rem 1rem; }
.service-row img, .thumb-empty { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-2); }
.hours-day { display: grid; grid-template-columns: 180px 1fr; gap: 0.75rem; align-items: start; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.hours-day:last-of-type { border-bottom: 0; }
.windows { display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-start; }
.window { display: flex; align-items: center; gap: 0.4rem; }
.window input { width: 8rem; }
.logo-field { display: flex; gap: 1rem; align-items: center; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.cols > .card { margin: 0; }
[hidden] { display: none !important; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .main { padding: 1.25rem 1rem; }
  .book-grid, .cols { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .hours-day { grid-template-columns: 1fr; }
  .nav .btn-ghost { display: none; }
  .copy-link { min-width: 100%; }
}
