/*
 * Jidokap design system.
 * Light "paper" theme by default (warm bg, near-black ink); dark theme follows the OS and uses the
 * jidokap.com monochrome with the violet accent of the Jidokap apps. Fonts are self-hosted (CSP: 'self').
 * Contrast (WCAG AA) is documented per pair in odd/tasks/jidokap-freelancer-v2.md (V06).
 */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/fonts/inter-latin-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/fonts/fraunces-latin-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light dark;
  /* Surfaces and text */
  --bg: #f6f3ec;
  --surface: #fdfbf6;
  --surface-2: #ece8dd;
  --text: #1a1815;
  --muted: #5f594e;
  --border: #d9d3c4;
  --border-strong: #8a8374;
  /* Actions: ink buttons, blue links and focus (the app's #2563eb, darkened to pass AA on paper) */
  --primary: #1a1a1a;
  --primary-hover: #34312c;
  --primary-text: #fdfbf6;
  --link: #1f4fd1;
  --link-hover: #173a9c;
  --focus: #1f4fd1;
  --input-bg: #fdfbf6;
  /* Status */
  --danger: #963a3a;
  --danger-solid: #a8332f;
  --danger-bg: #f6e1de;
  --ok: #2f6b3f;
  --ok-bg: #e2eddc;
  --warn: #7a5000;
  --warn-bg: #f6e7c1;
  --info: #1f4fd1;
  --info-bg: #e3e9fa;
  --neutral: #4a453c;
  --neutral-bg: #ebe7dc;
  /* Dark chrome (sidebar) is the same near-black in both themes: the jidokap.com identity */
  --side-bg: #161616;
  --side-text: #d4d4d4;
  --side-muted: #9a9a9a;
  --side-hover: #232323;
  --side-line: #2c2c2c;
  --side-accent: #ffffff;
  /* Shape, elevation, spacing, type */
  --radius: 10px;
  --radius-sm: 5px;
  --shadow-1: 0 1px 2px rgba(26, 24, 21, 0.06);
  --shadow-2: 0 8px 28px rgba(26, 24, 21, 0.16);
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s6: 1.5rem;
  --s8: 2rem;
  --s12: 3rem;
  --s16: 4rem;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --fs-0: 0.8125rem;
  --fs-1: 0.9375rem;
  --fs-2: 1rem;
  --fs-3: 1.25rem;
  --fs-4: 1.75rem;
  --fs-5: clamp(2rem, 1.4rem + 2.6vw, 3rem);
  --sidebar-w: 15rem;
  --tabbar-h: 3.5rem;
  /* Calendar */
  --st-held-bg: #f6e7c1; --st-held-fg: #5c3d00; --st-held-bar: #c58a00;
  --st-confirmed-bg: #e2eddc; --st-confirmed-fg: #234f2f; --st-confirmed-bar: #3f8a54;
  --st-completed-bg: #ebe7dc; --st-completed-fg: #3d3930; --st-completed-bar: #8a8374;
  --st-cancelled-bg: #f6e1de; --st-cancelled-fg: #7a2d2d; --st-cancelled-bar: #c25a5a;
  --cal-closed: #ece8dd; --cal-open: #fdfbf6; --cal-line: #ddd7c8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --surface: #141414;
    --surface-2: #1c1c1c;
    --text: #d4d4d4;
    --muted: #a0a0a0;
    --border: #2a2a2a;
    --border-strong: #6e6e6e;
    --primary: #ececec;
    --primary-hover: #ffffff;
    --primary-text: #0a0a0a;
    --link: #a194ff;
    --link-hover: #d1cbff;
    --focus: #a194ff;
    --input-bg: #0f0f0f;
    --danger: #e08a8a;
    --danger-solid: #e08a8a;
    --danger-bg: #2d1717;
    --ok: #8fd1a0;
    --ok-bg: #15261b;
    --warn: #e5b857;
    --warn-bg: #2b2210;
    --info: #c4bcff;
    --info-bg: #221d3f;
    --neutral: #b5b5b5;
    --neutral-bg: #222222;
    --side-bg: #0f0f0f;
    --side-hover: #1a1a1a;
    --side-line: #242424;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-2: 0 8px 28px rgba(0, 0, 0, 0.6);
    --st-held-bg: #2b2210; --st-held-fg: #f0cd7c; --st-held-bar: #d7a23a;
    --st-confirmed-bg: #15261b; --st-confirmed-fg: #a6dbb4; --st-confirmed-bar: #6ba87a;
    --st-completed-bg: #222222; --st-completed-fg: #c4c4c4; --st-completed-bar: #7a7a7a;
    --st-cancelled-bg: #2d1717; --st-cancelled-fg: #eea8a8; --st-cancelled-bar: #d27676;
    --cal-closed: #0e0e0e; --cal-open: #141414; --cal-line: #262626;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: var(--fs-2)/1.55 var(--font-ui); background: var(--bg); color: var(--text); overflow-wrap: break-word;
  font-feature-settings: "cv11", "ss03"; -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: 0.18em; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
