/*
 * Madder CRM — design system
 * The studio wall is black; records sit on white "flash sheets"; red is ink,
 * used for the one primary action, the active marker and alerts.
 */

/* --- Fonts (self-hosted: no requests to third-party servers) -------------- */

@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url("../fonts/golos-text-cyrillic-ext-wght-normal.d9983e11330d.woff2") format("woff2-variations");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url("../fonts/golos-text-cyrillic-wght-normal.a2d088854119.woff2") format("woff2-variations");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url("../fonts/golos-text-latin-ext-wght-normal.8d8ca70396ce.woff2") format("woff2-variations");
  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: "Golos Text";
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url("../fonts/golos-text-latin-wght-normal.9b970339a047.woff2") format("woff2-variations");
  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: "Yeseva One";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("../fonts/yeseva-one-cyrillic-ext-400-normal.dda8f694b24e.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Yeseva One";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("../fonts/yeseva-one-cyrillic-400-normal.e4d5be216c46.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Yeseva One";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("../fonts/yeseva-one-latin-ext-400-normal.f2d7cd527b4f.woff2") format("woff2");
  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: "Yeseva One";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("../fonts/yeseva-one-latin-400-normal.538667d292d4.woff2") format("woff2");
  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;
}

/* --- Tokens ---------------------------------------------------------------- */

:root {
  --ink: #000000;
  --ink-raised: #171717;
  --ink-hover: #222222;
  --ink-line: #2c2c2c;
  --on-ink: #ffffff;
  --on-ink-muted: #a3a3a3;

  --paper: #ffffff;
  --paper-sunk: #f4f4f2;
  --paper-line: #e3e3e0;
  --paper-line-strong: #c9c9c5;
  --on-paper: #000000;
  --on-paper-muted: #5c5c5c;

  --red: #c8102e;
  --red-press: #a00c24;
  --red-on-ink: #ff4d5e;
  --red-wash: #fbe9ec;

  --font-ui: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Yeseva One", Georgia, "Times New Roman", serif;

  --radius-sheet: 6px;
  --radius-control: 4px;
  --sidebar-width: 15.5rem;
  --tabbar-height: 3.75rem;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* Bootstrap colour modes, retuned to the palette. The shell is dark; sheets are light. */
[data-bs-theme="dark"] {
  color-scheme: dark;
  --bs-body-bg: var(--ink);
  --bs-body-color: var(--on-ink);
  --bs-emphasis-color: var(--on-ink);
  --bs-secondary-color: var(--on-ink-muted);
  --bs-tertiary-bg: var(--ink-raised);
  --bs-border-color: var(--ink-line);
  --bs-link-color: var(--on-ink);
  --bs-link-hover-color: var(--red-on-ink);
  --bs-link-color-rgb: 255, 255, 255;
  --bs-link-hover-color-rgb: 255, 77, 94;
  --bs-focus-ring-color: rgba(255, 77, 94, .45);

  /* Component tokens: each theme block sets them, so an element always takes
     the colours of its nearest themed ancestor (wall or sheet). */
  --focus: var(--red-on-ink);
  --input-border: #4a4a4a;
  --quiet-fg: var(--on-ink);
  --quiet-border: #5a5a5a;
  --quiet-hover-bg: var(--on-ink);
  --quiet-hover-fg: var(--ink);
  --danger-fg: var(--red-on-ink);
  --danger-hover-bg: var(--ink-hover);
  --seg-border: var(--ink-line);
  --seg-fg: var(--on-ink-muted);
  --seg-active-bg: var(--on-ink);
  --seg-active-fg: var(--ink);
  --icon-hover-bg: var(--ink-hover);
  --avatar-bg: var(--ink-hover);
  --st-plan-fg: var(--on-ink);
  --st-firm-fg: var(--ink);
  --st-firm-bg: var(--on-ink);
  --st-done-fg: var(--on-ink);
  --st-done-bg: var(--ink-hover);
  --st-done-border: var(--ink-line);
  --st-off-fg: var(--on-ink-muted);
  --st-alert: var(--red-on-ink);
}

[data-bs-theme="light"] {
  color-scheme: light;
  --bs-body-bg: var(--paper);
  --bs-body-color: var(--on-paper);
  --bs-emphasis-color: var(--on-paper);
  --bs-secondary-color: var(--on-paper-muted);
  --bs-tertiary-bg: var(--paper-sunk);
  --bs-border-color: var(--paper-line);
  --bs-link-color: var(--on-paper);
  --bs-link-hover-color: var(--red);
  --bs-link-color-rgb: 0, 0, 0;
  --bs-link-hover-color-rgb: 200, 16, 46;
  --bs-focus-ring-color: rgba(200, 16, 46, .3);

  --focus: var(--red);
  --input-border: var(--paper-line-strong);
  --quiet-fg: var(--on-paper);
  --quiet-border: var(--paper-line-strong);
  --quiet-hover-bg: var(--ink);
  --quiet-hover-fg: var(--on-ink);
  --danger-fg: var(--red);
  --danger-hover-bg: var(--red-wash);
  --seg-border: var(--paper-line-strong);
  --seg-fg: var(--on-paper-muted);
  --seg-active-bg: var(--ink);
  --seg-active-fg: var(--on-ink);
  --icon-hover-bg: var(--paper-sunk);
  --avatar-bg: var(--ink);
  --st-plan-fg: var(--on-paper);
  --st-firm-fg: var(--on-ink);
  --st-firm-bg: var(--ink);
  --st-done-fg: var(--on-paper);
  --st-done-bg: var(--paper-sunk);
  --st-done-border: var(--paper-line-strong);
  --st-off-fg: var(--on-paper-muted);
  --st-alert: var(--red);
}

:root {
  --bs-font-sans-serif: var(--font-ui);
  --bs-body-font-size: .9375rem;
  --bs-body-line-height: 1.5;
  --bs-border-radius: var(--radius-control);
  --bs-border-radius-sm: 3px;
  --bs-border-radius-lg: var(--radius-sheet);
  --bs-primary: var(--red);
  --bs-primary-rgb: 200, 16, 46;
  --bs-danger: var(--red);
  --bs-danger-rgb: 200, 16, 46;
}

/* --- Base ------------------------------------------------------------------ */

html,
body {
  background: var(--ink);
}

body {
  font-family: var(--font-ui);
  font-feature-settings: "kern";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.visually-hidden-focusable:focus {
  position: fixed !important;
  top: .5rem;
  left: .5rem;
  z-index: 2000;
  padding: .5rem 1rem;
  background: var(--paper);
  color: var(--on-paper);
}

.num {
  font-variant-numeric: tabular-nums;
}

.text-muted,
.muted {
  color: var(--bs-secondary-color) !important;
}

/* --- App shell ------------------------------------------------------------- */

.app {
  min-height: 100vh;
}

@media (min-width: 992px) {
  .app {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }
}

.sidebar {
  display: none;
}

@media (min-width: 992px) {
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--ink-line);
    padding: 1.5rem 0 1rem;
  }
}

.brand {
  display: flex;
  align-items: center;
  min-height: 3rem;
  padding: 0 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--on-ink);
  text-decoration: none;
}

