:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --surface-3: #f1f2ef;
  --line: #e1e3e7;
  --muted: #697386;
  --text: #171923;
  --orange: #ff5b18;
  --orange-dark: #e94c0c;
  --orange-soft: #fff0e8;
  --green: #159455;
  --green-soft: #eaf8f0;
  --slate: #8b93a2;
  --red: #b42318;
  --red-soft: #fff0ef;
  --amber: #a06400;
  --amber-soft: #fff7df;
  --blue: #ff5b18;
  --shadow: 0 1px 3px rgba(23, 25, 35, 0.06);
}

/* Settings: people-first workspace directory (Option C). */
#settingsPage .settings-workspace-panel {
  max-width: 1460px;
  margin: 0 auto;
  gap: 16px;
}

#settingsPage .settings-directory-hero {
  display: block;
  padding: 4px 0 2px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

#settingsPage .settings-directory-hero h2 {
  margin-top: 5px;
  font-size: clamp(30px, 3vw, 44px);
  letter-spacing: -0.04em;
}

#settingsPage .settings-tabbar {
  gap: 2px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

#settingsPage .settings-tabbar button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 0;
}

#settingsPage .settings-tabbar button svg {
  width: 17px;
  height: 17px;
}

#settingsPage .settings-tabbar button.active {
  position: relative;
  color: var(--text);
  box-shadow: none;
}

#settingsPage .settings-tabbar button.active::after {
  position: absolute;
  right: 12px;
  bottom: 0;
  left: 12px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--orange);
  content: "";
}

.settings-users-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 4px 0;
}

.settings-users-toolbar h3 {
  margin: 0 0 7px;
  color: var(--text);
  font-size: 21px;
}

.settings-users-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.settings-users-summary span {
  display: inline-flex;
  gap: 4px;
  align-items: baseline;
}

.settings-users-summary span + span::before {
  margin: 0 10px;
  color: #b1b6bf;
  content: "·";
}

.settings-users-summary strong {
  color: var(--text);
}

.settings-invite-toggle {
  min-height: 44px;
  padding-inline: 18px;
}

.settings-invite-panel[hidden] {
  display: none;
}

#settingsPage .settings-invite-panel {
  padding: 18px 20px;
  border-color: #ffd1bd;
  background: #fffaf7;
}

.settings-invite-panel .compact-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.settings-invite-panel .compact-heading .muted {
  margin: 5px 0 0;
}

.settings-invite-close {
  flex: 0 0 auto;
}

#settingsPage .users-invite-form {
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) auto auto;
  align-items: end;
}

#settingsPage .users-invite-form label:not(.checkbox-label) {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

#settingsPage .users-invite-form .checkbox-pill {
  min-height: 42px;
  margin: 0;
}

#settingsPage .users-invite-form .primary-button {
  min-height: 42px;
}

.settings-directory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, 0.85fr);
  gap: 16px;
  align-items: start;
}

#settingsPage .settings-member-directory,
#settingsPage .settings-member-detail {
  padding: 20px;
  border-radius: 14px;
}

.settings-directory-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px;
  gap: 10px;
}

.settings-member-search {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.settings-member-search svg {
  width: 18px;
  color: var(--muted);
}

.settings-member-search input {
  min-width: 0;
  min-height: 40px;
  padding: 0 9px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.settings-member-search input:focus {
  box-shadow: none;
}

.settings-member-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

#settingsPage .settings-member-card {
  display: grid;
  gap: 22px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: #fff;
  text-align: left;
  box-shadow: none;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

#settingsPage .settings-member-card:hover {
  border-color: #f1a37f;
  box-shadow: 0 5px 18px rgba(23, 25, 35, 0.07);
}

#settingsPage .settings-member-card.is-selected {
  border-color: var(--orange);
  background: #fff9f5;
  box-shadow: 0 0 0 1px rgba(255, 91, 24, 0.08);
}

.settings-member-card-topline {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.settings-member-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 50%;
  color: #a74218;
  background: #ffe9df;
  font-size: 15px;
  font-style: normal;
  font-weight: 850;
}

.settings-member-card:nth-child(3n + 2) .settings-member-avatar {
  color: #245f9b;
  background: #e4f0fc;
}

.settings-member-card:nth-child(3n + 3) .settings-member-avatar,
.settings-member-avatar.large {
  color: #16713d;
  background: #ddf4e3;
}

.settings-member-identity {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.settings-member-identity strong {
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-member-identity > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-member-card-meta {
  display: flex;
  align-items: center;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.settings-member-card-meta svg {
  width: 16px;
  margin-right: 7px;
}

.settings-member-card-meta em {
  margin-left: auto;
  padding: 3px 8px;
  border: 1px solid #ffc2a6;
  border-radius: 999px;
  color: #b94615;
  background: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
}

.settings-member-empty {
  grid-column: 1 / -1;
  padding: 30px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
}

#settingsPage .settings-member-detail {
  position: sticky;
  top: 88px;
  gap: 0;
}

.settings-detail-profile {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 18px;
}

.settings-member-avatar.large {
  width: 68px;
  height: 68px;
  flex-basis: 68px;
  font-size: 21px;
}

.settings-detail-profile > div {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.settings-detail-profile > div > span,
.settings-detail-profile small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-detail-profile small {
  color: var(--green);
}

.settings-detail-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-detail-name strong {
  color: var(--text);
  font-size: 18px;
}

.settings-detail-section {
  display: grid;
  gap: 8px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.settings-detail-section > strong,
.settings-detail-section-heading strong {
  color: var(--text);
  font-size: 13px;
}

.settings-detail-section > span:not(.settings-detail-section-heading, .settings-calendar-access-row) {
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
}

.settings-detail-section > small {
  color: var(--muted);
  line-height: 1.45;
}

.settings-detail-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.settings-detail-section-heading small {
  color: var(--muted);
}

.settings-calendar-access-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  background: #fafaf9;
  font-size: 13px;
  font-weight: 700;
}

.settings-calendar-access-row svg {
  width: 16px;
  color: var(--muted);
}

.settings-detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.settings-detail-actions > button {
  justify-content: center;
}

.settings-remove-member {
  grid-column: 1 / -1;
  min-height: 40px;
  border: 0;
  color: #b7352d;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.settings-remove-member:hover {
  background: var(--red-soft);
}

[data-theme="dark"] #settingsPage .settings-tabbar,
[data-theme="dark"] .settings-member-search,
[data-theme="dark"] #settingsPage .settings-member-card {
  border-color: var(--line);
  color: var(--text);
  background: #151f2e;
}

[data-theme="dark"] #settingsPage .settings-member-card.is-selected {
  border-color: var(--orange);
  background: #2a201c;
}

[data-theme="dark"] #settingsPage .settings-invite-panel {
  border-color: #563725;
  background: #211915;
}

[data-theme="dark"] .settings-calendar-access-row {
  border-color: var(--line);
  background: #111a27;
}

@media (max-width: 1050px) {
  .settings-directory-layout {
    grid-template-columns: minmax(0, 1.45fr) minmax(290px, 0.75fr);
  }

  .settings-member-grid {
    grid-template-columns: 1fr;
  }

  #settingsPage .users-invite-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  #settingsPage .settings-directory-hero {
    padding: 4px 2px;
  }

  #settingsPage .settings-directory-hero h2 {
    font-size: 28px;
  }

  #settingsPage .settings-tabbar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
  }

  #settingsPage .settings-tabbar button {
    justify-content: center;
    padding: 0 8px;
  }

  .settings-users-toolbar {
    align-items: flex-end;
  }

  .settings-users-toolbar h3 {
    font-size: 19px;
  }

  .settings-users-summary {
    max-width: 230px;
  }

  .settings-invite-toggle {
    width: auto;
    flex: 0 0 auto;
    padding-inline: 12px;
  }

  #settingsPage .users-invite-form,
  .settings-directory-layout,
  .settings-directory-controls {
    grid-template-columns: 1fr;
  }

  #settingsPage .settings-member-directory,
  #settingsPage .settings-member-detail,
  #settingsPage .settings-invite-panel {
    padding: 14px;
    border-radius: 12px;
  }

  .settings-member-grid {
    grid-template-columns: 1fr;
  }

  #settingsPage .settings-member-card {
    gap: 14px;
    padding: 14px;
  }

  #settingsPage .settings-member-detail {
    position: static;
  }
}

html,
body {
  background: var(--bg);
}

body {
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(255, 91, 24, 0.18);
  outline-offset: 1px;
}

.app-shell {
  grid-template-columns: 240px minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  z-index: 40;
  gap: 18px;
  width: 240px;
  padding: 0 12px 14px;
  color: #dbe1eb;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(180deg, #111724 0%, #151b29 100%);
}

.brand {
  min-height: 72px;
  padding: 0 10px;
  gap: 11px;
}

.brand strong {
  color: #ffffff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.brand span {
  color: #7d8798;
}

.brand .sidebar-brand-mark,
.mobile-soundmark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--orange);
  background: transparent;
  border: 0;
  box-shadow: none;
}

.sidebar-brand-mark {
  width: 34px;
  height: 36px;
}

.sidebar-brand-mark i,
.mobile-soundmark i {
  width: 3px;
  border-radius: 999px;
  background: currentColor;
}

.sidebar-brand-mark i:nth-child(1),
.mobile-soundmark i:nth-child(1) {
  height: 12px;
}

.sidebar-brand-mark i:nth-child(2),
.mobile-soundmark i:nth-child(2) {
  height: 24px;
}

.sidebar-brand-mark i:nth-child(3),
.mobile-soundmark i:nth-child(3) {
  height: 34px;
}

.sidebar-brand-mark i:nth-child(4),
.mobile-soundmark i:nth-child(4) {
  height: 22px;
}

.sidebar-brand-mark i:nth-child(5),
.mobile-soundmark i:nth-child(5) {
  height: 10px;
}

.nav-list {
  gap: 4px;
}

.nav-item {
  position: relative;
  min-height: 44px;
  gap: 13px;
  padding: 0 13px;
  border: 0;
  border-radius: 7px;
  color: #b9c1d0;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  stroke-width: 1.8;
}

.nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 3px 0 var(--orange);
}

.profile-card {
  min-height: 64px;
  margin: auto 0 0;
  padding: 11px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.035);
}

.profile-card strong {
  color: #ffffff;
  font-size: 12px;
}

.profile-card span {
  color: #7d8798;
  font-size: 10px;
}

.profile-card .avatar {
  width: 36px;
  height: 36px;
  border: 1px solid #778195;
  border-radius: 50%;
  color: #ffffff;
  background: #1a2231;
  box-shadow: none;
  font-size: 10px;
}

.profile-card .logout-button {
  color: #aeb7c5;
  border-color: transparent;
  background: transparent;
}