.skip { position: absolute; left: var(--s2); top: -4rem; background: var(--surface); color: var(--text); padding: var(--s2) var(--s3); z-index: 30; border-radius: var(--radius-sm); }
.skip:focus { top: var(--s2); }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Brand: "Jidokap." wordmark with the 自 mark. The period is the signature detail. */
.brand { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 700; letter-spacing: -0.02em; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand .mark { width: 1.5rem; height: 1.5rem; border-radius: 4px; flex: none; }
.brand .dot { color: var(--muted); }
.brand small { font-size: var(--fs-0); font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 0.1rem; }
.eyebrow { margin: 0 0 var(--s2); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* Public / anonymous pages */
body.plain { min-height: 100vh; display: flex; flex-direction: column; }
.site-header { border-bottom: 1px solid var(--border); }
.site-header .inner { max-width: 64rem; margin: 0 auto; padding: var(--s3) var(--s4); display: flex; align-items: center; justify-content: space-between; gap: var(--s4); }
.site-header nav { display: flex; gap: var(--s4); flex-wrap: wrap; font-size: var(--fs-1); }
.site-header nav a { color: var(--text); text-decoration: none; font-weight: 500; }
.site-header nav a:hover { text-decoration: underline; }
body.plain main { flex: 1; width: 100%; max-width: 40rem; margin: 0 auto; padding: var(--s6) var(--s4); }
@media (min-width: 640px) { body.plain main { padding-top: var(--s8); } }
.site-footer { border-top: 1px solid var(--border); margin-top: var(--s8); }
.site-footer .inner { max-width: 64rem; margin: 0 auto; padding: var(--s6) var(--s4); display: grid; gap: var(--s2); color: var(--muted); font-size: var(--fs-0); }
.site-footer .tagline { font-family: var(--font-display); font-size: var(--fs-2); color: var(--text); margin: 0; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--muted); }
.panel-foot { margin-top: var(--s12); padding-top: var(--s4); border-top: 1px solid var(--border); color: var(--muted); font-size: var(--fs-0); }
.panel-foot p { margin: 0; }
.panel-foot a { color: var(--muted); }

/* Panel shell: topbar + bottom tab bar on phones, dark sidebar from 900px */
body.panel { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
.shell { min-height: 100vh; }
.sidebar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3); padding: var(--s2) var(--s4); background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar form { margin: 0; }
.topbar .brand { font-size: var(--fs-1); }
.business { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.panel main { max-width: 64rem; margin: 0 auto; padding: var(--s4); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar > ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); }
.tabbar li { position: relative; }
.tabbar a, .tabbar summary {
  display: flex; align-items: center; justify-content: center; gap: var(--s1); min-height: var(--tabbar-h); padding: 0 var(--s1);
  font-size: var(--fs-0); font-weight: 600; color: var(--muted); text-decoration: none; cursor: pointer; list-style: none;
}
.tabbar summary::-webkit-details-marker { display: none; }
.tabbar a[aria-current="page"] { color: var(--text); box-shadow: inset 0 3px 0 var(--text); }
.morelist {
  position: absolute; right: var(--s2); bottom: calc(var(--tabbar-h) + var(--s2)); min-width: 13rem; margin: 0; padding: var(--s1);
  list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-2);
}
.morelist a { justify-content: flex-start; padding: 0 var(--s3); font-size: var(--fs-2); box-shadow: none !important; color: var(--text); }
.morelist a[aria-current="page"] { font-weight: 700; }
.count {
  display: inline-block; min-width: 1.25rem; padding: 0 0.35rem; border-radius: 999px; background: var(--danger-solid); color: var(--primary-text);
  font-size: 0.75rem; font-weight: 700; line-height: 1.25rem; text-align: center;
}
@media (min-width: 900px) {
  body.panel { padding-bottom: 0; }
  .shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; }
  .sidebar {
    display: block; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: var(--s6) var(--s3);
    background: var(--side-bg); border-right: 1px solid var(--side-line);
  }
  .sidebar .brand { display: flex; padding: 0 var(--s3) var(--s6); font-size: 1.25rem; color: #fff; }
  .sidebar .brand .dot, .sidebar .brand small { color: var(--side-muted); }
  .navlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
  .navlist a {
    display: flex; align-items: center; justify-content: space-between; min-height: 38px; padding: 0 var(--s3);
    color: var(--side-text); text-decoration: none; border-radius: var(--radius-sm); font-size: var(--fs-1); border-left: 2px solid transparent;
  }
  .navlist a:hover { background: var(--side-hover); color: #fff; }
  .navlist a[aria-current="page"] { background: var(--side-hover); color: #fff; font-weight: 600; border-left-color: var(--side-accent); }
  .sidebar :focus-visible { outline-color: #fff; }
  .tabbar { display: none; }
  .topbar { justify-content: flex-end; padding: var(--s3) var(--s8); background: transparent; }
  .topbar .brand { display: none; }
  .business { margin-right: auto; }
  body.panel main { padding: var(--s4) var(--s8) var(--s8); }
}

/* Typography and surfaces */
h1, h2, h3 { text-wrap: balance; }
h1 { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-4); line-height: 1.15; letter-spacing: -0.015em; margin: var(--s2) 0 var(--s4); }
h2 { font-size: 1.0625rem; line-height: 1.3; letter-spacing: -0.01em; margin: 0 0 var(--s2); }
h3 { font-size: var(--fs-2); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s4); box-shadow: var(--shadow-1); }
section.card { margin: var(--s4) 0; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-1); }
.stack > * + * { margin-top: var(--s3); }
code { font: 0.875em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 3px; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s6) 0; }