.brand {
  gap: .625rem;
}

/* The studio's logo, as in the website's header: the heart (--heart is its size) in its
   white rays, then the lettering. Without rays.svg or wordmark.webp in static/brand/ it
   is the plain heart and the studio name in text. */
.brand {
  --heart: 2.5rem;
}

.brand-mark {
  position: relative;
  flex: none;
  display: block;
  width: var(--heart);
  height: var(--heart);
}

.brand-heart {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 14px rgba(168, 35, 45, .45));
  transition: transform .8s cubic-bezier(.16, 1, .3, 1), filter .5s;
}

.brand:hover .brand-heart {
  transform: rotate(-8deg) scale(1.06);
  filter: drop-shadow(0 6px 20px rgba(224, 68, 63, .6));
}

/* rays.svg is a box of 157 × 152 units with the heart (100 units wide) at its centre.
   Only the heart moves on hover; the rays stand still. */
.brand-mark.has-rays {
  width: calc(var(--heart) * 1.57);
  height: calc(var(--heart) * 1.52);
}

.brand-mark.has-rays img {
  position: absolute;
}

.brand-rays {
  inset: 0;
  width: 100%;
  height: 100%;
}

.brand-mark.has-rays .brand-heart {
  left: calc(28 / 157 * 100%);
  top: calc(27 / 152 * 100%);
  width: calc(100 / 157 * 100%);
  height: calc(100 / 152 * 100%);
}

.brand-word {
  flex: none;
  width: auto;
  height: calc(var(--heart) * .91);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.625rem;
  line-height: 1.1;
  letter-spacing: .01em;
}

.nav-rail {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1 1 auto;
}

.nav-rail a {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .625rem 1.5rem;
  color: var(--on-ink-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color .15s var(--ease), background-color .15s var(--ease);
}

.nav-rail a .bi {
  font-size: 1.125rem;
  line-height: 1;
}

.nav-rail a:hover {
  color: var(--on-ink);
  background: var(--ink-raised);
}

/* The "needle line": the one red mark that says where you are. */
.nav-rail a[aria-current="page"] {
  color: var(--on-ink);
  background: var(--ink-raised);
  box-shadow: inset 3px 0 0 var(--red);
}

.sidebar-foot {
  border-top: 1px solid var(--ink-line);
  padding: 1rem 1.5rem 0;
  margin-top: 1rem;
}

.me {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}

.me-name {
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.me-role {
  font-size: .8125rem;
  color: var(--on-ink-muted);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  color: inherit;
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
}

.icon-btn:hover {
  background: var(--icon-hover-bg);
}

/* Language switch: a two-segment control. */
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--seg-border);
  border-radius: var(--radius-control);
  overflow: hidden;
}

.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--seg-fg);
  font-size: .8125rem;
  font-weight: 600;
  padding: .3rem .7rem;
  letter-spacing: .02em;
}

.lang-switch button:hover {
  color: var(--bs-body-color);
}

.lang-switch button[aria-pressed="true"] {
  background: var(--seg-active-bg);
  color: var(--seg-active-fg);
}

/* Mobile top bar and bottom tab bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: calc(.5rem + env(safe-area-inset-top, 0px)) 1rem .5rem;
  background: var(--ink);
  border-bottom: 1px solid var(--ink-line);
}

.topbar .brand {
  padding: 0;
  margin: 0;
  min-height: 2.5rem;
}

.topbar .brand-name {
  font-size: 1.375rem;
}

.topbar .brand {
  gap: .5rem;
}

.topbar .brand {
  --heart: 2rem;
}

/* The rays reach into the bar's padding, so the bar keeps its height. */
.topbar .brand-mark.has-rays {
  margin-block: -.3rem;
}

@media (min-width: 992px) {
  .topbar,
  .tabbar {
    display: none !important;
  }
}

.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 1030;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--ink);
  border-top: 1px solid var(--ink-line);
}

.tabbar a,
.tabbar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .15rem;
  border: 0;
  background: none;
  color: var(--on-ink-muted);
  font-size: .6875rem;
  font-weight: 500;
  text-decoration: none;
  min-width: 0;
}

.tabbar .bi {
  font-size: 1.25rem;
  line-height: 1;
}

.tabbar span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 .25rem;
}

.tabbar a[aria-current="page"] {
  color: var(--on-ink);
  box-shadow: inset 0 2px 0 var(--red);
}

.offcanvas.nav-drawer {
  --bs-offcanvas-width: min(20rem, 86vw);
  --bs-offcanvas-bg: var(--ink);
  border-right: 1px solid var(--ink-line);
}

.nav-drawer .nav-rail a {
  padding-left: 1.25rem;
}

/* --- Main column ----------------------------------------------------------- */

.main {
  min-width: 0;
  padding: 1.25rem 1rem calc(var(--tabbar-height) + 2rem + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 992px) {
  .main {
    padding: 2.25rem 2.75rem 3rem;
  }
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 1.5rem;
}

.page-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.875rem, 1.4rem + 1.6vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: .005em;
  margin: 0;
  overflow-wrap: anywhere;
}

.page-sub {
  color: var(--on-ink-muted);
  margin: .5rem 0 0;
  max-width: 70ch;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.breadcrumb-back {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  color: var(--on-ink-muted);
  text-decoration: none;
  font-size: .875rem;
  margin-bottom: .75rem;
}

.breadcrumb-back:hover {
  color: var(--on-ink);
}

/* Sub-navigation inside a section (Calendar / Schedule / List). */
.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.5rem;
  margin: -.5rem 0 1.25rem;
  border-bottom: 1px solid var(--ink-line);
}