.main {
  grid-column: 2;
  min-width: 0;
  padding: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 72px;
  margin: 0;
  padding: 0 clamp(24px, 3vw, 46px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.workspace-switcher {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 190px;
  height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #303642;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.03);
  font-size: 12px;
  font-weight: 700;
}

.workspace-switcher > span:last-child {
  margin-left: auto;
  transform: rotate(90deg);
}

.workspace-switcher svg {
  width: 15px;
  color: var(--muted);
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(430px, 36vw);
  height: 40px;
  margin-left: auto;
  padding: 0 10px 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #ffffff;
}

.topbar-search svg {
  width: 17px;
}

.topbar-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12px;
}

.topbar-search kbd {
  padding: 2px 6px;
  border: 1px solid #e8e8eb;
  border-radius: 5px;
  color: #9297a3;
  background: #f8f8f8;
  font-family: inherit;
  font-size: 9px;
}

.topbar-actions {
  flex-wrap: nowrap;
  gap: 7px;
}

.topbar-actions .ghost-button,
.topbar-actions .primary-button {
  min-height: 40px;
  border-radius: 8px;
}

.app-page-heading {
  width: min(1600px, calc(100% - 48px));
  margin: 0 auto;
  padding: 32px 0 22px;
}

.app-page-heading .eyebrow {
  margin-bottom: 7px;
}

.app-page-heading h1 {
  max-width: 760px;
  color: var(--text);
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 800;
  letter-spacing: -0.045em;
}

.eyebrow {
  color: var(--orange);
  font-size: 10px;
  letter-spacing: 0.14em;
}

.page-view {
  width: min(1600px, calc(100% - 48px));
  margin: 0 auto;
  padding-bottom: 54px;
}

.primary-button {
  border-color: var(--orange);
  border-radius: 8px;
  color: #ffffff;
  background: var(--orange);
  box-shadow: 0 7px 18px rgba(255, 91, 24, 0.18);
  font-weight: 750;
}

.primary-button:hover {
  border-color: var(--orange-dark);
  background: var(--orange-dark);
}

.ghost-button,
.icon-button,
.segmented button,
.tiny-button {
  border-color: #dfe0e5;
  color: #555d6e;
  background: #ffffff;
}

.ghost-button:hover,
.icon-button:hover,
.segmented button:hover,
.segmented button.active {
  color: var(--text);
  background: #f5f5f3;
}

.stats-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat-pill {
  min-height: 82px;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.stat-pill .status-dot,
.stat-pill > [data-icon] {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.stat-pill .status-dot {
  border: 11px solid var(--green-soft);
  background: var(--green);
}

.stat-pill.orange .status-dot {
  border-color: var(--orange-soft);
  background: var(--orange);
}

.stat-pill.slate .status-dot {
  border-color: #f0f1f3;
  background: #8b93a2;
}

.stat-pill > [data-icon] {
  color: #7c8494;
  background: #f0f1f3;
}

.stat-pill strong {
  color: var(--text);
  font-size: 20px;
}

.workspace {
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
}

.calendar-panel,
.clients-page-panel,
.panel-section,
.reporting-card,
.reporting-row {
  border-color: var(--line);
  border-radius: 11px;
  color: var(--text);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.calendar-panel {
  padding: 0;
  overflow: hidden;
}

.calendar-toolbar {
  min-height: 64px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.year-control {
  gap: 7px;
}

.year-control strong {
  min-width: 120px;
  color: var(--text);
  font-size: 18px;
  text-align: center;
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 7px;
}

.segmented {
  padding: 3px;
  border-color: var(--line);
  border-radius: 8px;
  background: #f7f7f5;
}

.segmented button {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.segmented button.active {
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(23, 25, 35, 0.09);
}

.legend {
  margin: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.filters-row {
  grid-template-columns: repeat(3, minmax(130px, 1fr)) auto;
  gap: 8px;
  margin: 0;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fafaf9;
}

.filter-field span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tiny-select,
input,
select,
textarea {
  border-color: #dfe0e5;
  color: #444b58;
  background: #ffffff;
}

.calendar-view {
  min-height: 530px;
}

.month-card {
  border-color: transparent;
  border-radius: 0;
  color: var(--text);
  background: #ffffff;
}

.month-expanded {
  padding: 0;
}

.month-expanded .month-title {
  display: none;
}

.weekday-row {
  min-height: 30px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  color: #5f6776;
  font-size: 10px;
}

.weekday-row span {
  display: grid;
  place-items: center;
}

.month-days {
  gap: 0;
}

.month-expanded .month-days {
  grid-auto-rows: minmax(88px, 1fr);
}

.month-expanded .month-days > span,
.month-expanded .day-cell {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.day-cell {
  color: #4c5360;
  background: transparent;
}

.month-expanded .day-cell {
  min-height: 88px;
  padding: 9px;
  border-radius: 0;
  place-items: start;
  align-content: start;
  text-align: left;
}

.month-expanded .day-cell:hover,
.month-expanded .day-cell:focus-visible {
  border-color: var(--line);
  background: #fafaf8;
}

.month-expanded .day-cell.is-selected {
  z-index: 1;
  border: 1.5px solid var(--orange);
  background: #fffdfb;
}

.month-expanded .day-cell.is-today .day-number,
.month-expanded .day-cell.is-selected .day-number {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #ffffff;
  background: var(--orange);
}

.day-cell.has-booking,
.day-cell.pencilled,
.day-cell.blocked,
.day-cell.retained,
.day-cell.cancelled,
.day-cell.has-request {
  color: #4c5360;
  background: transparent;
}

.day-event-label {
  display: none;
}

.month-expanded .day-event-label {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 5px 7px;
  overflow: hidden;
  border-radius: 5px;
  color: #087d4b;
  background: var(--green-soft);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-expanded .day-cell.pencilled .day-event-label {
  color: #c9470b;
  background: var(--orange-soft);
}

.month-expanded .day-cell.blocked .day-event-label {
  color: #616876;
  background:
    repeating-linear-gradient(-45deg, #f0f1f3 0, #f0f1f3 4px, #e7e8eb 4px, #e7e8eb 8px);
}

.month-expanded .day-cell.cancelled .day-event-label {
  color: #9d2c24;
  background: #fff0ef;
}

.month-expanded .day-cell.has-request .day-event-label {
  color: #8a5b00;
  background: #fff7df;
}

.side-panel {
  gap: 14px;
}

.panel-section {
  padding: 17px;
}

.panel-section .section-heading {
  align-items: flex-start;
}

.panel-section h2 {
  color: var(--text);
  font-size: 16px;
}

.multi-select-tools {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.agenda-list,
.request-list {
  gap: 9px;
}

.agenda-item,
.request-item,
.booking-chip,
.list-row {
  border-color: var(--line);
  color: var(--text);
  background: #ffffff;
}

.agenda-item {
  padding: 13px;
  border-radius: 8px;
}

.agenda-item strong {
  color: var(--text);
  font-size: 15px;
}

.agenda-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.agenda-actions .tiny-button {
  min-height: 34px;
  border-radius: 7px;
}

.public-panel {
  background: #fffdfa;
}

.request-form input,
.request-form .ghost-button {
  min-height: 38px;
}

.year-grid {
  gap: 10px;
  padding: 12px;
}

.year-grid .month-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #ffffff;
}

.year-grid .month-title {
  color: var(--text);
}

.year-grid .day-cell.has-booking {
  color: #ffffff;
  background: var(--green);
}

.year-grid .day-cell.pencilled {
  color: #ffffff;
  background: var(--orange);
}

.year-grid .day-cell.blocked {
  color: #ffffff;
  background: var(--slate);
}

.week-day,
.booking-chip {
  border-color: var(--line);
  color: var(--text);
  background: #ffffff;
}

.booking-chip.confirmed {
  border-color: #ccebd9;
  background: var(--green-soft);
}

.booking-chip.pencilled {
  border-color: #ffd7c3;
  background: var(--orange-soft);
}

.list-view {
  padding: 16px;
}

.list-toolbar {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.list-history-panel {
  border-color: var(--line);
  background: #fafaf9;
}

.list-row {
  min-height: 76px;
  padding: 12px 13px;
  border-radius: 8px;
}

.list-row.is-selected {
  border-color: rgba(255, 91, 24, 0.55);
  background: #fffaf7;
}

.list-row .tiny-button {
  min-height: 32px;
  border-radius: 7px;
}

.event-popover {
  z-index: 80;
  width: min(320px, calc(100vw - 28px));
  border: 1px solid #dfe0e5;
  border-radius: 11px;
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(17, 24, 39, 0.18);
}

.popover-header {
  padding: 14px 15px 12px;
  border-bottom: 1px solid #ececf0;
  background: #fafaf9;
}

.popover-header h3 {
  color: var(--text);
  font-size: 15px;
  letter-spacing: -0.02em;
}

.popover-header span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.popover-close {
  border-color: #dfe0e5;
  color: var(--muted);
  background: #ffffff;
}

.popover-close:hover {
  color: var(--text);
  background: #f1f2ef;
}

.popover-body {
  gap: 9px;
  padding: 11px;
}

.popover-event {
  padding: 12px;
  border-color: var(--line);
  border-radius: 9px;
  color: var(--text);
  background: #ffffff;
}

.popover-event.confirmed {
  border-color: #c9e9d6;
  background: var(--green-soft);
}

.popover-event.pencilled {
  border-color: #ffd5c0;
  background: var(--orange-soft);
}

.popover-event.retained {
  border-color: #ead8bd;
  background: linear-gradient(135deg, #fff6ec, #edf9f2);
}

.popover-event.cancelled {
  border-color: #f2c7c3;
  background: var(--red-soft);
}

.popover-event.blocked {
  border-color: #dfe1e5;
  background:
    repeating-linear-gradient(-45deg, #f7f7f6 0, #f7f7f6 5px, #f0f1f2 5px, #f0f1f2 10px);
}

.popover-event strong {
  color: var(--text);
}

.popover-event span,
.popover-event p {
  color: #626b7a;
}

.tiny-button {
  border-color: #dfe0e5;
  color: #4f5665;
  background: #ffffff;
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.tiny-button:hover {
  border-color: #cfd1d7;
  color: var(--text);
  background: #f5f5f3;
  transform: translateY(-1px);
}

.tiny-button:focus-visible {
  border-color: rgba(255, 91, 24, 0.55);
}

.tiny-button.danger,
.ghost-button.danger {
  border-color: #f0c8c4;
  color: #a1372f;
  background: #fffafa;
}

.tiny-button.danger:hover,
.ghost-button.danger:hover {
  border-color: #e8aaa4;
  color: #8d251e;
  background: var(--red-soft);
}

.month-expanded .day-cell,
.year-grid .day-cell,
.week-day,
.booking-chip,
.agenda-item,
.request-item,
.list-row,
.client-ledger-row,
.invoice-ledger-row,
.user-card,
.calendar-choice {
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.booking-chip:hover,
.agenda-item:hover,
.request-item:hover,
.list-row:hover,
.client-ledger-row:hover,
.invoice-ledger-row:hover,
.user-card:hover {
  border-color: #d0d3d9;
  background: #fafaf9;
  box-shadow: 0 6px 18px rgba(23, 25, 35, 0.06);
}

.list-row:hover,
.client-ledger-row:hover,
.invoice-ledger-row:hover {
  transform: translateY(-1px);
}

.booking-chip.confirmed:hover,
.popover-event.confirmed:hover {
  border-color: #a8dabb;
  background: #e3f6eb;
}

.booking-chip.pencilled:hover,
.popover-event.pencilled:hover {
  border-color: #ffc49f;
  background: #ffeadd;
}

.modal {
  background: rgba(17, 24, 39, 0.48);
  backdrop-filter: blur(6px);
}

.modal-card,
.booking-modal-card,
.booking-modal-card.client-detail-modal-card {
  border: 1px solid var(--line);
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.22);
}

.booking-modal-card .modal-header,
.booking-modal-card.auth-card .modal-header {
  border-bottom-color: var(--line);
  background: #fafaf9;
}

.modal-header h2,
.modal-header h3,
.booking-modal-card h2,
.booking-modal-card h3 {
  color: var(--text);
}

.modal-card .icon-button,
.modal-card .ghost-button,
.booking-modal-card .icon-button,
.booking-modal-card .ghost-button {
  border-color: #dfe0e5;
  color: #4f5665;
  background: #ffffff;
}

.modal-card .icon-button:hover,
.modal-card .ghost-button:hover,
.booking-modal-card .icon-button:hover,
.booking-modal-card .ghost-button:hover {
  border-color: #cfd1d7;
  color: var(--text);
  background: #f3f3f1;
}

.modal-form {
  background: #ffffff;
}

.auth-card label {
  color: #404754;
}

.auth-card input:not([type="checkbox"]),
.auth-card textarea,
.booking-modal-card input:not([type="checkbox"]),
.booking-modal-card select,
.booking-modal-card textarea {
  border-color: #dfe0e5;
  color: var(--text);
  background: #ffffff;
}

.auth-card input:not([type="checkbox"]):hover,
.auth-card textarea:hover,
.booking-modal-card input:not([type="checkbox"]):hover,
.booking-modal-card select:hover,
.booking-modal-card textarea:hover {
  border-color: #c6c9d0;
}

.auth-card input:not([type="checkbox"]):focus,
.auth-card textarea:focus,
.booking-modal-card input:not([type="checkbox"]):focus,
.booking-modal-card select:focus,
.booking-modal-card textarea:focus {
  border-color: var(--orange);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 91, 24, 0.13);
}

.calendar-choice {
  border-color: var(--line);
  color: var(--text);
  background: #ffffff;
}

.calendar-choice:hover {
  border-color: #cfd1d7;
  background: #f7f7f5;
  transform: translateY(-1px);
}

.calendar-choice.is-active {
  border-color: rgba(255, 91, 24, 0.52);
  background: #fff7f2;
  box-shadow: 0 0 0 3px rgba(255, 91, 24, 0.08);
}

.calendar-choice-kind,
.calendar-choice-role {
  border-color: #dedfe4;
  color: #626a78;
  background: #f5f5f3;
}

.calendar-default-toggle {
  border-color: var(--line);
  background: #fafaf9;
}

.calendar-default-toggle .checkbox-copy::before {
  border-color: #cdd0d6;
  background: #ffffff;
}

.calendar-default-toggle input[type="checkbox"]:checked + .checkbox-copy::before {
  background: var(--orange);
  box-shadow: inset 0 0 0 4px #ffffff;
}

.settings-tabbar {
  border-color: var(--line);
  background: #f3f3f1;
}

.settings-tabbar button.active,
.settings-tabbar button:hover {
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(23, 25, 35, 0.09);
}

.users-summary-strip article,
.user-card,
.calendar-member-card {
  border-color: var(--line);
  color: var(--text);
  background: #ffffff;
}

.user-card.is-current-user {
  border-color: #b9dfc7;
  background: #f1fbf5;
}

.invoice-status-option:hover {
  border-color: #cfd1d7;
  background: #f7f7f5;
}

.invoice-status-option.active {
  border-color: rgba(255, 91, 24, 0.48);
  background: var(--orange-soft);
  box-shadow: inset 0 0 0 1px rgba(255, 91, 24, 0.08);
}

.clients-page-panel,
.users-admin-card,
.account-section-card,
.account-hero-card,
.client-section-card,
.invoice-controls-card,
.invoice-section-card {
  border-color: var(--line);
  color: var(--text);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.reporting-meter,
.mobile-dashboard {
  border-color: var(--line);
  color: var(--text);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.reporting-card strong,
.reporting-row strong,
.reporting-panel h3 {
  color: var(--text);
}

.reporting-row,
.reporting-card {
  background: #ffffff;
}

#loginModal.modal {
  z-index: 100;
  padding: 28px;
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 91, 24, 0.08), transparent 24rem),
    #f3f3f0;
  backdrop-filter: none;
}

body:has(#loginModal:not([hidden])) .app-shell {
  display: none;
}

#loginModal .auth-login-card {
  display: grid;
  grid-template-columns: minmax(300px, 0.86fr) minmax(390px, 1.14fr);
  width: min(880px, calc(100vw - 56px));
  max-width: 880px;
  min-height: 570px;
  max-height: calc(100dvh - 56px);
  overflow: hidden;
  border: 1px solid #dfe0e5;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(17, 24, 39, 0.18);
}

#loginModal .auth-login-header {
  min-width: 0;
  height: 100%;
  padding: 42px 38px;
  border: 0;
  color: #ffffff;
  background:
    radial-gradient(circle at 12% 88%, rgba(255, 91, 24, 0.18), transparent 18rem),
    linear-gradient(155deg, #111724 0%, #161d2b 100%);
}

#loginModal .auth-login-intro {
  display: grid;
  align-content: space-between;
  justify-items: start;
  gap: 90px;
  width: 100%;
  height: 100%;
  text-align: left;
}

#loginModal .auth-login-wordmark {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #ffffff;
}

#loginModal .auth-login-wordmark strong {
  color: #ffffff;
  font-size: 20px;
  letter-spacing: -0.035em;
}

#loginModal .auth-soundmark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 31px;
  height: 36px;
  color: var(--orange);
}

.auth-soundmark i {
  display: block;
  width: 3px;
  border-radius: 999px;
  background: currentColor;
}

.auth-soundmark i:nth-child(1) { height: 11px; }
.auth-soundmark i:nth-child(2) { height: 22px; }
.auth-soundmark i:nth-child(3) { height: 33px; }
.auth-soundmark i:nth-child(4) { height: 20px; }
.auth-soundmark i:nth-child(5) { height: 9px; }

#loginModal .auth-login-copy {
  justify-items: start;
  gap: 12px;
}

#loginModal .auth-login-copy .eyebrow {
  color: var(--orange);
  font-size: 10px;
}

#loginModal .auth-login-copy h2 {
  max-width: 8ch;
  color: #ffffff;
  font-size: clamp(32px, 4vw, 46px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

#loginModal .auth-login-copy .muted {
  max-width: 28ch;
  color: #a9b2c1;
  font-size: 13px;
  line-height: 1.55;
}

#loginModal .modal-form {
  align-content: center;
  gap: 17px;
  min-width: 0;
  margin: 0;
  padding: 46px 52px;
  background: #ffffff;
}

#loginModal .auth-form-heading {
  display: grid;
  gap: 6px;
  margin-bottom: 7px;
}

#loginModal .auth-form-heading .eyebrow {
  margin: 0;
  font-size: 9px;
}

#loginModal .auth-form-heading h3 {
  margin: 0;
  color: var(--text);
  font-size: 27px;
  letter-spacing: -0.04em;
}

#loginModal .auth-form-heading .muted {
  margin: 0;
  font-size: 12px;
}

#loginModal label,
#loginModal .password-label-row label {
  gap: 7px;
  color: #414854;
  font-size: 11px;
  font-weight: 750;
}

#loginModal .auth-field-group {
  gap: 7px;
}

#loginModal input:not([type="checkbox"]) {
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid #d9dbe1;
  border-radius: 8px;
  color: var(--text);
  background: #ffffff;
  font-size: 15px;
}

#loginModal input:not([type="checkbox"]):hover {
  border-color: #c3c6ce;
}

#loginModal input:not([type="checkbox"]):focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 91, 24, 0.13);
}

#loginModal .password-toggle {
  right: 8px;
  color: #7b8391;
}

#loginModal .password-toggle:hover {
  color: var(--text);
  background: #f3f3f1;
}

#loginModal .auth-text-button {
  color: #d74d12;
  font-size: 11px;
}

#loginModal .checkbox-label {
  min-height: 24px;
  padding: 0;
  color: #626b78;
  font-size: 11px;
}

#loginModal .checkbox-label .checkbox-copy::before {
  border-color: #cbd0d7;
  background: #ffffff;
}

#loginModal .checkbox-label input[type="checkbox"]:checked + .checkbox-copy::before {
  background: var(--orange);
  box-shadow: inset 0 0 0 4px #ffffff;
}

#loginModal #loginMessage {
  min-height: 18px;
  margin: -2px 0 0;
  color: #747d8b;
  text-align: left;
  font-size: 11px;
}

#loginModal .auth-form-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  justify-content: stretch;
}

#loginModal .auth-form-actions > * {
  order: initial;
}

#loginModal .auth-form-actions .primary-button,
#loginModal .auth-form-actions .ghost-button {
  min-height: 46px;
  border-radius: 8px;
  font-size: 12px;
}

#loginModal .auth-form-actions .primary-button {
  color: #ffffff;
  background: var(--orange);
  box-shadow: 0 8px 18px rgba(255, 91, 24, 0.2);
}

#loginModal .auth-form-actions .ghost-button {
  border-color: #d9dbe1;
  color: #4f5665;
  background: #ffffff;
}

#loginModal .auth-form-actions .ghost-button:hover {
  border-color: #c6c9d0;
  color: var(--text);
  background: #f7f7f5;
}

.auth-action-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #9298a3;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-action-divider::before,
.auth-action-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: #e5e6e9;
}

.auth-action-divider:has(+ #loginPasskeyButton[hidden]) {
  display: none;
}

#loginModal .auth-security-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  color: #89919e;
  font-size: 9px;
  line-height: 1.45;
}

#loginModal .auth-security-note span {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border-radius: 50%;
  color: #087d4b;
  background: var(--green-soft);
  font-size: 9px;
  font-weight: 900;
}

.mobile-nav-scrim,
.mobile-appbar {
  display: none;
}

/* Complete the light workspace treatment for data-heavy secondary pages. */
.clients-workspace-panel,
.invoices-page-panel,
.settings-workspace-panel {
  color: var(--text);
}

