/* ==========================================================================
   Smile Shine Dental Clinic - portal design system
   Calm clinical navy: ink-navy rail, cool clinical ground, white work
   surfaces, one surgical-blue accent, state colours only where they mean
   something. Type: Atkinson Hyperlegible Next (self-hosted, OFL) with
   tabular, slashed-zero figures for codes, money and times.
   Icons: Phosphor regular sprite (assets/icons/sprite.svg, MIT).
   ========================================================================== */

@font-face {
  font-family: "Atkinson Next";
  src: url("../fonts/atkinson-hyperlegible-next/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Next";
  src: url("../fonts/atkinson-hyperlegible-next/atkinson-hyperlegible-next-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Next";
  src: url("../fonts/atkinson-hyperlegible-next/atkinson-hyperlegible-next-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Shell */
  --ink-900: #0e2742;
  --ink-800: #163558;
  --ink-700: #21466f;
  --rail-text: #c6d4e7;
  --rail-muted: #8ea5c3;

  /* Surfaces */
  --ground: #f2f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f7;
  --line: #dce3ec;
  --line-strong: #c3cedb;

  /* Text */
  --text: #0f1f33;
  --text-2: #36475c;
  --text-3: #56677d;

  /* Accent: surgical blue */
  --accent: #1d5fd0;
  --accent-hover: #1852b8;
  --accent-press: #14459c;
  --accent-tint: #e9f1fd;
  --accent-tint-2: #d4e3fb;
  --focus-ring: 0 0 0 3px rgb(29 95 208 / 0.32);

  /* States */
  --ok: #0b6b4f;      --ok-bg: #e2f4ec;      --ok-line: #a8dbc6;
  --warn: #875000;    --warn-bg: #fff3db;    --warn-line: #efcf8f;
  --bad: #b3261e;     --bad-bg: #fdecea;     --bad-line: #f1b8b1;
  --info: #1d5fd0;    --info-bg: #e9f1fd;    --info-line: #b9cff5;
  --muted-bg: #eef2f7; --muted-line: #d4dce6;

  /* Type */
  --font: "Atkinson Next", "Segoe UI", system-ui, sans-serif;
  --fs-xs: 0.78rem;   /* 12.5 */
  --fs-sm: 0.845rem;  /* 13.5 */
  --fs-base: 0.94rem; /* 15 */
  --fs-md: 1.06rem;   /* 17 */
  --fs-lg: 1.4rem;    /* 22.4 */
  --fs-xl: 1.75rem;   /* 28 */

  /* Shape and depth */
  --r-control: 8px;
  --r-panel: 12px;
  --shadow-1: 0 1px 2px rgb(14 39 66 / 0.06), 0 1px 1px rgb(14 39 66 / 0.03);
  --shadow-pop: 0 14px 34px -10px rgb(14 39 66 / 0.28), 0 3px 8px rgb(14 39 66 / 0.08);

  /* Motion (Emil Kowalski's curves) */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  /* Appointment book */
  --book-row: 64px;
  --rail-w: 236px;

  color-scheme: light;
}

/* ── Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line-strong) transparent; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--ground);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent-tint-2); color: var(--text); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--text); text-wrap: balance; }
p { margin: 0; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
[hidden] { display: none !important; }
.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;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 2px solid var(--ground); }
::-webkit-scrollbar-track { background: transparent; }

.icon { width: 18px; height: 18px; flex: none; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 22px; height: 22px; }
.num { font-variant-numeric: tabular-nums slashed-zero; }
.muted { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--surface); color: var(--text); padding: 10px 14px;
  border-radius: var(--r-control); box-shadow: var(--shadow-pop);
}
.skip-link:not(:focus) { box-shadow: none; }
.skip-link:focus { top: 12px; }

/* ── App shell ─────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100dvh;
  background: linear-gradient(to right, var(--ink-900) var(--rail-w), var(--ground) var(--rail-w));
}

.rail {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--ink-900);
  color: var(--rail-text);
  padding: 20px 14px 16px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand__mark {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent); color: #fff;
}
.brand__mark .icon { width: 22px; height: 22px; }
.brand__name { font-weight: 700; font-size: 1.02rem; line-height: 1.15; }
.brand__sub { display: block; font-weight: 400; font-size: var(--fs-xs); color: var(--rail-muted); }

.nav { display: grid; gap: 2px; }
.nav__group { margin-top: 18px; }
.nav__label {
  padding: 0 10px 6px; font-size: var(--fs-xs); color: var(--rail-muted); font-weight: 600;
}
.nav a {
  display: flex; align-items: center; gap: 11px;
  min-height: 40px; padding: 8px 10px;
  border-radius: var(--r-control);
  color: var(--rail-text); text-decoration: none; font-weight: 500;
  transition: background-color 120ms ease, color 120ms ease;
}
.nav a:hover { background: var(--ink-800); color: #fff; }
.nav a[aria-current="page"] { background: var(--ink-700); color: #fff; font-weight: 600; }
.nav a[aria-current="page"] .icon { color: #9ec0ff; }
.nav a:focus-visible { box-shadow: 0 0 0 2px #9ec0ff; }
.nav__count {
  margin-left: auto; min-width: 22px; padding: 1px 7px;
  border-radius: 999px; background: #e9a23b; color: #2b1800;
  font-size: var(--fs-xs); font-weight: 700; text-align: center;
}

.rail__me {
  margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgb(255 255 255 / 0.1);
  display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center;
}
.avatar {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: #2a5285; color: #fff; font-weight: 700; font-size: var(--fs-sm); letter-spacing: 0.02em;
}
.rail__who { min-width: 0; }
.rail__who strong { display: block; color: #fff; font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail__who span { font-size: var(--fs-xs); color: var(--rail-muted); }
.rail__out {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-control);
  color: var(--rail-text); background: transparent; border: 0; cursor: pointer;
}
.rail__out:hover { background: var(--ink-800); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: 64px; padding: 0 32px;
  background: rgb(242 245 249 / 0.92);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid transparent;
}
.topbar.is-scrolled { border-bottom-color: var(--line); }
.topbar__menu { display: none; }
.search-trigger {
  display: flex; align-items: center; gap: 10px;
  width: min(440px, 100%); height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-control);
  background: var(--surface); color: var(--text-3); cursor: text; text-align: left;
  transition: border-color 120ms ease;
}
.search-trigger:hover { border-color: var(--line-strong); }
.search-trigger span { flex: 1; }
.kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  font-size: var(--fs-xs); color: var(--text-3); background: var(--surface-2);
}
.topbar__spacer { flex: 1; }
.icon-btn {
  position: relative; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: var(--r-control);
  border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer;
  transition: background-color 120ms ease, transform 120ms var(--ease-out);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:active { transform: scale(0.96); }
.icon-btn__badge {
  position: absolute; top: 1px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; line-height: 1;
  display: grid; place-items: center; border: 2px solid var(--ground);
}

.content { width: 100%; max-width: 1480px; padding: 8px 32px 56px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin: 8px 0 22px; flex-wrap: wrap;
}
.page-title { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.01em; }
.page-sub { margin-top: 4px; color: var(--text-3); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border-radius: var(--r-control); border: 1px solid transparent;
  font-weight: 600; font-size: var(--fs-base); white-space: nowrap;
  cursor: pointer; text-decoration: none; user-select: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms var(--ease-out);
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); color: #fff; }
.btn--primary:active { background: var(--accent-press); }
.btn--secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.btn--secondary:hover { background: var(--surface-2); color: var(--text); border-color: #aebdcf; }
.btn--ghost { background: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-3); color: var(--text); }
.btn--danger { background: var(--bad); color: #fff; }
.btn--danger:hover { background: #9a1f18; color: #fff; }
.btn--danger-quiet { background: transparent; color: var(--bad); }
.btn--danger-quiet:hover { background: var(--bad-bg); color: #8f1d17; }
.btn--sm { min-height: 32px; padding: 0 11px; font-size: var(--fs-sm); gap: 6px; }
.btn--sm .icon { width: 16px; height: 16px; }
.btn--block { width: 100%; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: #fff #fff transparent transparent;
  animation: spin 600ms linear infinite;
}
.btn--secondary.is-loading::after { border-color: var(--accent) var(--accent) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Panels ────────────────────────────────────────────────────────────── */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-panel); box-shadow: var(--shadow-1);
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.panel__head--plain { border-bottom: 0; padding-bottom: 6px; }
.panel__title { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); font-weight: 700; white-space: nowrap; }
.panel__meta { color: var(--text-3); font-size: var(--fs-sm); }
.panel__body { padding: 18px 20px; }
.panel__foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.stack { display: grid; gap: 20px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }

/* ── "Needs you" work strip ────────────────────────────────────────────── */
.worklist { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.work {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 6px 14px 6px 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-control);
  color: var(--text); text-decoration: none; font-weight: 500;
  box-shadow: var(--shadow-1);
  transition: border-color 120ms ease, transform 120ms var(--ease-out);
}
.work:hover { border-color: var(--line-strong); color: var(--text); }
.work:active { transform: scale(0.98); }
.work__count {
  display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px;
  border-radius: 6px; font-weight: 700; background: var(--surface-3); color: var(--text-2);
}
.work--warn .work__count { background: var(--warn-bg); color: var(--warn); }
.work--bad .work__count { background: var(--bad-bg); color: var(--bad); }
.work--ok .work__count { background: var(--ok-bg); color: var(--ok); }
.work .icon { color: var(--text-3); }

/* ── Status chips (text carries the meaning; colour reinforces it) ─────── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px; min-height: 24px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
  background: var(--muted-bg); color: var(--text-2); border: 1px solid var(--muted-line);
}
.chip .icon { width: 13px; height: 13px; }
.chip--ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.chip--warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.chip--bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.chip--info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.form { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; align-content: start; }
.field > label, .label { font-weight: 600; font-size: var(--fs-sm); color: var(--text-2); }
.label .opt { font-weight: 400; color: var(--text-3); }
.input {
  width: 100%; min-height: 42px; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-control);
  background: var(--surface); color: var(--text);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.input::placeholder { color: #6a7a8f; }
.input:hover { border-color: #a9b8cb; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.input[aria-invalid="true"] { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); background-color: #fffafa; }
.input[aria-invalid="true"]:focus { box-shadow: inset 0 0 0 1px var(--bad), 0 0 0 3px rgb(179 38 30 / 0.22); }
.input:disabled, .input[readonly] { background: var(--surface-2); color: var(--text-2); }
textarea.input { min-height: 92px; resize: vertical; line-height: 1.5; }
select.input {
  appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%2356677d'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 14px;
}
.input-affix { position: relative; }
.input-affix .input { padding-left: 34px; }
.input-affix__pre {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none; display: flex;
}
.input-affix--end .input { padding-left: 12px; padding-right: 44px; }
.input-affix__btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 34px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--text-3); border-radius: 6px; cursor: pointer;
}
.input-affix__btn:hover { color: var(--text); background: var(--surface-3); }
.hint { font-size: var(--fs-sm); color: var(--text-3); }
.error {
  display: flex; gap: 8px; align-items: flex-start;
  margin-top: 2px; padding: 8px 10px; border: 1px solid var(--bad-line); border-left: 4px solid var(--bad);
  border-radius: 6px; background: var(--bad-bg);
  font-size: var(--fs-sm); color: var(--bad); font-weight: 600; line-height: 1.4;
}
.error .icon { width: 17px; height: 17px; margin-top: 1px; flex: none; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-actions--end { justify-content: flex-end; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.fieldset legend { padding: 0; margin-bottom: 8px; font-weight: 600; font-size: var(--fs-sm); color: var(--text-2); }
.seg { display: inline-flex; justify-self: start; width: max-content; max-width: 100%; padding: 3px; gap: 3px; background: var(--surface-3); border-radius: 10px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px;
  border-radius: 7px; font-weight: 600; font-size: var(--fs-sm); color: var(--text-2);
}
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.seg input:focus-visible + span { box-shadow: var(--focus-ring); }

/* Password requirements checklist */
.rules { display: grid; gap: 4px; margin: 2px 0 0; padding: 0; list-style: none; font-size: var(--fs-sm); color: var(--text-3); }
.rules li { display: flex; align-items: center; gap: 7px; }
.rules li .icon { width: 15px; height: 15px; color: var(--line-strong); }
.rules li.is-met { color: var(--ok); }
.rules li.is-met .icon { color: var(--ok); }

/* ── Toolbar, search, filters ──────────────────────────────────────────── */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.toolbar__search { position: relative; flex: 1 1 260px; max-width: 380px; }
.toolbar__search .input { padding-left: 38px; min-height: 40px; }
.toolbar__search > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.toolbar__count { color: var(--text-3); font-size: var(--fs-sm); margin-left: auto; }
.toolbar .input { min-height: 40px; }
.toolbar select.input { width: auto; min-width: 150px; }

/* ── Tabs ──────────────────────────────────────────────────────────────── */
.tabs { position: relative; display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: 46px; padding: 0 12px; border: 0; background: transparent;
  color: var(--text-3); font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: color 120ms ease;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"], .tab[aria-current="page"] { color: var(--text); }
.tab[aria-selected="true"]::after, .tab[aria-current="page"]::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px;
  background: var(--accent); border-radius: 2px 2px 0 0;
}
.tab__count {
  min-width: 22px; padding: 0 7px; border-radius: 999px; font-size: var(--fs-xs);
  background: var(--surface-3); color: var(--text-2); text-align: center;
}
.tab__count--warn { background: var(--warn-bg); color: var(--warn); }
.tab__count--bad { background: var(--bad-bg); color: var(--bad); }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.table th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-weight: 600; font-size: var(--fs-sm); color: var(--text-2);
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background-color 120ms ease; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .right { text-align: right; }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions .btn + .btn, .table td.actions form + .btn, .table td.actions .btn + form, .table td.actions form + form { margin-left: 6px; }
.table td.actions form { display: inline-flex; }
/* Buttons, links and one-button forms share one centre line, icon or not. */
.table td.actions > .btn, .table td.actions > form { vertical-align: middle; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-main a { color: var(--text); text-decoration: none; }
.cell-main a:hover { color: var(--accent); text-decoration: underline; }
.cell-sub { font-size: var(--fs-sm); color: var(--text-3); }
.row-low td { background: #fffaf0; }
.row-out td { background: #fff6f5; }
.th-sort {
  display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none;
  font: inherit; color: inherit; cursor: pointer;
}
.th-sort .icon { width: 14px; height: 14px; color: var(--text-3); }
.th-sort:hover { color: var(--text); }
th[aria-sort="ascending"] .th-sort, th[aria-sort="descending"] .th-sort { color: var(--accent); }
th[aria-sort="ascending"] .th-sort .icon, th[aria-sort="descending"] .th-sort .icon { color: var(--accent); }
.table--compact td { padding: 9px 14px; }

/* Stock level bar */
.stock { display: grid; gap: 5px; min-width: 120px; }
.stock__top { display: flex; align-items: baseline; gap: 6px; }
.stock__qty { font-weight: 700; font-size: var(--fs-md); }
.stock__bar { position: relative; height: 4px; border-radius: 999px; background: var(--surface-3); overflow: visible; }
.stock__bar::after { content: ""; position: absolute; left: 50%; top: -3px; width: 2px; height: 10px; border-radius: 1px; background: var(--text-3); }
.stock__fill { border-radius: 999px; }
.stock__fill { height: 100%; border-radius: inherit; background: var(--ok); }
.stock--low .stock__fill { background: #d18a1e; }
.stock--out .stock__fill { background: var(--bad); }

/* ── Lists ─────────────────────────────────────────────────────────────── */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list__main { flex: 1; min-width: 0; }
.list__title { font-weight: 600; }
.list__meta { font-size: var(--fs-sm); color: var(--text-3); }
.list__time { font-size: var(--fs-sm); color: var(--text-3); white-space: nowrap; }

.dl { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 0; margin: 0; }
.dl dt, .dl dd { padding: 11px 0; border-bottom: 1px solid var(--line); margin: 0; }
.dl dt { color: var(--text-3); font-size: var(--fs-sm); padding-top: 13px; }
.dl dd { font-weight: 500; overflow-wrap: break-word; }
.dl > :nth-last-child(-n + 2) { border-bottom: 0; }

/* ── Appointment book (signature) ─────────────────────────────────────── */
.book { position: relative; display: grid; grid-template-columns: 64px repeat(var(--lanes, 2), minmax(0, 1fr)); }
.book__head { display: contents; }
.book__head > div {
  position: sticky; top: 64px; z-index: 3; height: 42px; padding: 10px 12px;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-2);
}
.book__head > div + div { border-left: 1px solid var(--line); }
.book__gutter { position: relative; }
.book__time {
  height: var(--book-row); padding: 0 10px 0 0; text-align: right;
  font-size: var(--fs-xs); color: var(--text-3); transform: translateY(-0.6em);
}
.book__time--hour { color: var(--text-2); font-weight: 600; }
.book__time:first-child { transform: translateY(2px); }
.book__lane {
  position: relative; border-left: 1px solid var(--line);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0, transparent calc(var(--book-row) / 2 - 1px), var(--line) calc(var(--book-row) / 2 - 1px), var(--line) calc(var(--book-row) / 2)
  );
}
.book__lane::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0, transparent calc(var(--book-row) - 1px), var(--line-strong) calc(var(--book-row) - 1px), var(--line-strong) var(--book-row)
  );
}
.appt {
  position: absolute; left: 6px; right: 6px;
  top: calc(var(--start) * var(--book-row) + 2px); height: calc(var(--span) * var(--book-row) - 4px);
  display: flex; flex-direction: column; gap: 1px; overflow: hidden;
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--info-line);
  background: var(--info-bg); color: var(--text); text-decoration: none;
  font-size: var(--fs-sm); line-height: 1.3;
  transition: box-shadow 120ms ease, transform 120ms var(--ease-out);
}
.appt:hover { color: var(--text); box-shadow: var(--shadow-pop); z-index: 2; }
.appt:active { transform: scale(0.99); }
.appt__name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt__meta { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt--pending { background: var(--warn-bg); border-color: #d6a04a; border-style: dashed; }
.appt--arrived { background: #dcebff; border-color: #8fb3ef; }
.appt--completed { background: var(--ok-bg); border-color: var(--ok-line); }
.appt--no_show { background: var(--bad-bg); border-color: var(--bad-line); }
.appt--past { opacity: 0.72; }
.appt--short { flex-direction: row; align-items: center; gap: 8px; padding-top: 0; padding-bottom: 0; }
.appt--short .appt__name { flex: none; max-width: 45%; }
.book__now {
  position: absolute; left: 64px; right: 0; top: calc(42px + var(--now) * var(--book-row)); height: 2px; background: var(--accent); z-index: 4; pointer-events: none;
}
.book__now::before {
  content: attr(data-label); position: absolute; left: -64px; top: -9px; width: 58px; text-align: right;
  font-size: 11px; font-weight: 700; color: var(--accent);
}
.book__now::after { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.book-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-3); }
.book-legend span { display: inline-flex; align-items: center; gap: 6px; }
.book-legend i { width: 14px; height: 10px; border-radius: 3px; border: 1px solid; display: inline-block; }

/* Day switcher */
.daynav { display: flex; align-items: center; gap: 6px; }
.daynav__label { min-width: 170px; text-align: center; font-weight: 600; }

/* Slot picker (booking) */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.slot {
  min-height: 44px; border: 1px solid var(--line-strong); border-radius: var(--r-control);
  background: var(--surface); font-weight: 600; cursor: pointer; display: grid; place-items: center;
  font-size: var(--fs-sm); line-height: 1.2;
  transition: border-color 120ms ease, background-color 120ms ease, transform 120ms var(--ease-out);
}
.slot small { display: block; font-weight: 400; color: var(--text-3); font-size: 11px; }
.slot:hover:not(:disabled) { border-color: var(--accent); }
.slot:active:not(:disabled) { transform: scale(0.97); }
.slot[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.slot[aria-pressed="true"] small { color: #dbe7ff; }
.slot:disabled { background: var(--surface-2); color: #8c99aa; cursor: not-allowed; text-decoration: line-through; }

/* ── Empty states and banners ─────────────────────────────────────────── */
.empty { display: grid; justify-items: center; gap: 8px; padding: 40px 20px; text-align: center; color: var(--text-3); }
.empty .icon { width: 34px; height: 34px; color: var(--line-strong); }
.empty strong { color: var(--text); font-size: var(--fs-md); }
.empty p { max-width: 42ch; }

.banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px; border-radius: var(--r-control); border: 1px solid;
  margin-bottom: 16px;
}
.banner .icon { margin-top: 2px; }
.banner--error { background: var(--bad-bg); border-color: var(--bad-line); color: #7f1b15; }
.banner--info { background: var(--info-bg); border-color: var(--info-line); color: #16408a; }
.banner--warn { background: var(--warn-bg); border-color: var(--warn-line); color: #6b3f00; }
.banner--ok { background: var(--ok-bg); border-color: var(--ok-line); color: #075238; }
.banner__body { flex: 1; }
.banner__close { margin: -4px -6px -4px 0; }
.banner ul { margin: 4px 0 0; padding-left: 18px; }

/* ── Dialogs (native <dialog>) ─────────────────────────────────────────── */
.dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  padding: 0; border: 0; border-radius: 14px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop);
  overflow: hidden;
  opacity: 1; transform: scale(1);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out), overlay 200ms allow-discrete, display 200ms allow-discrete;
}
.dialog--wide { width: min(760px, calc(100vw - 32px)); }
.dialog:not([open]) { opacity: 0; transform: scale(0.97); transition-duration: 140ms; }
@starting-style { .dialog[open] { opacity: 0; transform: scale(0.97); } }
.dialog::backdrop { background: rgb(14 39 66 / 0.42); transition: background-color 200ms ease, overlay 200ms allow-discrete, display 200ms allow-discrete; }
@starting-style { .dialog[open]::backdrop { background: rgb(14 39 66 / 0); } }
.dialog > form, .dialog__inner { display: flex; flex-direction: column; max-height: calc(100dvh - 48px); }
.dialog__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px 6px; }
.dialog__title { font-size: 1.12rem; font-weight: 700; }
.dialog__desc { color: var(--text-3); margin-top: 4px; font-size: var(--fs-sm); }
.dialog__body { padding: 14px 22px 18px; overflow-y: auto; }
.dialog__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.dialog__foot .spacer { flex: 1; }
.dialog__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--bad-bg); color: var(--bad); flex: none; }

/* Secret reveal (default password shown once) */
.secret {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-radius: var(--r-control);
  background: var(--surface-2); border: 1px dashed var(--line-strong);
  font-size: 1.25rem; font-weight: 700; letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums slashed-zero;
}

/* ── Popovers: menus, combobox, notifications ─────────────────────────── */
.popover {
  position: absolute; z-index: 40; min-width: 220px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop);
  padding: 6px; transform-origin: top left;
  opacity: 1; transform: scale(1) translateY(0);
  transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out), display 160ms allow-discrete;
}
.popover--end { transform-origin: top right; right: 0; }
.popover[hidden] { display: none; }
@starting-style { .popover { opacity: 0; transform: scale(0.97) translateY(-4px); } }

