/*
  Components — reusable UI primitives.
  Sections roughly: buttons → cards/KPIs → dashboard → profile menu →
  forms → tables → tabs → alerts/toasts → modal → dropdown → misc.
  Do not put page-only one-offs here; keep those next to the page or in layout.
*/

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--control-h);
  padding: 0 var(--space-3);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: var(--control-font);
  font-weight: 500;
  line-height: var(--text-body-sm-lh);
  letter-spacing: var(--tracking-normal);
  white-space: nowrap;
  box-shadow: none;
  transition: var(--motion-interactive);
  transform: none;
  text-transform: none;
}

.btn:hover {
  background: var(--hover);
  color: var(--text);
  transform: none;
  box-shadow: none;
}

.btn:active {
  transform: none;
  transition-duration: var(--t-instant);
}

.btn--primary,
a.btn--primary,
button.btn--primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--text-inverse);
}

.btn--primary:hover,
a.btn--primary:hover,
button.btn--primary:hover {
  background: var(--accent-hover);
  border-color: transparent;
  color: var(--text-inverse);
  box-shadow: none;
}

.btn--primary:active,
a.btn--primary:active,
button.btn--primary:active {
  background: var(--accent-pressed);
  color: var(--text-inverse);
}

.btn--warm,
a.btn--warm,
button.btn--warm {
  background: var(--accent-warm);
  border-color: transparent;
  color: var(--text-inverse);
}

.btn--warm:hover,
a.btn--warm:hover,
button.btn--warm:hover {
  background: var(--accent-warm-hover);
  border-color: transparent;
  color: var(--text-inverse);
}

.btn--soft {
  background: var(--bg-prompt);
  border-color: var(--border);
  color: var(--text);
}

.btn--soft:hover {
  background: var(--hover);
}

.btn--muted {
  background: var(--surface-secondary);
  border-color: transparent;
  color: var(--text);
  border-radius: var(--r-sm);
}

.btn--muted:hover {
  background: var(--hover);
}

.btn--ghost {
  background: var(--accent-muted);
  border-color: transparent;
  box-shadow: none;
}

.btn--ghost:hover {
  background: var(--hover);
  transform: none;
  box-shadow: none;
}

.btn--danger,
a.btn--danger,
button.btn--danger {
  background: var(--danger);
  border-color: transparent;
  color: var(--text-inverse);
}

.btn--danger:hover,
a.btn--danger:hover,
button.btn--danger:hover {
  background: color-mix(in srgb, var(--danger) 88%, #000);
  box-shadow: none;
  color: var(--text-inverse);
}

.btn-icon {
  width: var(--control-h);
  height: var(--control-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: var(--motion-interactive);
}

.btn-icon:hover:not(:disabled) {
  background: var(--hover);
  color: var(--text);
}

.btn-icon:active:not(:disabled) {
  transition-duration: var(--t-instant);
}

.btn-icon--danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

/* Row action buttons in data tables */
.table-actions {
  white-space: nowrap;
  text-align: right;
}

.table-actions .btn-icon {
  width: 32px;
  height: 32px;
}

/* Cards & KPI tiles */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  transition: var(--motion-interactive);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.card:hover {
  transform: none;
  box-shadow: var(--shadow-card);
  border-color: var(--border);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-header);
}

.card__title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card__body {
  padding: var(--space-4);
  min-width: 0;
}

.card__body > form,
.card__body > .tt-form-shell {
  min-width: 0;
  max-width: 100%;
}

.card--table:hover {
  transform: none;
  box-shadow: var(--shadow-card);
  border-color: var(--border);
}

.card--table .card__header {
  padding: var(--space-3) var(--space-4);
}

.card--table .card__body {
  padding: 0;
}

.card--table .data-table-wrap {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.card--table .data-table-wrap:hover {
  box-shadow: none;
}

.report-toolbar {
  margin-bottom: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
}

.report-filters {
  margin: 0;
}

.report-filters__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-3);
}

.report-filters__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.report-filters .form-field {
  margin-bottom: 0;
}

.report-columns {
  margin-top: var(--space-3);
}

.report-columns summary {
  cursor: pointer;
  user-select: none;
}

.report-columns__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-2);
  margin: var(--space-2) 0;
  padding: var(--space-3);
  background: var(--bg-subtle, var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: var(--r-card);
}

.report-columns__option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  cursor: pointer;
}

.card--table .report-empty {
  padding: var(--space-4);
}

.dashboard-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.info-box {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: var(--motion-interactive);
}

.info-box:hover {
  border-color: var(--border);
  background: var(--hover-subtle);
  transform: none;
  box-shadow: none;
}

.info-box__icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  background: var(--accent-muted);
  color: var(--accent);
  font-size: 20px;
  flex-shrink: 0;
  transition: none;
}

.info-box:hover .info-box__icon {
  transform: none;
}

.info-box__value {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  transition: transform var(--t-fast) var(--ease);
}

.info-box__label {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.chart-wrap {
  position: relative;
  height: 280px;
}

.chart-wrap--dash {
  height: 260px;
}

/* Dashboard layout */
.dash-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2);
  align-items: end;
  margin-bottom: var(--space-2);
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
}

.dash-hero__eyebrow {
  margin: 0 0 var(--space-2);
  font-size: var(--text-micro);
  font-weight: 500;
  line-height: var(--text-micro-lh);
  letter-spacing: var(--tracking-normal);
  text-transform: none;
  color: var(--text-muted);
}

.dash-hero__title {
  margin: 0;
  font-size: var(--text-h1);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  line-height: var(--text-h1-lh);
}

.dash-hero__accent { color: var(--accent); }

.dash-hero__subtitle {
  margin: var(--space-2) 0 0;
  max-width: 42ch;
  font-size: var(--text-body-sm);
  font-weight: 400;
  line-height: var(--text-body-sm-lh);
  color: var(--text-muted);
}