.clients-workspace-panel > .section-heading,
.invoices-page-panel > .section-heading,
.users-hero {
  margin: 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.clients-workspace-panel > .section-heading h2,
.invoices-page-panel > .section-heading h2,
.users-hero h2,
.client-section-header h3,
.invoice-section-header h3,
.compact-heading h3 {
  color: var(--text);
}

.client-overview-strip,
.invoice-overview-strip {
  gap: 8px;
}

.client-overview-strip article,
.invoice-overview-strip article,
.users-summary-strip article {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.client-overview-strip span,
.invoice-overview-strip span,
.users-summary-strip span {
  color: #7b8391;
}

.client-overview-strip strong,
.invoice-overview-strip strong,
.users-summary-strip strong {
  color: var(--text);
}

.client-section-card,
.invoice-controls-card,
.invoice-section-card,
.invoice-section-card-muted,
.users-admin-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.client-section-card,
.invoice-section-card {
  padding: 16px 18px 18px;
}

.invoice-controls-card,
.users-admin-card {
  padding: 16px 18px;
}

.client-section-header,
.invoice-section-header {
  padding-bottom: 2px;
}

.client-empty,
.invoice-empty,
.account-empty {
  padding: 22px;
  border: 1px dashed #d6d8de;
  border-radius: 10px;
  color: var(--muted);
  background: #fafaf9;
  text-align: center;
}

.client-ledger-row,
.invoice-ledger-row {
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(23, 25, 35, 0.04);
}

.client-ledger-row::before,
.invoice-ledger-row::before {
  width: 3px;
  background: #c5c9d1;
}

.client-ledger-row.client-tone-stable::before,
.invoice-ledger-row.invoice-tone-sent::before {
  background: var(--green);
}

.client-ledger-row.client-tone-outstanding::before,
.invoice-ledger-row-pending::before {
  background: var(--orange);
}

.client-ledger-row.client-tone-missing::before,
.invoice-ledger-row.invoice-tone-overdue::before {
  background: var(--red);
}

.invoice-ledger-row.invoice-tone-paid::before {
  background: #3182b8;
}

.invoice-ledger-row.invoice-tone-draft::before {
  background: #9299a5;
}

.client-ledger-main,
.invoice-ledger-main {
  color: var(--text);
}

.client-ledger-title strong,
.client-ledger-stats strong,
.invoice-ledger-title strong,
.invoice-ledger-amount strong {
  color: var(--text);
}

.client-ledger-title span,
.client-ledger-title p,
.client-ledger-stats span,
.client-ledger-meta p,
.invoice-ledger-title span,
.invoice-ledger-title p,
.invoice-ledger-amount span,
.invoice-ledger-meta p {
  color: var(--muted);
}

.invoice-filter-chip,
.invoice-status-pill,
.history-status-pill,
.user-role-pill {
  border-color: #dadde3;
  color: #5d6573;
  background: #f5f5f3;
}

.invoice-filter-chip.sent,
.invoice-status-pill.sent,
.history-status-pill.confirmed,
.history-status-pill.invoice-paid,
.user-role-pill.admin {
  border-color: #b9dfc7;
  color: #087d4b;
  background: var(--green-soft);
}

.invoice-filter-chip.draft,
.invoice-status-pill.draft,
.history-status-pill.retained,
.history-status-pill.invoice-draft,
.history-status-pill.invoice-sent,
.user-role-pill.member {
  border-color: #dadde3;
  color: #5d6573;
  background: #f5f5f3;
}

.invoice-filter-chip.overdue,
.invoice-status-pill.overdue,
.history-status-pill.invoice-overdue {
  border-color: #f0c8c4;
  color: #a1372f;
  background: var(--red-soft);
}

.history-status-pill.pencilled,
.invoice-status-pill.outstanding {
  border-color: #f2d4a1;
  color: #8d5800;
  background: var(--amber-soft);
}

.invoice-status-pill.paid {
  border-color: #b9d9ec;
  color: #21658d;
  background: #edf7fc;
}

.inline-settings-panel,
.invoice-settings-bank-section {
  border-color: var(--line);
  color: var(--text);
  background: #fafaf9;
}

.inline-settings-panel {
  padding: 16px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.invoice-settings-bank-section {
  border-radius: 10px;
  background: #ffffff;
}

.client-kpis article,
.client-detail-section,
.client-history-card {
  border-color: var(--line);
  color: var(--text);
  background: #fafaf9;
}

.client-kpis article {
  border-radius: 10px;
}

.client-detail-section,
.client-history-card {
  border-radius: 10px;
}

.client-detail-header {
  border-bottom-color: var(--line);
}

.client-detail-section h3,
.client-history-grid h3,
.client-history-card-header strong,
.client-kpis strong {
  color: var(--text);
}

.users-main-panel {
  gap: 14px;
}

.users-hero {
  align-items: center;
}

.users-summary-strip {
  gap: 8px;
}

.settings-tabbar {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #efefec;
}

.settings-tabbar button {
  color: #697180;
}

.settings-tabbar button.active,
.settings-tabbar button:hover {
  color: var(--text);
  background: #ffffff;
}

.users-admin-grid {
  gap: 14px;
}

.users-share-inline {
  border-top-color: var(--line);
}

.user-card,
.calendar-member-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: #fafaf9;
  box-shadow: none;
}

.user-card.is-current-user {
  border-color: #b9dfc7;
  background: #f1fbf5;
}

.user-card-header strong,
.calendar-member-card strong {
  color: var(--text);
}

.calendar-choice {
  border: 1px solid var(--line);
  color: var(--text);
  background: #fafaf9;
}

.calendar-choice.is-active {
  border-color: rgba(255, 91, 24, 0.46);
  background: #fff7f2;
  box-shadow: 0 0 0 3px rgba(255, 91, 24, 0.08);
}

.calendar-choice-kind,
.calendar-choice-role {
  border-color: #dadde3;
  color: #626a78;
  background: #ffffff;
}

.calendar-default-toggle {
  border-color: var(--line);
  color: var(--text);
  background: #fafaf9;
}

.calendar-member-card {
  background: #ffffff;
}

.checkbox-pill {
  border-color: var(--line);
  color: #4f5665;
  background: #fafaf9;
}

.checkbox-pill:hover {
  border-color: #cfd1d7;
  background: #f5f5f3;
}

/* Invoice viewer and editor */
#invoiceModal.modal {
  z-index: 70;
  padding: 12px;
}

.invoice-modal-card,
.booking-modal-card.client-detail-modal-card.invoice-modal-card,
.invoice-modal-card.editor-open,
.booking-modal-card.client-detail-modal-card.invoice-modal-card.editor-open {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1560px, calc(100vw - 24px));
  height: min(1040px, calc(100dvh - 24px));
  max-width: none;
  max-height: none;
  overflow: hidden;
  border: 1px solid #d8dbe1;
  border-radius: 14px;
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 30px 90px rgba(17, 24, 39, 0.26);
}

.invoice-modal-card:not(.editor-open),
.booking-modal-card.client-detail-modal-card.invoice-modal-card:not(.editor-open) {
  width: min(1040px, calc(100vw - 24px));
  max-width: none;
}

.invoice-modal-card > .modal-header {
  min-height: 68px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  background: #ffffff;
}

.invoice-modal-card > .modal-header h2 {
  font-size: 20px;
  letter-spacing: -0.025em;
}

.invoice-modal-card > .modal-header .icon-button {
  flex: 0 0 auto;
  border-color: #dfe0e5;
  color: #5c6472;
  background: #ffffff;
}

.invoice-preview {
  min-width: 0;
  min-height: 0;
  padding: 18px;
  overflow: auto;
  color: var(--text);
  background: #eff0ed;
}

.invoice-editor-shell {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  gap: 14px;
}

.invoice-editor-shell.editor-open {
  grid-template-columns: minmax(0, 1.12fr) minmax(420px, 0.88fr);
  align-items: stretch;
}

.invoice-editor-form,
.invoice-preview-pane {
  min-width: 0;
  border: 1px solid #dcdfe4;
  border-radius: 11px;
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(23, 25, 35, 0.05);
}

.invoice-editor-form {
  align-content: start;
  gap: 17px;
  max-height: none;
  padding: 18px;
  overflow: auto;
}

.invoice-modal-card.editor-open .invoice-editor-form {
  max-height: none;
  align-self: stretch;
}

.invoice-editor-form label {
  gap: 7px;
  color: #4e5663;
  font-size: 11px;
  font-weight: 750;
}

.invoice-editor-form input,
.invoice-editor-form select,
.invoice-editor-form textarea {
  border: 1px solid #dadde3;
  border-radius: 8px;
  color: var(--text);
  background: #ffffff;
}

.invoice-editor-form textarea {
  resize: vertical;
}

.invoice-editor-header {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fafaf9;
}

.invoice-editor-header strong {
  color: var(--text);
  font-size: 16px;
}

.invoice-editor-header span {
  color: var(--muted);
}

.invoice-editor-section {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafaf9;
}

.invoice-editor-line {
  grid-template-columns: minmax(150px, 1.55fr) minmax(140px, 1.2fr) minmax(90px, 0.55fr) auto;
  gap: 8px;
}

.invoice-editor-line .tiny-button {
  min-height: 38px;
  align-self: end;
}

.invoice-preview-pane {
  position: static;
  top: auto;
  align-self: stretch;
  display: block;
  padding: 16px;
  overflow: auto;
  background: #e7e9e6;
}

.invoice-preview-pane-inner {
  display: block;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.invoice-editor-shell.editor-open .invoice-preview-pane,
.invoice-editor-shell.editor-open .invoice-editor-form {
  width: auto;
  min-height: 0;
}

.invoice-editor-shell.editor-closed {
  min-height: 100%;
  justify-items: center;
}

.invoice-editor-shell.editor-closed .invoice-preview-pane {
  width: min(860px, 100%);
  max-width: none;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.invoice-sheet,
.invoice-modal-card:not(.editor-open) .invoice-sheet {
  width: 100%;
  height: auto;
  min-height: 0;
  max-width: none;
  aspect-ratio: auto;
  padding: clamp(24px, 3vw, 38px);
  border: 1px solid #e0e2e6;
  border-radius: 12px;
  color: #20242d;
  background: #ffffff;
  box-shadow: 0 16px 45px rgba(23, 25, 35, 0.12);
}

.invoice-sheet-header {
  margin-bottom: 30px;
  padding: 20px 22px;
  border: 1px solid #ffd8c5;
  border-radius: 10px;
  background: #fff4ed;
}

.invoice-sheet-header .eyebrow {
  color: var(--orange);
}

.invoice-sheet-header h3 {
  color: #171923;
  font-size: 28px;
  letter-spacing: -0.035em;
}

.invoice-sheet-header p {
  color: #6a5145;
}

.invoice-sheet-meta strong {
  color: #171923;
}

.invoice-sheet-meta span,
.invoice-note {
  color: #697386;
}

.invoice-meta {
  margin-bottom: 26px;
}

.invoice-meta strong,
.invoice-footer-grid strong,
.invoice-line strong {
  color: #20242d;
}

.invoice-table-header {
  padding: 11px 16px;
  border-radius: 8px;
  background: #171e2c;
}

.invoice-line {
  padding: 13px 16px;
  border: 1px solid #e6e7ea;
  border-radius: 8px;
  background: #fafaf9;
}

.invoice-total-box {
  min-width: 240px;
  padding: 16px 18px;
  border: 1px solid #ffd8c5;
  border-radius: 10px;
  background: #fff4ed;
}

.invoice-total-box span {
  color: #d94b0f;
}

.invoice-total-box strong {
  color: #171923;
}

.invoice-footer-grid {
  padding-top: 24px;
  border-top: 1px solid #e6e7ea;
}

.invoice-modal-card > .modal-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 -8px 24px rgba(23, 25, 35, 0.04);
}

.invoice-modal-card.editor-open > .modal-actions {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.invoice-modal-card > .modal-actions button {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  justify-content: center;
  padding-inline: 10px;
  border-radius: 8px;
}

.invoice-modal-card > .modal-actions .ghost-button {
  border-color: #dfe0e5;
  color: #4f5665;
  background: #ffffff;
}

.invoice-modal-card > .modal-actions .ghost-button:hover {
  border-color: #cfd1d7;
  color: var(--text);
  background: #f5f5f3;
}

.invoice-modal-card > .modal-actions .ghost-button.danger {
  border-color: #f0c8c4;
  color: #a1372f;
  background: #fffafa;
}

@media (max-width: 1279px) {
  .invoice-modal-card.editor-open,
  .booking-modal-card.client-detail-modal-card.invoice-modal-card.editor-open {
    width: min(900px, calc(100vw - 24px));
  }

  .invoice-editor-shell.editor-open {
    display: block;
  }

  .invoice-editor-shell.editor-open .invoice-preview-pane {
    display: none;
  }

  .invoice-editor-form {
    height: 100%;
  }
}

@media (max-width: 700px) {
  #invoiceModal.modal {
    align-items: stretch;
    padding: 0;
  }

  .invoice-modal-card,
  .booking-modal-card.client-detail-modal-card.invoice-modal-card,
  .invoice-modal-card.editor-open,
  .booking-modal-card.client-detail-modal-card.invoice-modal-card.editor-open,
  .invoice-modal-card:not(.editor-open),
  .booking-modal-card.client-detail-modal-card.invoice-modal-card:not(.editor-open) {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    border: 0;
    border-radius: 0;
  }

  .invoice-modal-card > .modal-header {
    min-height: 58px;
    padding: 10px 12px;
  }

  .invoice-preview {
    padding: 10px;
  }

  .invoice-editor-form {
    padding: 12px;
    border-radius: 9px;
  }

  .invoice-editor-grid,
  .invoice-editor-grid-compact,
  .invoice-editor-line {
    grid-template-columns: 1fr;
  }

  .invoice-editor-line {
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fafaf9;
  }

  .invoice-preview-pane {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .invoice-sheet,
  .invoice-modal-card:not(.editor-open) .invoice-sheet {
    padding: 16px;
    border-radius: 9px;
  }

  .invoice-sheet-header {
    margin-bottom: 18px;
    padding: 14px;
  }

  .invoice-sheet-header h3 {
    font-size: 21px;
  }

  .invoice-meta,
  .invoice-footer-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .invoice-total-box {
    width: 100%;
    min-width: 0;
  }

  .invoice-modal-card > .modal-actions,
  .invoice-modal-card.editor-open > .modal-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    padding: 9px 10px max(9px, env(safe-area-inset-bottom));
    background: #ffffff;
    border-top-color: var(--line);
    box-shadow: 0 -8px 22px rgba(23, 25, 35, 0.08);
  }

  .invoice-modal-card > .modal-actions button {
    min-height: 40px;
    padding-inline: 6px;
    border-radius: 7px;
    font-size: 11px;
  }

  .invoice-modal-card #saveInvoiceButton,
  .invoice-modal-card #toggleInvoiceEditorButton {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1180px) {
  .topbar-actions #copyPublicLink,
  .topbar-actions #exportIcs,
  .topbar-actions #newClientButton {
    display: none;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr) 270px;
  }
}