.combo { position: relative; }
.combo__list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40;
  max-height: 280px; overflow-y: auto; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop);
  transform-origin: top center;
  transition: opacity 140ms var(--ease-out), transform 140ms var(--ease-out), display 140ms allow-discrete;
}
@starting-style { .combo__list { opacity: 0; transform: scale(0.98) translateY(-3px); } }
.combo__opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 10px; border-radius: 7px; cursor: pointer;
}
.combo__opt[aria-selected="true"] { background: var(--accent-tint); }
.combo__opt mark { background: none; color: var(--accent); font-weight: 700; }
.combo__opt .cell-sub { white-space: nowrap; }
.combo__note { padding: 9px 10px; color: var(--text-3); font-size: var(--fs-sm); }
.combo__new { color: var(--accent); font-weight: 600; }

/* ── Global search palette ────────────────────────────────────────────── */
.palette { width: min(640px, calc(100vw - 32px)); margin-top: 12vh; }
.palette__input { display: flex; align-items: center; gap: 10px; padding: 6px 16px; border-bottom: 1px solid var(--line); }
.palette__input input { flex: 1; min-height: 48px; border: 0; outline: none; font-size: 1.05rem; background: transparent; }
.palette__results { max-height: min(56vh, 460px); overflow-y: auto; padding: 6px; margin: 0; list-style: none; }
.palette__group { padding: 10px 10px 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); }
.palette__item a {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 8px;
  color: var(--text); text-decoration: none;
}
.palette__item[aria-selected="true"] a { background: var(--accent-tint); }
.palette__item .icon { color: var(--text-3); }
/* The palette opens hundreds of times a day: no entrance animation (Emil). */
.palette.dialog, .palette.dialog:not([open]) { transition: none; transform: none; }

