:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --ink: #111827;
  --ink-soft: #374151;
  --muted: #6b7280;
  --dim: #9ca3af;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --accent: #0f5c56;
  --accent-hover: #0c4a45;
  --accent-soft: rgba(15, 92, 86, 0.08);
  --teal: #0f766e;
  --teal-soft: rgba(15, 118, 110, 0.1);
  --blue: #1d4ed8;
  --blue-soft: rgba(29, 78, 216, 0.08);
  --danger: #b42318;
  --danger-soft: rgba(180, 35, 24, 0.08);
  --purple: #5b21b6;
  --purple-soft: rgba(91, 33, 182, 0.08);
  --warn: #b45309;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 28px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --font: 'IBM Plex Sans', system-ui, sans-serif;
  --font-display: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 clamp(16px, 2.5vw, 36px) 48px;
}

/* ─── Topbar ─── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 18px 0 16px;
  border-bottom: 1px solid var(--line);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: #0f172a;
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  border-radius: 8px;
}

.topbar__title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.topbar__tagline {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 1px;
}

.topbar__nav.sidebar-triggers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.stats-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.stats-trigger:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--ink);
}

.stats-trigger:active {
  transform: translateY(1px);
}

.stats-trigger__icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.stats-trigger--penalty .stats-trigger__icon { color: var(--danger); }
.stats-trigger--extra .stats-trigger__icon { color: var(--teal); }
.stats-trigger--payments .stats-trigger__icon { color: var(--blue); }

.stats-trigger__hint,
.stats-trigger__arrow {
  display: none;
}

/* ─── Metrics ─── */
.metrics.header__totals {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 12px;
  margin: 18px 0 24px;
}

.metrics__tile {
  padding: 16px 18px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.metrics__tile--hero {
  background: #0f172a;
  border-color: #0f172a;
  color: #f8fafc;
}

.metrics__tile--hero .header__total-label {
  color: rgba(248, 250, 252, 0.58);
}

.metrics__tile--hero .header__total-value {
  color: #fff;
}

.header__total-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.header__total-value {
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}

.header__total-value--sm {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
}

.header__total-value--green { color: var(--teal); }
.header__total-value--red { color: var(--danger); }
.header__total-value--blue { color: var(--blue); }
.header__total-value--muted { color: var(--dim); }

/* ─── Layout ─── */
.workspace.main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
  gap: clamp(18px, 2.4vw, 28px);
  align-items: start;
}

.content-section {
  min-width: 0;
}

.dock.sidebar {
  position: sticky;
  top: 16px;
}

/* ─── Cards (dock) ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.card__title {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.card__hint {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: -4px 0 12px;
  line-height: 1.45;
}

.card__hint--tight {
  margin-top: 0;
  margin-bottom: 12px;
}

.card--add { border-top: 2px solid var(--accent); }
.card--add .btn--block { margin-top: 10px; }
.card--employee-export { border-top: 2px solid var(--teal); }
.card--backup { border-top: 2px solid var(--blue); }

/* ─── Clients header ─── */
.clients-header {
  margin-bottom: 16px;
}

.clients-header__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.clients-header__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.clients-header__count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.clients-header__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.clients-header__toolbar .input--search {
  flex: 1 1 200px;
  min-width: 160px;
  max-width: 280px;
}

/* ─── Forms & inputs ─── */
.add-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input,
.select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder {
  color: var(--dim);
}

.input:focus,
.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input--textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.5;
}

.input--compact {
  max-width: 96px;
  padding: 7px 9px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-align: right;
}

.select {
  width: auto;
  min-width: 160px;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--surface);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--secondary {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}

.btn--secondary:hover {
  background: #eef1f4;
}

.btn--outline {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn--outline:hover {
  background: var(--blue-soft);
  border-color: #bfdbfe;
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  padding: 6px;
}

.btn--ghost:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.btn--sm {
  padding: 6px 10px;
  font-size: 0.75rem;
}

.btn--block {
  width: 100%;
}

.btn-lost-subtle {
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--dim);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-lost-subtle:hover { color: var(--danger); }
.btn-lost-subtle--second-chance { color: var(--warn); }
.btn-lost-subtle--active { color: var(--muted); }

/* ─── Toolbar controls ─── */
.action-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}