@media (max-width: 860px) and (min-width: 701px) {
  .app-shell {
    grid-template-columns: 205px minmax(0, 1fr);
  }

  .sidebar {
    width: 205px;
  }

  .main {
    grid-column: 2;
  }

  .page-view,
  .app-page-heading {
    width: min(100% - 36px, 1280px);
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .side-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .side-panel .public-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  body {
    overflow-x: hidden;
  }

  .app-shell {
    display: block;
    min-height: 100dvh;
  }

  .main {
    width: 100%;
    min-height: 100dvh;
    padding: 0;
  }

  .mobile-appbar {
    position: sticky;
    top: 0;
    z-index: 35;
    display: grid !important;
    grid-template-columns: 40px minmax(92px, auto) minmax(0, 1fr) 40px;
    align-items: center;
    gap: 6px;
    min-height: calc(64px + env(safe-area-inset-top));
    padding:
      calc(8px + env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      8px
      max(10px, env(safe-area-inset-left));
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
  }

  .mobile-menu-button,
  .mobile-search-button {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
  }

  .mobile-menu-button {
    align-content: center;
    gap: 4px;
  }

  .mobile-menu-button span {
    width: 19px;
    height: 2px;
    border-radius: 999px;
    background: var(--text);
  }

  .mobile-search-button svg {
    width: 21px;
  }

  .mobile-wordmark {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
  }

  .mobile-wordmark strong {
    font-size: 14px;
    letter-spacing: -0.035em;
  }

  .mobile-soundmark {
    width: 24px;
    height: 30px;
    flex: 0 0 24px;
    gap: 2px;
  }

  .mobile-soundmark i {
    width: 2px;
  }

  .mobile-soundmark i:nth-child(1) { height: 8px; }
  .mobile-soundmark i:nth-child(2) { height: 16px; }
  .mobile-soundmark i:nth-child(3) { height: 24px; }
  .mobile-soundmark i:nth-child(4) { height: 15px; }
  .mobile-soundmark i:nth-child(5) { height: 7px; }

  .mobile-calendar-button {
    display: flex;
    align-items: center;
    justify-self: end;
    gap: 7px;
    width: 100%;
    max-width: 132px;
    min-width: 0;
    height: 40px;
    padding: 0 8px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: #353b47;
    background: #ffffff;
    font-size: 10px;
    font-weight: 700;
  }

  .mobile-calendar-button span:nth-child(2) {
    max-width: 76px;
  }

  .mobile-calendar-button span:nth-child(2) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-calendar-button svg {
    width: 15px;
    flex: 0 0 15px;
  }

  .mobile-calendar-button span:last-child {
    transform: rotate(90deg);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(290px, calc(100vw - 54px));
    height: 100dvh;
    padding:
      env(safe-area-inset-top)
      max(12px, env(safe-area-inset-right))
      calc(14px + env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
    transform: translateX(-102%);
    transition: transform 180ms ease;
    box-shadow: 20px 0 50px rgba(17, 24, 39, 0.25);
  }

  .mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .mobile-nav-scrim:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(17, 24, 39, 0.48);
    backdrop-filter: blur(2px);
  }

  .sidebar .nav-list {
    display: grid;
    grid-template-columns: 1fr;
    grid-auto-flow: row;
  }

  .sidebar .nav-item {
    justify-content: flex-start;
  }

  .sidebar .mobile-secondary-nav {
    display: flex;
  }

  .mobile-sidebar-tools {
    display: grid !important;
  }

  .app-page-heading {
    display: none;
  }

  .page-view {
    width: 100%;
    padding: 0 14px 34px;
  }

  .mobile-dashboard {
    display: grid;
    gap: 16px;
    margin: 0;
    padding: 28px 0 16px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .mobile-dashboard-copy {
    gap: 6px;
  }

  .mobile-dashboard-copy h1 {
    color: var(--text);
    font-size: clamp(30px, 9vw, 40px);
    letter-spacing: -0.045em;
  }

  .mobile-dashboard-copy .muted {
    font-size: 14px;
  }

  .mobile-dashboard-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .mobile-dashboard-actions .primary-button {
    grid-column: 1 / -1;
    min-height: 50px;
    border-radius: 9px;
    font-size: 14px;
  }

  .mobile-dashboard-actions .mobile-dashboard-secondary {
    min-height: 40px;
    border-radius: 8px;
    font-size: 12px;
  }

  .stats-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin: 0 0 16px;
    padding: 0;
    overflow: visible;
  }

  .stat-pill {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 1px;
    min-width: 0;
    min-height: 82px;
    padding: 12px 11px;
    border-radius: 10px;
  }

  .stat-pill .status-dot,
  .stat-pill > [data-icon] {
    grid-column: 1;
    grid-row: 1 / 3;
    align-self: center;
    width: 38px;
    height: 38px;
  }

  .stat-pill strong {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    min-width: 0;
    font-size: 19px;
    line-height: 1.05;
  }

  .stat-pill > span:last-child {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.2;
    text-overflow: ellipsis;
    text-transform: capitalize;
    white-space: nowrap;
  }

  .workspace {
    display: block;
  }

  .calendar-panel {
    border-radius: 11px;
    box-shadow: var(--shadow);
  }

  .mobile-calendar-controls.mobile-only {
    display: grid !important;
    gap: 10px;
    margin: 0;
    padding: 12px;
    border-bottom: 1px solid var(--line);
  }

  .mobile-period-bar {
    min-height: 38px;
  }

  .mobile-period-bar strong {
    color: var(--text);
    font-size: 18px;
  }

  .mobile-calendar-switcher {
    display: none !important;
  }

  .calendar-panel:has(.calendar-view.list-expanded) .mobile-period-bar,
  .calendar-panel:has(.calendar-view.list-expanded) #mobileTodayButton {
    display: none;
  }

  #mobileTodayButton {
    justify-self: center;
    width: auto;
    min-height: 30px;
    margin: -2px 0;
    padding: 0 15px;
    border-radius: 999px;
    font-size: 10px;
  }

  .mobile-view-switcher {
    margin: 0;
  }

  .mobile-view-switcher button {
    min-height: 38px;
    font-size: 12px;
  }

  .calendar-view {
    min-height: 0;
  }

  .list-view {
    gap: 13px;
    padding: 18px 10px 12px;
  }

  .list-toolbar {
    display: none;
  }

  .list-section {
    gap: 10px;
  }

  .list-section-header {
    align-items: center;
    padding: 0 2px 3px;
  }

  .list-section-header .eyebrow {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
  }

  .list-section-header h3 {
    display: none;
  }

  .list-row {
    grid-template-columns: 72px minmax(0, 1fr) 34px;
    grid-template-areas: "mobile-date summary mobile-controls";
    min-height: 118px;
    gap: 12px;
    padding: 14px 10px 14px 14px;
    overflow: visible;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 3px 12px rgba(23, 25, 35, 0.05);
  }

  .list-row::before {
    top: 0;
    bottom: 0;
    left: 0;
    width: 4px;
    border-radius: 10px 0 0 10px;
  }

  .list-row .list-date {
    display: none;
  }

  .mobile-list-date.mobile-only {
    grid-area: mobile-date;
    align-self: center;
    display: grid !important;
    grid-template-rows: 25px auto 24px;
    min-height: 92px;
    overflow: hidden;
    border: 1px solid #e0e2e6;
    border-radius: 9px;
    color: var(--text);
    background: #ffffff;
    text-align: center;
  }

  .mobile-list-date > span {
    display: grid;
    place-items: center;
    color: #ffffff;
    background: var(--orange);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
  }

  .mobile-list-date > strong {
    align-self: end;
    color: var(--text);
    font-size: 24px;
    line-height: 1;
  }

  .mobile-list-date > small {
    align-self: center;
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.05em;
  }

  .list-summary {
    align-self: center;
    gap: 5px;
  }

  .list-row .list-summary strong {
    color: var(--text);
    overflow: hidden;
    font-size: 17px;
    letter-spacing: -0.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .list-row .list-summary span {
    color: var(--muted);
    font-size: 11px;
  }

  .list-summary-location {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .list-summary-detail {
    display: none;
  }

  .mobile-list-meta.mobile-only {
    display: flex !important;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 4px;
  }

  .mobile-status-pill,
  .mobile-fee-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 23px;
    padding: 0 8px;
    border: 1px solid #e0e2e6;
    border-radius: 999px;
    color: #5f6775;
    background: #f6f6f4;
    font-size: 9px;
    font-weight: 750;
    white-space: nowrap;
  }

  .mobile-status-pill i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
  }

  .mobile-status-pill.pencilled i {
    background: var(--orange);
  }

  .mobile-status-pill.retained i {
    background: linear-gradient(135deg, var(--orange) 0 48%, var(--green) 52%);
  }

  .mobile-status-pill.cancelled i {
    background: var(--red);
  }

  .list-row .row-actions {
    display: none;
  }

  .mobile-list-controls.mobile-only {
    position: relative;
    grid-area: mobile-controls;
    align-self: stretch;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .mobile-list-menu {
    position: relative;
    z-index: 3;
  }

  .mobile-list-menu summary {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid #dfe1e6;
    border-radius: 8px;
    color: #656d7a;
    background: #ffffff;
    cursor: pointer;
    list-style: none;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
  }

  .mobile-list-menu summary::-webkit-details-marker {
    display: none;
  }

  .mobile-list-menu > div {
    position: absolute;
    top: 38px;
    right: 0;
    z-index: 12;
    display: grid;
    width: 152px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #ffffff;
    box-shadow: 0 14px 34px rgba(17, 24, 39, 0.18);
  }

  .mobile-list-menu button {
    min-height: 36px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    color: #3f4652;
    background: transparent;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
  }

  .mobile-list-menu button:hover {
    background: #f5f5f3;
  }

  .mobile-list-chevron {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    color: #687180;
    background: transparent;
  }

  .mobile-list-chevron svg {
    width: 18px;
    height: 18px;
  }

  .list-history-panel {
    border-radius: 9px;
  }

  .month-expanded .month-days {
    grid-auto-rows: minmax(62px, 1fr);
  }

  .month-expanded .day-cell {
    min-height: 62px;
    padding: 5px;
  }

  .month-expanded .day-event-label {
    margin-top: 4px;
    padding: 3px;
    font-size: 8px;
  }

  .week-grid {
    padding: 12px;
  }

  .week-day {
    border-radius: 9px;
  }

  .side-panel {
    display: none;
  }

  .clients-page-panel,
  .users-admin-card,
  .account-section-card,
  .account-hero-card,
  .client-section-card,
  .invoice-controls-card,
  .invoice-section-card {
    border-radius: 11px;
    box-shadow: var(--shadow);
  }

  .page-view:not(#calendarPage) {
    padding-top: 18px;
  }

  .modal {
    background: rgba(17, 24, 39, 0.46);
    backdrop-filter: blur(4px);
  }

  .modal-card,
  .booking-modal-card {
    border-color: var(--line);
    color: var(--text);
    background: #ffffff;
  }

  .date-action-card.mobile-sheet {
    border-color: var(--line);
    color: var(--text);
    background: #ffffff;
    box-shadow: 0 24px 80px rgba(17, 24, 39, 0.24);
  }

  .date-action-card.mobile-sheet .date-action-subtitle,
  .date-action-card.mobile-sheet .date-action-header .eyebrow,
  .date-action-card.mobile-sheet .date-action-footer-label {
    color: var(--muted);
  }

  .date-action-item,
  .date-action-item.confirmed,
  .date-action-item.pencilled,
  .date-action-item.retained,
  .date-action-item.cancelled,
  .date-action-item.blocked {
    border-color: var(--line);
    color: var(--text);
    background: #fafaf9;
    box-shadow: none;
  }

  #loginModal.modal {
    align-items: start;
    padding: 14px;
    overflow: auto;
    background: #f3f3f0;
  }

  #loginModal .auth-login-card {
    display: grid;
    grid-template-columns: 1fr;
    width: min(100%, 500px);
    min-height: 0;
    max-height: none;
    margin: auto;
    overflow: hidden;
    border-radius: 14px;
  }

  #loginModal .auth-login-header {
    min-height: 206px;
    height: auto;
    padding: 26px 24px;
  }

  #loginModal .auth-login-intro {
    align-content: space-between;
    gap: 34px;
    min-height: 154px;
  }

  #loginModal .auth-login-copy {
    gap: 8px;
  }

  #loginModal .auth-login-copy h2 {
    max-width: 12ch;
    font-size: 31px;
  }

  #loginModal .auth-login-copy .muted {
    max-width: 34ch;
    font-size: 11px;
  }

  #loginModal .modal-form {
    gap: 15px;
    padding: 28px 22px 24px;
  }

  #loginModal .auth-form-heading h3 {
    font-size: 24px;
  }

  #loginModal input:not([type="checkbox"]) {
    min-height: 48px;
    font-size: 16px;
  }

  #loginModal .auth-form-actions .primary-button,
  #loginModal .auth-form-actions .ghost-button {
    min-height: 48px;
  }
}

@media (max-width: 480px) {
  .mobile-appbar {
    grid-template-columns: 36px minmax(92px, auto) minmax(0, 1fr) 36px;
    gap: 5px;
    padding-inline: 10px;
  }

  .mobile-menu-button,
  .mobile-search-button {
    width: 36px;
    height: 40px;
  }

  .mobile-wordmark {
    gap: 5px;
  }

  .mobile-wordmark strong {
    font-size: 14px;
  }

  .mobile-soundmark {
    width: 20px;
    flex-basis: 20px;
  }

  .mobile-calendar-button {
    width: 100%;
    padding-inline: 8px;
    font-size: 10px;
  }

  .mobile-calendar-button span:nth-child(2) {
    max-width: 72px;
  }
}

/* Appearance */
.appearance-card {
  gap: 18px;
}

.appearance-card .compact-heading .muted {
  max-width: 56ch;
  margin: 6px 0 0;
}

.appearance-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.theme-choice {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  background: #ffffff;
  text-align: left;
}

.theme-choice:hover {
  border-color: #cfd1d7;
  background: #fafaf9;
}

.theme-choice.active,
.theme-choice[aria-pressed="true"] {
  border-color: rgba(255, 91, 24, 0.58);
  background: #fff8f4;
  box-shadow: 0 0 0 3px rgba(255, 91, 24, 0.09);
}

.theme-choice strong {
  font-size: 13px;
}

.theme-choice small {
  color: var(--muted);
  font-size: 11px;
}

.theme-preview {
  display: grid;
  grid-template-columns: 28% 1fr;
  grid-template-rows: repeat(2, 1fr);
  gap: 5px;
  height: 104px;
  margin-bottom: 6px;
  padding: 8px;
  overflow: hidden;
  border: 1px solid #dfe1e6;
  border-radius: 8px;
  background: #f4f4f1;
}

.theme-preview i {
  display: block;
  border-radius: 4px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(23, 25, 35, 0.08);
}

.theme-preview i:first-child {
  grid-row: 1 / -1;
  background: #151c29;
}

.theme-preview i:last-child {
  background: #fff0e8;
}

.theme-preview-dark {
  border-color: #344055;
  background: #0d1420;
}

.theme-preview-dark i {
  background: #182231;
  box-shadow: none;
}

.theme-preview-dark i:first-child {
  background: #080d16;
}

.theme-preview-dark i:last-child {
  background: #3a2019;
}

.theme-preview-system {
  background: linear-gradient(90deg, #f4f4f1 0 50%, #0d1420 50%);
}

.theme-preview-system i:nth-child(2) {
  background: linear-gradient(90deg, #ffffff 0 40%, #182231 40%);
}

.theme-preview-system i:last-child {
  background: linear-gradient(90deg, #fff0e8 0 40%, #3a2019 40%);
}

@media (max-width: 700px) {
  .appearance-options {
    grid-template-columns: 1fr;
  }

  .theme-choice {
    grid-template-columns: 118px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
  }

  .theme-preview {
    grid-row: 1 / -1;
    height: 76px;
    margin: 0;
  }
}

/* Dark theme */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090e17;
  --surface: #111927;
  --surface-2: #151f2e;
  --surface-3: #1b2636;
  --line: #2a3547;
  --muted: #98a4b7;
  --text: #f2f5fa;
  --orange: #ff6b2c;
  --orange-dark: #f05a1a;
  --orange-soft: #3a2019;
  --green: #32b875;
  --green-soft: #142d24;
  --slate: #7f8a9d;
  --red: #ef6a62;
  --red-soft: #351d20;
  --amber: #e7ad4f;
  --amber-soft: #332817;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] html,
[data-theme="dark"] body,
[data-theme="dark"] .app-shell,
[data-theme="dark"] .main {
  color: var(--text);
  background: var(--bg);
}

[data-theme="dark"] .sidebar {
  border-right-color: #222c3b;
  background: linear-gradient(180deg, #080d16 0%, #0d1420 100%);
}

[data-theme="dark"] .topbar,
[data-theme="dark"] .mobile-appbar {
  border-color: var(--line);
  background: rgba(13, 20, 32, 0.94);
}

[data-theme="dark"] .workspace-switcher,
[data-theme="dark"] .topbar-search,
[data-theme="dark"] .mobile-calendar-button {
  border-color: var(--line);
  color: var(--text);
  background: #111927;
}

[data-theme="dark"] .topbar-search kbd {
  border-color: #344055;
  color: #a8b2c1;
  background: #1a2433;
}

[data-theme="dark"] .app-page-heading h1,
[data-theme="dark"] .mobile-dashboard-copy h1,
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] strong {
  color: var(--text);
}

[data-theme="dark"] .stat-pill,
[data-theme="dark"] .calendar-panel,
[data-theme="dark"] .clients-page-panel,
[data-theme="dark"] .panel-section,
[data-theme="dark"] .reporting-card,
[data-theme="dark"] .reporting-row,
[data-theme="dark"] .reporting-meter,
[data-theme="dark"] .users-hero,
[data-theme="dark"] .users-admin-card,
[data-theme="dark"] .account-section-card,
[data-theme="dark"] .account-hero-card,
[data-theme="dark"] .client-section-card,
[data-theme="dark"] .invoice-controls-card,
[data-theme="dark"] .invoice-section-card,
[data-theme="dark"] .invoice-section-card-muted,
[data-theme="dark"] .clients-workspace-panel > .section-heading,
[data-theme="dark"] .invoices-page-panel > .section-heading {
  border-color: var(--line);
  color: var(--text);
  background: #111927;
  box-shadow: var(--shadow);
}

[data-theme="dark"] .client-overview-strip article,
[data-theme="dark"] .invoice-overview-strip article,
[data-theme="dark"] .users-summary-strip article,
[data-theme="dark"] .account-overview-strip article {
  border-color: var(--line);
  color: var(--text);
  background: #151f2e;
}

[data-theme="dark"] .stat-pill .status-dot {
  border-color: #173527;
}

[data-theme="dark"] .stat-pill.orange .status-dot {
  border-color: #442419;
}

[data-theme="dark"] .stat-pill.slate .status-dot,
[data-theme="dark"] .stat-pill > [data-icon] {
  border-color: #242e3d;
  color: #a8b2c1;
  background: #202a39;
}

[data-theme="dark"] .segmented,
[data-theme="dark"] .settings-tabbar {
  border-color: var(--line);
  background: #0d1420;
}

[data-theme="dark"] .segmented button,
[data-theme="dark"] .settings-tabbar button {
  color: var(--muted);
  background: transparent;
}

[data-theme="dark"] .segmented button.active,
[data-theme="dark"] .segmented button:hover,
[data-theme="dark"] .settings-tabbar button.active,
[data-theme="dark"] .settings-tabbar button:hover {
  color: var(--text);
  background: #202a39;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .calendar-toolbar,
[data-theme="dark"] .legend,
[data-theme="dark"] .filters-row,
[data-theme="dark"] .mobile-calendar-controls,
[data-theme="dark"] .weekday-row {
  border-color: var(--line);
  background: #111927;
}

[data-theme="dark"] .filters-row {
  background: #0e1622;
}

[data-theme="dark"] .month-card,
[data-theme="dark"] .month-expanded .day-cell,
[data-theme="dark"] .year-grid .month-card {
  border-color: var(--line);
  color: #dce3ed;
  background: #111927;
}

[data-theme="dark"] .month-expanded .day-cell:hover,
[data-theme="dark"] .month-expanded .day-cell:focus-visible {
  border-color: var(--line);
  background: #192332;
}

[data-theme="dark"] .month-expanded .day-cell.is-selected {
  border-color: var(--orange);
  background: #241a18;
}

[data-theme="dark"] .month-expanded .month-days > span,
[data-theme="dark"] .month-expanded .day-cell {
  border-right-color: var(--line);
  border-bottom-color: var(--line);
}

[data-theme="dark"] .week-day,
[data-theme="dark"] .booking-chip,
[data-theme="dark"] .agenda-item,
[data-theme="dark"] .request-item,
[data-theme="dark"] .list-row,
[data-theme="dark"] .client-ledger-row,
[data-theme="dark"] .invoice-ledger-row,
[data-theme="dark"] .user-card,
[data-theme="dark"] .calendar-member-card,
[data-theme="dark"] .calendar-choice,
[data-theme="dark"] .client-history-card,
[data-theme="dark"] .client-detail-section,
[data-theme="dark"] .client-kpis article {
  border-color: var(--line);
  color: var(--text);
  background: #151f2e;
  box-shadow: none;
}

[data-theme="dark"] .booking-chip:hover,
[data-theme="dark"] .agenda-item:hover,
[data-theme="dark"] .request-item:hover,
[data-theme="dark"] .list-row:hover,
[data-theme="dark"] .client-ledger-row:hover,
[data-theme="dark"] .invoice-ledger-row:hover,
[data-theme="dark"] .user-card:hover {
  border-color: #3b485c;
  background: #1b2636;
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.22);
}

[data-theme="dark"] .booking-chip.confirmed,
[data-theme="dark"] .booking-chip.confirmed:hover {
  border-color: #28523d;
  background: #142d24;
}

[data-theme="dark"] .booking-chip.pencilled,
[data-theme="dark"] .booking-chip.pencilled:hover {
  border-color: #67402d;
  background: #3a2019;
}

[data-theme="dark"] .list-view,
[data-theme="dark"] .list-history-panel,
[data-theme="dark"] .list-history-body {
  border-color: var(--line);
  color: var(--text);
  background: #111927;
}

[data-theme="dark"] .mobile-list-date.mobile-only,
[data-theme="dark"] .mobile-list-menu summary,
[data-theme="dark"] .mobile-list-menu > div {
  border-color: var(--line);
  color: var(--text);
  background: #182231;
}

[data-theme="dark"] .mobile-list-menu button {
  color: #dce3ed;
}

[data-theme="dark"] .mobile-list-menu button:hover {
  background: #222e3f;
}

[data-theme="dark"] .mobile-status-pill,
[data-theme="dark"] .mobile-fee-pill,
[data-theme="dark"] .invoice-filter-chip,
[data-theme="dark"] .invoice-status-pill,
[data-theme="dark"] .history-status-pill,
[data-theme="dark"] .user-role-pill {
  border-color: #354156;
  color: #c4ccd8;
  background: #202a39;
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .tiny-select,
[data-theme="dark"] .auth-card input:not([type="checkbox"]),
[data-theme="dark"] .auth-card textarea,
[data-theme="dark"] .booking-modal-card input:not([type="checkbox"]),
[data-theme="dark"] .booking-modal-card select,
[data-theme="dark"] .booking-modal-card textarea {
  border-color: #344055;
  color: var(--text);
  background: #0e1622;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: #6f7b8e;
}

[data-theme="dark"] input:hover,
[data-theme="dark"] select:hover,
[data-theme="dark"] textarea:hover {
  border-color: #46546a;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  border-color: var(--orange);
  background: #111927;
}

[data-theme="dark"] .ghost-button,
[data-theme="dark"] .icon-button,
[data-theme="dark"] .tiny-button,
[data-theme="dark"] .modal-card .ghost-button,
[data-theme="dark"] .modal-card .icon-button,
[data-theme="dark"] .booking-modal-card .ghost-button,
[data-theme="dark"] .booking-modal-card .icon-button {
  border-color: #344055;
  color: #c9d1dc;
  background: #151f2e;
}

[data-theme="dark"] .ghost-button:hover,
[data-theme="dark"] .icon-button:hover,
[data-theme="dark"] .tiny-button:hover,
[data-theme="dark"] .modal-card .ghost-button:hover,
[data-theme="dark"] .modal-card .icon-button:hover {
  border-color: #46546a;
  color: #ffffff;
  background: #202a39;
}

[data-theme="dark"] .primary-button {
  border-color: var(--orange);
  color: #ffffff;
  background: var(--orange);
}

[data-theme="dark"] .inline-settings-panel,
[data-theme="dark"] .invoice-settings-bank-section,
[data-theme="dark"] .invoice-editor-header,
[data-theme="dark"] .invoice-editor-section,
[data-theme="dark"] .checkbox-pill,
[data-theme="dark"] .calendar-default-toggle {
  border-color: var(--line);
  color: var(--text);
  background: #0e1622;
}

[data-theme="dark"] .client-empty,
[data-theme="dark"] .invoice-empty,
[data-theme="dark"] .account-empty {
  border-color: #354156;
  color: var(--muted);
  background: #0e1622;
}

[data-theme="dark"] .modal {
  background: rgba(2, 6, 12, 0.72);
}

[data-theme="dark"] .modal-card,
[data-theme="dark"] .booking-modal-card,
[data-theme="dark"] .booking-modal-card.client-detail-modal-card {
  border-color: var(--line);
  color: var(--text);
  background: #111927;
}

[data-theme="dark"] .booking-modal-card .modal-header,
[data-theme="dark"] .booking-modal-card.auth-card .modal-header,
[data-theme="dark"] .modal-form {
  border-color: var(--line);
  background: #111927;
}

[data-theme="dark"] .event-popover,
[data-theme="dark"] .date-action-card.mobile-sheet {
  border-color: var(--line);
  color: var(--text);
  background: #111927;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.44);
}

[data-theme="dark"] .popover-header,
[data-theme="dark"] .popover-footer,
[data-theme="dark"] .date-action-card.mobile-sheet .date-action-header {
  border-color: var(--line);
  background: #151f2e;
}

[data-theme="dark"] .date-action-item,
[data-theme="dark"] .date-action-item.confirmed,
[data-theme="dark"] .date-action-item.pencilled,
[data-theme="dark"] .date-action-item.retained,
[data-theme="dark"] .date-action-item.cancelled,
[data-theme="dark"] .date-action-item.blocked {
  border-color: var(--line);
  color: var(--text);
  background: #182231;
}

[data-theme="dark"] .invoice-modal-card,
[data-theme="dark"] .booking-modal-card.client-detail-modal-card.invoice-modal-card {
  border-color: var(--line);
  background: #111927;
}

[data-theme="dark"] .invoice-modal-card > .modal-header,
[data-theme="dark"] .invoice-modal-card > .modal-actions {
  border-color: var(--line);
  background: #111927;
}

[data-theme="dark"] .invoice-preview {
  background: #090e17;
}

[data-theme="dark"] .invoice-editor-form {
  border-color: var(--line);
  color: var(--text);
  background: #111927;
}

[data-theme="dark"] .invoice-preview-pane {
  border-color: var(--line);
  background: #0d1420;
}

[data-theme="dark"] .invoice-sheet,
[data-theme="dark"] .invoice-sheet strong,
[data-theme="dark"] .invoice-sheet h3 {
  color: #20242d;
}

[data-theme="dark"] .theme-choice {
  border-color: var(--line);
  color: var(--text);
  background: #151f2e;
}

[data-theme="dark"] .theme-choice:hover {
  border-color: #46546a;
  background: #1b2636;
}

[data-theme="dark"] .theme-choice.active,
[data-theme="dark"] .theme-choice[aria-pressed="true"] {
  border-color: rgba(255, 107, 44, 0.68);
  background: #261a18;
}

[data-theme="dark"] #loginModal.modal {
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 107, 44, 0.1), transparent 24rem),
    #090e17;
}

[data-theme="dark"] #loginModal .auth-login-card {
  border-color: #2a3547;
  background: #111927;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

[data-theme="dark"] #loginModal .modal-form {
  background: #111927;
}