.dash-hero__score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  min-width: 140px;
}

.dash-hero__score-value {
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}

.dash-hero__score-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.dash-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.dash-metric {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  text-decoration: none;
  color: var(--text);
  transition: background var(--t-fast) var(--ease);
}

.dash-metric:hover { background: var(--hover); }

.dash-metric__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-muted);
  color: var(--accent);
  font-size: 20px;
  flex-shrink: 0;
}

.dash-metric__icon--danger {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

.dash-metric__icon--warn {
  background: color-mix(in srgb, var(--warning) 14%, transparent);
  color: var(--warning);
}

.dash-metric__icon--info {
  background: color-mix(in srgb, var(--info) 14%, transparent);
  color: var(--info);
}

.dash-metric__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dash-metric__label {
  font-size: 12px;
  color: var(--text-muted);
}

.dash-metric__value {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: var(--space-2);
  align-items: start;
}

.dash-stack,
.dash-aside {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.dash-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-muted);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.dash-attention {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.dash-attention__row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--text);
  transition: background var(--t-fast) var(--ease);
}

.dash-attention__row:hover { background: var(--hover); }

.dash-attention__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-prompt);
  color: var(--accent);
  font-size: 18px;
  flex-shrink: 0;
}

.dash-attention__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.dash-attention__title {
  font-size: 14px;
  font-weight: 500;
}

.dash-attention__text {
  font-size: 12px;
  color: var(--text-muted);
}

.dash-attention__count {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.dash-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.dash-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-prompt);
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--t-fast) var(--ease);
}

.dash-action:hover { background: var(--hover); }

.dash-action i {
  font-size: 18px;
  color: var(--accent);
}

.dash-secondary {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.card:has(> .card__body > .dash-secondary) > .card__body {
  padding: 0;
}

.dash-secondary__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  transition: background var(--t-fast) var(--ease);
}

.dash-secondary__item:last-child { border-bottom: 0; }
.dash-secondary__item:hover { background: var(--hover); }

.dash-secondary__item strong {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.dash-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.dash-feed__item {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.dash-feed__dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--accent);
  flex-shrink: 0;
}

.dash-feed__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dash-feed__title {
  font-size: 13.5px;
  font-weight: 500;
}

.dash-feed__meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* Account menu (topbar) */
.profile-menu {
  position: relative;
}

.profile-menu > summary {
  list-style: none;
  cursor: pointer;
}

.profile-menu > summary::-webkit-details-marker {
  display: none;
}

.profile {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

.profile--compact {
  padding: 2px;
}

.profile:hover,
.profile-menu[open] > summary .profile,
.profile-menu.is-open > .profile {
  background: var(--hover);
  border-color: var(--border);
}

.profile__avatar-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.profile__avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--text-inverse);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.profile__status {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--success);
  border: 2px solid var(--bg-sidebar);
  box-sizing: border-box;
}

.profile__name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}

/* Name avatar — round initials, deterministic 0-7 color variants.
   Tint-on-elevated keeps contrast in both light and dark mode. */
.emp-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  user-select: none;
  white-space: nowrap;
  border: 1px solid transparent;
  line-height: 1;
}

.emp-avatar--xs { width: 24px; height: 24px; font-size: 9px; }
.emp-avatar--sm { width: 28px; height: 28px; font-size: 10px; }
.emp-avatar--md { width: 32px; height: 32px; font-size: 11px; }
.emp-avatar--lg { width: 40px; height: 40px; font-size: 13px; }
.emp-avatar--xl { width: 56px; height: 56px; font-size: 18px; }