.subnav a {
  padding: .5rem 0 .625rem;
  color: var(--on-ink-muted);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.subnav a:hover {
  color: var(--on-ink);
}

.subnav a[aria-current="page"] {
  color: var(--on-ink);
  border-bottom-color: var(--red);
}

/* --- Sheets (light surfaces on the black wall) ------------------------------ */

.sheet {
  background: var(--paper);
  color: var(--on-paper);
  border-radius: var(--radius-sheet);
  padding: 1.25rem;
}

@media (min-width: 768px) {
  .sheet {
    padding: 1.5rem 1.75rem;
  }
}

.sheet + .sheet,
.sheet-stack > * + * {
  margin-top: 1.25rem;
}

.sheet-flush {
  padding: 0;
  overflow: hidden;
}

.sheet-form {
  max-width: 52rem;
}

.sheet-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem 1rem;
  margin-bottom: 1rem;
}

.sheet-flush > .sheet-head {
  padding: 1.25rem 1.25rem 0;
}

@media (min-width: 768px) {
  .sheet-flush > .sheet-head {
    padding: 1.5rem 1.75rem 0;
  }
}

.sheet-title {
  font-size: 1.125rem;
  font-weight: 650;
  margin: 0;
}

.sheet-note {
  color: var(--on-paper-muted);
  font-size: .875rem;
  margin: 0;
}

/* Project time: completed sessions solid, booked ones hatched, the estimate is the full track. */
.time-bar {
  position: relative;
  display: flex;
  height: .5rem;
  border-radius: 999px;
  background: var(--paper-sunk);
  box-shadow: inset 0 0 0 1px var(--paper-line);
}

.time-bar > span:first-child {
  border-radius: 999px 0 0 999px;
}

.time-bar__done,
.time-swatch--done {
  background: var(--on-paper);
}

.time-bar__booked,
.time-swatch--booked {
  background: repeating-linear-gradient(-45deg, var(--on-paper) 0 2px, transparent 2px 5px);
}

.time-bar__estimate {
  position: absolute;
  top: -.25rem;
  bottom: -.25rem;
  width: 2px;
  margin-left: -1px;
  background: var(--red);
}

.time-swatch {
  display: inline-block;
  width: .625rem;
  height: .625rem;
  margin-right: .375rem;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px var(--on-paper);
  vertical-align: -.05em;
}

/* Panels on black (secondary info that doesn't need a sheet) */
.panel-ink {
  border: 1px solid var(--ink-line);
  border-radius: var(--radius-sheet);
  padding: 1.25rem;
}

/* --- Layout helpers -------------------------------------------------------- */

.grid-main-side {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 1200px) {
  .grid-main-side {
    grid-template-columns: minmax(0, 1fr) 22rem;
    align-items: start;
  }
}

.grid-2 {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 992px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

/* --- Key facts (definition lists) ------------------------------------------- */

.facts {
  display: grid;
  grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr);
  gap: .5rem 1.25rem;
  margin: 0;
}

.facts dt {
  font-weight: 500;
  color: var(--bs-secondary-color);
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 575.98px) {
  .facts {
    grid-template-columns: 1fr;
    gap: .125rem;
  }

  .facts dd {
    margin-bottom: .5rem;
  }
}

/* --- Stats strip (on black, not boxed) --------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 0;
  margin: 0 0 1.75rem;
  padding: 0;
  list-style: none;
}

@media (min-width: 768px) {
  .stats {
    grid-template-columns: repeat(var(--stat-count, 4), minmax(0, 1fr));
  }
}

.stat {
  padding: 0 1.25rem;
  border-left: 1px solid var(--ink-line);
  min-width: 0;
}

.stat:first-child,
.stats > .stat:nth-child(2n + 1) {
  border-left: 0;
  padding-left: 0;
}

@media (min-width: 768px) {
  .stats > .stat:nth-child(2n + 1) {
    border-left: 1px solid var(--ink-line);
    padding-left: 1.25rem;
  }

  .stats > .stat:first-child {
    border-left: 0;
    padding-left: 0;
  }
}

.stat-label {
  color: var(--on-ink-muted);
  font-size: .875rem;
  margin: 0 0 .25rem;
}

.stat-value {
  font-size: clamp(1.625rem, 1.3rem + 1vw, 2.125rem);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  white-space: nowrap;
}

.stat-delta {
  font-size: .8125rem;
  color: var(--on-ink-muted);
  margin: .25rem 0 0;
}

.stat a {
  color: inherit;
  text-decoration: none;
}

.stat a:hover .stat-value {
  color: var(--red-on-ink);
}

/* --- Buttons ---------------------------------------------------------------- */

.btn {
  --bs-btn-font-weight: 600;
  --bs-btn-padding-x: 1rem;
  --bs-btn-padding-y: .5rem;
  --bs-btn-border-radius: var(--radius-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}

.btn-sm {
  --bs-btn-padding-x: .75rem;
  --bs-btn-padding-y: .3rem;
  --bs-btn-font-size: .875rem;
}

.btn-primary {
  --bs-btn-bg: var(--red);
  --bs-btn-border-color: var(--red);
  --bs-btn-color: #fff;
  --bs-btn-hover-bg: var(--red-press);
  --bs-btn-hover-border-color: var(--red-press);
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--red-press);
  --bs-btn-active-border-color: var(--red-press);
  --bs-btn-disabled-bg: var(--red);
  --bs-btn-disabled-border-color: var(--red);
  --bs-btn-focus-shadow-rgb: 200, 16, 46;
}

/* Secondary action: white on the wall, black on paper. */
.btn-quiet {
  --bs-btn-bg: transparent;
  --bs-btn-color: var(--quiet-fg);
  --bs-btn-border-color: var(--quiet-border);
  --bs-btn-hover-bg: var(--quiet-hover-bg);
  --bs-btn-hover-color: var(--quiet-hover-fg);
  --bs-btn-hover-border-color: var(--quiet-hover-bg);
  --bs-btn-active-bg: var(--quiet-hover-bg);
  --bs-btn-active-color: var(--quiet-hover-fg);
  --bs-btn-active-border-color: var(--quiet-hover-bg);
}