[data-theme="dark"] #loginModal .auth-form-heading h3,
[data-theme="dark"] #loginModal label,
[data-theme="dark"] #loginModal .password-label-row label {
  color: var(--text);
}

[data-theme="dark"] #loginModal input:not([type="checkbox"]) {
  border-color: #344055;
  color: var(--text);
  background: #0e1622;
}

[data-theme="dark"] #loginModal .auth-form-actions .ghost-button {
  border-color: #344055;
  color: #d5dce6;
  background: #151f2e;
}

[data-theme="dark"] #loginModal .auth-action-divider::before,
[data-theme="dark"] #loginModal .auth-action-divider::after {
  background: #2a3547;
}

/* Mobile booking editor */
@media (max-width: 700px) {
  #bookingModal {
    z-index: 130;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    width: 100%;
    height: 100dvh;
    padding: 0;
    overflow: hidden;
    background: rgba(17, 24, 39, 0.54);
    backdrop-filter: blur(8px);
  }

  #bookingModal[hidden] {
    display: none;
  }

  #bookingModal .booking-modal-card {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  #bookingModal .modal-header {
    min-height: 74px;
    padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
    background: rgba(250, 250, 249, 0.97);
    backdrop-filter: blur(16px);
  }

  #bookingModal .modal-header .eyebrow {
    margin-bottom: 3px;
    font-size: 9px;
  }

  #bookingModal .modal-header h2 {
    font-size: 22px;
  }

  #bookingModal .modal-header .icon-button {
    width: 42px;
    height: 42px;
    border-radius: 11px;
  }

  #bookingModal #bookingForm {
    align-content: start;
    gap: 13px;
    min-height: 0;
    padding: 16px 16px 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  #bookingModal #bookingForm .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  #bookingModal #bookingForm label {
    gap: 6px;
    font-size: 13px;
  }

  #bookingModal #bookingForm input:not([type="checkbox"]),
  #bookingModal #bookingForm select {
    min-height: 46px;
    height: 46px;
    padding: 10px 12px;
    border-radius: 11px;
  }

  #bookingModal #bookingForm input[type="date"] {
    height: 46px;
    min-height: 46px;
    padding: 10px;
    padding-right: 30px;
  }

  #bookingModal #bookingForm textarea {
    min-height: 88px;
    padding: 11px 12px;
    border-radius: 11px;
  }

  #bookingModal #bookingForm .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 2px -16px 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
  }

  #bookingModal #bookingForm .form-actions button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding-inline: 10px;
    border-radius: 11px;
    white-space: nowrap;
  }

  #bookingModal #bookingForm .form-actions .primary-button {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  #bookingModal #bookingForm .form-actions .danger {
    grid-column: 1;
    grid-row: 2;
  }

  #bookingModal #bookingForm .form-actions #clearFormButton {
    grid-column: 2;
    grid-row: 2;
  }

  #bookingModal #bookingForm .form-actions:not(:has(#deleteBookingButton:not([hidden]))) #clearFormButton {
    grid-column: 1 / -1;
  }

  [data-theme="dark"] #bookingModal .modal-header {
    background: rgba(17, 25, 39, 0.97);
  }

  [data-theme="dark"] #bookingModal #bookingForm .form-actions {
    background: rgba(17, 25, 39, 0.96);
  }
}

/* Mobile week agenda, month heatmap, and bottom navigation */
@media (max-width: 700px) {
  .main {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .mobile-bottom-nav.mobile-only {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 45;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: calc(66px + env(safe-area-inset-bottom));
    padding:
      6px
      max(10px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -10px 30px rgba(17, 24, 39, 0.07);
    backdrop-filter: blur(18px);
  }

  .mobile-bottom-nav button {
    position: relative;
    display: grid;
    grid-template-rows: 27px auto;
    place-items: center;
    gap: 1px;
    min-width: 0;
    min-height: 52px;
    padding: 3px 2px;
    border: 0;
    border-radius: 9px;
    color: #7a8290;
    background: transparent;
  }

  .mobile-bottom-nav button::before {
    content: "";
    position: absolute;
    top: 0;
    width: 24px;
    height: 3px;
    border-radius: 0 0 999px 999px;
    background: transparent;
  }

  .mobile-bottom-nav button > span {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
  }

  .mobile-bottom-nav button svg {
    width: 20px;
    height: 20px;
  }

  .mobile-bottom-nav button small {
    overflow: hidden;
    font-size: 9px;
    font-weight: 750;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-bottom-nav button.active {
    color: var(--orange);
    background: #fff7f2;
  }

  .mobile-bottom-nav button.active::before {
    background: var(--orange);
  }

  .modal {
    z-index: 120;
  }

  #calendarPage:has(.calendar-view.week-expanded) .calendar-panel,
  #calendarPage:has(.calendar-view.month-expanded) .calendar-panel {
    border-radius: 14px;
  }

  .mobile-week-agenda {
    display: grid;
    gap: 0;
    padding: 0 10px 12px;
  }

  .mobile-week-chip-row {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
    padding: 12px 0 14px;
    border-bottom: 1px solid var(--line);
  }

  .mobile-week-chip {
    position: relative;
    display: grid;
    place-items: center;
    gap: 2px;
    min-width: 0;
    min-height: 61px;
    padding: 7px 2px 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    background: #ffffff;
  }

  .mobile-week-chip span {
    color: var(--muted);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .mobile-week-chip strong {
    font-size: 16px;
    line-height: 1;
  }

  .mobile-week-chip i {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: transparent;
  }

  .mobile-week-chip.has-activity i {
    background: var(--green);
  }

  .mobile-week-chip.is-today:not(.is-selected) {
    border-color: rgba(255, 91, 24, 0.38);
  }

  .mobile-week-chip.is-selected {
    border-color: var(--orange);
    color: #ffffff;
    background: var(--orange);
    box-shadow: 0 7px 18px rgba(255, 91, 24, 0.18);
  }

  .mobile-week-chip.is-selected span {
    color: rgba(255, 255, 255, 0.82);
  }

  .mobile-week-chip.is-selected i {
    background: #ffffff;
  }

  .mobile-week-agenda-days {
    display: grid;
  }

  .mobile-week-day-section {
    padding: 15px 0;
    border-bottom: 1px solid var(--line);
  }

  .mobile-week-day-section:last-child {
    border-bottom: 0;
  }

  .mobile-week-day-heading {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: baseline;
    gap: 6px;
    width: 100%;
    padding: 0 2px 10px;
    border: 0;
    color: var(--text);
    background: transparent;
    text-align: left;
  }

  .mobile-week-day-heading > span {
    color: var(--orange);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .mobile-week-day-heading > strong {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
  }

  .mobile-week-day-heading > small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
  }

  .mobile-week-day-body {
    display: grid;
    gap: 8px;
  }

  .mobile-week-booking {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px 11px 12px 15px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #ffffff;
  }

  .mobile-week-booking::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--green);
  }

  .mobile-week-booking.pencilled::before {
    background: var(--orange);
  }

  .mobile-week-booking.retained::before {
    background: linear-gradient(180deg, var(--green) 0 50%, var(--orange) 50%);
  }

  .mobile-week-booking.cancelled::before {
    background: #dc3545;
  }

  .mobile-week-booking.request::before {
    background: #39aeea;
  }

  .mobile-week-booking-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
  }

  .mobile-week-booking-copy > strong {
    overflow: hidden;
    color: var(--text);
    font-size: 15px;
    letter-spacing: -0.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-week-booking-copy > span {
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-week-booking-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
  }

  .mobile-week-booking-actions {
    display: grid;
    align-content: center;
    gap: 5px;
  }

  .mobile-week-booking-actions .tiny-button {
    min-width: 70px;
    min-height: 29px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 9px;
  }

  .mobile-week-availability {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px dashed #d7dbe2;
    border-radius: 10px;
    color: var(--muted);
    background: #fafaf9;
    text-align: left;
  }

  .mobile-week-availability strong {
    color: var(--text);
    font-size: 11px;
  }

  .mobile-week-availability span {
    font-size: 10px;
  }

  .mobile-week-availability.blocked {
    border-style: solid;
    background: repeating-linear-gradient(135deg, #f4f5f7, #f4f5f7 6px, #e9ebef 6px, #e9ebef 12px);
  }

  .mobile-month-heatmap {
    display: grid;
    gap: 12px;
    padding: 14px 10px 12px;
  }

  .mobile-heatmap-legend {
    display: grid;
    grid-template-columns: repeat(4, auto);
    justify-content: space-between;
    gap: 5px;
    padding: 0 2px;
  }

  .mobile-heatmap-legend span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 8px;
    font-weight: 700;
  }

  .mobile-heatmap-legend i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8ed3a8;
  }

  .mobile-heatmap-legend i.pencilled {
    background: #ffb37c;
  }

  .mobile-heatmap-legend i.blocked {
    border-radius: 2px;
    background: #a0a8b5;
  }

  .mobile-heatmap-legend i.request {
    background: #39aeea;
  }

  .mobile-heatmap-weekdays,
  .mobile-heatmap-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
  }

  .mobile-heatmap-weekdays span {
    color: var(--muted);
    text-align: center;
    font-size: 8px;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .mobile-heatmap-day {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr;
    min-width: 0;
    min-height: 54px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    background: #ffffff;
    text-align: left;
  }

  .mobile-heatmap-day > span {
    font-size: 10px;
    font-weight: 750;
  }

  .mobile-heatmap-day > strong {
    align-self: end;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
  }

  .mobile-heatmap-day.density-1 {
    border-color: #96d5ae;
    background: #ddf3e6;
  }

  .mobile-heatmap-day.density-2 {
    border-color: #61b982;
    background: #bce5cb;
  }

  .mobile-heatmap-day.density-3 {
    border-color: #32985a;
    background: #8ed0a7;
  }

  .mobile-heatmap-day.density-1 > strong,
  .mobile-heatmap-day.density-2 > strong,
  .mobile-heatmap-day.density-3 > strong {
    color: #126b3b;
  }

  .mobile-heatmap-day.has-pencilled {
    border-color: #ffd0b1;
    background: #fff3eb;
  }

  .mobile-heatmap-day.has-request {
    border-color: #bae3f7;
    background: #edf8fe;
  }

  .mobile-heatmap-day.is-blocked {
    color: #747d8a;
    background: repeating-linear-gradient(135deg, #f2f3f5, #f2f3f5 5px, #e5e7eb 5px, #e5e7eb 10px);
  }

  .mobile-heatmap-day.is-outside {
    min-height: 54px;
    border: 0;
    border-radius: 9px;
    background: #f7f7f5;
  }

  .mobile-heatmap-day.is-selected {
    border-color: var(--orange);
    box-shadow: 0 0 0 2px rgba(255, 91, 24, 0.12);
  }

  .mobile-heatmap-detail {
    display: grid;
    gap: 10px;
    margin-top: 2px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 4px 18px rgba(17, 24, 39, 0.06);
  }

  .mobile-heatmap-detail > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .mobile-heatmap-detail .eyebrow {
    margin-bottom: 3px;
    font-size: 8px;
  }

  .mobile-heatmap-detail h3 {
    font-size: 16px;
  }

  .mobile-heatmap-detail > header > span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
  }

  .mobile-heatmap-detail-body {
    display: grid;
    gap: 8px;
  }

  .mobile-heatmap-booking {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
    padding: 10px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--green);
    border-radius: 9px;
    background: #fafaf9;
  }

  .mobile-heatmap-booking.pencilled {
    border-left-color: var(--orange);
  }

  .mobile-heatmap-booking > div:first-child {
    display: grid;
    gap: 3px;
    min-width: 0;
  }

  .mobile-heatmap-booking > div:first-child strong {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-heatmap-booking > div:first-child span {
    overflow: hidden;
    color: var(--muted);
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-heatmap-booking-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .mobile-heatmap-booking-actions .tiny-button {
    min-height: 29px;
    border-radius: 8px;
    font-size: 9px;
  }

  .mobile-heatmap-empty {
    display: grid;
    gap: 3px;
    padding: 12px;
    border: 1px dashed #d7dbe2;
    border-radius: 9px;
    color: var(--muted);
    background: #fafaf9;
  }

  .mobile-heatmap-empty strong {
    color: var(--text);
    font-size: 12px;
  }

  .mobile-heatmap-empty span {
    font-size: 10px;
  }

  .mobile-heatmap-detail > .primary-button {
    width: 100%;
    min-height: 42px;
    border-radius: 9px;
  }

  [data-theme="dark"] .mobile-bottom-nav.mobile-only {
    border-color: #2a3547;
    background: rgba(13, 20, 32, 0.96);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.22);
  }

  [data-theme="dark"] .mobile-bottom-nav button {
    color: #8f9aad;
  }

  [data-theme="dark"] .mobile-bottom-nav button.active {
    color: #ff7a42;
    background: #261a18;
  }

  [data-theme="dark"] .mobile-week-chip,
  [data-theme="dark"] .mobile-week-booking,
  [data-theme="dark"] .mobile-heatmap-day,
  [data-theme="dark"] .mobile-heatmap-detail {
    border-color: var(--line);
    background: #151f2e;
  }

  [data-theme="dark"] .mobile-week-chip.is-selected {
    border-color: var(--orange);
    background: var(--orange);
  }

  [data-theme="dark"] .mobile-week-availability,
  [data-theme="dark"] .mobile-heatmap-empty,
  [data-theme="dark"] .mobile-heatmap-booking {
    border-color: #344055;
    background: #111927;
  }

  [data-theme="dark"] .mobile-week-availability.blocked,
  [data-theme="dark"] .mobile-heatmap-day.is-blocked {
    background: repeating-linear-gradient(135deg, #1b2636, #1b2636 5px, #222e40 5px, #222e40 10px);
  }

  [data-theme="dark"] .mobile-heatmap-day.is-outside {
    background: #0d1420;
  }

  [data-theme="dark"] .mobile-heatmap-day.density-1 {
    border-color: #28563d;
    background: #173426;
  }

  [data-theme="dark"] .mobile-heatmap-day.density-2 {
    border-color: #34704e;
    background: #1c442f;
  }

  [data-theme="dark"] .mobile-heatmap-day.density-3 {
    border-color: #489664;
    background: #24593a;
  }

  [data-theme="dark"] .mobile-heatmap-day.has-pencilled {
    border-color: #794128;
    background: #3b241b;
  }

  [data-theme="dark"] .mobile-heatmap-day.has-request {
    border-color: #285872;
    background: #142f3f;
  }
}

/* Mobile client smart directory */
@media (max-width: 700px) {
  #clientsPage {
    padding-top: 14px;
  }

  #clientsPage .clients-workspace-panel {
    gap: 10px;
  }

  #clientsPage .clients-workspace-panel > .section-heading {
    align-items: center;
    padding: 14px;
    border-radius: 12px;
  }

  #clientsPage .clients-workspace-panel > .section-heading h2 {
    font-size: 22px;
  }

  #clientsPage .clients-workspace-panel > .section-heading .primary-button {
    width: auto;
    min-height: 40px;
    padding-inline: 14px;
    border-radius: 9px;
    font-size: 11px;
  }

  #clientsPage .client-page-list {
    min-width: 0;
  }

  .mobile-client-directory {
    min-width: 0;
    padding-bottom: 8px;
  }

  .mobile-client-directory-tools {
    position: sticky;
    top: calc(64px + env(safe-area-inset-top));
    z-index: 30;
    display: grid;
    gap: 10px;
    padding: 12px 0 10px;
    background: rgba(243, 243, 240, 0.96);
    backdrop-filter: blur(16px);
  }

  .mobile-client-search {
    position: relative;
    display: block;
  }

  .mobile-client-search > span {
    position: absolute;
    top: 50%;
    left: 13px;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    color: var(--muted);
    transform: translateY(-50%);
    pointer-events: none;
  }

  .mobile-client-search svg {
    width: 17px;
    height: 17px;
  }

  .mobile-client-search input {
    min-height: 44px;
    padding: 10px 12px 10px 40px;
    border-color: var(--line);
    border-radius: 10px;
    color: var(--text);
    background: #ffffff;
    font-size: 16px;
    font-weight: 500;
  }

  .mobile-client-filter-row {
    display: flex;
    gap: 7px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .mobile-client-filter-row::-webkit-scrollbar {
    display: none;
  }

  .mobile-client-filter-row button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 32px;
    padding: 0 11px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #596170;
    background: #ffffff;
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
  }

  .mobile-client-filter-row button span {
    display: grid;
    place-items: center;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    color: #78808e;
    background: #f0f1f3;
    font-size: 8px;
  }

  .mobile-client-filter-row button.active {
    border-color: var(--orange);
    color: #ffffff;
    background: var(--orange);
  }

  .mobile-client-filter-row button.active span {
    color: var(--orange);
    background: #ffffff;
  }

  .mobile-client-groups {
    display: grid;
    gap: 12px;
  }

  .mobile-client-group {
    display: grid;
    gap: 5px;
  }

  .mobile-client-group > h3 {
    padding: 0 5px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .mobile-client-group > div {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(17, 24, 39, 0.04);
  }

  .mobile-client-row {
    border-bottom: 1px solid var(--line);
    background: #ffffff;
  }

  .mobile-client-row:last-child {
    border-bottom: 0;
  }

  .mobile-client-row[open] {
    background: #fffdfb;
  }

  .mobile-client-row > summary {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto 18px;
    align-items: center;
    gap: 10px;
    min-height: 76px;
    padding: 11px 10px 11px 12px;
    color: var(--text);
    cursor: pointer;
    list-style: none;
  }

  .mobile-client-row > summary::-webkit-details-marker {
    display: none;
  }

  .mobile-client-avatar {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #087d4b;
    background: #e3f4e9;
    font-size: 11px;
    font-weight: 850;
  }

  .mobile-client-summary-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  .mobile-client-summary-copy strong,
  .mobile-client-summary-copy small,
  .mobile-client-summary-copy > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-client-summary-copy strong {
    color: var(--text);
    font-size: 13px;
    letter-spacing: -0.015em;
  }

  .mobile-client-summary-copy small {
    color: var(--muted);
    font-size: 9px;
    font-weight: 550;
  }

  .mobile-client-summary-copy > span {
    color: #697282;
    font-size: 9px;
    font-weight: 700;
  }

  .mobile-client-balance {
    display: grid;
    gap: 2px;
    justify-items: end;
    min-width: 54px;
  }

  .mobile-client-balance small {
    color: var(--muted);
    font-size: 8px;
    font-weight: 650;
  }

  .mobile-client-balance strong {
    font-size: 10px;
    font-weight: 850;
  }

  .mobile-client-balance.owes strong {
    color: #d94f16;
  }

  .mobile-client-balance.clear strong {
    color: #087d4b;
  }

  .mobile-client-chevron {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    color: #7c8492;
    transition: transform 140ms ease;
  }

  .mobile-client-chevron svg {
    width: 15px;
    height: 15px;
  }

  .mobile-client-row[open] .mobile-client-chevron {
    transform: rotate(90deg);
  }

  .mobile-client-expanded {
    display: grid;
    gap: 10px;
    padding: 0 12px 12px 62px;
  }

  .mobile-client-expanded-stats {
    display: flex;
    gap: 12px;
    color: var(--muted);
    font-size: 9px;
  }

  .mobile-client-expanded-stats strong {
    color: var(--text);
  }

  .mobile-client-quick-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .mobile-client-quick-actions button,
  .mobile-client-quick-actions a {
    display: grid;
    grid-template-rows: 20px auto;
    place-items: center;
    gap: 3px;
    min-width: 0;
    min-height: 52px;
    padding: 6px 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: #525b6a;
    background: #ffffff;
    text-align: center;
    text-decoration: none;
    font-size: 8px;
    font-weight: 750;
  }

  .mobile-client-quick-actions span {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    color: var(--orange);
  }

  .mobile-client-quick-actions svg {
    width: 16px;
    height: 16px;
  }

  .mobile-client-empty-state,
  .mobile-client-no-results {
    padding: 24px 14px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    background: #ffffff;
    text-align: center;
  }

  [data-theme="dark"] .mobile-client-directory-tools {
    background: rgba(9, 14, 23, 0.96);
  }

  [data-theme="dark"] .mobile-client-search input,
  [data-theme="dark"] .mobile-client-filter-row button,
  [data-theme="dark"] .mobile-client-group > div,
  [data-theme="dark"] .mobile-client-row,
  [data-theme="dark"] .mobile-client-quick-actions button,
  [data-theme="dark"] .mobile-client-quick-actions a,
  [data-theme="dark"] .mobile-client-empty-state,
  [data-theme="dark"] .mobile-client-no-results {
    border-color: var(--line);
    color: var(--text);
    background: #151f2e;
  }

  [data-theme="dark"] .mobile-client-row[open] {
    background: #192434;
  }

  [data-theme="dark"] .mobile-client-filter-row button span {
    color: #aeb7c6;
    background: #263246;
  }

  [data-theme="dark"] .mobile-client-filter-row button.active {
    border-color: var(--orange);
    color: #ffffff;
    background: var(--orange);
  }

  [data-theme="dark"] .mobile-client-filter-row button.active span {
    color: var(--orange);
    background: #ffffff;
  }

  [data-theme="dark"] .mobile-client-avatar {
    color: #6ed39a;
    background: #173426;
  }
}