.emp-avatar--0 {
  background: var(--accent-muted);
  color: var(--accent-pressed);
  border-color: color-mix(in srgb, var(--accent) 32%, transparent);
}
.emp-avatar--1 {
  background: color-mix(in srgb, var(--success) 14%, var(--bg-elevated));
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 30%, transparent);
}
.emp-avatar--2 {
  background: color-mix(in srgb, var(--info) 14%, var(--bg-elevated));
  color: var(--info);
  border-color: color-mix(in srgb, var(--info) 30%, transparent);
}
.emp-avatar--3 {
  background: color-mix(in srgb, var(--warning) 16%, var(--bg-elevated));
  color: light-dark(#9a6b00, var(--warning));
  border-color: color-mix(in srgb, var(--warning) 32%, transparent);
}
.emp-avatar--4 {
  background: color-mix(in srgb, #8b5cf6 14%, var(--bg-elevated));
  color: light-dark(#6d28d9, #a78bfa);
  border-color: color-mix(in srgb, #8b5cf6 32%, transparent);
}
.emp-avatar--5 {
  background: color-mix(in srgb, #0d9488 14%, var(--bg-elevated));
  color: light-dark(#0f766e, #2dd4bf);
  border-color: color-mix(in srgb, #0d9488 32%, transparent);
}
.emp-avatar--6 {
  background: color-mix(in srgb, var(--danger) 12%, var(--bg-elevated));
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}
.emp-avatar--7 {
  background: var(--bg-muted);
  color: var(--text-muted);
  border-color: var(--border);
}

/* Table / list cell: avatar + name stack */
.emp-cell {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.emp-cell__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.emp-cell__name {
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emp-cell__sub {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-menu__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 244px;
  background: var(--bg-popover);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-popover);
  padding: var(--space-1);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 1px;
  transform-origin: top right;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.96);
  transition: var(--motion-spring), visibility var(--t-base) var(--ease);
  pointer-events: none;
}

.profile-menu[open] .profile-menu__panel,
.profile-menu.is-open .profile-menu__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.profile-menu__head {
  padding: var(--space-2) var(--space-2) var(--space-1);
}

.profile-menu__email {
  font-size: 12px;
  color: var(--text-dim);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  transition: var(--motion-interactive);
}

.profile-menu__item:hover {
  background: var(--hover-strong);
}

.profile-menu__item--danger {
  color: var(--danger);
}

.profile-menu__divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

/* Theme customizer (topbar) */
.theme-customizer {
  position: relative;
}

.theme-customizer > summary {
  list-style: none;
}

.theme-customizer > summary::-webkit-details-marker {
  display: none;
}

.theme-customizer[open] > .theme-customizer__trigger,
.theme-customizer.is-open > .theme-customizer__trigger {
  background: var(--hover);
  color: var(--text);
}

.theme-customizer__panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(320px, calc(100vw - 24px));
  background: var(--bg-popover);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-popover);
  padding: var(--space-3);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transform-origin: top right;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transition: var(--motion-spring), visibility var(--t-base) var(--ease);
  pointer-events: none;
}

.theme-customizer[open] .theme-customizer__panel,
.theme-customizer.is-open .theme-customizer__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.theme-customizer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.theme-customizer__title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.theme-customizer__subtitle {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.35;
}

.theme-customizer__actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.theme-customizer__section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-customizer__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* Notifications dropdown (topbar) */
.notify-menu {
  position: relative;
}

.notify-menu > summary {
  list-style: none;
}

.notify-menu > summary::-webkit-details-marker {
  display: none;
}

.notify-menu[open] > .topbar__notify,
.notify-menu.is-open > .topbar__notify {
  background: var(--hover);
  color: var(--text);
}

.notify-menu__panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, calc(100vw - 24px));
  background: var(--bg-popover);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-popover);
  z-index: 90;
  display: flex;
  flex-direction: column;
  transform-origin: top right;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transition: var(--motion-spring), visibility var(--t-base) var(--ease);
  pointer-events: none;
  overflow: hidden;
}

.notify-menu[open] .notify-menu__panel,
.notify-menu.is-open .notify-menu__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.notify-menu__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.notify-menu__title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.notify-menu__subtitle {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.35;
}

.notify-menu__list {
  display: flex;
  flex-direction: column;
  padding: var(--space-1);
  max-height: min(360px, 55vh);
  overflow-y: auto;
}

.notify-menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px var(--space-2);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--text);
  transition: var(--motion-interactive);
}

.notify-menu__item:hover {
  background: var(--hover);
}

.notify-menu__icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg-muted);
  color: var(--text-muted);
}

.notify-menu__icon--warn {
  background: color-mix(in srgb, var(--warning) 16%, transparent);
  color: var(--warning);
}

.notify-menu__icon--info {
  background: color-mix(in srgb, var(--info) 16%, transparent);
  color: var(--info);
}

.notify-menu__icon--accent {
  background: var(--accent-muted);
  color: var(--accent);
}

.notify-menu__icon--danger {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

.notify-menu__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.notify-menu__label {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
}

.notify-menu__meta {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notify-menu__count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--surface-secondary);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notify-menu__footer {
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--border);
}

.notify-menu__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: var(--motion-interactive);
}

.notify-menu__link:hover {
  background: var(--accent-muted);
}

.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0;
  padding: 3px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-muted);
}

.seg__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  height: 30px;
  border-radius: calc(var(--r-md) - 2px);
  cursor: pointer;
  transition: var(--motion-interactive);
}

.seg__btn:hover {
  color: var(--text);
}

.seg__btn.is-active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
}

.seg__btn.is-disabled,
.seg__btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  pointer-events: none;
}

.profile-details {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.profile-details__row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--space-3);
  align-items: baseline;
}

.profile-details__row dt {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.profile-details__row dd {
  margin: 0;
  font-size: 14px;
}

/* Forms */
.form-field { margin-bottom: var(--space-3); }

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: var(--control-h);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--input);
  border-radius: var(--r-md);
  background-color: var(--bg-prompt);
  color: var(--text);
  font: inherit;
  line-height: var(--text-body-sm-lh);
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  transition: var(--motion-interactive);
  transform: none;
}

.form-select {
  padding-right: calc(var(--space-3) + 22px);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%238A7F84' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  cursor: pointer;
}

:root[data-theme="dark"] .form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23C3C1BA' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-faint);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--input);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: var(--shadow-focus);
  transform: none;
}

.form-textarea { min-height: 96px; resize: vertical; }

.form-error {
  font-size: 12.5px;
  color: var(--danger);
  margin-top: 4px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-header, var(--border));
}

.tt-form-shell > .form-actions,
#modal-body form > .form-actions {
  margin-top: var(--space-2);
}

.form-actions .btn--ghost,
.form-actions a.btn--ghost {
  margin-left: 0;
}

/* Accordion sections (details/summary) */
details.form-section {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  background: var(--bg-elevated);
}

details.form-section > .form-section__title {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

details.form-section > .form-section__title::-webkit-details-marker,
details.form-section > .form-section__title::marker {
  display: none;
  content: none;
}

details.form-section > .form-section__title::after {
  content: "▾";
  color: var(--text-muted);
  font-size: 12px;
  transition: transform var(--t-fast) var(--ease);
}

details.form-section:not([open]) > .form-section__title::after {
  transform: rotate(-90deg);
}

details.form-section > .form-section__body {
  margin-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Legacy alias — prefer details.form-section / fieldset.tt-panel */
.form-section:not(details):not(fieldset) {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  background: var(--bg-elevated);
}

.form-section__title {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.form-section__title::-webkit-details-marker,
.form-section__title::marker {
  display: none;
  content: none;
}

.form-section__title::after {
  content: "▾";
  color: var(--text-muted);
  font-size: 12px;
  transition: transform var(--t-fast) var(--ease);
}

.form-section:not([open]) > .form-section__title::after {
  transform: rotate(-90deg);
}

.form-section__body {
  margin-top: var(--space-3);
}

.formset-table {
  width: 100%;
  border-collapse: collapse;
}

.formset-table th,
.formset-table td {
  padding: var(--space-2);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.formset-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.formset-table .form-input,
.formset-table .form-select {
  min-height: 32px;
}

/* Tables */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  min-width: 0;
}

.toolbar__search {
  flex: 1 1 200px;
  min-width: 0;
  max-width: 320px;
}

.data-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-elevated);
  max-width: 100%;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.4;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-header);
}