/* ── Toasts ───────────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: grid; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 10px; background: var(--ink-900); color: #eef3fa;
  box-shadow: var(--shadow-pop); font-size: var(--fs-sm);
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
}
@starting-style { .toast { opacity: 0; transform: translateY(12px); } }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition-duration: 140ms; }
.toast .icon { margin-top: 1px; color: #7fe0b6; }
.toast--error .icon { color: #ffaba3; }
.toast__body { flex: 1; }
.toast button { background: none; border: 0; color: #b8c7da; cursor: pointer; padding: 0; }

/* ── Jump-to-record highlight (signature interaction) ─────────────────── */
.is-jumped { animation: jumped 2400ms var(--ease-out) both; scroll-margin: 120px; outline-offset: -2px; }
tr.is-jumped td { animation: jumped-cell 2400ms var(--ease-out) both; }
@keyframes jumped {
  0%, 45% { background-color: var(--accent-tint-2); outline: 2px solid #7fa6ea; }
  100% { background-color: transparent; outline: 2px solid transparent; }
}
@keyframes jumped-cell {
  0%, 45% { background-color: var(--accent-tint-2); }
  100% { background-color: transparent; }
}

/* ── Pager ────────────────────────────────────────────────────────────── */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); font-size: var(--fs-sm); color: var(--text-3); }
.pager__btns { display: flex; gap: 6px; }