.btn-danger-quiet {
  --bs-btn-bg: transparent;
  --bs-btn-color: var(--danger-fg);
  --bs-btn-border-color: transparent;
  --bs-btn-hover-bg: var(--danger-hover-bg);
  --bs-btn-hover-color: var(--danger-fg);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: var(--danger-hover-bg);
  --bs-btn-active-color: var(--danger-fg);
}

.btn-danger {
  --bs-btn-bg: var(--red);
  --bs-btn-border-color: var(--red);
  --bs-btn-hover-bg: var(--red-press);
  --bs-btn-hover-border-color: var(--red-press);
  --bs-btn-active-bg: var(--red-press);
}

.btn-link {
  --bs-btn-color: inherit;
  --bs-btn-hover-color: var(--red);
  font-weight: 500;
  padding-left: 0;
  padding-right: 0;
}

/* --- Forms ------------------------------------------------------------------ */

.form-label {
  font-weight: 600;
  font-size: .875rem;
  margin-bottom: .375rem;
}

.form-control,
.form-select {
  border-color: var(--input-border);
  border-radius: var(--radius-control);
  padding: .5rem .75rem;
}

/* Room for the arrow: the shared padding above would otherwise run text under it. */
.form-select {
  padding-right: 2.25rem;
  background-position: right .75rem center;
}

.form-select-sm {
  padding-right: 2rem;
  background-position: right .625rem center;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--bs-body-color);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, .22);
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--red);
}

.invalid-feedback {
  color: var(--red);
  font-weight: 500;
}

.form-text {
  color: var(--on-paper-muted);
  font-size: .8125rem;
}

.form-check-input:checked {
  background-color: var(--ink);
  border-color: var(--ink);
}

.form-check-input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, .22);
}

.form-grid {
  display: grid;
  gap: 1rem 1.25rem;
}

@media (min-width: 768px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid .span-all {
    grid-column: 1 / -1;
  }
}

.form-section + .form-section {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--paper-line);
}

.form-section-title {
  font-size: 1rem;
  font-weight: 650;
  margin: 0 0 1rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--paper-line);
}

.form-errors {
  border-left: 3px solid var(--red);
  background: var(--red-wash);
  color: var(--on-paper);
  padding: .75rem 1rem;
  margin-bottom: 1.25rem;
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
}

.form-errors ul {
  margin: 0;
  padding-left: 1.1rem;
}

/* "Please check before saving": allowed, but probably a mistake. */
.form-warnings {
  border-left: 3px solid var(--on-paper);
  background: var(--paper-sunk);
  color: var(--on-paper);
  padding: .75rem 1rem;
  margin-bottom: 1.25rem;
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
}

.form-warnings > strong {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.form-warnings > strong .bi {
  color: var(--red);
}

.form-warnings ul {
  margin: .5rem 0 0;
  padding-left: 1.1rem;
}

.form-warnings a {
  color: var(--on-paper);
  font-weight: 600;
}

.form-warnings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .75rem;
  margin-top: .75rem;
  font-size: .875rem;
  color: var(--on-paper-muted);
}

legend.form-label {
  float: none;
  font-size: .875rem;
}

.check-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.check-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .35rem .75rem;
  border: 1px solid var(--paper-line-strong);
  border-radius: 999px;
  font-size: .875rem;
  cursor: pointer;
}

.check-chip .form-check-input {
  margin: 0;
}

.check-chip:has(:checked) {
  border-color: var(--on-paper);
  background: var(--paper-sunk);
  font-weight: 600;
}

/* Filter bar: compact row at the top of a list sheet. */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .75rem;
  padding-bottom: 1rem;
  margin-bottom: .25rem;
  border-bottom: 1px solid var(--paper-line);
}

.filters .filter-field {
  flex: 1 1 10rem;
  min-width: 0;
  max-width: 16rem;
}

.filters .filter-field.wide {
  flex-basis: 14rem;
  max-width: 22rem;
}

.filters .form-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--on-paper-muted);
  margin-bottom: .25rem;
}

.filters .filter-actions {
  display: flex;
  gap: .5rem;
}

/* Phone: the filter bar folds behind one button. */
.filters-toggle-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.filters-toggle {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

.filters-count {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 .375rem;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
}

.filters-chevron {
  transition: transform .2s ease;
}

.filters-toggle:not(.collapsed) .filters-chevron {
  transform: rotate(180deg);
}

@media (max-width: 767.98px) {
  .filters {
    margin-top: .875rem;
  }

  .filters .filter-field,
  .filters .filter-field.wide {
    flex-basis: calc(50% - .375rem);
    max-width: none;
  }

  .filters .filter-field.wide {
    flex-basis: 100%;
  }
}

/* Tom Select, tuned to the palette: the wrapper keeps the .form-select border. */
.ts-wrapper.form-select .ts-control {
  padding: .5rem 2.25rem .5rem .75rem;
  min-height: calc(2.5rem - 2px);
  background: transparent;
}

.ts-wrapper.form-select.focus {
  border-color: var(--bs-body-color);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, .22);
}

.ts-dropdown .active {
  background: var(--paper-sunk);
  color: var(--on-paper);
}

.ts-dropdown .option {
  padding: .5rem .75rem;
}

/* Client options: name, then contact details in a quieter line. */
.ts-person {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  min-width: 0;
}

.ts-person-name {
  font-weight: 600;
}

.ts-person-hint {
  font-size: .8125rem;
  color: var(--on-paper-muted);
  font-variant-numeric: tabular-nums;
}

.ts-control .ts-person {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 .5rem;
}