.data-table th {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  background: transparent;
  white-space: nowrap;
  height: 40px;
}

.data-table tbody tr {
  transition: background var(--t-micro) var(--ease);
}

.data-table tbody tr:hover {
  background: var(--hover-subtle);
}

.data-table tbody tr:last-child td { border-bottom: 0; }

/* DataTables theme overrides */
table.dataTable {
  border-collapse: collapse !important;
  width: 100% !important;
  margin: 0 !important;
}

table.dataTable thead th {
  background: transparent !important;
  color: var(--text-muted) !important;
  border-bottom: 1px solid var(--border-header) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  padding: 12px 16px !important;
  white-space: nowrap;
}

table.dataTable tbody td {
  border-bottom: 1px solid var(--border-header) !important;
  color: var(--text) !important;
  background: transparent !important;
  padding: 12px 16px !important;
}

table.dataTable tbody tr:hover td {
  background: var(--hover-subtle) !important;
}

.dataTable thead th.sorting,
.dataTable thead th.sorting_asc,
.dataTable thead th.sorting_desc {
  color: var(--text-dim) !important;
}

.dt-container,
.dataTables_wrapper {
  width: 100%;
}

.dt-container .dt-layout-row,
.dataTables_wrapper .row {
  margin: 0 !important;
	padding: var(--space-3) !important;
}

.dt-container .dt-layout-row:first-child,
.dt-container .dt-layout-row:last-child {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center !important;
  gap: var(--space-2);
  padding: var(--space-3) !important;
  box-sizing: border-box;
}

.dt-container .dt-layout-row:first-child {
  border-bottom: 1px solid var(--border-header);
}

.dt-container .dt-layout-row:last-child {
  border-top: 1px solid var(--border-header);
}

.dt-container .dt-layout-cell {
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.dt-container .dt-layout-cell:empty {
  display: none !important;
}

.dt-container .dt-layout-row:last-child .dt-layout-start {
  flex-wrap: wrap;
  gap: var(--space-3);
}

.dt-container .dt-layout-table,
.dt-container .dt-scroll {
  padding: 0 !important;
  margin: 0 !important;
}

/* Length + search — vertical align label with control */
.dt-container .dt-length,
.dt-container .dt-search,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  color: var(--text-muted) !important;
  font-size: 13px;
  line-height: 1.2;
  margin: 0 !important;
}

.dt-container .dt-length label,
.dt-container .dt-search label,
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  margin: 0 !important;
  color: var(--text-muted) !important;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.2;
}

.dt-container .dt-search input,
.dt-container .dt-length select,
.dt-container .dataTables_filter input,
.dt-container .dataTables_length select,
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper input[type="search"],
.dataTables_wrapper select {
  background-color: var(--bg-prompt) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: var(--r-md) !important;
  padding: 0 28px 0 10px !important;
  min-height: 32px !important;
  height: 32px !important;
  font-size: 13px !important;
  line-height: 1 !important;
  margin: 0 !important;
  vertical-align: middle;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%238A7F84' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 12px !important;
}

:root[data-theme="dark"] .dt-container .dt-length select,
:root[data-theme="dark"] .dt-container .dataTables_length select,
:root[data-theme="dark"] .dataTables_wrapper .dataTables_length select,
:root[data-theme="dark"] .dataTables_wrapper select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23C3C1BA' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

.dt-container .dt-search input,
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper input[type="search"] {
  padding: 0 10px !important;
  background-image: none !important;
  min-width: 180px;
}

.dt-container .dt-info,
.dataTables_wrapper .dataTables_info {
  color: var(--text-muted) !important;
  font-size: 13px !important;
  line-height: 1.4;
  padding: 0 !important;
  margin: 0 !important;
}

/* Paging — theme chips. DataTables 3 sets disabled color to rgba(0,0,0,.5). */
div.dt-container div.dt-paging,
.dataTables_wrapper .dataTables_paginate {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  margin: 0 !important;
}

div.dt-container div.dt-paging nav,
div.dt-container .dt-paging .pagination {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

div.dt-container .dt-paging .dt-paging-button,
div.dt-container div.dt-paging button.dt-paging-button,
.dataTables_wrapper .dataTables_paginate .paginate_button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px !important;
  margin: 0 !important;
  border-radius: var(--r-md) !important;
  border: 1px solid var(--border) !important;
  background: var(--bg-prompt) !important;
  background-image: none !important;
  color: var(--text) !important;
  font-family: var(--font-sans) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  box-shadow: none !important;
  cursor: pointer;
  transition: var(--motion-interactive);
  opacity: 1 !important;
  text-decoration: none !important;
}

div.dt-container .dt-paging .dt-paging-button i,
div.dt-container .dt-paging .dt-paging-button .admin-icon,
div.dt-container .dt-paging .dt-paging-button .bx {
  color: inherit !important;
}

div.dt-container .dt-paging .dt-paging-button:hover:not(.disabled):not(.current),
div.dt-container div.dt-paging button.dt-paging-button:hover:not(.disabled):not(.current),
.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.disabled):not(.current) {
  background: var(--hover) !important;
  background-image: none !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

div.dt-container .dt-paging .dt-paging-button.current,
div.dt-container .dt-paging .dt-paging-button.current:hover,
div.dt-container div.dt-paging button.dt-paging-button.current,
div.dt-container div.dt-paging button.dt-paging-button.current:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--accent) !important;
  background-image: none !important;
  color: #fff !important;
  border-color: transparent !important;
  font-weight: 600 !important;
}