/* Forms */
label { display: block; font-weight: 600; font-size: var(--fs-1); margin: var(--s3) 0 var(--s1); }
input, textarea, select {
  width: 100%; min-height: 44px; padding: var(--s2) var(--s3); font: inherit; color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--input-bg);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline-offset: 0; border-color: var(--focus); }
textarea { min-height: 6rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); margin: var(--s3) 0 0; padding: var(--s2) var(--s3); }
legend { font-weight: 600; padding: 0 var(--s1); }
label.check { display: flex; align-items: center; gap: var(--s2); margin: var(--s1) var(--s3) var(--s1) 0; font-weight: 400; min-height: 44px; }
label.check input { width: auto; min-height: 0; margin: 0; accent-color: var(--primary); }
.help { color: var(--muted); font-size: var(--fs-1); margin: var(--s1) 0 0; }
.error-text { color: var(--danger); font-size: var(--fs-1); }

/* Buttons: primary (ink), secondary (outline), danger, ghost/link */
button, .button {
  display: inline-block; min-height: 44px; padding: var(--s2) var(--s4); margin-top: var(--s4); font: inherit; font-weight: 600; font-size: var(--fs-1);
  color: var(--primary-text); background: var(--primary); border: 1px solid var(--primary); border-radius: var(--radius-sm); cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s;
}
button:hover, .button:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-text); }
.button { text-decoration: none; line-height: 1.7; text-align: center; }
.button.secondary, button.secondary { background: transparent; color: var(--text); border-color: var(--border-strong); }
.button.secondary:hover, button.secondary:hover { background: var(--surface-2); color: var(--text); border-color: var(--text); }
button.danger, .button.danger { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
button.danger:hover, .button.danger:hover { filter: brightness(0.92); background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
@media (prefers-color-scheme: dark) { button.danger, .button.danger, button.danger:hover, .button.danger:hover { color: #0a0a0a; } }
button.ghost { background: transparent; border-color: transparent; color: var(--link); }
button.ghost:hover { background: var(--surface-2); color: var(--link-hover); border-color: transparent; }
button.link { background: none; border: 0; color: var(--link); padding: 0; margin: 0; min-height: 0; text-decoration: underline; font-weight: 500; }
button.link:hover { background: none; color: var(--link-hover); }
button:disabled, .button[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }

/* Feedback: flash messages and chips */
.alert { padding: var(--s3) var(--s4); border-radius: var(--radius-sm); margin: var(--s3) 0; border-left: 3px solid currentColor; }
.alert p { margin: 0; }
.alert a { color: inherit; font-weight: 600; }
.alert.error { background: var(--danger-bg); color: var(--danger); }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.badge {
  display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em; line-height: 1.5;
  background: var(--neutral-bg); color: var(--neutral); border: 1px solid transparent; vertical-align: 0.05em;
}
/* booking: held / confirmed / completed / cancelled; payment: pending / reported_by_client / transfer_detected / needs_review / paid / verified / failed; subscription */
.badge.held, .badge.pending, .badge.needs_review, .badge.reported_by_client, .badge.past_due, .badge.requested, .badge.proposed { background: var(--warn-bg); color: var(--warn); }
.badge.confirmed, .badge.paid, .badge.verified, .badge.trialing, .badge.active, .badge.approved, .badge.published, .badge.ready, .badge.indexed { background: var(--ok-bg); color: var(--ok); }
.badge.transfer_detected, .badge.new, .badge.open, .badge.processing { background: var(--info-bg); color: var(--info); }
.badge.completed, .badge.closed, .badge.hidden, .badge.canceled_sub { background: var(--neutral-bg); color: var(--neutral); }
.badge.cancelled, .badge.expired, .badge.no_show, .badge.failed, .badge.rejected, .badge.refunded, .badge.suspended, .badge.blocked, .badge.error { background: var(--danger-bg); color: var(--danger); }

/* Lists and tables */
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s3); }
.actions { display: flex; gap: var(--s4); align-items: center; flex-wrap: wrap; margin-top: var(--s2); }
.actions form { margin: 0; }
.quick-actions { display: grid; grid-template-columns: 1fr; gap: var(--s3); margin: var(--s3) 0 var(--s4); }
.quick-actions .button { margin: 0; width: 100%; text-align: center; }
@media (min-width: 560px) { .quick-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.search { margin: var(--s4) 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: var(--s3); border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
.row-error { background: var(--danger-bg); }
/* Tables become stacked cards on phones (cells carry data-label) */
@media (max-width: 639px) {
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.responsive tr { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); }
  table.responsive tbody tr:last-child { border-bottom: 0; }
  table.responsive td { display: grid; grid-template-columns: 7.5rem 1fr; gap: var(--s2); padding: var(--s1) 0; border: 0; }
  table.responsive td::before { content: attr(data-label); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding-top: 0.2em; }
}
.day-row { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; padding: 0.35rem 0; border-bottom: 1px solid var(--border); }
form.inline { display: inline; margin: 0; }
.slots { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s2) 0; }
.slots label.check { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 var(--s3); margin: 0; background: var(--surface); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--s1) var(--s4); margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
@media (max-width: 420px) { dl.facts { grid-template-columns: 1fr; } dl.facts dd { margin-bottom: var(--s2); } }

/* Confirmation via <details> (works without JavaScript) */
details.confirm { margin: var(--s3) 0; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 var(--s3); background: var(--surface); }
details.confirm > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; color: var(--link); }
details.confirm.danger > summary { color: var(--danger); }
details.confirm[open] { padding-bottom: var(--s3); }

/* Dashboard */
.grid { display: grid; gap: var(--s4); }
@media (min-width: 720px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }
.grid > section.card { margin: 0; }
.metric { font-family: var(--font-display); font-size: 1.625rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; margin: var(--s1) 0; }
.copy-row { display: flex; gap: var(--s2); align-items: stretch; }
.copy-row input { flex: 1; min-width: 0; }
.copy-row button { margin-top: 0; }
.agenda { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.agenda li { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); align-items: baseline; padding: var(--s2) 0; border-bottom: 1px solid var(--border); }
.agenda li:last-child { border-bottom: 0; }
.agenda .when { font-weight: 600; min-width: 8.5rem; font-variant-numeric: tabular-nums; }

/* WhatsApp simulator */
.sim-log { min-height: 14rem; max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: var(--s2); padding: var(--s1) 0; }
.sim-msg { max-width: 85%; padding: var(--s2) var(--s3); border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); overflow-wrap: anywhere; }
.sim-msg p { margin: 0.1rem 0; white-space: pre-wrap; }
.sim-in { align-self: flex-end; background: var(--ok-bg); color: var(--ok); }
.sim-out { align-self: flex-start; }
.sim-options { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.4rem; }
.sim-form { display: flex; gap: var(--s2); margin-top: var(--s2); }
.sim-form input { flex: 1; }