.action-filter-btn:hover {
  background: var(--surface-2);
}

.action-filter-btn--alert {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--danger);
}

.action-filter-btn--active {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.action-filter-btn__count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
}

.action-filter-btn--active .action-filter-btn__count {
  background: #fff;
  color: var(--danger);
}

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-toggle__btn {
  padding: 8px 12px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.view-toggle__btn + .view-toggle__btn {
  border-left: 1px solid var(--line);
}

.view-toggle__btn--active {
  background: #0f172a;
  color: #fff;
}

.view-toggle__btn--active:hover {
  background: #0f172a;
  color: #fff;
}

/* ─── Client list ─── */
.clients-list--cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 1100px) {
  .clients-list--cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.clients-list--cards .empty-state {
  grid-column: 1 / -1;
}

.clients-list--table {
  display: block;
}

/* ─── Client card ─── */
.client-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.client-card:hover {
  border-color: var(--line-strong);
}

.client-card--full-package {
  box-shadow: inset 3px 0 0 var(--purple);
}

.client-card--needs-action {
  box-shadow: inset 3px 0 0 var(--danger);
  background: #fffbfb;
}

.client-card--lost {
  opacity: 0.7;
}

.client-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.client-card__info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.client-card__avatar {
  width: 38px;
  height: 38px;
  background: #e5e7eb;
  color: var(--ink-soft);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.client-card__meta {
  min-width: 0;
}

.client-card__name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.client-card__name {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.client-card__date {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 3px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.client-card__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.client-card__total {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--teal);
  white-space: nowrap;
}

.client-card__total--penalty { color: var(--danger); }
.client-card__total--pending { color: var(--dim); }

.client-card__services {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px;
}

.client-card__services--disabled {
  opacity: 0.35;
  pointer-events: none;
}

.client-card__footer {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  padding: 10px 16px 12px;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
}

.client-card__badge,
.client-card__warn-badge,
.client-card__lost-badge,
.client-card__second-chance-badge {
  display: inline-block;
  padding: 2px 7px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
}

.client-card__badge {
  background: var(--purple-soft);
  color: var(--purple);
}

button.client-card__badge {
  border: none;
  font: inherit;
  cursor: pointer;
}

.client-card__warn-badge,
.client-card__second-chance-badge {
  background: var(--danger-soft);
  color: var(--danger);
}

.client-card__lost-badge {
  background: #f3f4f6;
  color: var(--muted);
}

/* ─── Service checks ─── */
.service-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.service-group__label {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dim);
}

.service-group__items {
  display: grid;
  gap: 6px;
}

.service-group--4 .service-group__items { grid-template-columns: repeat(4, 1fr); }
.service-group--3 .service-group__items { grid-template-columns: repeat(3, 1fr); }

.service-check {
  position: relative;
  min-width: 0;
}

.service-check__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.service-check__label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.service-check__label:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.service-check__input:checked + .service-check__label {
  background: var(--teal-soft);
  border-color: #99f6e4;
  color: var(--teal);
  font-weight: 700;
}

.service-check--package .service-check__input:checked + .service-check__label {
  background: var(--purple-soft);
  border-color: #ddd6fe;
  color: var(--purple);
}

.service-check--inactive-qonto .service-check__input:checked + .service-check__label {
  background: var(--danger-soft);
  border-color: #fecaca;
  color: var(--danger);
}

.service-check__input:focus-visible + .service-check__label {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.service-check__name {
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}

.service-check--table .service-check__label {
  min-height: 30px;
  padding: 4px;
}

.service-check--table .service-check__name {
  font-size: 0.6875rem;
}

/* ─── Table view ─── */
.clients-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.clients-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
}

.clients-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0f172a;
  color: #f8fafc;
}

.clients-table th {
  padding: 11px 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  border-bottom: 1px solid #0f172a;
}

.clients-table__name-head {
  text-align: left;
  padding-left: 16px;
  min-width: 220px;
  position: sticky;
  left: 0;
  z-index: 3;
  background: #0f172a;
}

.clients-table__row {
  border-bottom: 1px solid var(--line);
}

.clients-table__row:hover {
  background: var(--surface-2);
}

.clients-table__row--lost {
  background: #f9fafb;
}

.clients-table__row--action {
  background: #fff7f6;
}

.clients-table__row--full {
  box-shadow: inset 3px 0 0 var(--purple);
}

.clients-table td {
  padding: 10px 8px;
  vertical-align: middle;
}

.clients-table__name {
  padding-left: 16px;
  min-width: 220px;
  position: sticky;
  left: 0;
  z-index: 1;
  background: inherit;
}

.clients-table__name-text {
  display: block;
  font-size: 0.875rem;
  font-weight: 650;
  border: none;
  background: none;
  padding: 0;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.clients-table__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.clients-table__date {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--muted);
}

.clients-table__total {
  text-align: right;
  padding-right: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
}

.clients-table__actions {
  text-align: center;
  padding-right: 10px;
}

.clients-table__actions-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}