div.dt-container .dt-paging .dt-paging-button.disabled,
div.dt-container .dt-paging .dt-paging-button.disabled:hover,
div.dt-container .dt-paging .dt-paging-button.disabled:active,
div.dt-container div.dt-paging button.dt-paging-button.disabled,
div.dt-container div.dt-paging button.dt-paging-button.disabled:hover,
div.dt-container div.dt-paging button.dt-paging-button.disabled:active,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  color: var(--text-muted) !important;
  background: var(--bg-muted) !important;
  background-image: none !important;
  border-color: var(--border) !important;
  cursor: default !important;
  opacity: 1 !important;
  box-shadow: none !important;
}

div.dt-container .dt-paging .dt-paging-button:focus,
div.dt-container .dt-paging .dt-paging-button:focus-visible,
div.dt-container button.dt-paging-button:focus-visible {
  outline: none !important;
  box-shadow: var(--shadow-focus) !important;
}

/* DataTables 3 wrapper controls (legacy class names) */
.dataTables_wrapper,
.dataTables_wrapper * {
  box-sizing: border-box;
}

.dataTables_wrapper .dataTables_processing {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: var(--r-md) !important;
  padding: var(--space-2) var(--space-3) !important;
}

/* Status pills — badge-like */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  transition: none;
}

.status-pill:hover { transform: none; }

.status-pill--active,
.status-pill--paid,
.status-pill--shipped {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
}

.status-pill--inactive,
.status-pill--cancelled {
  background: var(--bg-muted);
  color: var(--text-muted);
  border-color: var(--border);
}

.status-pill--draft {
  background: var(--bg-muted);
  color: var(--text-muted);
  border-color: var(--border);
}

.status-pill--pending {
  background: color-mix(in srgb, var(--warning) 14%, transparent);
  color: #a16207;
}

/* Attendance status pills (UI-only pill style) */
.status-pill--present {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
}

.status-pill--absent {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

.status-pill--late {
  background: color-mix(in srgb, var(--warning) 18%, transparent);
  color: #9a7b00;
}

.status-pill--incomplete {
  background: color-mix(in srgb, var(--text-dim) 12%, transparent);
  color: var(--text-dim);
}

.status-pill--missing_punch {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
}

.status-pill--auto_approved {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
}

.status-pill--leave {
  background: color-mix(in srgb, var(--info) 14%, transparent);
  color: var(--info);
}

.status-pill--early_out {
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  color: #7c6a00;
}

.status-pill--day_off {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
}

.status-pill--holiday {
  background: color-mix(in srgb, var(--text-muted) 10%, transparent);
  color: var(--text-muted);
}

.status-pill--worked_holiday {
  background: color-mix(in srgb, var(--info) 12%, transparent);
  color: var(--info);
}

.status-pill--overtime {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

/* Correction workflow pills */
.status-pill--approved {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
}

.status-pill--rejected {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

/* Dropdowns */
.dropdown { position: relative; display: inline-block; }

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 160px;
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  background: var(--bg-popover);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-popover);
  z-index: 60;
  transform-origin: top right;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(0.96);
  transition: var(--motion-spring), visibility var(--t-base) var(--ease);
  pointer-events: none;
}

.dropdown-menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.dropdown-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-2);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  transition: var(--motion-interactive);
}

.dropdown-menu__item:hover {
  background: var(--hover-strong);
  transform: none;
}

.dropdown-menu__item--danger { color: var(--danger) !important; }

.dropdown-menu__divider {
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

/* Modal — right drawer; follows data-sidebar-variant (default | inset) */
.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  padding: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  transition: visibility var(--modal-backdrop-t) var(--modal-backdrop-ease);
}

.admin-modal.is-open {
  visibility: visible;
  pointer-events: auto;
}

/*
  Blur stays applied; only opacity animates (animating backdrop-filter is janky).
  Parent no longer fades — avoids a double opacity*blur fade.
*/
.admin-modal__backdrop {
  position: absolute;
  inset: 0;
  background: var(--modal-backdrop-bg);
  -webkit-backdrop-filter: var(--modal-backdrop-filter);
  backdrop-filter: var(--modal-backdrop-filter);
  opacity: 0;
  transform: translateZ(0);
  backface-visibility: hidden;
  transition: opacity var(--modal-backdrop-t) var(--modal-backdrop-ease);
  will-change: opacity;
}

.admin-modal.is-open .admin-modal__backdrop {
  opacity: 1;
}

.admin-modal__dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  height: 100%;
  max-height: 100%;
  background: var(--bg-popover);
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  box-shadow: var(--shadow-popover);
  transform: translateX(100%);
  transition:
    transform var(--modal-backdrop-t) var(--modal-backdrop-ease),
    border-radius var(--modal-backdrop-t) var(--modal-backdrop-ease),
    box-shadow var(--modal-backdrop-t) var(--modal-backdrop-ease);
}

.admin-modal.is-open .admin-modal__dialog {
  transform: translateX(0);
}

.admin-modal--wide .admin-modal__dialog {
  width: min(640px, 100%);
}

/* Default — edge-flush sheet */
:root[data-sidebar-variant="default"] .admin-modal {
  padding: 0;
}

:root[data-sidebar-variant="default"] .admin-modal__dialog {
  border-radius: 0;
  border: 0;
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-popover);
}

/* Inset — floating panel matching shell gap + radius */
:root[data-sidebar-variant="inset"] .admin-modal {
  padding: var(--shell-gap);
}

:root[data-sidebar-variant="inset"] .admin-modal__dialog {
  border: 1px solid var(--border);
  border-radius: var(--r-shell);
  box-shadow: var(--shadow-popover-lg);
  transform: translateX(calc(100% + var(--shell-gap)));
}