/* --- Tables ----------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: var(--paper-sunk);
  --bs-table-border-color: var(--paper-line);
  margin-bottom: 0;
  vertical-align: middle;
}

.table > :not(caption) > * > * {
  padding: .75rem .75rem;
}

.table > :not(caption) > * > *:first-child {
  padding-left: 0;
}

.table > :not(caption) > * > *:last-child {
  padding-right: 0;
}

.sheet-flush .table > :not(caption) > * > *:first-child {
  padding-left: 1.25rem;
}

.sheet-flush .table > :not(caption) > * > *:last-child {
  padding-right: 1.25rem;
}

@media (min-width: 768px) {
  .sheet-flush .table > :not(caption) > * > *:first-child {
    padding-left: 1.75rem;
  }

  .sheet-flush .table > :not(caption) > * > *:last-child {
    padding-right: 1.75rem;
  }
}

.table thead th {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--on-paper-muted);
  white-space: nowrap;
  border-bottom-color: var(--paper-line-strong);
}

.table td.amount,
.table th.amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table .row-title {
  font-weight: 600;
  color: var(--on-paper);
  text-decoration: none;
}

.table .row-title:hover {
  color: var(--red);
  text-decoration: underline;
}

.table .row-sub {
  display: block;
  font-size: .8125rem;
  color: var(--on-paper-muted);
}

.table tr.is-muted td {
  color: var(--on-paper-muted);
}

/* Phone numbers and emails in lists: tap to call or write, styled as plain text. */
.table .row-link {
  color: inherit;
  text-decoration: none;
}

.table .row-link:hover {
  color: var(--red);
  text-decoration: underline;
}

@media (pointer: coarse) {
  .table .row-link {
    text-decoration: underline;
    text-decoration-color: var(--paper-line);
    text-underline-offset: .2em;
  }
}

/* Lists that collapse into stacked rows on phones */
@media (max-width: 767.98px) {
  .table-stack thead {
    display: none;
  }

  .table-stack tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .125rem 1rem;
    padding: .875rem 1.25rem;
    border-bottom: 1px solid var(--paper-line);
  }

  .table-stack td {
    display: block;
    border: 0 !important;
    padding: 0 !important;
  }

  .table-stack td[data-label]:not(.primary)::before {
    content: attr(data-label) ": ";
    color: var(--on-paper-muted);
  }

  .table-stack td.primary {
    grid-column: 1 / -1;
  }

  .table-stack td.hide-sm {
    display: none;
  }

  .table-stack td.amount {
    text-align: left;
  }
}

/* --- Status badges (fill and outline carry meaning; hue stays in palette) --- */

.status {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .125rem .55rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

/* Planned, not yet committed: outline only (a stencil). */
.status--scheduled,
.status--consultation,
.status--sketch,
.status--pending,
.status--on_hold {
  color: var(--st-plan-fg);
  background: transparent;
}

/* Committed: solid ink. */
.status--confirmed,
.status--approved {
  color: var(--st-firm-fg);
  background: var(--st-firm-bg);
  border-color: var(--st-firm-bg);
}

/* Happening now: red ink. */
.status--in_progress {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

/* Done: grey wash. */
.status--completed {
  color: var(--st-done-fg);
  background: var(--st-done-bg);
  border-color: var(--st-done-border);
}

/* Did not happen: dashed and struck through. */
.status--cancelled,
.status--no_show {
  color: var(--st-off-fg);
  border-style: dashed;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.status--no_show {
  color: var(--st-alert);
  text-decoration: none;
}

.tag {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: var(--radius-control);
  background: var(--paper-sunk);
  color: var(--on-paper);
  font-size: .75rem;
  font-weight: 600;
}

.warning-line {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  border-left: 3px solid var(--red);
  padding: .5rem .75rem;
  background: var(--red-wash);
  color: var(--on-paper);
  font-size: .875rem;
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
}

.warning-line .bi {
  color: var(--red);
}

/* Artist colour key */
.ink-dot {
  display: inline-block;
  width: .625rem;
  height: .625rem;
  border-radius: 50%;
  background: var(--dot, var(--red));
  flex: none;
}

/* Avatars */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--avatar-bg);
  color: var(--on-ink);
  font-weight: 600;
  font-size: .875rem;
  overflow: hidden;
  flex: none;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-lg {
  width: 5.5rem;
  height: 5.5rem;
  font-size: 1.5rem;
}

/* --- Messages --------------------------------------------------------------- */

.toast-stack {
  position: fixed;
  z-index: 1090;
  right: 1rem;
  bottom: calc(var(--tabbar-height) + 1rem + env(safe-area-inset-bottom, 0px));
  display: grid;
  gap: .5rem;
  width: min(26rem, calc(100vw - 2rem));
}

@media (min-width: 992px) {
  .toast-stack {
    bottom: 1.5rem;
    right: 1.5rem;
  }
}

.flash {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .875rem 1rem;
  background: var(--paper);
  color: var(--on-paper);
  border-radius: var(--radius-sheet);
  border-left: 4px solid var(--ink);
  box-shadow: 0 0 0 1px var(--ink-line);
  animation: flash-in .25s var(--ease);
}

.flash--danger,
.flash--warning {
  border-left-color: var(--red);
}

.flash .flash-text {
  flex: 1;
}

.flash .btn-close {
  flex: none;
  margin-top: .1rem;
}

@keyframes flash-in {
  from {
    opacity: 0;
    transform: translateY(.5rem);
  }
}

/* --- Empty states ----------------------------------------------------------- */

.empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--on-paper-muted);
}

.empty p {
  margin: 0 auto 1rem;
  max-width: 42ch;
}

.empty .bi {
  display: block;
  font-size: 1.75rem;
  margin-bottom: .5rem;
  color: var(--paper-line-strong);
}

/* --- Pagination --------------------------------------------------------------- */

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 0 0;
  font-size: .875rem;
  color: var(--on-paper-muted);
}

.sheet-flush .pager {
  padding: 1rem 1.25rem 1.25rem;
}

@media (min-width: 768px) {
  .sheet-flush .pager {
    padding: 1rem 1.75rem 1.5rem;
  }
}

.pager-links {
  display: flex;
  gap: .5rem;
}

/* --- Dashboard: today's book ------------------------------------------------ */

.daybook {
  list-style: none;
  margin: 0;
  padding: 0;
}

.daybook li {
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1fr) auto;
  gap: .25rem 1rem;
  align-items: center;
  padding: .875rem 0;
  border-top: 1px solid var(--paper-line);
}

.daybook li:first-child {
  border-top: 0;
}

.daybook .time {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.daybook--dated li {
  grid-template-columns: 5.25rem minmax(0, 1fr) auto;
}

.daybook--dated .time {
  white-space: nowrap;
}

.daybook .time small {
  display: block;
  font-weight: 400;
  color: var(--on-paper-muted);
}

.daybook .who {
  min-width: 0;
}

.daybook .who a {
  font-weight: 600;
  color: var(--on-paper);
  text-decoration: none;
}

.daybook .who a:hover {
  color: var(--red);
}

.daybook .meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .25rem .75rem;
  font-size: .8125rem;
  color: var(--on-paper-muted);
}