/* ─── Empty state ─── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.empty-state.hidden {
  display: none;
}

.empty-state__kicker {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 8px;
}

.empty-state__title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.empty-state__text {
  font-size: 0.875rem;
  color: var(--muted);
}

.empty-state__icon,
.empty-state__drawing {
  display: none;
}

/* ─── Modals ─── */
.stats-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s, visibility 0.18s;
}

@media (min-width: 720px) {
  .stats-modal {
    align-items: center;
    padding: 24px;
  }
}

.stats-modal--open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.modal-open {
  overflow: hidden;
}

.stats-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.46);
}

.stats-modal__panel {
  position: relative;
  z-index: 1;
  width: min(880px, 100%);
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

@media (max-width: 719px) {
  .stats-modal__panel {
    max-height: 94vh;
    border-bottom: none;
    border-radius: 12px 12px 0 0;
  }
}

.stats-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: #0f172a;
  color: #f8fafc;
  flex-shrink: 0;
}

.stats-modal__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stats-modal__header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-modal__header .btn--secondary {
  background: transparent;
  color: #f8fafc;
  border-color: rgba(248, 250, 252, 0.22);
}

.stats-modal__header .btn--secondary:hover {
  background: rgba(248, 250, 252, 0.08);
}

.stats-modal__close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(248, 250, 252, 0.18);
  border-radius: 8px;
  background: transparent;
  color: #f8fafc;
  font-size: 0.875rem;
  cursor: pointer;
}

.stats-modal__close:hover {
  background: var(--danger);
  border-color: var(--danger);
}

.stats-modal__body {
  padding: 18px 20px 24px;
  overflow-y: auto;
}

.stats-modal__summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.stats-modal__summary--single {
  grid-template-columns: 1fr;
}

.stats-modal__summary-item {
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.stats-modal__summary-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.stats-modal__summary-value {
  font-family: var(--font-mono);
  font-size: 1.375rem;
  font-weight: 600;
}

.stats-modal__summary-value--green { color: var(--teal); }
.stats-modal__summary-value--red { color: var(--danger); }
.stats-modal__summary-value--blue { color: var(--blue); }

.stats-modal__section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.stats-modal__section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stats-modal .stats-grid {
  grid-template-columns: repeat(2, 1fr);
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat-item__label {
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 500;
}

.stat-item__value {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
}

.stat-item--penalty .stat-item__value { color: var(--danger); }
.stat-item--package .stat-item__value { color: var(--purple); }
.stat-item--extra .stat-item__value { color: var(--teal); }

.service-breakdown {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.service-breakdown__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.875rem;
}

.service-breakdown__item--extra {
  margin-top: 4px;
}

.service-breakdown__name { color: var(--ink-soft); font-weight: 600; }
.service-breakdown__price { font-family: var(--font-mono); font-weight: 600; color: var(--teal); }
.service-breakdown__count { font-size: 0.75rem; color: var(--dim); margin-left: 6px; }

/* ─── Lists in modals ─── */
.penalties-list,
.payments-list,
.extra-services-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.payments-list--modal {
  max-height: none;
  margin-top: 16px;
}

.payments-list {
  max-height: 220px;
  overflow-y: auto;
}

.penalties-empty,
.payments-empty,
.extra-services-empty {
  font-size: 0.875rem;
  color: var(--muted);
  text-align: center;
  padding: 14px;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
}

.penalty-item,
.payment-item,
.extra-service-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.penalty-item--lost {
  border-left: 3px solid var(--danger);
}

.penalty-item__info,
.payment-item__info,
.extra-service-item__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.penalty-item__title,
.extra-service-item__name {
  font-size: 0.875rem;
  font-weight: 650;
}

.penalty-item__note,
.payment-item__date {
  font-size: 0.75rem;
  color: var(--muted);
}

.payment-item__amount {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--blue);
}

.payment-item__note {
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.penalty-item__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.penalty-item__amount,
.extra-service-item__amount {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--danger);
  white-space: nowrap;
}

.extra-service-item__amount {
  color: var(--teal);
}

/* ─── Extras form ─── */
.extras-form__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.extras-form__label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

.deposit-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
}