:root[data-sidebar-variant="inset"] .admin-modal.is-open .admin-modal__dialog {
  transform: translateX(0);
}

@media (max-width: 768px) {
  :root[data-sidebar-variant="inset"] .admin-modal {
    padding: var(--space-2);
  }

  :root[data-sidebar-variant="inset"] .admin-modal__dialog {
    border-radius: var(--r-card);
    transform: translateX(calc(100% + var(--space-2)));
  }

  :root[data-sidebar-variant="inset"] .admin-modal.is-open .admin-modal__dialog {
    transform: translateX(0);
  }
}

.admin-modal__head {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-header);
}

.admin-modal__title { font-size: 16px; font-weight: 600; }

.admin-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-4);
}

.admin-modal__body > * {
  min-width: 0;
  max-width: 100%;
}

.admin-modal__foot {
  display: flex;
  flex-shrink: 0;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-header);
}

/* Alerts */
.alert {
  padding: var(--space-3);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  font-size: 14px;
  margin-bottom: var(--space-3);
}

.alert:hover { transform: none; }

.alert--success {
  background: color-mix(in srgb, var(--success) 10%, var(--bg-elevated));
  border-color: color-mix(in srgb, var(--success) 25%, var(--border));
  color: var(--text);
}

.alert--warning {
  background: color-mix(in srgb, var(--warning) 10%, var(--bg-elevated));
  border-color: color-mix(in srgb, var(--warning) 28%, var(--border));
  color: var(--text);
}

.alert--error {
  background: color-mix(in srgb, var(--danger) 10%, var(--bg-elevated));
  border-color: color-mix(in srgb, var(--danger) 25%, var(--border));
  color: var(--text);
}

.alert--info {
  background: color-mix(in srgb, var(--info) 10%, var(--bg-elevated));
  border-color: color-mix(in srgb, var(--info) 25%, var(--border));
  color: var(--text);
}

/* Toasts */
.toasts {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: var(--bg-popover);
  border: 1px solid var(--border);
  color: var(--text);
  padding: var(--space-2) var(--space-3);
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-popover);
  animation: toastIn var(--t-base) var(--ease-spring) both;
  pointer-events: auto;
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease);
}

.toast.is-leaving {
  animation: toastOut var(--t-base) var(--ease) forwards;
}

.toast--success { border-color: color-mix(in srgb, var(--success) 40%, var(--border)); }
.toast--error   { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.toast--info    { border-color: color-mix(in srgb, var(--info) 40%, var(--border)); }

/* Command palette */
.command-palette {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 24px;
}

.command-palette__backdrop {
  position: absolute;
  inset: 0;
  background: var(--modal-backdrop-bg);
  -webkit-backdrop-filter: var(--modal-backdrop-filter);
  backdrop-filter: var(--modal-backdrop-filter);
  transform: translateZ(0);
  backface-visibility: hidden;
}

.command-palette__dialog {
  position: relative;
  width: min(560px, 100%);
  max-height: min(520px, 70vh);
  display: flex;
  flex-direction: column;
  background: var(--bg-popover);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-popover);
  overflow: hidden;
  animation: scaleIn var(--t-base) var(--ease-out) both;
}

.command-palette__search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

.command-palette__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: none;
}

.command-palette__esc {
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 500;
  font-family: inherit;
  background: var(--bg-muted);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.command-palette__list {
  overflow-y: auto;
  padding: var(--space-1);
  min-height: 120px;
}

.command-palette__group-title {
  margin: 0;
  padding: 8px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.command-palette__item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.command-palette__item.is-active,
.command-palette__item:hover {
  background: var(--hover);
}

.command-palette__icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg-muted);
  color: var(--text-muted);
}

.command-palette__copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.command-palette__title {
  font-size: 13.5px;
  font-weight: 500;
}

.command-palette__subtitle {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.command-palette__empty {
  margin: 0;
  padding: 24px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--space-3);
}

.pagination__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: var(--motion-interactive);
}

.pagination__item:hover {
  background: var(--hover);
  color: var(--text);
  transform: none;
}

.pagination__item:active { transform: none; }

.pagination__item.is-active {
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  transform: none;
  box-shadow: none;
}

.pagination__item.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Tabs — muted track + active surface (shadcn TabsList) */
.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: var(--space-3);
  border-bottom: 0;
  padding: 4px;
  background: var(--bg-muted);
  border-radius: var(--r-md);
  width: fit-content;
  max-width: 100%;
}

.tab {
  padding: 6px 12px;
  border-radius: calc(var(--r-md) - 2px);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  position: relative;
  border: 1px solid transparent;
}

.tab:hover {
  background: transparent;
  color: var(--text);
}

.tab.is-active {
  background: var(--nav-active);
  color: var(--text);
  border-color: transparent;
  box-shadow: none;
}

/* HTMX indicator */
.htmx-indicator {
  opacity: 0;
  transform: translateY(2px);
  transition: var(--motion-micro);
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .dash-hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .dash-hero__score { align-items: flex-start; }
  .dash-metrics { grid-template-columns: 1fr; }
  .dash-actions { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .toasts { bottom: 88px; }
  .toasts {
    left: var(--space-2);
    right: var(--space-2);
    transform: none;
    align-items: stretch;
  }

  .toast { border-radius: var(--r-md); text-align: center; width: 100%; }
}

/* Form dialog shell + nested panels (shared by timetable + drawer forms) */
.tt-form-shell,
#modal-body form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.tt-form-shell > .field,
.tt-form-shell > .field-row,
.tt-form-shell > .form-switch,
.tt-form-shell > .tt-panel,
.tt-form-shell > .tt-toggle-block,
.tt-form-shell > fieldset,
.tt-form-shell > details.form-section,
#modal-body form > .field,
#modal-body form > .field-row,
#modal-body form > .form-switch,
#modal-body form > .tt-panel,
#modal-body form > .tt-toggle-block,
#modal-body form > fieldset,
#modal-body form > details.form-section {
  margin-bottom: 0;
}