.daybook .meta span {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
}

.daybook li.is-next {
  box-shadow: inset 3px 0 0 var(--red);
  padding-left: .875rem;
  margin-left: -.875rem;
}

.daybook li.is-past .time,
.daybook li.is-past .who a {
  color: var(--on-paper-muted);
}

@media (max-width: 575.98px) {
  .daybook li {
    grid-template-columns: 3.5rem minmax(0, 1fr);
  }

  .daybook--dated li {
    grid-template-columns: 5rem minmax(0, 1fr);
  }

  .daybook li .status {
    grid-column: 2;
    justify-self: start;
  }
}

/* Activity feed */
.feed {
  list-style: none;
  margin: 0;
  padding: 0;
}

.feed li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .125rem 1rem;
  padding: .75rem 0;
  border-top: 1px solid var(--paper-line);
}

.feed li:first-child {
  border-top: 0;
  padding-top: 0;
}

.feed .what {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.feed .what a {
  color: var(--on-paper);
  text-decoration: none;
}

.feed .what a:hover {
  color: var(--red);
  text-decoration: underline;
}

.feed .how {
  font-size: .8125rem;
  color: var(--on-paper-muted);
}

/* What exactly changed: "Amount: 10,00 € → 9 999,00 €". */
.feed .feed-changes {
  list-style: none;
  margin: .25rem 0 0;
  padding: 0;
  font-size: .8125rem;
}

.feed .feed-changes li {
  display: block;
  padding: 0;
  border: 0;
}

.feed .feed-changes .was {
  color: var(--on-paper-muted);
  text-decoration: line-through;
}

.feed time {
  font-size: .8125rem;
  color: var(--on-paper-muted);
  white-space: nowrap;
}

/* --- Charts ----------------------------------------------------------------- */

.chart-box {
  position: relative;
  height: 15rem;
}

.chart-table summary {
  cursor: pointer;
  font-size: .8125rem;
  color: var(--on-paper-muted);
  margin-top: .75rem;
}

.method-bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .75rem;
}

.method-bars .row-label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: .875rem;
  margin-bottom: .25rem;
}

.method-bars .track {
  height: .5rem;
  border-radius: 999px;
  background: var(--paper-sunk);
  overflow: hidden;
}

.method-bars .fill {
  height: 100%;
  border-radius: 999px;
  background: var(--ink);
}

/* --- Client / project header -------------------------------------------------- */

.record-head {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem 1.25rem;
  margin-top: .75rem;
  color: var(--on-ink-muted);
}

.record-meta a {
  color: var(--on-ink);
}

.record-meta span,
.record-meta a {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
}

/* Tabs on the black wall above a sheet */
.tabs-ink {
  --bs-nav-link-color: var(--on-ink-muted);
  --bs-nav-link-hover-color: var(--on-ink);
  --bs-nav-tabs-border-width: 0;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 1.5rem;
  border-bottom: 1px solid var(--ink-line);
  margin-bottom: 1.25rem;
  scrollbar-width: none;
}

.tabs-ink .nav-link {
  padding: .5rem 0 .625rem;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  font-weight: 500;
  white-space: nowrap;
  margin-bottom: -1px;
}

.tabs-ink .nav-link.active {
  color: var(--on-ink);
  background: none;
  border-bottom-color: var(--red);
}

.tabs-ink .count {
  color: var(--on-ink-muted);
  font-weight: 400;
  margin-left: .25rem;
}

/* --- Images ----------------------------------------------------------------- */

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: .75rem;
}

@media (min-width: 768px) {
  .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  }
}

.image-tile {
  position: relative;
  display: block;
  border: 0;
  padding: 0;
  background: var(--paper-sunk);
  border-radius: var(--radius-control);
  overflow: hidden;
  aspect-ratio: 1;
  width: 100%;
  cursor: zoom-in;
}

.image-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s var(--ease);
}

.image-tile:hover img {
  transform: scale(1.03);
}

.image-caption {
  margin-top: .375rem;
  font-size: .8125rem;
  line-height: 1.35;
}

.image-caption strong {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-caption span {
  color: var(--bs-secondary-color);
}

.gallery-grid {
  display: grid;
  /* Two columns even on a narrow phone: one tile per row makes a very long feed. */
  grid-template-columns: repeat(auto-fill, minmax(min(10rem, calc(50% - .375rem)), 1fr));
  gap: 1.25rem .75rem;
}

@media (min-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  }
}

.lightbox .modal-content {
  background: var(--ink);
  border: 0;
}

.lightbox img {
  max-height: 78vh;
  width: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

.cover-thumb {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-control);
  object-fit: cover;
  background: var(--paper-sunk);
  flex: none;
}

.cover-thumb.empty-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--paper-line-strong);
}

/* --- Calendar (FullCalendar) ------------------------------------------------ */

.calendar-sheet {
  padding: 1rem;
}

@media (min-width: 768px) {
  .calendar-sheet {
    padding: 1.25rem 1.5rem;
  }
}

.fc {
  --fc-border-color: var(--paper-line);
  --fc-today-bg-color: #fdf3f4;
  --fc-now-indicator-color: var(--red);
  --fc-button-bg-color: transparent;
  --fc-button-border-color: var(--paper-line-strong);
  --fc-button-text-color: var(--on-paper);
  --fc-button-hover-bg-color: var(--ink);
  --fc-button-hover-border-color: var(--ink);
  --fc-button-active-bg-color: var(--ink);
  --fc-button-active-border-color: var(--ink);
  --fc-event-text-color: #fff;
  --fc-page-bg-color: var(--paper);
  --fc-neutral-bg-color: var(--paper-sunk);
  --fc-list-event-hover-bg-color: var(--paper-sunk);
  --fc-non-business-color: rgba(0, 0, 0, .045);
  font-size: .875rem;
}

.fc .fc-button {
  font-weight: 600;
  text-transform: none;
  border-radius: var(--radius-control);
  padding: .35rem .75rem;
  box-shadow: none !important;
}

.fc .fc-button:hover,
.fc .fc-button-primary:not(:disabled).fc-button-active {
  color: var(--on-ink);
}