.deposit-stepper__btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: none;
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.deposit-stepper__btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}

.deposit-stepper__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.deposit-stepper__value {
  min-width: 40px;
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
}

.extras-form__sum {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--teal);
  text-align: right;
}

.extras-form__sum--boss {
  margin-top: 6px;
}

.employee-pay-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.employee-pay-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.employee-pay-row__label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
}

.employee-pay-period-row {
  margin-top: 4px;
}

/* ─── Backup ─── */
.backup-actions {
  display: flex;
  gap: 8px;
}

.backup-actions .btn {
  flex: 1;
}

.backup-status {
  margin-top: 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--teal);
}

.backup-status--error {
  color: var(--danger);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Responsive ─── */
@media (max-width: 960px) {
  .workspace.main {
    grid-template-columns: 1fr;
  }

  .dock.sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .dock.sidebar .card {
    margin-bottom: 0;
  }

  .metrics.header__totals {
    grid-template-columns: 1fr;
  }

  .metrics__tile--hero {
    order: -1;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar__nav.sidebar-triggers {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .dock.sidebar {
    grid-template-columns: 1fr;
  }

  .stats-modal__summary,
  .stats-modal .stats-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .service-group--4 .service-group__items {
    grid-template-columns: repeat(2, 1fr);
  }

  .employee-pay-grid {
    grid-template-columns: 1fr;
  }

  .clients-header__toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .clients-header__toolbar .input--search,
  .select {
    width: 100%;
    max-width: none;
  }

  .view-toggle {
    width: 100%;
  }

  .view-toggle__btn {
    flex: 1;
  }
}

/* ─── Auth ─── */
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
}

.auth-card__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.auth-card__title {
  font-size: 1.25rem;
  font-weight: 700;
}

.auth-card__text,
.field__label {
  font-size: 0.8125rem;
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-card__error {
  font-size: 0.8125rem;
  color: var(--danger);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ─── Worker cabinet ─── */
.worker-pay {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.worker-pay__item {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.worker-pay__label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.worker-pay__value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
}

.worker-pay__value--teal { color: var(--teal); }
.worker-pay__value--danger { color: var(--danger); }

.worker-pay__hint {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--muted);
}

@media (max-width: 860px) {
  .worker-pay {
    grid-template-columns: 1fr 1fr;
  }
}

.worker-card--needs-action {
  border-color: #fecaca;
  box-shadow: inset 0 0 0 1px #fecaca;
}

.worker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.worker-card,
.dossier-photo,
.photo-preview__item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.worker-card {
  position: relative;
}

.worker-card__open {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.worker-card:hover,
.worker-card:focus-within {
  border-color: var(--accent);
}

.worker-card__open:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.worker-card__delete {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
  cursor: pointer;
}

.worker-card__delete:hover {
  background: var(--danger);
}

.worker-card__photo {
  position: relative;
  height: 160px;
  background: #e5e7eb;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.8125rem;
}

.worker-card__photo img,
.photo-preview__item img,
.dossier-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.worker-card__count {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.75rem;
}

.worker-card__body {
  padding: 12px 14px 14px;
}

.worker-card__name {
  font-size: 1rem;
  font-weight: 650;
}

.worker-card__meta,
.worker-card__date,
.worker-card__notes {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 4px;
}

.worker-card__notes {
  color: var(--ink-soft);
}

/* ─── Wizard ─── */
.stats-modal__panel--narrow {
  width: min(640px, 100%);
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  list-style: none;
  margin-bottom: 18px;
}

.wizard-steps__item {
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--muted);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
}

.wizard-steps__item--active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.wizard-steps__item--done {
  color: var(--teal);
  border-bottom-color: #99f6e4;
}

.wizard-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wizard-pane[hidden] {
  display: none;
}

.wizard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.input--notes {
  min-height: 240px;
  resize: vertical;
  line-height: 1.55;
}

.photo-drop {
  position: relative;
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 168px;
  padding: 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
  outline: none;
}

.photo-drop__catcher {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  opacity: 0;
  color: transparent;
  caret-color: transparent;
  outline: none;
}

.photo-drop__body {
  position: relative;
  z-index: 0;
  display: grid;
  gap: 4px;
  pointer-events: none;
}

.photo-drop__actions {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.photo-drop strong {
  color: var(--ink);
}

.photo-drop--over,
.photo-drop:focus-within {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.photo-preview,
.dossier-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.photo-preview__item,
.dossier-photo {
  position: relative;
  height: 110px;
}

.dossier-photo__open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
}

.photo-preview__remove,
.dossier-photo__remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
  cursor: pointer;
}

.client-card__name {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
}

.client-card__name:hover {
  text-decoration: underline;
}

.client-card__sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

.staff-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.staff-item__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.staff-item__name {
  font-weight: 650;
}

.staff-item__login,
.staff-item__terms {
  font-size: 0.75rem;
  color: var(--muted);
}

.staff-item__terms {
  margin-top: 4px;
}

.staff-item__earn {
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--ink-soft);
}

.staff-item__earn strong {
  color: var(--teal);
  font-family: var(--font-mono);
}

.staff-item__fines {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.staff-item__fines-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.staff-pay-form,
.staff-pay-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.staff-pay-card {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.staff-pay-card:first-child {
  margin-top: 0;
}

.staff-pay-card__name {
  font-weight: 650;
}

.account-chip {
  font-size: 0.75rem;
  color: var(--muted);
  margin-right: 4px;
}

.stats-modal__section--flush {
  margin-top: 0;
  padding-top: 0;
  border: 0;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(15, 23, 42, 0.88);
}

.lightbox[hidden] {
  display: none;
}

.lightbox__image {
  max-width: min(94vw, 1100px);
  max-height: 86vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}

.lightbox__close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(248, 250, 252, 0.22);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
  color: #f8fafc;
  cursor: pointer;
}

.btn--danger {
  background: var(--danger);
  color: #fff;
}

.btn--danger:hover {
  background: #8f1c13;
}

.site-dialog {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.site-dialog[hidden] {
  display: none;
}

.site-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
}

.site-dialog__panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.site-dialog__header {
  padding: 16px 20px;
  background: #0f172a;
  color: #f8fafc;
}

.site-dialog__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.site-dialog__body {
  padding: 18px 20px 20px;
}

.site-dialog__text {
  color: var(--ink-soft);
  white-space: pre-wrap;
}

.site-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.site-toast-stack {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 1500;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100% - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}

.site-toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
  pointer-events: auto;
  animation: site-toast-in 0.18s ease-out;
}

.site-toast--error {
  border-color: rgba(180, 35, 24, 0.22);
  background: #fff8f7;
}

.site-toast--out {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.16s, transform 0.16s;
}

.site-toast__text {
  flex: 1;
  color: var(--ink);
  font-size: 0.875rem;
}

.site-toast__close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.site-toast__close:hover {
  background: var(--surface-2);
  color: var(--ink);
}

@keyframes site-toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