.tt-panel > .field,
.tt-panel > .field-row,
.tt-panel > .form-switch,
.tt-panel > .tt-switch-stack,
.tt-panel > .help-text,
fieldset.tt-panel > .field,
fieldset.tt-panel > .field-row,
fieldset.tt-panel > .form-switch,
fieldset.tt-panel > .tt-switch-stack,
fieldset.tt-panel > .help-text,
fieldset.form-section > .field,
fieldset.form-section > .field-row,
fieldset.form-section > .form-switch,
fieldset.form-section > .help-text {
  margin-bottom: 0;
}

.tt-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.tt-form > .field,
.tt-form > .tt-name-row,
.tt-form > .tt-toggle-block,
.tt-form > .tt-panel,
.tt-form > .form-switch,
.tt-form > .tabs,
.tt-form > details.form-section,
.tt-form > [x-show] {
  margin-bottom: 0;
}

.tt-name-row .field {
  margin-bottom: 0;
}

/* Shift type as full-width tabs */
.tt-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 100%;
  margin-bottom: 0;
  box-sizing: border-box;
	background: var(--bg);
	border-radius: var(--r-md);
}

.tt-tabs .tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  cursor: pointer;
  user-select: none;
  text-align: center;
}

.tt-tabs .tab input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.tt-name-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-3);
  align-items: end;
}

.tt-color-field {
  width: 56px;
}

.tt-color-field .form-label {
  text-align: center;
}

.tt-color-field .tt-color,
.tt-color-field input[type="color"] {
  width: 44px;
  margin-inline: auto;
}

.tt-segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.tt-segment__btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-h);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--motion-interactive);
}

.tt-segment__btn input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tt-segment__btn.is-active {
  border-color: var(--accent, #e11d48);
  color: var(--accent, #e11d48);
  box-shadow: inset 0 0 0 1px var(--accent, #e11d48);
}

.tt-color,
.form-input[type="color"],
input.tt-color[type="color"] {
  display: block;
  width: 44px;
  max-width: 44px;
  height: var(--control-h);
  min-height: var(--control-h);
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-prompt);
  cursor: pointer;
  box-shadow: none;
}

.tt-hours,
.tt-range {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-2);
  align-items: start;
  min-width: 0;
}

.tt-hours {
  grid-template-columns: 1fr 1fr;
}

.tt-hours > .field,
.tt-range > .field {
  margin-bottom: 0;
  min-width: 0;
}

.tt-range__sep {
  margin-top: calc(var(--control-h) / 2 - 0.5em);
  color: var(--text-muted);
}

/* Form switches (replaces checkbox UI).
   !important beats .field label { display:block } and .form-input width rules. */
.form-switch,
.tt-switch,
.field .form-switch,
.field .tt-switch,
.field-row .form-switch,
.tt-toggle-block .form-switch {
  position: relative;
  display: inline-flex !important;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
  margin-bottom: var(--space-3);
  width: auto;
  max-width: 100%;
}

.form-switch input,
.tt-switch input,
.field .form-switch input,
.field .tt-switch input,
.tt-toggle-block .form-switch input {
  position: absolute !important;
  inset: 0 auto 0 0;
  opacity: 0 !important;
  width: 40px !important;
  height: 22px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: 40px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  pointer-events: none;
  appearance: none !important;
  -webkit-appearance: none !important;
}

.tt-toggle-block {
  display: flex;
  flex-direction: column;
}

.form-switch__ui,
.tt-switch__ui {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--border);
  transition: background var(--t-fast, 150ms) ease;
  flex-shrink: 0;
  flex-grow: 0;
}

.form-switch__ui::after,
.tt-switch__ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 18%);
  transition: transform var(--t-fast, 150ms) ease;
}

.form-switch input:checked + .form-switch__ui,
.tt-switch input:checked + .tt-switch__ui {
  background: #16a34a;
}

.form-switch input:checked + .form-switch__ui::after,
.tt-switch input:checked + .tt-switch__ui::after {
  transform: translateX(18px);
}

.form-switch input:focus-visible + .form-switch__ui,
.tt-switch input:focus-visible + .tt-switch__ui {
  outline: 2px solid var(--accent, #e11d48);
  outline-offset: 2px;
}

.form-switch__label,
.tt-switch__label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.tt-switch-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Legacy .field.checkbox → toggle switch */
.field.checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  cursor: pointer;
  user-select: none;
}

.field.checkbox label {
  display: inline;
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}

.field.checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 40px;
  height: 22px;
  min-height: 22px;
  margin: 0;
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  background: var(--border);
  box-shadow: none;
  cursor: pointer;
  transition: background var(--t-fast, 150ms) ease;
}

.field.checkbox input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 18%);
  transition: transform var(--t-fast, 150ms) ease;
}

.field.checkbox input[type="checkbox"]:checked {
  background: #16a34a;
}

.field.checkbox input[type="checkbox"]:checked::after {
  transform: translateX(18px);
}

.field.checkbox input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent, #e11d48);
  outline-offset: 2px;
}

/* Keep formset delete boxes compact */
.formset-table input[type="checkbox"] {
  appearance: auto;
  -webkit-appearance: auto;
  width: auto;
  height: auto;
  min-height: auto;
  border-radius: var(--r-sm, 4px);
  background: var(--bg-prompt);
}

.tt-panel,
fieldset.tt-panel,
fieldset.form-section {
  min-width: 0;
  margin: 0;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-muted);
}

/* Non-fieldset panels stack with flex gap */
div.tt-panel {
  display: flex;
  flex-direction: column;
	margin-bottom: var(--space-3);
  gap: var(--space-3);
}