/* Mobile combined invoice dashboard and status inbox */
.invoice-page-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#invoicesPage #toggleInvoiceSettings.active {
  border-color: rgba(255, 91, 24, 0.42);
  color: var(--orange);
  background: var(--orange-soft);
  box-shadow: 0 0 0 3px rgba(255, 91, 24, 0.08);
}

#invoicesPage #toggleInvoiceSettings.active:hover {
  border-color: rgba(255, 91, 24, 0.58);
  color: var(--orange-dark);
  background: #ffe7da;
}

[data-theme="dark"] #invoicesPage #toggleInvoiceSettings.active,
[data-theme="dark"] #invoicesPage #toggleInvoiceSettings.active:hover {
  border-color: rgba(255, 107, 44, 0.58);
  color: #ff8b58;
  background: var(--orange-soft);
  box-shadow: 0 0 0 3px rgba(255, 107, 44, 0.1);
}

@media (max-width: 700px) {
  #invoicesPage {
    padding-top: 14px;
  }

  #invoicesPage .invoices-page-panel {
    gap: 10px;
  }

  #invoicesPage .invoices-page-panel > .section-heading {
    align-items: center;
    padding: 14px;
    border-radius: 12px;
  }

  #invoicesPage .invoices-page-panel > .section-heading h2 {
    font-size: 21px;
  }

  #invoicesPage .invoice-page-heading-actions {
    gap: 6px;
  }

  #invoicesPage #toggleInvoiceSettings {
    width: 38px;
    min-width: 38px;
    min-height: 38px;
    padding: 0;
    overflow: hidden;
    border-radius: 9px;
    font-size: 0;
  }

  #invoicesPage #toggleInvoiceSettings svg {
    width: 15px;
    height: 15px;
  }

  #invoicesPage #mobileCreateInvoiceButton {
    display: inline-flex !important;
    width: auto;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 9px;
    font-size: 10px;
    white-space: nowrap;
  }

  #invoicesPage > .clients-page-panel > .invoice-controls-card {
    display: none;
  }

  #invoicesPage .client-page-list {
    min-width: 0;
  }

  .mobile-invoice-workspace {
    min-width: 0;
    padding-bottom: 8px;
  }

  .mobile-invoice-summary {
    display: grid;
    gap: 10px;
  }

  .mobile-invoice-outstanding,
  .mobile-invoice-kpis article,
  .mobile-income-chart {
    border: 1px solid var(--line);
    color: var(--text);
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(17, 24, 39, 0.04);
  }

  .mobile-invoice-outstanding {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 15px;
    border-radius: 12px;
  }

  .mobile-invoice-outstanding > div:first-child {
    display: grid;
    gap: 5px;
  }

  .mobile-invoice-outstanding > div:first-child span,
  .mobile-invoice-kpis span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
  }

  .mobile-invoice-outstanding > div:first-child strong {
    color: var(--orange);
    font-size: 28px;
    line-height: 1;
    letter-spacing: -0.04em;
  }

  .mobile-invoice-trend {
    display: grid;
    align-content: start;
    justify-items: end;
    gap: 4px;
  }

  .mobile-invoice-trend span {
    color: var(--muted);
    font-size: 8px;
    font-weight: 650;
  }

  .mobile-invoice-trend strong {
    color: #d94f16;
    font-size: 11px;
  }

  .mobile-invoice-trend.positive strong {
    color: #07854d;
  }

  .mobile-invoice-progress {
    grid-column: 1 / -1;
    position: relative;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #ebedf0;
  }

  .mobile-invoice-progress i {
    position: absolute;
    inset: 0 auto 0 0;
    min-width: 2px;
    border-radius: inherit;
    background: var(--orange);
  }

  .mobile-invoice-progress-copy {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 650;
  }

  .mobile-invoice-progress-copy span:first-child {
    color: var(--orange);
  }

  .mobile-invoice-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .mobile-invoice-kpis article {
    display: grid;
    gap: 5px;
    min-width: 0;
    padding: 11px 10px;
    border-radius: 10px;
  }

  .mobile-invoice-kpis strong {
    overflow: hidden;
    font-size: 15px;
    line-height: 1.05;
    letter-spacing: -0.025em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-invoice-kpis small {
    color: var(--muted);
    font-size: 8px;
    font-weight: 650;
  }

  .mobile-invoice-kpis .paid strong {
    color: #07854d;
  }

  .mobile-invoice-kpis .sent strong {
    color: var(--orange);
  }

  .mobile-invoice-kpis .overdue strong {
    color: #d9363e;
  }

  .mobile-income-chart {
    display: grid;
    gap: 8px;
    padding: 12px 14px 10px;
    border-radius: 11px;
  }

  .mobile-income-chart > header {
    display: flex;
    align-items: baseline;
    gap: 5px;
  }

  .mobile-income-chart > header strong {
    font-size: 12px;
  }

  .mobile-income-chart > header span {
    color: var(--muted);
    font-size: 9px;
  }

  .mobile-income-chart-bars {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: end;
    gap: 10px;
    height: 86px;
    padding-top: 7px;
    border-bottom: 1px solid var(--line);
    background: repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 24px,
      rgba(148, 155, 167, 0.16) 25px,
      transparent 26px
    );
  }

  .mobile-income-chart-bars > div {
    display: grid;
    grid-template-rows: minmax(0, 1fr) 16px;
    align-items: end;
    justify-items: center;
    height: 100%;
  }

  .mobile-income-chart-bars i {
    width: min(24px, 74%);
    min-height: 5px;
    border-radius: 4px 4px 0 0;
    background: #a8dbba;
  }

  .mobile-income-chart-bars i.current {
    background: #078a4e;
  }

  .mobile-income-chart-bars span {
    color: var(--muted);
    font-size: 8px;
    font-weight: 700;
  }

  .mobile-invoice-directory {
    display: grid;
    gap: 12px;
    margin-top: 12px;
  }

  .mobile-invoice-directory-tools {
    position: sticky;
    top: calc(64px + env(safe-area-inset-top));
    z-index: 30;
    display: grid;
    gap: 9px;
    padding: 10px 0;
    background: rgba(243, 243, 240, 0.96);
    backdrop-filter: blur(16px);
  }

  .mobile-invoice-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 8px;
  }

  .mobile-invoice-search-row label {
    position: relative;
    display: block;
  }

  .mobile-invoice-search-row label > span {
    position: absolute;
    top: 50%;
    left: 13px;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    color: var(--muted);
    transform: translateY(-50%);
    pointer-events: none;
  }

  .mobile-invoice-search-row svg {
    width: 17px;
    height: 17px;
  }

  .mobile-invoice-search-row input {
    min-height: 44px;
    padding: 10px 12px 10px 40px;
    border-color: var(--line);
    border-radius: 10px;
    color: var(--text);
    background: #ffffff;
    font-size: 16px;
    font-weight: 500;
  }

  .mobile-invoice-search-row > button {
    display: grid;
    place-items: center;
    min-height: 42px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    background: #ffffff;
  }

  .mobile-invoice-filter-row {
    display: flex;
    gap: 7px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .mobile-invoice-filter-row::-webkit-scrollbar {
    display: none;
  }

  .mobile-invoice-filter-row button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 32px;
    padding: 0 11px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #596170;
    background: #ffffff;
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
  }

  .mobile-invoice-filter-row button span {
    display: grid;
    place-items: center;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    color: #78808e;
    background: #f0f1f3;
    font-size: 8px;
  }

  .mobile-invoice-filter-row button.active {
    border-color: var(--orange);
    color: #ffffff;
    background: var(--orange);
  }

  .mobile-invoice-filter-row button.active span {
    color: var(--orange);
    background: #ffffff;
  }

  .mobile-invoice-groups {
    display: grid;
    gap: 13px;
  }

  .mobile-invoice-group {
    display: grid;
    gap: 6px;
  }

  .mobile-invoice-group > header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: baseline;
    gap: 9px;
    padding: 0 5px;
  }

  .mobile-invoice-group > header h3 {
    color: #647084;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.09em;
    text-transform: uppercase;
  }

  .mobile-invoice-group.overdue > header h3 {
    color: #d9363e;
  }

  .mobile-invoice-group.due-soon > header h3 {
    color: var(--orange);
  }

  .mobile-invoice-group.paid > header h3 {
    color: #07854d;
  }

  .mobile-invoice-group > header span,
  .mobile-invoice-group > header strong {
    color: var(--muted);
    font-size: 9px;
  }

  .mobile-invoice-group > div {
    display: grid;
    gap: 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .mobile-invoice-card {
    position: relative;
    display: grid;
    grid-template-columns: 38px minmax(84px, 1fr) auto auto 24px;
    align-items: center;
    gap: 7px;
    min-height: 92px;
    padding: 11px 9px 11px 11px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--text);
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(17, 24, 39, 0.04);
  }

  .mobile-invoice-card:last-child {
    border-bottom: 1px solid var(--line);
  }

  .mobile-invoice-avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #243147;
    background: #e8eef8;
    font-size: 11px;
    font-weight: 850;
  }

  .mobile-invoice-card.overdue .mobile-invoice-avatar {
    color: #9d2930;
    background: #fbe8e9;
  }

  .mobile-invoice-card.paid .mobile-invoice-avatar {
    color: #087d4b;
    background: #e3f4e9;
  }

  .mobile-invoice-card.draft .mobile-invoice-avatar {
    color: #6e4a91;
    background: #f0e8f8;
  }

  .mobile-invoice-card-main {
    display: grid;
    gap: 2px;
    min-width: 0;
    padding: 0;
    border: 0;
    color: var(--text);
    background: transparent;
    text-align: left;
  }

  .mobile-invoice-card-main strong,
  .mobile-invoice-card-main span,
  .mobile-invoice-card-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-invoice-card-main strong {
    font-size: 13px;
  }

  .mobile-invoice-card-main span {
    font-size: 11px;
    font-weight: 700;
  }

  .mobile-invoice-card-main small {
    color: var(--muted);
    font-size: 9px;
    font-weight: 550;
  }

  .mobile-invoice-card-money {
    display: grid;
    justify-items: end;
    gap: 3px;
    min-width: 64px;
  }

  .mobile-invoice-card-money small {
    color: var(--muted);
    font-size: 8px;
    font-weight: 650;
  }

  .mobile-invoice-card-money > strong {
    color: var(--text);
    font-size: 13px;
    line-height: 1;
  }

  .mobile-invoice-card-money > b {
    padding: 2px 5px;
    border: 1px solid #d8dce2;
    border-radius: 5px;
    color: #687181;
    background: #f3f4f6;
    font-size: 7px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .mobile-invoice-card-money > b.overdue {
    border-color: #f1b7bb;
    color: #c52c34;
    background: #fff0f1;
  }

  .mobile-invoice-card-money > b.sent {
    border-color: #f4c999;
    color: #b96413;
    background: #fff6e9;
  }

  .mobile-invoice-card-money > b.paid {
    border-color: #add9bd;
    color: #087d4b;
    background: #eaf7ee;
  }

  .mobile-invoice-view {
    padding: 0;
    border: 0;
    color: #4d5665;
    background: transparent;
    font-size: 9px;
    font-weight: 750;
  }

  .mobile-invoice-menu {
    position: relative;
    z-index: 4;
  }

  .mobile-invoice-menu summary {
    display: grid;
    place-items: center;
    width: 24px;
    height: 34px;
    color: var(--text);
    cursor: pointer;
    list-style: none;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.08em;
  }

  .mobile-invoice-menu summary::-webkit-details-marker {
    display: none;
  }

  .mobile-invoice-menu > div {
    position: absolute;
    top: 35px;
    right: 0;
    z-index: 50;
    display: grid;
    width: 150px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #ffffff;
    box-shadow: 0 16px 38px rgba(17, 24, 39, 0.18);
  }

  .mobile-invoice-menu button {
    min-height: 34px;
    padding: 0 9px;
    border: 0;
    border-radius: 6px;
    color: #4d5665;
    background: transparent;
    text-align: left;
    font-size: 9px;
    font-weight: 700;
  }

  .mobile-invoice-menu button:hover {
    background: #f4f4f2;
  }

  .mobile-invoice-menu button.danger {
    color: #bb333b;
  }

  .mobile-ready-invoices {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fffaf7;
  }

  .mobile-ready-invoices > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .mobile-ready-invoices .eyebrow {
    margin-bottom: 2px;
    font-size: 8px;
  }

  .mobile-ready-invoices h3 {
    font-size: 13px;
  }

  .mobile-ready-invoices > header > span {
    display: grid;
    place-items: center;
    min-width: 24px;
    height: 24px;
    border-radius: 999px;
    color: var(--orange);
    background: #ffeade;
    font-size: 9px;
    font-weight: 850;
  }

  .mobile-ready-invoices > div {
    display: grid;
    gap: 7px;
  }

  .mobile-ready-invoice-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid #efddd3;
    border-radius: 9px;
    background: #ffffff;
  }

  .mobile-ready-invoice-card > div {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  .mobile-ready-invoice-card strong,
  .mobile-ready-invoice-card span,
  .mobile-ready-invoice-card small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-ready-invoice-card strong {
    font-size: 12px;
  }

  .mobile-ready-invoice-card span,
  .mobile-ready-invoice-card small {
    color: var(--muted);
    font-size: 9px;
  }

  .mobile-ready-invoice-card .primary-button {
    width: auto;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 9px;
  }

  .mobile-invoice-no-results {
    padding: 24px 14px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    background: #ffffff;
    text-align: center;
  }

  [data-theme="dark"] .mobile-invoice-outstanding,
  [data-theme="dark"] .mobile-invoice-kpis article,
  [data-theme="dark"] .mobile-income-chart,
  [data-theme="dark"] .mobile-invoice-search-row input,
  [data-theme="dark"] .mobile-invoice-search-row > button,
  [data-theme="dark"] .mobile-invoice-filter-row button,
  [data-theme="dark"] .mobile-invoice-group > div,
  [data-theme="dark"] .mobile-invoice-card,
  [data-theme="dark"] .mobile-invoice-menu > div,
  [data-theme="dark"] .mobile-ready-invoice-card,
  [data-theme="dark"] .mobile-invoice-no-results {
    border-color: var(--line);
    color: var(--text);
    background: #151f2e;
  }

  [data-theme="dark"] .mobile-invoice-directory-tools {
    background: rgba(9, 14, 23, 0.96);
  }

  [data-theme="dark"] .mobile-invoice-progress {
    background: #263246;
  }

  [data-theme="dark"] .mobile-invoice-filter-row button span {
    color: #aeb7c6;
    background: #263246;
  }

  [data-theme="dark"] .mobile-invoice-filter-row button.active {
    border-color: var(--orange);
    color: #ffffff;
    background: var(--orange);
  }

  [data-theme="dark"] .mobile-invoice-filter-row button.active span {
    color: var(--orange);
    background: #ffffff;
  }

  [data-theme="dark"] .mobile-invoice-card-main,
  [data-theme="dark"] .mobile-invoice-view {
    color: var(--text);
  }

  [data-theme="dark"] .mobile-invoice-menu button {
    color: #d4dbe6;
  }

  [data-theme="dark"] .mobile-ready-invoices {
    border-color: #4d382f;
    background: #221916;
  }

  [data-theme="dark"] .mobile-ready-invoice-card {
    background: #1a202d;
  }

  [data-theme="dark"] .mobile-invoice-group > div {
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  /* Mobile collections use standalone cards, without an extra framed wrapper. */
  #clientsPage .clients-workspace-panel,
  #invoicesPage .invoices-page-panel,
  #settingsPage .settings-workspace-panel {
    padding: 0;
    border: 0;
    background: var(--bg);
    box-shadow: none;
  }

  #invoicesPage,
  #invoicePageList,
  #invoicesPage .mobile-invoice-workspace,
  #invoicesPage .mobile-invoice-summary,
  #invoicesPage .mobile-invoice-directory,
  #invoicesPage .mobile-invoice-groups {
    border: 0;
    background: var(--bg);
    box-shadow: none;
  }

  .mobile-client-group > div {
    display: grid;
    gap: 8px;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .mobile-client-row {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(17, 24, 39, 0.04);
  }

  .mobile-client-row:last-child {
    border-bottom: 1px solid var(--line);
  }

  .mobile-ready-invoices {
    padding: 0;
    border: 0;
    background: transparent;
  }

  [data-theme="dark"] .mobile-client-group > div,
  [data-theme="dark"] .mobile-ready-invoices {
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  #mobileNewBookingButton,
  #clientsPage #clientsPageNewButton,
  #invoicesPage #mobileCreateInvoiceButton {
    display: none !important;
  }

  .mobile-create-fab.mobile-only {
    position: fixed;
    right: 18px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    z-index: 46;
    display: grid !important;
    place-items: center;
    width: 58px;
    height: 58px;
    padding: 0;
    border: 1px solid rgba(224, 73, 12, 0.72);
    border-radius: 50%;
    color: #ffffff;
    background: var(--orange);
    box-shadow:
      0 12px 28px rgba(255, 91, 24, 0.34),
      0 2px 6px rgba(23, 25, 35, 0.18);
    transition:
      transform 140ms ease,
      box-shadow 140ms ease,
      background 140ms ease;
  }

  .mobile-create-fab[hidden] {
    display: none !important;
  }

  .mobile-create-fab svg {
    width: 28px;
    height: 28px;
    stroke-width: 1.8;
  }

  .mobile-create-fab:hover {
    background: var(--orange-dark);
    transform: translateY(-2px);
    box-shadow:
      0 15px 32px rgba(255, 91, 24, 0.38),
      0 3px 8px rgba(23, 25, 35, 0.2);
  }

  .mobile-create-fab:active {
    transform: scale(0.96);
  }

  .mobile-create-fab:disabled {
    opacity: 0.45;
    transform: none;
    box-shadow: none;
  }

  [data-theme="dark"] .mobile-create-fab.mobile-only {
    border-color: #ff8b58;
    background: var(--orange);
    box-shadow:
      0 12px 30px rgba(255, 107, 44, 0.3),
      0 2px 8px rgba(0, 0, 0, 0.42);
  }
}