/* ── Timeline (activity) ──────────────────────────────────────────────── */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); align-items: start; }
.timeline > li:last-child { border-bottom: 0; }
.timeline__icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); }
.timeline__icon--ok { background: var(--ok-bg); color: var(--ok); }
.timeline__icon--warn { background: var(--warn-bg); color: var(--warn); }
.timeline__icon--bad { background: var(--bad-bg); color: var(--bad); }
.timeline__icon--info { background: var(--info-bg); color: var(--info); }
.day-divider { padding: 10px 20px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }

/* Notification rows */
.notif { position: relative; }
.notif.is-unread { background: #f6f9ff; }
.notif.is-unread .list__title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: 2px; }

/* ── Sign-in ──────────────────────────────────────────────────────────── */
.auth { display: grid; grid-template-columns: minmax(440px, 5fr) minmax(0, 6fr); min-height: 100dvh; background: var(--ground); }
.auth__side {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  padding: 48px clamp(32px, 4.5vw, 64px) 40px; background: var(--ink-900); color: var(--rail-text);
}
/* The logo: the tooth mark large, the clinic's name beside the form. The
   same tooth, oversized and faint, sits behind the panel. */
.auth__echo { position: absolute; z-index: -1; right: -16%; bottom: -14%; width: min(640px, 80%); aspect-ratio: 1; height: auto;
              color: #fff; opacity: 0.035; pointer-events: none; }
.auth__clinic { display: grid; justify-items: start; margin-block: auto; animation: auth-in 700ms var(--ease-out) both; }
.auth__mark { width: 80px; height: 80px; border-radius: 18px; box-shadow: 0 0 0 1px rgb(255 255 255 / 0.14), 0 22px 44px -22px rgb(4 14 28 / 0.95); }
.auth__name { margin-top: 28px; color: #fff; font-size: clamp(2.4rem, 3.3vw, 3.1rem); font-weight: 700; line-height: 1.02; letter-spacing: -0.03em; }
.auth__name span { display: block; margin-top: 8px; font-size: 0.4em; font-weight: 500; letter-spacing: 0; color: var(--rail-text); }
.auth__clinic p { max-width: 40ch; margin-top: 24px; padding-top: 22px; border-top: 1px solid rgb(255 255 255 / 0.12); color: var(--rail-text); }
@keyframes auth-in { from { opacity: 0.001; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { .auth__clinic { animation: none; } }
.auth__facts { display: grid; gap: 12px; font-size: var(--fs-sm); }
.auth__facts div { display: flex; gap: 10px; align-items: flex-start; }
.auth__facts .icon { color: #9ec0ff; margin-top: 2px; }
.auth__main { display: grid; place-content: center; justify-items: center; gap: 18px; padding: 48px 24px; }
.auth__card { width: min(420px, calc(100vw - 48px)); padding: 32px 32px 28px; background: var(--surface); border: 1px solid var(--line);
              border-radius: var(--r-panel); box-shadow: var(--shadow-1), 0 28px 56px -36px rgb(14 39 66 / 0.32); }
.auth__card h1 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.015em; }
.auth__card .page-sub { margin: 6px 0 26px; }
.auth__aside { font-size: var(--fs-sm); color: var(--text-3); text-align: center; }
.auth__aside a { font-weight: 600; text-underline-offset: 3px; }

.steps { display: flex; gap: 8px; margin-bottom: 22px; font-size: var(--fs-sm); color: var(--text-3); }
.steps span { display: inline-flex; align-items: center; gap: 6px; }
.steps b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); font-size: 12px; }
.steps .is-current { color: var(--text); font-weight: 600; }
.steps .is-current b { background: var(--accent); color: #fff; }
.steps .is-done b { background: var(--ok-bg); color: var(--ok); }

/* ── Receipt (print) ──────────────────────────────────────────────────── */
.receipt { max-width: 520px; margin: 0 auto; }
.receipt__head { text-align: center; padding-bottom: 14px; border-bottom: 1px dashed var(--line-strong); }
.receipt__amount { font-size: 2rem; font-weight: 700; }
@media print {
  body { background: #fff; }
  .rail, .topbar, .no-print, .toasts { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .panel { box-shadow: none; border: 0; }
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 1023px) {
  .app { grid-template-columns: 1fr; background: var(--ground); }
  .rail {
    position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(var(--rail-w), 84vw);
    transform: translateX(-100%); transition: transform 240ms var(--ease-out), box-shadow 240ms ease;
  }
  .rail.is-open { transform: translateX(0); box-shadow: var(--shadow-pop); }
  .rail-scrim { position: fixed; inset: 0; z-index: 55; background: rgb(14 39 66 / 0.4); }
  .topbar { padding: 0 16px; }
  .topbar__menu { display: grid; }
  .content { padding: 8px 16px 48px; }
  .grid-2, .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .auth { grid-template-columns: 1fr; }
  .auth__side { padding: 24px 24px 26px; gap: 20px; }
  .auth__clinic { grid-template-columns: auto 1fr; align-items: center; column-gap: 14px; }
  .auth__mark { width: 52px; height: 52px; border-radius: 12px; }
  .auth__name { margin-top: 0; font-size: 1.6rem; }
  .auth__name span { margin-top: 4px; font-size: 0.56em; }
  .auth__clinic p { grid-column: 1 / -1; margin-top: 16px; padding-top: 14px; font-size: var(--fs-sm); }
  .auth__facts, .auth__echo { display: none; }
  .auth__main { place-content: start center; padding: 28px 16px 40px; }
  .auth__card { padding: 26px 22px 22px; width: min(420px, calc(100vw - 32px)); }
}
@media (max-width: 640px) {
  .search-trigger .kbd, .search-trigger span { display: none; }
  .search-trigger { width: 40px; padding: 0; justify-content: center; }
  .page-title { font-size: 1.25rem; }
  .table-stack thead { display: none; }
  .table-stack tr { display: grid; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .table-stack td { border: 0; padding: 4px 0; display: grid; grid-template-columns: minmax(6.5rem, 34%) minmax(0, 1fr); column-gap: 12px; align-items: start; text-align: left; }
  .table-stack td::before { content: attr(data-label); grid-row: 1 / span 6; color: var(--text-3); font-size: var(--fs-sm); padding-top: 2px; }
  .table-stack td > * { grid-column: 2; }
  .table-stack td > .chip, .table-stack td > .btn, .table-stack td .stock { justify-self: start; }
  .table-stack td[style] { max-width: none !important; }
  .table-stack td.right, .table-stack td.num.right { text-align: left; }
  .table-stack td.actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-start; padding-top: 8px; }
  .table-stack td.actions::before { content: none; }
  .table-stack td.actions form { display: inline-flex; }
  .table-stack td.actions .btn + .btn, .table-stack td.actions form + .btn, .table-stack td.actions .btn + form, .table-stack td.actions form + form { margin-left: 0; }
  .table-stack td.day-divider, .table-stack td[colspan] { display: block; text-align: left; }
  .table-stack td[colspan]::before { content: none; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { border-bottom: 0; padding-bottom: 0; }
  .book { --book-row: 56px; }
}

/* ── Reduced motion: keep fades, drop movement ────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
  .is-jumped, tr.is-jumped td { animation: jumped-fade 1200ms ease both !important; }
  @keyframes jumped-fade { from { background-color: var(--accent-tint-2); } to { background-color: transparent; } }
  .btn:active, .work:active, .icon-btn:active, .slot:active { transform: none; }
}
@media (hover: none) {
  .table tbody tr:hover { background: transparent; }
}

/* Back link above a record's title */
.backlink { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-3); text-decoration: none; }
.backlink:hover { color: var(--accent); }

/* ── Reports: numbers strip and charts (dataviz: one hue per single
      series, 4px rounded data ends, 2px gaps, recessive grid) ─────────── */
.report-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); box-shadow: var(--shadow-1); }
.report-strip > div { display: grid; gap: 2px; padding: 14px 18px; border-left: 1px solid var(--line); }
.report-strip > div:first-child { border-left: 0; }
.report-strip strong { font-size: 1.3rem; font-weight: 700; }
.vchart { position: relative; height: 220px; padding: 0 0 22px 44px; }
.vchart__grid { position: absolute; inset: 0 0 22px 44px; }
.vchart__line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.vchart__line span { position: absolute; right: calc(100% + 8px); top: -0.65em; font-size: 11px; color: var(--text-3); white-space: nowrap; }
.vchart__bars { position: relative; height: 100%; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; align-items: end; }
.vchart__col { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; outline: none; border-radius: 4px; }
.vchart__col:hover, .vchart__col:focus-visible { background: rgb(29 95 208 / 0.06); }
.vchart__bar { width: min(100%, 22px); background: var(--accent); border-radius: 4px 4px 0 0; }
.vchart__x { position: absolute; top: 100%; margin-top: 4px; font-size: 11px; color: var(--text-3); }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.hbar { display: grid; grid-template-columns: minmax(120px, 38%) 1fr auto; gap: 12px; align-items: center; padding: 6px 4px; border-radius: 6px; outline: none; }
.hbar:hover, .hbar:focus-visible { background: var(--surface-2); }
.hbar__label { font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar__track { height: 10px; }
.hbar__fill { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.hbar__value { font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; }
.stackbar { display: flex; gap: 2px; height: 18px; border-radius: 4px; overflow: hidden; margin: 6px 0 16px; }
.stackbar__seg { min-width: 4px; outline: none; }
.stackbar__seg:focus-visible { box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px var(--accent); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.legend li { display: grid; grid-template-columns: 12px 1fr auto 44px; gap: 10px; align-items: center; font-size: var(--fs-sm); }
.legend i { width: 12px; height: 12px; border-radius: 3px; }
.legend .cell-sub { text-align: right; }
.chart-table { margin-top: 12px; }
.chart-table summary { cursor: pointer; font-size: var(--fs-sm); color: var(--accent); font-weight: 600; min-height: 24px; }
.tip {
  position: fixed; z-index: 95; pointer-events: none; padding: 6px 10px; border-radius: 6px;
  background: var(--ink-900); color: #fff; font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
  box-shadow: var(--shadow-pop); transform: translate(-50%, calc(-100% - 8px));
}
.tip--side { transform: translateY(-50%); }
@media print { .vchart__col:hover { background: none; } details.chart-table[open] summary { display: none; } }

/* On narrow screens, what needs staff now comes before the book. */
@media (max-width: 1180px) { .grid-main--aside-first > .stack { order: -1; } }
/* Inventory: names on one or two lines, meta on one truncated line */
.col-item { min-width: 14rem; }
.table th.wrap { white-space: normal; max-width: 7.5rem; line-height: 1.25; }
.table th.wrap .th-sort { text-align: right; }
.stock__top { flex-wrap: wrap; row-gap: 4px; }
.stock { min-width: 7rem; justify-items: start; }
.stock .stock__bar, .stock .stock__top { justify-self: stretch; }
@media (min-width: 641px) and (max-width: 1366px) { .table .hide-md { display: none; } }
.one-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30rem; }

/* ── Top bar buttons: drawer on phones, collapse on desktop ──────────── */
.icon-btn.topbar__menu { display: none; }
@media (max-width: 1023px) {
  .icon-btn.topbar__menu { display: grid; }
  .icon-btn.topbar__collapse { display: none; }
}

/* ── Collapsed rail (desktop): icons only, names on hover ─────────────── */
@media (min-width: 1024px) {
  .app { transition: grid-template-columns 200ms var(--ease-out); }
  html.rail-collapsed { --rail-w: 76px; }
  html.rail-collapsed .rail { padding-left: 12px; padding-right: 12px; }
  html.rail-collapsed .brand { justify-content: center; padding: 4px 0 22px; }
  html.rail-collapsed .brand__name,
  html.rail-collapsed .nav__text,
  html.rail-collapsed .rail__who,
  html.rail-collapsed .nav__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  html.rail-collapsed .nav__group { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgb(255 255 255 / 0.1); }
  html.rail-collapsed .nav a { justify-content: center; padding: 8px 0; position: relative; }
  html.rail-collapsed .nav__count { position: absolute; top: 3px; right: 5px; min-width: 18px; padding: 0 5px; font-size: 10px; line-height: 16px; }
  html.rail-collapsed .rail__me { grid-template-columns: 1fr; justify-items: center; gap: 8px; padding-left: 0; padding-right: 0; }
}
@media (prefers-reduced-motion: reduce) { .app { transition: none; } }
.toolbar__group { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-left: 12px; border-left: 1px solid var(--line); }
@media (max-width: 640px) { .toolbar__group { padding-left: 0; border-left: 0; } }

/* ── Medical alerts ──────────────────────────────────────────────────────
   Red family: an alert is a safety notice, read before anything else. */
.banner--alert { background: var(--bad-bg); border-color: var(--bad-line); color: #7f1b15; }
.banner--alert > .icon { color: var(--bad); }
.banner .alert-lines { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 20px; }
.alert-kind { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.01em; color: var(--bad); margin-right: 4px; }
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 20px; border-top: 1px solid var(--line); }
.alert-item:first-child { border-top: 0; }
.alert-item__main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.alert-item__main .alert-kind { color: var(--text-3); }
.alert-item--allergy .alert-item__main .alert-kind { color: var(--bad); }
.alert-item__actions { display: flex; gap: 2px; margin: -4px -8px 0 0; }
.alert-history summary { padding: 10px 20px; border-top: 1px solid var(--line); cursor: pointer; font-size: var(--fs-sm); color: var(--text-3); min-height: 24px; }
.alert-history .list li { padding: 8px 20px; }
.alert-flag { display: inline-flex; align-items: center; gap: 1px; margin-left: 6px; vertical-align: -3px; color: var(--bad); cursor: help; border-radius: 4px; }
.alert-flag .icon { width: 16px; height: 16px; }
.alert-flag__n { font-size: var(--fs-xs); font-weight: 700; }
.alert-flag__n:empty { display: none; }
.alert-flag:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ── Visit log of a long treatment (one row per braces adjustment) ─────── */
.vlog { list-style: none; margin: 0; padding: 0; }
.vlog__item { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 4px 18px; padding: 16px 20px; border-top: 1px solid var(--line); }
.vlog__item:first-child { border-top: 0; }
.vlog__when { display: grid; align-content: start; }
.vlog__date { font-weight: 700; font-size: var(--fs-md); line-height: 1.25; }
.vlog__year { font-size: var(--fs-xs); color: var(--text-3); }
.vlog__n { margin-top: 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); }
.vlog__repair { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); }
.vlog__repair .icon { width: 14px; height: 14px; }
.vlog__item--start .vlog__n { color: var(--accent); }
.vlog__body { display: grid; gap: 8px; min-width: 0; align-content: start; }
.vlog__items { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.vlog__items li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.vlog__items li > span:first-child { font-weight: 600; }
.vlog__items li > .num { color: var(--text-2); }
.vlog__items li.is-void > span:first-child { color: var(--text-3); text-decoration: line-through; }
.vlog__items .cell-sub { flex-basis: 100%; }
.vlog__money { font-size: var(--fs-sm); color: var(--text-2); }
.vlog__money .is-owed { color: var(--warn); }
.vlog__money .is-clear { color: var(--ok); }
.vlog__notes { display: grid; gap: 6px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-control); }
.vlog__notes--empty { background: none; border: 0; padding: 0; color: var(--text-3); font-size: var(--fs-sm); }
.vlog__plan { color: var(--text-2); }
.vlog__meta { font-size: var(--fs-xs); color: var(--text-3); }
@media (max-width: 640px) {
  .vlog__item { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; }
  .vlog__when { grid-auto-flow: column; justify-content: start; align-items: baseline; gap: 8px; }
  .vlog__n, .vlog__repair { margin-top: 0; }
}

/* Record visit dialog */
.charge-lines { display: grid; border: 1px solid var(--line); border-radius: var(--r-control); }
.charge-line { display: grid; grid-template-columns: minmax(0, 1fr) 72px 96px; gap: 12px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); }
.charge-line:first-child { border-top: 0; }
.charge-line .check { align-items: center; font-weight: 500; }
.input.charge-line__qty { min-height: 34px; padding: 4px 8px; text-align: right; }
.charge-line__qty:disabled { opacity: 0.45; }
.charge-line__fee { text-align: right; color: var(--text-2); }
.charge-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 2px 12px 0; font-size: var(--fs-sm); color: var(--text-2); }
.charge-total strong { font-size: var(--fs-md); color: var(--text); }
.lastvisit { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--r-control); background: var(--info-bg); border: 1px solid var(--info-line); color: #16408a; }
.lastvisit .label { color: inherit; }
.visit-after { font-size: var(--fs-sm); font-weight: 600; color: var(--ok); min-height: 1.4em; }
.visit-after.is-owed { color: var(--warn); }
.visit-after.is-over { color: var(--bad); }
.dialog .banner--alert { margin-bottom: 0; }

/* Treatment page side panels */
.price-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.price-lines li { display: flex; justify-content: space-between; gap: 12px; }
.price-lines .num { color: var(--text-2); }
.dl--money { grid-template-columns: minmax(0, 1fr) auto; }
.dl--money dd { text-align: right; }
.money-row { display: flex; gap: 28px; flex-wrap: wrap; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn--quiet { font-size: var(--fs-xs); color: var(--text-3); text-decoration: none; }
.linkbtn--quiet:hover, .linkbtn--quiet:focus-visible { color: var(--bad); text-decoration: underline; }

/* Treatment prices: visit items sit under their main treatment */
.panel--sub { margin-left: 32px; }
@media (max-width: 640px) { .panel--sub { margin-left: 12px; } }
.appt__alert { display: inline-flex; vertical-align: -2px; margin-left: 5px; color: var(--bad); }
.appt__alert .icon { width: 14px; height: 14px; }
.icon-btn--xs { width: 28px; height: 28px; min-width: 28px; min-height: 28px; color: var(--text-3); }
.icon-btn--xs .icon { width: 15px; height: 15px; }
.icon-btn--xs:hover { color: var(--bad); }
.vlog__item:focus { outline: none; }
.vlog__item:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
@media (max-width: 480px) {
  .charge-line { grid-template-columns: minmax(0, 1fr) 56px auto; gap: 8px; padding: 8px 10px; }
}
.vlog__kind { font-size: var(--fs-xs); color: var(--text-3); }
.charge-line .check .cell-sub, .price-lines .cell-sub { display: block; font-size: var(--fs-xs); }
.charge-total > span { display: grid; }
.pay-history summary { padding: 10px 20px; border-top: 1px solid var(--line); cursor: pointer; font-size: var(--fs-sm); color: var(--text-3); min-height: 24px; }
.pay-history .price-lines { padding: 4px 20px 16px; }
.stack-sm { display: grid; gap: 16px; }
/* Moving an appointment: its own time is marked, not struck through. */
.slot.slot--current:disabled { text-decoration: none; background: var(--accent-tint); border-color: var(--info-line); color: var(--accent); }
.slot.slot--current small { color: var(--accent); }
.check > span > .cell-sub { display: block; }
/* Record visit: the plan item is fixed; extras are added only when they happen. */
.charge-line--plan { grid-template-columns: minmax(0, 1fr) auto; }
.charge-line--plan .charge-line__name { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; }
.charge-line--plan .charge-line__name > .icon { width: 20px; height: 20px; color: var(--ok); flex: none; margin-top: 1px; }
.charge-line__name .cell-sub { display: block; font-weight: 400; font-size: var(--fs-xs); }
.charge-line--extra { grid-template-columns: minmax(0, 1fr) 72px 96px 28px; font-weight: 500; }
.charge-line--other { grid-template-columns: minmax(0, 1fr) 150px 28px; align-items: start; }
.charge-line--other .field { gap: 4px; }
.charge-line--other .charge-line__remove { margin-top: 6px; }
.add-charge { position: relative; display: grid; justify-items: start; gap: 8px; }
.charge-menu { width: min(460px, 100%); display: grid; padding: 6px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); box-shadow: var(--shadow-pop); }
.charge-menu__item { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; font: inherit; font-weight: 600; text-align: left; color: var(--text); cursor: pointer; }
.charge-menu__item small { display: block; font-weight: 400; font-size: var(--fs-xs); color: var(--text-3); }
.charge-menu__item .num { font-weight: 500; color: var(--text-2); white-space: nowrap; }
.charge-menu__item:hover, .charge-menu__item:focus-visible { background: var(--accent-tint); outline: none; }
@media (max-width: 480px) {
  .charge-line--extra { grid-template-columns: minmax(0, 1fr) 56px auto 28px; }
  .charge-line--other { grid-template-columns: minmax(0, 1fr) 28px; }
  .charge-line--other .field:nth-child(2) { grid-column: 1; }
}

/* ── Receive a delivery: one line per item ─────────────────────────────── */
.rlines-head, .rline { display: grid; grid-template-columns: minmax(0, 2.2fr) 110px 130px 150px 104px 28px; gap: 10px; align-items: end; }
.rlines-head { padding: 0 0 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); border-bottom: 1px solid var(--line); }
.rlines { display: grid; }
.rline { padding: 10px 0; border-bottom: 1px solid var(--line); }
.rline .field { gap: 4px; min-width: 0; }
.rline__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rline__unit { font-weight: 400; color: var(--text-3); }
.rline__total { align-self: center; text-align: right; font-weight: 600; white-space: nowrap; }
.rline__remove { align-self: center; }
.rlines-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; }
.rlines-total { flex: 1 1 220px; justify-content: flex-end; gap: 16px; padding: 0; }
.input--file { padding: 7px 10px; }
.input--file::file-selector-button { margin-right: 10px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.banner__list { margin: 6px 0 0; padding-left: 18px; }
@media (max-width: 860px) {
  .rlines-head { display: none; }
  .rline { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 28px; align-items: start; gap: 10px 12px;
           grid-template-areas: "item item remove" "qty cost cost" "exp total total"; }
  .rline__item { grid-area: item; }
  .rline__qty { grid-area: qty; }
  .rline__cost { grid-area: cost; }
  .rline__exp { grid-area: exp; }
  .rline__total { grid-area: total; align-self: end; padding-bottom: 10px; }
  .rline__remove { grid-area: remove; align-self: end; margin-bottom: 6px; }
  .rline__label { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); }
  .rline__total::before { content: 'Amount '; font-weight: 400; color: var(--text-3); }
}