/* Fieldsets avoid display:flex (legend bugs in Chromium) */
fieldset.tt-panel > *:not(legend),
fieldset.form-section > *:not(legend) {
  margin-top: var(--space-3);
}

fieldset.tt-panel > legend + *,
fieldset.form-section > legend + * {
  margin-top: var(--space-2);
}

fieldset.tt-panel > legend,
fieldset.form-section > legend {
  float: none;
  width: auto;
  max-width: 100%;
  padding: 0 var(--space-1);
  margin: 0 0 calc(var(--space-1) * -1);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  background: transparent;
}

.tt-indent {
	margin-bottom: var(--space-3);
  padding-left: calc(40px + var(--space-2));
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.tt-indent .field {
  margin-bottom: 0;
}

.tt-switch-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.tt-switch-stack .form-switch,
.tt-panel > .form-switch,
.tt-form-shell > .form-switch {
  margin-bottom: 0;
}

/* Align switches with labeled inputs only when sharing a row with .field */
.field-row > .form-switch {
  margin-top: calc(var(--space-2) + 1.1em);
  margin-bottom: 0;
}

.field-row > .form-switch:only-child,
.field-row > .form-switch:first-child:last-child {
  margin-top: 0;
}

/* When a row is only switches, don't offset */
.field-row:not(:has(.field)) > .form-switch {
  margin-top: 0;
}

.tt-link {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent, #2563eb);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
}

.tt-identity {
  min-width: 0;
  width: 100%;
}

.tt-identity__name {
  min-width: 0;
}

.tt-chip {
  flex-shrink: 0;
}

/* Numbered form sections (timetable add/edit) */
.tt-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-4) 0 var(--space-2);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.tt-step:first-child {
  margin-top: 0;
}

.tt-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--accent-muted);
  color: var(--accent-pressed);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Shift-type choice cards */
.tt-choice {
  flex: 1;
  display: flex !important;
  align-items: flex-start;
  gap: var(--space-2);
  padding: 10px 12px !important;
  cursor: pointer;
}

.tt-choice__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.35;
}

.tt-choice__title {
  font-weight: 600;
}

.tt-choice__desc {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

/* Name + color identity row */
.tt-identity {
  display: flex;
  gap: var(--space-2);
  align-items: flex-end;
}

.tt-identity__name {
  flex: 1;
  min-width: 0;
}

.tt-identity__color {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.tt-color {
  width: 44px;
  height: var(--control-h);
  padding: 3px;
  border: 1px solid var(--input);
  border-radius: var(--r-md);
  background: var(--bg-prompt);
  cursor: pointer;
}

.tt-color__hidden {
  display: contents;
}

/* Ends-next-day chip next to check-out time */
.tt-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: center;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--motion-interactive);
}

.tt-chip:hover {
  color: var(--text);
  border-color: var(--accent);
}

.tt-chip.is-on {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent-pressed);
}

.tt-chip input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
}

/* One-line flow explainer under section tabs */
.tabs-hint {
  margin: -4px 0 var(--space-3);
  font-size: 12.5px;
  color: var(--text-muted);
}

.tabs-hint strong {
  color: var(--text);
  font-weight: 600;
}

.tt-swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--tt-color);
  border: 1px solid var(--border);
  vertical-align: middle;
}

.tt-list-name {
  font-weight: 500;
}

/* ── Responsive layout / spacing ─────────────────────────────── */
@media (max-width: 768px) {
  .page-content {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  .card__header,
  .card__body {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  .card--table .card__header {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  .admin-modal__head,
  .admin-modal__body,
  .admin-modal__foot {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  .admin-modal__dialog {
    width: 100%;
  }

  .admin-modal--wide .admin-modal__dialog {
    width: 100%;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar__search,
  .toolbar .search-input {
    max-width: none;
    width: 100%;
    flex: 1 1 auto;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .form-actions .btn,
  .form-actions button,
  .form-actions a.btn {
    width: 100%;
    justify-content: center;
  }

  .profile-details__row {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }

  .tt-indent {
    padding-left: var(--space-3);
  }

  .tt-range {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .tt-range__sep {
    display: none;
  }

  .tt-hours {
    grid-template-columns: 1fr 1fr;
  }

  .tt-identity {
    flex-wrap: wrap;
  }

  .tt-chip {
    width: 100%;
    justify-content: center;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .field-row > .form-switch {
    margin-top: 0;
  }

  .tabs.tt-tabs,
  .tt-tabs {
    width: 100%;
  }

  .dashboard-kpis,
  .dash-kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .page-content {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }

  .tt-hours {
    grid-template-columns: 1fr;
  }

  .dashboard-kpis,
  .dash-kpi-grid {
    grid-template-columns: 1fr;
  }

  .page-head__title {
    font-size: clamp(1.25rem, 5vw, var(--text-h1));
  }

  /* Inset shell: tighten gap so content isn't squeezed */
  :root[data-sidebar-variant="inset"] {
    --shell-gap: 8px;
  }
}

/* Drawer forms: keep grids from overflowing the panel */
#modal-body .field-row,
.admin-modal__body .field-row {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
}

#modal-body .formset-table,
.admin-modal__body .formset-table,
.tt-form-shell .formset-table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#modal-body .formset-table th,
#modal-body .formset-table td,
.admin-modal__body .formset-table th,
.admin-modal__body .formset-table td,
.tt-form-shell .formset-table th,
.tt-form-shell .formset-table td {
  white-space: nowrap;
}

/* Prefer gap over stacked margins inside panels */
.form-section__body > .field,
.form-section__body > .field-row,
.form-section__body > .form-switch,
.form-section__body > .tt-switch-stack,
.form-section__body > .tt-toggle-block {
  margin-bottom: 0;
}

[x-cloak] {
  display: none !important;
}