.fc .fc-toolbar-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
}

.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number,
.fc .fc-list-day-cushion a {
  color: var(--on-paper);
  text-decoration: none;
  font-weight: 600;
}

.fc .fc-timegrid-slot-label-cushion {
  color: var(--on-paper-muted);
  font-variant-numeric: tabular-nums;
}

.fc .fc-timegrid-slot {
  height: 1.75rem; /* an hour is tall enough for time, client and artist */
}

.fc .fc-event {
  border-radius: 3px;
  border-width: 0;
  padding: 0;
  cursor: pointer;
  /* Touch: a long press picks the session up instead of opening the link menu. */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Time grid block: shrinks line by line as parallel sessions narrow it. */
.fc .fc-timegrid-event .fc-event-main {
  height: 100%;
}

.fc .ev {
  container-type: size; /* narrow blocks switch layout by width and height */
  height: 100%;
  overflow: hidden;
  font-size: .75rem;
  line-height: 1.25;
}

.fc .ev-in {
  height: 100%;
  padding: 2px 5px;
}

.fc .ev-in > div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fc .ev-time {
  font-variant-numeric: tabular-nums;
  opacity: .9;
}

.fc .ev-title {
  font-weight: 650;
}

.fc .ev-short {
  display: none;
  font-weight: 700;
  letter-spacing: .02em;
}

/* Narrow and short: the client's first name. */
@container (max-width: 4.5rem) {
  .fc .ev .ev-in {
    padding: 2px 3px;
  }

  .fc .ev .ev-time,
  .fc .ev .ev-title,
  .fc .ev .ev-meta {
    display: none;
  }

  .fc .ev .ev-short {
    display: block;
  }
}

/* Narrow and tall (parallel sessions in the week view): the text runs along
   the block, so time and full name stay readable instead of shrinking. */
@container (max-width: 4.5rem) and (min-height: 3rem) {
  .fc .ev .ev-in {
    writing-mode: vertical-lr;
    padding: 4px 2px;
  }

  .fc .ev .ev-time,
  .fc .ev .ev-title {
    display: block;
  }

  .fc .ev .ev-short {
    display: none;
  }
}

/* Month: one coloured line per session, the client drops out in narrow cells. */
.fc .fc-daygrid-block-event {
  margin-top: 2px;
}

.fc .ev-line {
  container-type: inline-size;
  display: flex;
  gap: .3rem;
  padding: 1px 4px;
  font-size: .75rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
}

.fc .ev-line .ev-time {
  flex: none;
}

.fc .ev-line .ev-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

@container (max-width: 5.5rem) {
  .fc .ev-line .ev-title {
    display: none;
  }
}

.fc .fc-daygrid-more-link {
  font-size: .75rem;
  font-weight: 600;
  color: var(--on-paper);
}

/* Agenda list: client first, artist and service after it. */
.fc .ev-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0 .5rem;
  align-items: baseline;
}

.fc .ev-row .ev-title {
  font-weight: 600;
}

.fc .ev-row .ev-meta {
  font-size: .8125rem;
  color: var(--on-paper-muted);
}

.fc .fc-list-event:hover .ev-title {
  text-decoration: underline;
}

.fc .ev-row .status {
  font-size: .6875rem;
  padding: 0 .45rem;
}

/* Parallel sessions that don't fit side by side fold into "+2"; a click lists them. */
.fc .fc-timegrid-more-link {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: .75rem;
  font-weight: 700;
  text-decoration: none;
}

.fc .fc-timegrid-more-link:hover {
  background: var(--red);
  color: #fff;
}

.fc .fc-more-popover .fc-popover-body {
  min-width: 13rem;
}

/* In that list a block has no grid cell to take its height from: it grows with its text. */
.fc .fc-more-popover .fc-timegrid-event {
  margin-bottom: 3px;
}

.fc .fc-more-popover .ev {
  container-type: normal;
  height: auto;
}

.fc .fc-more-popover .ev-short {
  display: none;
}

/* Hover details of a session: one fact per line. */
.ev-tooltip .tooltip-inner {
  max-width: 17rem;
  white-space: pre-line;
  text-align: left;
}

.fc .fc-event.fc-event-dragging,
.fc .fc-event.fc-event-selected {
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
  z-index: 5;
}

.fc .fc-event.fc-status-cancelled,
.fc .fc-event.fc-status-no_show {
  opacity: .45;
  text-decoration: line-through;
}

.fc .fc-event.fc-status-scheduled {
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .14) 0 4px, transparent 4px 9px);
}

.fc .fc-event.fc-status-completed {
  filter: saturate(.55);
}

/* The buttons keep their places whatever the title's length: three fixed
   columns, the title in the middle one. Where the sheet is too narrow for all
   three, the title moves to a row of its own above the buttons. */
.calendar-sheet {
  container-type: inline-size;
}

.fc .fc-toolbar.fc-header-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
}

.fc .fc-header-toolbar .fc-toolbar-chunk:nth-child(2) {
  min-width: 0;
  text-align: center;
}

.fc .fc-header-toolbar .fc-toolbar-chunk:last-child {
  justify-self: end;
}

@container (max-width: 56rem) {
  .fc .fc-toolbar.fc-header-toolbar {
    grid-template-columns: auto auto;
    justify-content: space-between;
  }

  .fc .fc-header-toolbar .fc-toolbar-chunk:nth-child(2) {
    grid-column: 1 / -1;
    order: -1;
  }

  .fc .fc-toolbar-title {
    font-size: 1.25rem;
  }
}

@media (max-width: 767.98px) {
  .fc .fc-toolbar.fc-header-toolbar {
    margin-bottom: 1rem;
  }

  .fc .fc-footer-toolbar .fc-button {
    padding: .4rem .65rem;
  }
}

.hint-touch {
  display: none !important;
}

@media (pointer: coarse) {
  .hint-touch {
    display: inline-flex !important;
  }

  .hint-pointer {
    display: none !important;
  }
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.25rem;
  font-size: .8125rem;
  color: var(--on-ink-muted);
}

.legend-row span {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
}