/* Calendar. Positions and lengths come from classes in /css/calendar-grid.css (no inline styles under CSP). */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4); }
.cal-toolbar .button { margin: 0; padding: var(--s1) var(--s3); min-height: 40px; }
.cal-nav, .cal-views { display: flex; gap: var(--s2); }
.cal-title { flex: 1; min-width: 10rem; margin: 0; font-weight: 700; font-size: 1.125rem; text-transform: capitalize; }
.cal-meta { margin: var(--s2) 0 var(--s3); }
.st-held { background: var(--st-held-bg); color: var(--st-held-fg); border-left: 3px solid var(--st-held-bar); }
.st-confirmed { background: var(--st-confirmed-bg); color: var(--st-confirmed-fg); border-left: 3px solid var(--st-confirmed-bar); }
.st-completed { background: var(--st-completed-bg); color: var(--st-completed-fg); border-left: 3px solid var(--st-completed-bar); }
.st-cancelled, .st-expired, .st-no_show {
  background: var(--st-cancelled-bg); color: var(--st-cancelled-fg); border-left: 3px solid var(--st-cancelled-bar); text-decoration: line-through;
}

.cal-week { display: flex; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.cal-hours { flex: 0 0 3rem; border-right: 1px solid var(--cal-line); }
.cal-hour { height: var(--hour-h); padding: 0 var(--s1); font-size: 0.75rem; color: var(--muted); text-align: right; transform: translateY(-0.5em); }
.cal-head { height: 3rem; display: flex; flex-direction: column; justify-content: center; padding: 0 var(--s2); border-bottom: 1px solid var(--cal-line); font-size: 0.875rem; }
.cal-hours .cal-head { border-bottom-color: transparent; }
.cal-day { flex: 1 1 0; min-width: 0; border-right: 1px solid var(--cal-line); }
.cal-day:last-child { border-right: 0; }
.cal-day.today .cal-head { background: var(--surface-2); font-weight: 700; }
.cal-col {
  position: relative; background-color: var(--cal-closed);
  background-image: linear-gradient(to bottom, var(--cal-line) 1px, transparent 1px); background-size: 100% var(--hour-h);
}
.cal-open { position: absolute; left: 0; right: 0; background: var(--cal-open); background-image: linear-gradient(to bottom, var(--cal-line) 1px, transparent 1px); background-size: 100% var(--hour-h); }
.cal-break, .cal-block {
  position: absolute; left: 0; right: 0; overflow: hidden; font-size: 0.6875rem; color: var(--muted);
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--cal-line) 6px 8px);
}
.cal-break span, .cal-block span { padding: 0 var(--s1); }
.cal-ev {
  position: absolute; overflow: hidden; padding: 1px var(--s1); font-size: 0.75rem; line-height: 1.25; text-decoration: none; border-radius: 4px;
  min-width: 0; white-space: nowrap; text-overflow: ellipsis; z-index: 2;
}
.cal-ev.st-cancelled, .cal-ev.st-expired, .cal-ev.st-no_show { z-index: 1; opacity: 0.85; }
.cal-ev:hover { filter: brightness(0.96); }
.cal-svc { display: none; }
.cal-day.today { background: transparent; }