/* Desktop calendar family: mobile clarity, desktop density. */
.filters-row[hidden] {
  display: none;
}

.desktop-filter-toggle {
  gap: 7px;
  margin-left: auto;
}

.desktop-filter-toggle svg {
  width: 15px;
  height: 15px;
}

.desktop-filter-toggle.active {
  border-color: #ffc0a3;
  color: var(--orange);
  background: var(--orange-soft);
}

.day-density-count,
.desktop-list-date,
.desktop-list-status,
.desktop-list-finance,
.desktop-list-date-heading {
  display: none;
}

@media (min-width: 701px) {
  #calendarPage .calendar-toolbar {
    min-height: 66px;
  }

  #calendarPage .year-control {
    display: flex;
    align-items: center;
  }

  #calendarPage .year-control strong {
    min-width: 150px;
    font-size: 21px;
  }

  #calendarPage #todayButton {
    min-height: 34px;
    margin-left: 5px;
    padding-inline: 14px;
  }

  #calendarPage .legend {
    display: flex;
    align-items: center;
    min-height: 48px;
    gap: 15px;
  }

  #calendarPage .filters-row {
    border-top: 1px solid var(--line);
    animation: calendar-filter-reveal 150ms ease-out;
  }

  @keyframes calendar-filter-reveal {
    from {
      opacity: 0;
      transform: translateY(-4px);
    }
  }

  /* Year: compact mobile-style density heatmaps. */
  .year-expanded .year-grid {
    gap: 13px;
    padding: 16px;
  }

  .year-expanded .month-card {
    padding: 14px;
    border-color: var(--line);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(23, 25, 35, 0.025);
  }

  .year-expanded .month-card.is-selected-month {
    border-color: var(--orange);
    box-shadow: 0 0 0 1px rgba(255, 91, 24, 0.08);
  }

  .year-expanded .month-title {
    margin-bottom: 12px;
    font-size: 14px;
    letter-spacing: -0.015em;
  }

  .year-expanded .weekday-row {
    min-height: 22px;
    margin-bottom: 5px;
    border: 0;
    font-size: 9px;
  }

  .year-expanded .month-days {
    gap: 4px;
  }

  .year-expanded .day-cell {
    display: grid;
    min-height: 28px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #414956;
    background: transparent;
  }

  .year-expanded .day-cell.has-booking {
    border-color: #9dd5b2;
    color: #087d4b;
    background: #f2fbf5;
  }

  .year-expanded .day-cell.has-booking.density-2 {
    border-color: #65bd87;
    background: #dff4e7;
  }

  .year-expanded .day-cell.has-booking.density-3 {
    border-color: var(--green);
    color: #fff;
    background: var(--green);
  }

  .year-expanded .day-cell.pencilled {
    border-color: #ffc3a7;
    color: #b64616;
    background: #fff5ef;
  }

  .year-expanded .day-cell.blocked {
    border-color: #d6d9df;
    color: #626b79;
    background: repeating-linear-gradient(-45deg, #f8f8f7 0, #f8f8f7 4px, #eceef1 4px, #eceef1 8px);
  }

  .year-expanded .day-cell.has-request {
    border-color: #9bd5f0;
    color: #17688f;
    background: #eff9fd;
  }

  .year-expanded .day-cell.retained {
    border-color: #c9c6a2;
    color: #5b6349;
    background: linear-gradient(135deg, #fff4ed 0 49%, #edf9f2 51%);
  }

  .year-expanded .day-cell.cancelled {
    border-color: #efc6c2;
    color: #9d2c24;
    background: var(--red-soft);
  }

  .year-expanded .day-cell.is-selected {
    z-index: 1;
    border-color: var(--orange);
    box-shadow: 0 0 0 2px rgba(255, 91, 24, 0.12);
  }

  .year-expanded .day-cell.is-today:not(.is-selected) {
    border-color: #ffb18d;
  }

  .year-expanded .day-event-label,
  .year-expanded .day-overlap-badge {
    display: none;
  }

  .year-expanded .day-density-count {
    position: absolute;
    right: 3px;
    bottom: 2px;
    display: block;
    color: currentColor;
    font-size: 7px;
    font-weight: 850;
    opacity: 0.72;
  }

  /* Month: the approved mobile heatmap, widened with the desktop agenda beside it. */
  .month-expanded .mobile-month-heatmap {
    display: grid;
    gap: 0;
    padding: 0;
  }

  .month-expanded .mobile-heatmap-legend {
    display: none;
  }

  .month-expanded .mobile-heatmap-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    min-height: 44px;
    border-bottom: 1px solid var(--line);
  }

  .month-expanded .mobile-heatmap-weekdays span {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .month-expanded .mobile-heatmap-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    padding: 16px;
  }

  .month-expanded .mobile-heatmap-day {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr;
    align-items: start;
    justify-items: start;
    min-height: 100px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    color: var(--text);
    background: #fff;
  }

  .month-expanded .mobile-heatmap-day > span {
    font-size: 15px;
    font-weight: 800;
  }

  .month-expanded .mobile-heatmap-day > strong {
    align-self: end;
    color: var(--muted);
    font-size: 13px;
  }

  .month-expanded .mobile-heatmap-day.density-1,
  .month-expanded .mobile-heatmap-day.density-2,
  .month-expanded .mobile-heatmap-day.density-3 {
    border-color: #8ed0a8;
    color: #075e37;
    background: #e7f7ed;
  }

  .month-expanded .mobile-heatmap-day.density-2 {
    border-color: #55b77b;
    background: #d0eedc;
  }

  .month-expanded .mobile-heatmap-day.density-3 {
    border-color: var(--green);
    color: #fff;
    background: var(--green);
  }

  .month-expanded .mobile-heatmap-day.has-pencilled {
    border-color: #ffad82;
    color: #ad3e10;
    background: #fff1e9;
  }

  .month-expanded .mobile-heatmap-day.has-request {
    border-color: #8fcdea;
    color: #17688f;
    background: #ebf8fd;
  }

  .month-expanded .mobile-heatmap-day.is-blocked {
    border-color: #d0d4da;
    color: #66707f;
    background: repeating-linear-gradient(-45deg, #fafafa 0, #fafafa 7px, #eceef1 7px, #eceef1 14px);
  }

  .month-expanded .mobile-heatmap-day.is-selected {
    z-index: 1;
    border: 2px solid var(--orange);
    color: var(--orange);
    background: #fff8f4;
    box-shadow: 0 7px 20px rgba(255, 91, 24, 0.12);
  }

  .month-expanded .mobile-heatmap-day.is-outside {
    border: 0;
    background: #fafaf8;
  }

  .month-expanded .mobile-heatmap-detail {
    display: none;
  }

  /* Week: a seven-lane planning board instead of an hourly spreadsheet. */
  .desktop-week-board {
    display: grid;
    gap: 14px;
    padding: 16px;
  }

  .desktop-week-summary {
    display: flex;
    align-items: center;
    gap: 28px;
    min-height: 58px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
  }

  .desktop-week-summary > strong {
    margin-right: auto;
    color: var(--text);
    font-size: 15px;
  }

  .desktop-week-summary > span {
    display: grid;
    gap: 2px;
    color: var(--muted);
    font-size: 10px;
  }

  .desktop-week-summary b {
    color: var(--text);
    font-size: 15px;
  }

  .week-expanded .week-grid {
    grid-template-columns: repeat(7, minmax(120px, 1fr));
    gap: 8px;
  }

  .week-expanded .week-day {
    min-height: 490px;
    padding: 0;
    overflow: hidden;
    border-radius: 11px;
    background: #fff;
  }

  .week-expanded .week-day.is-weekend {
    background: #fffaf6;
  }

  .week-expanded .week-day.is-selected {
    border-color: #ffb18d;
  }

  .desktop-week-day-header {
    display: block;
    margin: 0;
    padding: 13px 8px;
    border-bottom: 1px solid var(--line);
  }

  .desktop-week-day-header button {
    display: grid;
    place-items: center;
    gap: 4px;
    width: 100%;
    padding: 0;
    border: 0;
    color: var(--text);
    background: transparent;
  }

  .desktop-week-day-header span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .desktop-week-day-header strong {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 2px solid transparent;
    border-radius: 50%;
    font-size: 20px;
  }

  .desktop-week-day-header strong.is-today {
    border-color: var(--orange);
  }

  .desktop-week-day-header small {
    color: var(--muted);
    font-size: 9px;
  }

  .desktop-week-day-body {
    display: grid;
    align-content: start;
    gap: 8px;
    min-height: 400px;
    padding: 10px 8px;
  }

  .desktop-week-booking {
    position: relative;
    display: grid;
    gap: 5px;
    padding: 11px 9px 9px 13px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
  }

  .desktop-week-booking::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--green);
    content: "";
  }

  .desktop-week-booking.pencilled::before {
    background: var(--orange);
  }

  .desktop-week-booking.request::before {
    background: #39aeea;
  }

  .desktop-week-booking.retained::before {
    background: linear-gradient(180deg, var(--green) 0 50%, var(--orange) 50%);
  }

  .desktop-week-booking.cancelled::before {
    background: var(--red);
  }

  .desktop-week-booking > strong {
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .desktop-week-booking > span,
  .desktop-week-booking > small {
    overflow: hidden;
    color: var(--muted);
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .desktop-week-booking-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
  }

  .desktop-week-booking .mobile-status-pill,
  .desktop-list-status .mobile-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    padding: 0 8px;
    border: 1px solid #b9dfc7;
    border-radius: 999px;
    color: #087d4b;
    background: var(--green-soft);
    font-size: 9px;
    font-weight: 800;
    white-space: nowrap;
  }

  .desktop-week-booking .mobile-status-pill i,
  .desktop-list-status .mobile-status-pill i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
  }

  .desktop-week-booking .mobile-status-pill.pencilled,
  .desktop-list-status .mobile-status-pill.pencilled {
    border-color: #ffd0b9;
    color: #b64616;
    background: var(--orange-soft);
  }

  .desktop-week-booking .mobile-status-pill.pencilled i,
  .desktop-list-status .mobile-status-pill.pencilled i {
    background: var(--orange);
  }

  .desktop-week-booking .mobile-status-pill.request {
    border-color: #b8def0;
    color: #17688f;
    background: #edf8fd;
  }

  .desktop-week-booking .mobile-status-pill.request i {
    background: #39aeea;
  }

  .desktop-week-booking .mobile-status-pill.cancelled,
  .desktop-list-status .mobile-status-pill.cancelled {
    border-color: #efc6c2;
    color: #9d2c24;
    background: var(--red-soft);
  }

  .desktop-week-booking .mobile-status-pill.cancelled i,
  .desktop-list-status .mobile-status-pill.cancelled i {
    background: var(--red);
  }

  .desktop-week-booking-meta b {
    color: var(--text);
    font-size: 10px;
  }

  .desktop-week-booking-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    padding-top: 3px;
  }

  .desktop-week-booking-actions button {
    min-height: 26px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--muted);
    background: #fff;
    font-size: 8px;
    font-weight: 750;
  }

  .desktop-week-blocked {
    display: grid;
    place-items: center;
    gap: 6px;
    min-height: 190px;
    padding: 12px 7px;
    border: 1px solid #d4d7dc;
    border-radius: 9px;
    color: #687180;
    background: repeating-linear-gradient(-45deg, #fafafa 0, #fafafa 7px, #eceef1 7px, #eceef1 14px);
    text-align: center;
  }

  .desktop-week-blocked svg {
    width: 25px;
  }

  .desktop-week-blocked strong {
    font-size: 11px;
  }

  .desktop-week-blocked span {
    font-size: 9px;
  }

  .desktop-week-available {
    align-self: end;
    min-height: 38px;
    margin-top: auto;
    border: 1px dashed transparent;
    color: var(--muted);
    background: transparent;
    font-size: 10px;
  }

  .desktop-week-available:hover {
    border-color: var(--line);
    border-radius: 8px;
    background: #fafaf9;
  }

  /* List: grouped desktop agenda using the approved mobile card hierarchy. */
  .list-expanded .list-view {
    gap: 14px;
    padding: 16px;
  }

  .list-expanded .list-toolbar {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fafaf9;
  }

  .list-expanded .list-section {
    gap: 8px;
  }

  .list-expanded .list-section-header {
    padding: 2px 2px 6px;
  }

  .desktop-list-date-heading {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 13px 3px 4px;
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  .desktop-list-date-heading span {
    color: var(--orange);
    font-weight: 850;
  }

  .desktop-list-date-heading strong {
    color: var(--muted);
    font-size: 10px;
  }

  .list-expanded .list-row {
    grid-template-columns: 22px 58px minmax(190px, 1fr) 105px 115px auto;
    grid-template-areas: "select desktop-date summary desktop-status desktop-finance actions";
    gap: 14px;
    min-height: 88px;
    padding: 11px 13px 11px 17px;
    border-radius: 11px;
    box-shadow: 0 2px 8px rgba(23, 25, 35, 0.035);
  }

  .list-expanded .list-row::before {
    top: 0;
    bottom: 0;
    left: 0;
    width: 4px;
    border-radius: 11px 0 0 11px;
  }

  .list-expanded .list-date {
    display: none;
  }

  .desktop-list-date {
    grid-area: desktop-date;
    display: grid;
    grid-template-rows: 18px 1fr 16px;
    place-items: center;
    min-height: 64px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .desktop-list-date > span {
    width: 100%;
    color: var(--orange);
    font-size: 8px;
    font-weight: 850;
    text-align: center;
  }

  .desktop-list-date > strong {
    color: var(--text);
    font-size: 21px;
    line-height: 1;
  }

  .desktop-list-date > small {
    color: var(--muted);
    font-size: 8px;
    font-weight: 800;
  }

  .list-expanded .list-summary {
    gap: 4px;
  }

  .list-expanded .list-summary > strong {
    color: var(--text);
    font-size: 15px;
  }

  .list-expanded .list-summary-location {
    font-size: 11px;
  }

  .list-expanded .list-summary-detail {
    display: none;
  }

  .desktop-list-status {
    grid-area: desktop-status;
    display: block;
  }

  .desktop-list-finance {
    grid-area: desktop-finance;
    display: grid;
    gap: 4px;
  }

  .desktop-list-finance strong {
    color: var(--text);
    font-size: 13px;
  }

  .desktop-list-finance span {
    color: var(--muted);
    font-size: 9px;
    text-transform: capitalize;
  }

  .list-expanded .list-row .row-actions {
    justify-self: end;
  }

  .list-expanded .list-row .row-actions .tiny-button {
    min-height: 34px;
    padding-inline: 10px;
  }

  [data-theme="dark"] .year-expanded .month-card,
  [data-theme="dark"] .month-expanded .mobile-heatmap-day,
  [data-theme="dark"] .desktop-week-summary,
  [data-theme="dark"] .week-expanded .week-day,
  [data-theme="dark"] .desktop-week-booking,
  [data-theme="dark"] .desktop-list-date {
    border-color: var(--line);
    color: var(--text);
    background: #151f2e;
  }

  [data-theme="dark"] .week-expanded .week-day.is-weekend {
    background: #1c1b1c;
  }

  [data-theme="dark"] .year-expanded .day-cell.has-booking,
  [data-theme="dark"] .month-expanded .mobile-heatmap-day.density-1,
  [data-theme="dark"] .month-expanded .mobile-heatmap-day.density-2 {
    border-color: #256843;
    color: #91ddb0;
    background: #142a20;
  }

  [data-theme="dark"] .year-expanded .day-cell.blocked,
  [data-theme="dark"] .month-expanded .mobile-heatmap-day.is-blocked,
  [data-theme="dark"] .desktop-week-blocked {
    border-color: #394454;
    color: #aab3c1;
    background: repeating-linear-gradient(-45deg, #151f2e 0, #151f2e 7px, #202b3b 7px, #202b3b 14px);
  }

  [data-theme="dark"] .month-expanded .mobile-heatmap-day.is-outside,
  [data-theme="dark"] .desktop-week-available:hover,
  [data-theme="dark"] .list-expanded .list-toolbar {
    background: #111a27;
  }

  [data-theme="dark"] .desktop-week-booking-actions button {
    border-color: var(--line);
    color: var(--muted);
    background: #111a27;
  }
}

/* Site-wide select treatment, including dynamically rendered controls. */
select,
.tiny-select {
  -webkit-appearance: none;
  appearance: none;
  min-height: 40px;
  padding: 7px 40px 7px 12px;
  border: 1px solid #dfe2e7;
  border-radius: 9px;
  color: #303744;
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23697386' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  box-shadow: 0 1px 2px rgba(23, 25, 35, 0.03);
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background-color 140ms ease;
}

.tiny-select {
  min-height: 34px;
  padding-top: 5px;
  padding-bottom: 5px;
  border-radius: 8px;
  font-size: 12px;
}

select:hover,
.tiny-select:hover {
  border-color: #c5cad2;
  background-color: #fcfcfb;
}

select:focus,
select:focus-visible,
.tiny-select:focus,
.tiny-select:focus-visible {
  border-color: var(--orange);
  outline: none;
  box-shadow:
    0 0 0 3px rgba(255, 91, 24, 0.13),
    0 1px 2px rgba(23, 25, 35, 0.04);
}

select:disabled,
.tiny-select:disabled {
  opacity: 0.58;
  color: #8a919d;
  background-color: #f3f4f2;
  cursor: not-allowed;
}

select option,
select optgroup {
  color: #303744;
  background: #ffffff;
  font-weight: 600;
}

select option:checked {
  color: #ffffff;
  background: var(--orange);
}

select::-ms-expand {
  display: none;
}

[data-theme="dark"] select,
[data-theme="dark"] .tiny-select {
  border-color: #344055;
  color: #e7ebf1;
  background-color: #111a27;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23aeb7c6' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  color-scheme: dark;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.24);
}

[data-theme="dark"] select:hover,
[data-theme="dark"] .tiny-select:hover {
  border-color: #4a5870;
  background-color: #162131;
}

[data-theme="dark"] select:focus,
[data-theme="dark"] select:focus-visible,
[data-theme="dark"] .tiny-select:focus,
[data-theme="dark"] .tiny-select:focus-visible {
  border-color: var(--orange);
  box-shadow:
    0 0 0 3px rgba(255, 107, 44, 0.2),
    0 1px 2px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] select option,
[data-theme="dark"] select optgroup {
  color: #e7ebf1;
  background: #111a27;
}

[data-theme="dark"] select option:checked {
  color: #ffffff;
  background: var(--orange);
}

/* Android Chrome can expose a shorter visual viewport than 100vh. */
@media (max-width: 700px) {
  #loginModal.modal {
    display: block;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 100svh;
    padding:
      max(12px, env(safe-area-inset-top))
      12px
      max(32px, calc(env(safe-area-inset-bottom) + 20px));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scroll-padding-bottom: max(32px, calc(env(safe-area-inset-bottom) + 20px));
    -webkit-overflow-scrolling: touch;
  }

  #loginModal.modal[hidden] {
    display: none;
  }

  #loginModal .auth-login-card {
    width: min(100%, 500px);
    margin: 0 auto;
  }
}

