:root {
  --ink: #14213d;
  --paper: #f2f4f7;
  --card: #ffffff;
  --line: #d9dee6;
  --red: #c8372d;
  --blue: #1f4e8c;
  --muted: #5b6678;
  --ok: #1d7a4d;
  --warn: #a8641a;
  --radius: 10px;
  --err: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #e8ecf4; --paper: #0f1626; --card: #172038; --line: #2a3654; --muted: #9aa6bd; --blue: #6f9ae0; --err: #ff8a80; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; display: flex; flex-direction: column; font-family: "DM Sans", system-ui, sans-serif; background: var(--paper); color: var(--ink); line-height: 1.5; }
h1, h2 { font-family: "Bricolage Grotesque", "DM Sans", sans-serif; letter-spacing: -0.01em; line-height: 1.15; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0.5rem 0 1rem; }
h2 { font-size: 1.25rem; margin: 0 0 0.75rem; }
a { color: var(--blue); }
.muted { color: var(--muted); margin: 0 0 1rem; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* top bar */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1.5rem; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: 1.3rem; color: var(--ink); text-decoration: none; }
.nav { display: flex; gap: 0.25rem; margin-right: auto; margin-left: 2rem; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 500; padding: 0.4rem 0.8rem; border-radius: 6px; border-bottom: 3px solid transparent; }
.nav a:hover { background: var(--paper); }
.nav a[aria-current="page"] { border-bottom-color: var(--red); font-weight: 700; }
.prose { max-width: 62ch; }
.topbar-user { display: flex; align-items: center; gap: 1rem; }
.topbar-user form { margin: 0; }

/* buttons */
.btn { display: inline-block; font: inherit; font-weight: 700; padding: 0.6rem 1.1rem; border-radius: 8px; border: 2px solid transparent; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { filter: brightness(0.92); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-block { width: 100%; margin-top: 1rem; }

/* barber pole stripe: the one signature element */
.pole, .stripe {
  background: repeating-linear-gradient(135deg, var(--red) 0 14px, #fff 14px 28px, var(--blue) 28px 42px, #fff 42px 56px);
}
.stripe { height: 10px; border-radius: 5px; max-width: 160px; }

/* login */
.login { flex: 1; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: #14213d; color: #fff; padding: 4rem; display: flex; flex-direction: column; justify-content: center; gap: 1rem; }
.login-art h1 { max-width: 14ch; font-size: clamp(2.2rem, 5vw, 3.6rem); margin: 0; }
.login-art p { max-width: 36ch; color: #c5cde0; margin: 0; }
.login-art .pole { width: 72px; height: 220px; border-radius: 36px; border: 4px solid #fff; margin-bottom: 1.5rem; }
.login-panel { display: grid; place-items: center; padding: 2rem; }
.login-form { width: 100%; max-width: 380px; }
.login-form label { display: block; font-weight: 700; margin: 1rem 0 0.3rem; }
.login-form input[type=email], .login-form input[type=password], .login-form input[type=text] {
  width: 100%; font: inherit; padding: 0.7rem 0.8rem; border: 2px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink);
}
.login-form input:focus { border-color: var(--blue); outline: none; }
.login-form .check { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; }
.alert { background: #fdecea; color: #8a1f17; border-left: 4px solid var(--red); padding: 0.6rem 0.9rem; border-radius: 6px; margin-top: 1rem; }
.alert ul { margin: 0; padding-left: 1.1rem; }
.demo { margin-top: 1.5rem; padding: 0.8rem 1rem; border: 1px dashed var(--line); border-radius: 8px; font-size: 0.85rem; display: grid; gap: 0.2rem; color: var(--muted); }
.demo strong { color: var(--ink); }

/* app pages */
.page { max-width: 1050px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.page section { margin-top: 2rem; }
.next-up { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem; background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--red); border-radius: var(--radius); padding: 1.5rem; }
.next-up .big { font-family: "Bricolage Grotesque", sans-serif; font-size: 1.6rem; font-weight: 700; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.rows { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.rows li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: 0; }
.rows li span:nth-child(2) { color: var(--muted); margin-right: auto; margin-left: 1rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; display: grid; }
.stats strong { font-family: "Bricolage Grotesque", sans-serif; font-size: 1.9rem; }
.stats span { color: var(--muted); }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.section-head h2 { margin: 0; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 0.85rem; color: var(--muted); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.tag { padding: 0.15rem 0.6rem; border-radius: 99px; font-size: 0.82rem; font-weight: 700; }
.tag.done { background: #e4e8ef; color: #3d4860; }
.tag.now { background: #dce8fa; color: var(--blue); }
.tag.wait { background: #fbebd5; color: var(--warn); }
.tag.ok { background: #d9f0e4; color: var(--ok); }

@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; gap: 0.5rem; padding: 0.6rem 1rem; }
  .nav { margin-left: 0; order: 3; width: 100%; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 2rem; min-height: 0; }
  .login-art .pole { width: 100%; height: 16px; border-width: 2px; border-radius: 8px; margin-bottom: 0.5rem; }
}

.inline { display: inline; margin: 0; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); text-decoration: underline; cursor: pointer; }
.tag.cancel { background: #fdecea; color: #8a1f17; }

/* data-entry forms (Add Service, Add Barber) */
.form-card { max-width: 480px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; margin-top: 1rem; }
.form-card label { display: block; font-weight: 700; margin: 1rem 0 0.3rem; }
.form-card label:first-of-type { margin-top: 0; }
.form-card input { width: 100%; font: inherit; padding: 0.7rem 0.8rem; border: 2px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }
.form-card input:focus { border-color: var(--blue); outline: none; }
.form-card .btn { margin: 1.25rem 0.5rem 0 0; }
.field-validation-error { display: block; color: var(--err); font-size: 0.9rem; margin-top: 0.25rem; }
.input-validation-error { border-color: var(--err) !important; }
.validation-summary-errors ul { margin: 0 0 1rem; padding-left: 1.1rem; color: var(--err); }

/* booking page */
.form-card select { width: 100%; font: inherit; padding: 0.7rem 0.8rem; border: 2px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }
.form-card select:focus { border-color: var(--blue); outline: none; }
.form-card.wide { max-width: 640px; }
.form-card + .form-card { margin-top: 1.5rem; }
.alert.wide { max-width: 640px; }
.slots { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.form-card label.slot { display: inline-block; margin: 0; position: relative; }
.form-card .slot input { position: absolute; opacity: 0; width: 1px; height: 1px; padding: 0; border: 0; }
.slot span { display: inline-block; padding: 0.55rem 1rem; border: 2px solid var(--line); border-radius: 8px; font-weight: 700; cursor: pointer; background: var(--paper); }
.slot span:hover { border-color: var(--ink); }
.slot input:checked + span { background: var(--red); border-color: var(--red); color: #fff; }
.slot input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }
.notice { background: #d9f0e4; color: #14573a; border-left: 4px solid var(--ok); padding: 0.8rem 1rem; border-radius: 6px; margin: 1rem 0; }

/* schedule day navigation */
.daynav { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 1rem 0; }
.daynav form { display: flex; gap: 0.5rem; margin: 0; }
.daynav input[type=date] { font: inherit; padding: 0.5rem 0.7rem; border: 2px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }

.declined { background: #fdecea; color: #8a1f17; border-left: 4px solid var(--red); padding: 0.8rem 1rem; border-radius: 6px; margin: 1rem 0; }
.declined a { color: #8a1f17; font-weight: 700; }

/* barber schedule grid */
.sub { color: var(--muted); font-size: 0.85rem; margin-top: 0.25rem; white-space: normal; }
table.grid { min-width: 560px; table-layout: fixed; }
table.grid th, table.grid td { padding: 0.35rem 0.6rem; white-space: normal; }
table.grid thead th { text-align: center; }
table.grid tbody th { width: 90px; font-size: 0.8rem; text-align: right; white-space: nowrap; }
table.grid td.cell { border-left: 1px solid var(--line); height: 34px; vertical-align: top; }
table.grid td.booked { display: table-cell; font-size: 0.85rem; line-height: 1.3; }
table.grid td.booked strong, table.grid td.booked span, table.grid td.booked small { display: block; }
table.grid td.booked small { opacity: 0.8; }
table.grid td.ok { background: #d9f0e4; color: #14573a; }
table.grid td.wait { background: #fbebd5; color: #7a4710; }
table.grid td.done { background: #e4e8ef; color: #3d4860; }

/* avatars, profiles, cards, galleries */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; object-fit: cover; background: #1f4e8c; color: #fff; font-weight: 700; flex: none; vertical-align: middle; }
.avatar.sm { width: 32px; height: 32px; font-size: 0.8rem; }
.avatar.md { width: 48px; height: 48px; font-size: 1rem; }
.avatar.lg { width: 84px; height: 84px; font-size: 1.6rem; }
.avatar.xl { width: 120px; height: 120px; font-size: 2.2rem; }
.who { display: inline-flex; align-items: center; gap: 0.5rem; }
.profile-head { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.profile-head h1 { margin: 0 0 0.25rem; }
.form-sub { margin: 1.5rem 0 0.25rem; }
.form-card textarea { width: 100%; font: inherit; padding: 0.7rem 0.8rem; border: 2px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); resize: vertical; }
.form-card textarea:focus { border-color: var(--blue); outline: none; }
.form-card input[type=file] { padding: 0.5rem; background: var(--paper); }
.form-card input[type=checkbox] { width: auto; margin-right: 0.5rem; }
.form-card label.check { font-weight: 400; display: flex; align-items: center; margin-top: 0.75rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.card { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; text-align: center; padding: 1.5rem 1rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.card:hover { border-color: var(--ink); }
.card .muted { margin: 0; }
.card-link { color: var(--blue); font-weight: 700; margin-top: 0.4rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; }
.gallery figure { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; padding-bottom: 0.6rem; }
.gallery img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.gallery figcaption { padding: 0.5rem 0.75rem 0; font-size: 0.9rem; }
.gallery figure .inline { padding: 0.4rem 0.75rem 0; display: block; }

/* roster + leave */
table.roster { min-width: 760px; table-layout: fixed; }
table.roster th, table.roster td { white-space: normal; vertical-align: top; }
table.roster thead th { text-align: center; }
table.roster tbody th { width: 140px; text-align: left; font-size: 0.95rem; color: var(--ink); }
table.roster .sub { display: block; font-weight: 400; }
.rcell { border-left: 1px solid var(--line); text-align: center; font-size: 0.85rem; line-height: 1.35; }
.rcell strong, .rcell small, .rcell a, .rcell form { display: block; }
.rcell small { opacity: 0.85; }
.rcell.in { background: #d9f0e4; color: #14573a; }
.rcell.in a, .rcell.leave .link-btn { color: inherit; font-weight: 700; }
.rcell.leave { background: #fbebd5; color: #7a4710; }
.rcell.closed { background: #e4e8ef; color: #3d4860; }
.rcell.past { opacity: 0.55; }
table.grid td.leave { background: repeating-linear-gradient(135deg, #e4e8ef 0 10px, #f2f4f7 10px 20px); color: #3d4860; text-align: center; vertical-align: middle; }

/* the signed-in barber's own bookings in the shared schedule table */
table.grid td.mine { outline: 3px solid var(--blue); outline-offset: -3px; }