.swatch-planned {
  width: .875rem;
  height: .625rem;
  border-radius: 2px;
  background: repeating-linear-gradient(135deg, var(--red) 0 2px, #e98a99 2px 4px);
}

.swatch-confirmed {
  width: .875rem;
  height: .625rem;
  border-radius: 2px;
  background: var(--red);
}

/* --- Day schedule by artist -------------------------------------------------- */

.schedule {
  display: grid;
  grid-template-columns: 3.5rem repeat(var(--columns, 1), minmax(10rem, 1fr));
  overflow-x: auto;
}

/* The hours stay in view while the artists' columns scroll sideways. */
.schedule > :first-child,
.schedule .schedule-hours {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--paper);
}

.schedule-scroll-hint {
  display: none;
  align-items: center;
  gap: .375rem;
  margin: 0 0 .75rem;
  font-size: .8125rem;
  color: var(--on-paper-muted);
}

.schedule-wrap.is-scrollable .schedule-scroll-hint {
  display: flex;
}

/* A soft edge on the side where more artists are hidden. */
.schedule-wrap.is-scrollable:not(.is-scrolled-end) .table-wrap {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent);
}

@media (max-width: 767.98px) {
  .schedule {
    grid-template-columns: 3rem repeat(var(--columns, 1), minmax(8.5rem, 1fr));
  }

  .schedule-head {
    align-items: flex-start;
    padding: 0 .5rem .75rem;
  }

  .schedule .schedule-head span {
    white-space: normal;
    line-height: 1.25;
  }

  .schedule-head .ink-dot {
    margin-top: .35em;
  }

  /* Narrow columns: the client's name wraps instead of being cut off. */
  .slot strong {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

.schedule-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 0 .75rem .75rem;
  font-weight: 600;
  background: var(--paper);
  min-width: 0;
}

.schedule-head span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-col,
.schedule-hours {
  position: relative;
  height: calc(var(--hours) * 4.5rem);
}

.schedule-col {
  border-left: 1px solid var(--paper-line);
  background-image: linear-gradient(var(--paper-line) 1px, transparent 1px);
  background-size: 100% 4.5rem;
}

.schedule-hours .hour {
  position: absolute;
  right: .5rem;
  transform: translateY(-50%);
  font-size: .75rem;
  color: var(--on-paper-muted);
  font-variant-numeric: tabular-nums;
}

.schedule-hours .hour:first-child {
  transform: none;
}

.slot {
  position: absolute;
  left: .375rem;
  right: .375rem;
  display: block;
  padding: .375rem .5rem;
  border-radius: 3px;
  border-left: 3px solid rgba(0, 0, 0, .35);
  background: var(--dot, var(--red));
  color: #fff;
  font-size: .8125rem;
  line-height: 1.3;
  text-decoration: none;
  overflow: hidden;
  min-height: 1.75rem;
}

.slot:hover {
  color: #fff;
  box-shadow: 0 0 0 2px var(--ink);
  z-index: 1;
}

.slot strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot.is-scheduled {
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .14) 0 4px, transparent 4px 9px);
}

.slot-new {
  position: absolute;
  inset: 0;
}

/* --- Auth --------------------------------------------------------------------- */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: calc(1.5rem + env(safe-area-inset-top, 0px)) 1rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
  .auth {
    padding: 2.5rem 3rem;
  }
}

.auth-top {
  display: flex;
  justify-content: flex-end;
}

.auth-body {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 2rem;
  width: min(26rem, 100%);
  margin: 0 auto;
}

.auth-mark {
  font-family: var(--font-display);
  font-size: clamp(3rem, 2rem + 6vw, 5.25rem);
  line-height: .95;
  margin: 0;
  overflow-wrap: anywhere;
}

.auth-mark {
  --heart: clamp(4rem, 3rem + 4vw, 6rem);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .75rem;
}

/* The heart in its rays with the lettering beside it, as in the sidebar. */
.auth-mark.has-wordmark {
  flex-direction: row;
  align-items: center;
  gap: clamp(.75rem, .5rem + 1vw, 1.25rem);
}

.auth-mark .brand-heart {
  filter: drop-shadow(0 6px 24px rgba(200, 16, 46, .35));
}

.auth .sheet {
  width: 100%;
}

.auth-foot {
  color: var(--on-ink-muted);
  font-size: .8125rem;
  text-align: center;
}

/* --- Settings ----------------------------------------------------------------- */

.settings-layout {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 992px) {
  .settings-layout {
    grid-template-columns: 13rem minmax(0, 46rem);
    align-items: start;
  }
}

.settings-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

@media (min-width: 992px) {
  .settings-nav {
    flex-direction: column;
  }
}

.settings-nav a {
  display: block;
  padding: .375rem 0;
  color: var(--on-ink-muted);
  text-decoration: none;
  font-weight: 500;
}

.settings-nav a:hover {
  color: var(--on-ink);
}

.settings-nav a[aria-current="page"] {
  color: var(--on-ink);
  box-shadow: inset 0 -2px 0 var(--red);
}

@media (min-width: 992px) {
  .settings-nav a {
    padding: .375rem 0 .375rem .875rem;
  }

  .settings-nav a[aria-current="page"] {
    box-shadow: inset 3px 0 0 var(--red);
  }
}

.choice-cards {
  display: grid;
  gap: .75rem;
}

@media (min-width: 576px) {
  .choice-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.choice-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 1rem 1.125rem;
  border: 1px solid var(--paper-line-strong);
  border-radius: var(--radius-sheet);
  background: var(--paper);
  color: var(--on-paper);
  text-align: left;
  font-weight: 600;
}

.choice-card small {
  display: block;
  font-weight: 400;
  color: var(--on-paper-muted);
}

.choice-card:hover {
  border-color: var(--ink);
}

.choice-card[aria-pressed="true"] {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.choice-card[aria-pressed="true"]::after {
  content: "";
  width: .625rem;
  height: .625rem;
  border-radius: 50%;
  background: var(--red);
  flex: none;
}

/* --- Error pages ----------------------------------------------------------------- */

.error-code {
  font-family: var(--font-display);
  font-size: clamp(4rem, 3rem + 6vw, 7rem);
  line-height: 1;
  color: var(--red-on-ink);
  margin: 0 0 .5rem;
}

/* --- Motion preferences ---------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  html,
  body,
  .sheet {
    background: #fff !important;
    color: #000 !important;
  }

  .sidebar,
  .topbar,
  .tabbar,
  .page-actions,
  .toast-stack {
    display: none !important;
  }
}