.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.cal-dow { padding: var(--s1); text-align: center; font-size: 0.75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; border-bottom: 1px solid var(--cal-line); }
.cal-cell { position: relative; min-height: 3.5rem; padding: var(--s1); border-right: 1px solid var(--cal-line); border-bottom: 1px solid var(--cal-line); min-width: 0; }
.cal-cell:nth-child(7n + 7) { border-right: 0; }
.cal-cell.out { background: var(--cal-closed); color: var(--muted); }
.cal-cell.today .cal-num { background: var(--primary); color: var(--primary-text); border-radius: 999px; }
.cal-num { display: inline-block; min-width: 1.75rem; text-align: center; font-weight: 600; color: inherit; text-decoration: none; line-height: 1.75rem; }
.cal-count { position: absolute; top: var(--s1); right: var(--s1); min-width: 1.25rem; padding: 0 0.3rem; border-radius: 999px; background: var(--primary); color: var(--primary-text); font-size: 0.6875rem; font-weight: 700; text-align: center; }
.cal-mini { display: none; list-style: none; margin: var(--s1) 0 0; padding: 0; font-size: 0.75rem; }
.cal-mini a { display: block; padding: 1px var(--s1); margin-bottom: 2px; border-radius: 4px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cal-agenda { display: none; list-style: none; margin: 0; padding: 0; gap: var(--s3); }
.cal-agenda-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); text-transform: capitalize; }
.cal-agenda .today { border-color: var(--primary); }
.cal-legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); list-style: none; margin: var(--s4) 0 0; padding: 0; color: var(--muted); }
.swatch { display: inline-block; width: 0.875rem; height: 0.875rem; vertical-align: -2px; border-radius: 3px; border: 1px solid var(--border); }
.cal-open-sw { background: var(--cal-open); }
.cal-break-sw { background-image: repeating-linear-gradient(135deg, transparent 0 3px, var(--cal-line) 3px 5px); }