/* Receiving receipt (print): wider than a payment receipt, with its lines and signatures. */
.receipt--wide { max-width: 760px; }
.receipt__lines { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--r-control); }
.receipt__lines tfoot th { padding-top: 12px; padding-bottom: 12px; border-top: 1px solid var(--line-strong); text-align: left; }
.receipt__total { font-size: var(--fs-md); }
.receipt__sign { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; margin-top: 40px; }
.receipt__sign > div { display: grid; gap: 4px; text-align: center; }
.receipt__line { display: block; min-height: 1.6em; padding-bottom: 2px; border-bottom: 1px solid var(--text); font-weight: 600; }
@media print { .receipt--wide { max-width: none; } .receipt__lines { border: 0; } }

.row-void td { color: var(--text-3); }
.receipt .dl .cell-sub { display: block; margin-top: 2px; }

/* Appointment rows: the dentist, with a quiet Assign / Change */
.appt-dentist { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 2px; }
.appt-dentist .icon { width: 14px; height: 14px; color: var(--text-3); }
.appt-dentist .is-warn { color: var(--warn); font-weight: 600; }
.link-btn { padding: 0; border: 0; background: none; font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { color: var(--accent-strong, var(--accent)); text-decoration-thickness: 2px; }
.link-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 4px; }