@media (max-width: 700px) and (max-height: 820px) {
  #loginModal .auth-login-header {
    min-height: 158px;
    padding: 20px 20px 18px;
  }

  #loginModal .auth-login-intro {
    min-height: 118px;
    gap: 22px;
  }

  #loginModal .auth-login-copy {
    gap: 5px;
  }

  #loginModal .auth-login-copy h2 {
    font-size: 27px;
  }

  #loginModal .modal-form {
    gap: 11px;
    padding: 20px 18px 22px;
  }

  #loginModal .auth-form-heading {
    gap: 3px;
    margin-bottom: 2px;
  }

  #loginModal .auth-form-heading h3 {
    font-size: 22px;
  }

  #loginModal input:not([type="checkbox"]),
  #loginModal .auth-form-actions .primary-button,
  #loginModal .auth-form-actions .ghost-button {
    min-height: 44px;
  }

  #loginModal .auth-security-note {
    margin-bottom: 2px;
  }
}

@media (max-width: 700px) and (max-height: 700px) {
  #loginModal .auth-login-header {
    min-height: 126px;
    padding: 16px 18px;
  }

  #loginModal .auth-login-intro {
    min-height: 94px;
    gap: 13px;
  }

  #loginModal .auth-login-copy h2 {
    max-width: none;
    font-size: 23px;
  }

  #loginModal .auth-login-copy .muted,
  #loginModal .auth-form-heading .muted,
  #loginModal .auth-security-note {
    display: none;
  }

  #loginModal .modal-form {
    gap: 9px;
    padding: 16px 16px 20px;
  }
}

/* Compact mobile calendar switcher */
.calendar-choice {
  grid-template-columns: 44px minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 12px;
}

.calendar-choice-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
  color: var(--orange);
  background: #fff0e9;
}

.calendar-choice-icon-personal {
  color: #6d4ae4;
  background: #f0ebff;
}

.calendar-choice-icon svg,
.calendar-choice-check svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.calendar-choice-content {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.calendar-choice-content strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-choice-check {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1.5px solid #cdd1d8;
  border-radius: 50%;
  color: #ffffff;
  background: #ffffff;
}

.calendar-choice.is-active .calendar-choice-check {
  border-color: var(--orange);
  background: var(--orange);
}

.calendar-choice-check svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.6;
}

.calendar-default-copy {
  display: grid;
  gap: 2px;
}

.calendar-default-copy strong {
  color: var(--text);
  font-size: 13px;
}

.calendar-default-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.calendar-default-icon {
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.calendar-chooser-handle {
  display: none;
}

@media (max-width: 700px) {
  #calendarChooserModal.modal {
    display: flex;
    align-items: flex-end;
    height: 100vh;
    height: 100dvh;
    padding: 0;
    overflow: hidden;
  }

  #calendarChooserModal.modal[hidden] {
    display: none;
  }

  #calendarChooserModal .calendar-chooser-card {
    width: 100%;
    max-width: none;
    max-height: min(76dvh, 620px);
    margin: 0;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    border-width: 1px 0 0;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -18px 55px rgba(17, 24, 39, 0.22);
    overscroll-behavior: contain;
  }

  #calendarChooserModal .calendar-chooser-header {
    position: relative;
    padding: 38px 20px 16px;
    background: #ffffff;
  }

  #calendarChooserModal .calendar-chooser-handle {
    position: absolute;
    top: 10px;
    left: 50%;
    display: block;
    width: 64px;
    height: 5px;
    border-radius: 999px;
    background: #cfd2d8;
    transform: translateX(-50%);
  }

  #calendarChooserModal .calendar-chooser-header .eyebrow,
  #calendarChooserModal .calendar-chooser-header .muted {
    display: none;
  }

  #calendarChooserModal .calendar-chooser-header h2 {
    font-size: 21px;
  }

  #calendarChooserModal .calendar-chooser-header .icon-button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
  }

  #calendarChooserModal .calendar-choice-grid {
    gap: 0;
    width: 100%;
  }

  #calendarChooserModal .calendar-choice {
    min-height: 76px;
    padding: 13px 20px;
    border-width: 0 0 1px;
    border-color: var(--line);
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
    transform: none;
  }

  #calendarChooserModal .calendar-choice:first-child {
    border-top-width: 0;
  }

  #calendarChooserModal .calendar-choice:hover {
    background: #fafaf9;
    transform: none;
  }

  #calendarChooserModal .calendar-choice.is-active {
    border-color: var(--line);
    background: #fff8f4;
    box-shadow: inset 3px 0 0 var(--orange);
  }

  #calendarChooserModal .calendar-choice-kind {
    min-height: 24px;
    padding: 0 8px;
    font-size: 10px;
  }

  #calendarChooserModal .calendar-choice-role {
    display: none;
  }

  #calendarChooserModal .calendar-choice-content strong {
    font-size: 14px;
  }

  #calendarChooserModal .calendar-choice-meta {
    font-size: 11px;
  }

  #calendarChooserModal .calendar-default-toggle {
    display: flex;
    width: 100%;
    max-width: none;
    min-height: 72px;
    margin: 0;
    padding: 12px 20px;
    border-width: 1px 0 0;
    border-radius: 0;
    background: #ffffff;
  }

  #calendarChooserModal .calendar-default-toggle .checkbox-copy {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 44px;
    align-items: center;
    width: 100%;
    gap: 10px;
  }

  #calendarChooserModal .calendar-default-toggle .checkbox-copy::before {
    grid-column: 3;
    grid-row: 1;
    width: 44px;
    height: 24px;
    border: 0;
    border-radius: 999px;
    background: #d7d9de;
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.08);
    transition: background-color 160ms ease;
  }

  #calendarChooserModal .calendar-default-toggle .checkbox-copy::after {
    grid-column: 3;
    grid-row: 1;
    width: 18px;
    height: 18px;
    margin-left: 3px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(17, 24, 39, 0.28);
    content: "";
    transition: transform 160ms ease;
  }

  #calendarChooserModal .calendar-default-toggle input:checked + .checkbox-copy::before {
    background: var(--orange);
  }

  #calendarChooserModal .calendar-default-toggle input:checked + .checkbox-copy::after {
    transform: translateX(20px);
  }

  #calendarChooserModal .calendar-default-icon {
    grid-column: 1;
    grid-row: 1;
  }

  #calendarChooserModal .calendar-default-copy {
    grid-column: 2;
    grid-row: 1;
  }
}

[data-theme="dark"] .calendar-choice-icon {
  background: rgba(255, 91, 24, 0.15);
}

[data-theme="dark"] .calendar-choice-icon-personal {
  background: rgba(109, 74, 228, 0.2);
}

[data-theme="dark"] .calendar-choice-check {
  border-color: #536075;
  background: #111a27;
}

[data-theme="dark"] .calendar-choice.is-active .calendar-choice-check {
  border-color: var(--orange);
  background: var(--orange);
}

@media (max-width: 700px) {
  [data-theme="dark"] #calendarChooserModal .calendar-chooser-card,
  [data-theme="dark"] #calendarChooserModal .calendar-chooser-header,
  [data-theme="dark"] #calendarChooserModal .calendar-choice,
  [data-theme="dark"] #calendarChooserModal .calendar-default-toggle {
    background: #111a27;
  }

  [data-theme="dark"] #calendarChooserModal .calendar-choice:hover {
    background: #151f2e;
  }

  [data-theme="dark"] #calendarChooserModal .calendar-choice.is-active {
    background: rgba(255, 91, 24, 0.1);
  }
}