/* Phones: the week grid becomes a per-day agenda; the day grid stays a single column. */
@media (max-width: 719px) {
  .cal-week.cal-semana { display: none; }
  .cal-agenda { display: grid; }
}
@media (min-width: 720px) {
  .cal-svc { display: inline; }
  .cal-mini { display: block; }
  .cal-cell { min-height: 6.5rem; }
}



/* Auth pages: form first (a11y, phones), brand pitch beside it on desktop */
body.plain main:has(.auth), body.plain main:has(.profile) { max-width: 64rem; }
.auth { display: grid; gap: var(--s6); align-items: start; }
.auth-form { max-width: 28rem; width: 100%; }
.auth-form h1 { font-size: var(--fs-4); }
.auth-form .card { padding: var(--s6); }
.auth-pitch { background: var(--side-bg); color: var(--side-text); border: 1px solid var(--side-line); border-radius: var(--radius); padding: var(--s6); }
.auth-pitch .eyebrow { color: var(--side-muted); }
.auth-pitch .tagline { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-4); line-height: 1.15; letter-spacing: -0.015em; color: #fff; margin: 0 0 var(--s4); }
.auth-pitch ul { list-style: none; margin: 0 0 var(--s4); padding: 0; display: grid; gap: var(--s3); }
.auth-pitch li { padding-left: 1.5rem; position: relative; font-size: var(--fs-1); }
.auth-pitch li::before { content: "→"; position: absolute; left: 0; color: var(--side-muted); }
.auth-pitch .fine { margin: 0; font-size: var(--fs-0); color: var(--side-muted); padding-top: var(--s3); border-top: 1px solid var(--side-line); }
@media (min-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr) minmax(0, 26rem); gap: var(--s12); padding-top: var(--s6); }
  .auth-pitch { order: -1; padding: var(--s8); align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
  .auth-form { justify-self: end; }
}