/* Public booking: one button per online hour (six: 10, 11, 1, 2, 3, 4),
   three to a row. A full hour stays visible in red and a passed one in
   grey, without strike-through so the time stays readable. */
.slots--hours { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.slots--hours .slot { min-width: 0; min-height: 52px; padding: 6px 4px; }
.slots--hours .slot:disabled { text-decoration: none; }
.slots--hours .slot--few small { color: var(--warn); font-weight: 600; }
.slots--hours .slot--full:disabled { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.slots--hours .slot--full small { color: var(--bad); font-weight: 600; }
.book__count { display: block; font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); }

/* ── Calendar: the month at a glance ─────────────────────────────────── */
.cal-toolbar { justify-content: space-between; }
.cal-title { margin: 0 6px; min-width: 9.5rem; text-align: center; font-size: var(--fs-md); font-weight: 700; }
.cal { display: grid; padding: 0 20px 16px; }
.cal__week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.cal__week--head { margin-top: 0; }
.cal__dow { padding: 8px 10px 2px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.cal__day { position: relative; display: grid; align-content: start; gap: 6px; min-height: 104px; padding: 10px 10px 12px; border: 1px solid var(--line); border-radius: var(--r-control);
            background: var(--surface); color: var(--text); text-decoration: none; transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease; }
.cal__day:hover { border-color: var(--accent); box-shadow: var(--shadow-1); }
.cal__day:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.cal__day.is-past { background: var(--surface-2); }
.cal__day.is-other { background: transparent; border-style: dashed; }
.cal__day.is-other .cal__num { color: var(--text-3); }
.cal__day.is-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal__day.is-today .cal__num { display: inline-grid; place-items: center; width: 28px; height: 28px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--accent); color: #fff; }
.cal__num { font-weight: 700; font-size: var(--fs-md); line-height: 1.2; }
.cal__count { display: inline-flex; align-items: center; gap: 5px; width: max-content; padding: 2px 8px 2px 6px; border-radius: 999px;
              background: var(--accent-tint); color: var(--accent); font-weight: 700; font-size: var(--fs-sm); }
.cal__count .icon { width: 15px; height: 15px; }
.cal__day.is-full .cal__count { background: var(--warn-bg); color: var(--warn); }
.cal__req { display: inline-block; font-size: var(--fs-xs); font-weight: 600; color: var(--warn); }
.cal__bar { position: absolute; left: 10px; right: 10px; bottom: 8px; height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.cal__bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.cal__day.is-full .cal__bar > span { background: var(--warn); }
.cal-legend { flex-wrap: wrap; justify-content: flex-start; gap: 10px 22px; font-size: var(--fs-xs); color: var(--text-3); }
.cal-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .icon { width: 15px; height: 15px; color: var(--accent); }
.cal__bar--key { position: static; display: inline-block; width: 36px; }
@media (max-width: 760px) {
  .cal { padding: 0 8px 12px; }
  .cal__week { gap: 3px; }
  .cal__dow { padding: 6px 2px 0; text-align: center; letter-spacing: 0; }
  .cal__day { min-height: 64px; padding: 6px 4px 10px; justify-items: center; gap: 3px; }
  .cal__day.is-today .cal__num { margin: -2px 0 0; width: 24px; height: 24px; }
  .cal__count { padding: 1px 5px; font-size: var(--fs-xs); gap: 2px; }
  .cal__count .icon { width: 12px; height: 12px; }
  .cal__req { display: none; }
  .cal__bar { left: 4px; right: 4px; bottom: 4px; }
  .cal-title { min-width: 0; }
}
.tabs--page { padding: 0; margin: 0 0 20px; }