/* Public profile (what clients see): editorial hero, ruled service list, quoted reviews */
.profile { max-width: none; margin: 0 auto; }
.profile-head { display: grid; gap: var(--s4); padding: var(--s6) 0 var(--s8); border-bottom: 1px solid var(--border); }
.profile h1 { font-size: var(--fs-5); line-height: 1.05; letter-spacing: -0.025em; margin: 0; }
.profile .bio { font-size: 1.125rem; max-width: 60ch; margin: 0; }
.profile h2 { font-size: var(--fs-0); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--s4); }
.profile h3 { margin: 0 0 var(--s1); font-size: 1.0625rem; letter-spacing: -0.01em; }
.profile .bio, .review-text { white-space: pre-line; }
.profile section { padding: var(--s8) 0 0; }
.profile .book { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s4) var(--s6); box-shadow: var(--shadow-1); }
.profile .book p { margin: 0; }
.profile .book .button { margin: var(--s2) 0 0; }
.rating-line { margin: var(--s2) 0 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--s2); }
.rating-avg { font-family: var(--font-display); font-size: 2rem; font-weight: 600; line-height: 1; }
.stars { color: #9a6400; letter-spacing: 0.08em; }
@media (prefers-color-scheme: dark) { .stars { color: #e5b857; } }
.profile .list { gap: 0; }
.profile .list > li.card { border: 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent; box-shadow: none; padding: var(--s4) 0; }
.profile .list > li.card:last-child { border-bottom: 1px solid var(--border); }
.profile .list > li.card:not(.review) { display: grid; grid-template-columns: 1fr; gap: var(--s1) var(--s6); }
.profile .list > li.card p { margin: 0; }
.profile .svc-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--s1) var(--s3); }
.profile .svc-meta strong { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; }
.profile .svc-meta .badge { background: transparent; border-color: var(--border-strong); color: var(--muted); }
.review-head { margin: 0 0 var(--s2); display: flex; flex-wrap: wrap; gap: var(--s2); align-items: baseline; }
.review-text { margin: 0; }
.review .reply { margin-top: var(--s3); padding: var(--s2) var(--s3); border-left: 3px solid var(--border-strong); background: var(--surface-2); border-radius: var(--radius-sm); }
.review .reply p { margin: 0; }
.profile .review-text { font-family: var(--font-display); font-size: 1.0625rem; max-width: 62ch; }
.button.wa { display: block; }
@media (min-width: 760px) {
  .profile-head { grid-template-columns: minmax(0, 1fr) 19rem; align-items: end; gap: var(--s8) var(--s12); }
  .profile-head > * { grid-column: 1; }
  .profile-head .book { grid-column: 2; grid-row: 1 / span 3; align-self: start; }
  .profile .list > li.card:not(.review) { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; }
  .profile .svc-meta { justify-content: flex-end; grid-column: 2; grid-row: 1 / span 2; }
  .button.wa { display: inline-block; }
}

/* Client area (phone-verified visitors) */
.client-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s4); margin-bottom: var(--s4); padding-bottom: var(--s3); border-bottom: 1px solid var(--border); }
.client-nav nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.pay-method h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2); }

/* Feedback ("Tu idea cuenta") floating button and subscription banner */
.idea-fab {
  position: fixed; right: var(--s4); bottom: 5rem; z-index: 20; padding: var(--s2) var(--s3); border-radius: 999px; background: var(--primary); color: var(--primary-text);
  text-decoration: none; font-weight: 600; font-size: var(--fs-1); box-shadow: var(--shadow-2);
}
.idea-fab:hover { background: var(--primary-hover); color: var(--primary-text); }
.idea-fab span { display: none; }
@media (min-width: 720px) { .idea-fab { bottom: var(--s4); } .idea-fab span { display: inline; } }
.sub-banner a { font-weight: 600; }

/* Long unbroken text (a URL, a pasted token) must wrap instead of widening the page at 360px. */
.card, th, td, .review-text, .review-head, .sim-msg, .profile, .list li, main p, main dd, main li { overflow-wrap: anywhere; }
table { max-width: 100%; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
