:root {
  color-scheme: light dark;
  --font-family: "Manrope", "Public Sans", "Avenir Next", "Helvetica Neue", sans-serif;
  --transition-duration: 180ms;
  --form-field-label-gap: 6px;
  --shadow-elevated: 0 18px 42px rgba(15, 23, 42, 0.14);
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 4px;
  --signout-bg: #b4232f;
  --signout-bg-hover: #8f1d28;
}

body {
  margin: 0;
  font-family: var(--font-family);
  background: var(--surface);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition-duration) ease, color var(--transition-duration) ease;
}

body.theme-light {
  color-scheme: light;
  --surface: #f6f8fe;
  --surface-elevated: #ffffff;
  --surface-muted: rgba(255, 255, 255, 0.7);
  --text-primary: #0b1628;
  --text-secondary: #4c5a71;
  --accent: #2f6bff;
  --accent-soft: rgba(47, 107, 255, 0.15);
  --accent-strong: #1346cb;
  --success: oklch(0.47 0.13 151);
  --danger: oklch(0.52 0.16 27);
  --warning: oklch(0.58 0.13 72);
  --border: rgba(15, 23, 42, 0.08);
  --dropzone-bg: rgba(47, 107, 255, 0.08);
  --dropzone-border: rgba(47, 107, 255, 0.45);
  --toast-bg: rgba(15, 23, 42, 0.92);
  --toast-text: #ffffff;
  --logo-bg: #ffffff;
  --toggle-track-bg: rgba(15, 23, 42, 0.12);
  --toggle-thumb-bg: #ffffff;
  --table-header-bg: rgba(47, 107, 255, 0.08);
  --table-header-bg-opaque: #dce8fb;
  --offers-sent-bg: rgba(48, 158, 92, 0.18);
  --offers-preview-border: rgba(15, 23, 42, 0.12);
}

body.theme-dark {
  color-scheme: dark;
  --surface: #0b1321;
  --surface-elevated: rgba(23, 33, 52, 0.92);
  --surface-muted: rgba(23, 33, 52, 0.7);
  --text-primary: #f5f7fb;
  --text-secondary: #b8c4de;
  --accent: #7da9ff;
  --accent-soft: rgba(125, 169, 255, 0.22);
  --accent-strong: #98c1ff;
  --success: oklch(0.76 0.13 151);
  --danger: oklch(0.72 0.13 27);
  --warning: oklch(0.78 0.12 72);
  --signout-bg: #a83232;
  --signout-bg-hover: #bd3b36;
  --border: rgba(135, 155, 192, 0.28);
  --dropzone-bg: rgba(125, 169, 255, 0.15);
  --dropzone-border: rgba(125, 169, 255, 0.5);
  --toast-bg: rgba(245, 247, 251, 0.95);
  --toast-text: #121a2c;
  --logo-bg: rgba(255, 255, 255, 0.95);
  --toggle-track-bg: rgba(245, 247, 251, 0.28);
  --toggle-thumb-bg: #0c1424;
  --table-header-bg: rgba(125, 169, 255, 0.15);
  --table-header-bg-opaque: #203957;
  --offers-sent-bg: rgba(92, 210, 150, 0.22);
  --offers-preview-border: rgba(135, 155, 192, 0.28);
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px clamp(24px, 6vw, 64px);
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: var(--logo-bg);
  border: 1px solid rgba(12, 20, 36, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: none;
}

.brand-icon img {
  width: 60%;
  height: auto;
}

.brand-text h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 700;
}

.brand-text p {
  margin: 6px 0 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dev-login {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dev-login[hidden] {
  display: none;
}

.dev-login input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--surface-elevated);
  color: var(--text-primary);
  width: 220px;
}

.dev-login button {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  padding: 8px 12px;
  cursor: pointer;
}

.dev-login button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

.user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.2;
}

#user-name {
  font-weight: 600;
}

#user-email {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.auth-button,
.primary-button,
.ghost-button,
.actions button {
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.98rem;
  padding: 12px 22px;
  border: none;
  cursor: pointer;
  transition: transform var(--transition-duration) ease, box-shadow var(--transition-duration) ease, opacity var(--transition-duration) ease;
}

.auth-button,
.primary-button,
.actions button {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 12px 28px rgba(47, 107, 255, 0.25);
}

.ghost-button {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.auth-button:disabled,
.primary-button:disabled,
.ghost-button:disabled,
.actions button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-button:hover,
.primary-button:hover,
.actions button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.ghost-button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  color: var(--text-secondary);
}

.theme-toggle__track {
  position: relative;
  width: 64px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(125, 147, 189, 0.35);
  background: var(--toggle-track-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-duration) ease, border var(--transition-duration) ease;
}

.theme-toggle__icon {
  position: absolute;
  top: 50%;
  line-height: 1;
  opacity: 0.55;
  font-size: 1rem;
  transition: opacity var(--transition-duration) ease;
  transform: translateY(-50%);
  pointer-events: none;
}

.theme-toggle__icon--sun {
  left: 12px;
}

.theme-toggle__icon--moon {
  right: 12px;
}

.theme-toggle__thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--toggle-thumb-bg);
  transform: translate(0, -50%);
  transition: transform var(--transition-duration) ease, background var(--transition-duration) ease;
}

.theme-toggle.theme-toggle--dark .theme-toggle__thumb {
  transform: translate(32px, -50%);
}

.theme-toggle__text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.nav-tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 0 clamp(24px, 6vw, 64px);
  padding: 0 0 8px;
  border-bottom: 1px solid var(--border);
}

.nav-tab {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 1rem;
  padding: 12px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--transition-duration) ease, background var(--transition-duration) ease;
}

.nav-tab--active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-tab[hidden] {
  display: none !important;
}

.nav-tab[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

.page-content {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: clamp(16px, 5vw, 48px);
}

.panel {
  width: min(1080px, 100%);
  background: var(--surface-elevated);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-elevated);
  display: none;
  flex-direction: column;
  gap: 32px;
}

.panel--wide {
  width: 100%;
  max-width: 1440px;
}

.panel--active {
  display: flex;
}

.labor-bill-panel {
  min-height: calc(100dvh - 96px);
  overflow: hidden;
  padding: 0;
}

.labor-bill-frame {
  width: 100%;
  min-height: calc(100dvh - 96px);
  flex: 1;
  border: 0;
}

.panel-header h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  font-weight: 700;
}

.panel-header p {
  margin: 8px 0 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.drop-zone {
  position: relative;
  border: 2px dashed var(--dropzone-border);
  border-radius: var(--radius-lg);
  background: var(--dropzone-bg);
  padding: clamp(32px, 6vw, 48px) clamp(20px, 4vw, 40px);
  cursor: pointer;
  transition: border-color var(--transition-duration) ease, background var(--transition-duration) ease, transform var(--transition-duration) ease;
  overflow: hidden;
}

.drop-zone--dragging,
.drop-zone:hover {
  border-color: var(--accent);
  background: rgba(47, 107, 255, 0.18);
  transform: translateY(-1px);
}


.drop-zone__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.drop-zone:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.drop-zone__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.drop-zone__icon {
  font-size: clamp(2.5rem, 4vw, 3.2rem);
  filter: drop-shadow(0 12px 28px rgba(47, 107, 255, 0.22));
}

.drop-zone__text {
  margin: 0;
  font-size: 1rem;
}

.drop-zone__hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.drop-zone__file {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
}

.filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: var(--form-field-label-gap);
  min-width: 0;
}

.filter-field--wide {
  grid-column: span 2;
}

.filter-field label {
  font-size: 0.95rem;
  line-height: 1.25;
  min-height: 0;
  color: var(--text-secondary);
}

.filter-field input,
.filter-field select,
textarea,
.modal__group input,
.modal__group textarea {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-primary);
  font-size: 1rem;
  padding: 12px 14px;
  transition: border var(--transition-duration) ease, box-shadow var(--transition-duration) ease;
}

.filter-field input:focus,
.modal__group input:focus,
.modal__group textarea:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 107, 255, 0.18);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.actions .ghost-button {
  color: var(--text-primary);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  box-shadow: none;
}

.actions .ghost-button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.run-status {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.request-status {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  padding: 14px 16px;
}

.request-status[hidden] {
  display: none;
}

.request-status h3,
.request-status p {
  margin: 0;
}

.request-status h3 {
  font-size: 1rem;
}

.request-status p,
.request-status__meta {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.request-status__meta {
  text-align: right;
  max-width: 44%;
  overflow-wrap: anywhere;
}

.dry-run-preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dry-run-preview[hidden] {
  display: none;
}

.dry-run-preview__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.dry-run-preview__header h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.dry-run-preview__header p,
.dry-run-preview__meta {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.dry-run-preview__meta {
  text-align: right;
  max-width: 46%;
  overflow-wrap: anywhere;
}

.dry-run-status {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px 12px 42px;
  background: var(--surface-elevated);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 700;
}

.dry-run-status[hidden] {
  display: none;
}

.dry-run-status::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: dry-run-status-spin 0.9s linear infinite;
}

.dry-run-status[data-tone="error"] {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 34%, var(--border));
  background: color-mix(in srgb, var(--danger) 8%, var(--surface-elevated));
}

.dry-run-status[data-tone="error"]::before {
  border-color: color-mix(in srgb, var(--danger) 28%, var(--border));
  border-top-color: var(--danger);
}

@keyframes dry-run-status-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dry-run-status::before {
    animation: none;
  }
}

.dry-run-preview__controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 16px;
  align-items: center;
}

.dry-run-preview__controls input[type="search"] {
  width: min(360px, 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface-elevated);
  color: var(--text-primary);
}

.dry-run-preview__filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.dry-run-preview__field-filter {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dry-run-filter-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--surface-elevated);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.dry-run-filter-chip:hover {
  color: var(--text-primary);
  border-color: var(--accent);
}

.dry-run-filter-chip--active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.dry-run-preview__table {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
}

.dry-run-preview__table table {
  min-width: 1420px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.dry-run-preview__table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--border);
  background: var(--table-header-bg);
  box-shadow: 0 1px 0 var(--border), 0 6px 12px color-mix(in srgb, var(--surface) 80%, transparent);
}

.dry-run-preview__table tbody tr {
  cursor: pointer;
}

.dry-run-preview__table tbody tr.selected {
  background: rgba(47, 107, 255, 0.18);
}

.dry-run-row--review {
  background: var(--accent-soft);
}

.dry-run-col--eventAction {
  width: 132px;
}

.dry-run-col--changedFields {
  width: 180px;
}

.dry-run-col--review {
  width: 150px;
}

.dry-run-col--WorkOrderNumber,
.dry-run-col--SoldOrder_OrderNumber,
.dry-run-col--AppointmentNumber {
  width: 120px;
}

.dry-run-col--Status,
.dry-run-col--ServiceAppointmentStatus,
.dry-run-col--WorkOrderType {
  width: 120px;
}

.dry-run-col--Scheduled,
.dry-run-col--ArrivalWindowStartTimeOnly,
.dry-run-col--ArrivalWindowEndTimeOnly {
  width: 130px;
}

.dry-run-col--JellyPrimaryResource,
.dry-run-col--Contact_FullName {
  width: 180px;
}

.dry-run-col--City {
  width: 140px;
}

.dry-run-preview__table th,
.dry-run-preview__table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dry-run-action-badge {
  display: inline-flex;
  align-items: center;
  min-width: 76px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 800;
}

.dry-run-action-badge--created {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 42%, var(--border));
  background: color-mix(in srgb, var(--success) 14%, var(--surface-elevated));
}

.dry-run-action-badge--updated {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  background: var(--accent-soft);
}

.dry-run-action-badge--deleted {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 42%, var(--border));
  background: color-mix(in srgb, var(--danger) 12%, var(--surface-elevated));
}

.dry-run-action-badge--skipped {
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 44%, var(--border));
  background: color-mix(in srgb, var(--warning) 14%, var(--surface-elevated));
}

.dry-run-detail {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  overflow: hidden;
}

.dry-run-detail[hidden] {
  display: none;
}

.dry-run-detail__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.dry-run-detail__header h4,
.dry-run-detail__summary,
.dry-run-detail__empty {
  margin: 0;
}

.dry-run-detail__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
}

.dry-run-detail__summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.dry-run-detail__summary-grid div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.dry-run-detail__summary-grid span,
.dry-run-detail__meta {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dry-run-detail__summary-grid strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dry-run-detail__summary,
.dry-run-detail__empty {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.dry-run-detail__diff-list {
  display: grid;
  gap: 12px;
}

.dry-run-diff-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  overflow: hidden;
}

.dry-run-diff-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.dry-run-diff-card__title {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.dry-run-diff-card__title span {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dry-run-diff-card__title strong {
  color: var(--text-primary);
  font-size: 0.98rem;
}

.dry-run-diff-card__action {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--text-secondary);
  background: var(--surface-elevated);
  font-size: 0.76rem;
  font-weight: 800;
}

.dry-run-diff-card__action--created {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 42%, var(--border));
  background: color-mix(in srgb, var(--success) 12%, var(--surface-elevated));
}

.dry-run-diff-card__action--updated {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  background: var(--accent-soft);
}

.dry-run-diff-card__action--deleted {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 42%, var(--border));
  background: color-mix(in srgb, var(--danger) 10%, var(--surface-elevated));
}

.dry-run-diff-card__panes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1px;
  background: var(--border);
}

.dry-run-diff-card__pane {
  min-width: 0;
  background: var(--surface-elevated);
  padding: 12px 14px;
}

.dry-run-diff-card__pane-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dry-run-diff-card__value {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 240px;
  overflow: auto;
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.dry-run-diff-line {
  display: block;
  min-height: 1.5em;
  border-radius: 4px;
  padding: 0 4px;
  white-space: pre-wrap;
}

.dry-run-diff-line--removed {
  background: color-mix(in srgb, var(--danger) 18%, transparent);
  color: var(--text-primary);
}

.dry-run-diff-line--added {
  background: color-mix(in srgb, var(--success) 18%, transparent);
  color: var(--text-primary);
}

.dry-run-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  text-transform: none;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.dry-run-detail__meta span {
  min-width: 0;
}

@media (max-width: 900px) {
  .dry-run-preview__header {
    flex-direction: column;
  }

  .dry-run-preview__meta {
    max-width: none;
    text-align: left;
  }

  .dry-run-detail__summary-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .dry-run-diff-card__panes {
    grid-template-columns: 1fr;
  }
}

.dry-run-preview__table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--table-header-bg-opaque);
}

table {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-elevated);
}

thead {
  background: var(--table-header-bg);
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
}

tbody tr:hover {
  background: rgba(47, 107, 255, 0.08);
}

.jobs-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  align-items: end;
}

.jobs-filters .filter-actions {
  display: flex;
  gap: 12px;
}

.jobs-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.jobs-toolbar__summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.jobs-toolbar__actions {
  display: flex;
  gap: 12px;
}

.jobs-table-wrapper {
  position: relative;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: auto;
}

.jobs-table-wrapper table {
  min-width: 960px;
}

.jobs-table-wrapper td:first-child,
.jobs-table-wrapper th:first-child {
  width: 48px;
}

.jobs-table-wrapper tbody tr.selected {
  background: rgba(47, 107, 255, 0.15);
}

.table-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.ec-status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: stretch;
}

.ec-status-strip > div {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.ec-status-label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ec-status-strip strong {
  display: block;
  overflow-wrap: anywhere;
}

.ec-connect-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 14px 0 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.ec-rforce-login-fields {
  display: contents;
}

.ec-rforce-login-fields[hidden],
.ec-rforce-connected-summary[hidden],
.ec-connect-form .actions [hidden] {
  display: none;
}

.ec-rforce-connected-summary {
  grid-column: 1 / 3;
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(73, 222, 128, 0.34);
  border-radius: 8px;
  background: rgba(73, 222, 128, 0.08);
}

.ec-rforce-connected-summary strong,
.ec-rforce-connected-summary span:last-child {
  display: block;
  overflow-wrap: anywhere;
}

.ec-rforce-connected-summary span:last-child {
  margin-top: 2px;
  color: var(--text-secondary);
}

.ec-connect-form[data-session-state="disabled"] .ec-rforce-connected-summary {
  grid-column: 1 / -1;
  border-color: var(--border);
  background: var(--surface-elevated);
}

.ec-connect-form[data-session-state="disabled"] .actions {
  display: none;
}

.ec-connect-form .actions {
  align-items: center;
  margin: 0;
}

.ec-connect-form .form-hint {
  grid-column: 1 / -1;
  margin: 0;
}

.ec-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: 24px;
  align-items: start;
}

.ec-pane {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.ec-pane__header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.ec-pane__header p {
  margin: 6px 0 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.ec-search,
.ec-create-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ec-search label {
  font-weight: 700;
}

.ec-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.ec-results {
  display: grid;
  gap: 10px;
  min-height: 44px;
  color: var(--text-secondary);
}

.ec-result {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
}

.ec-result:hover,
.ec-result:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.ec-result span {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.ec-template-card {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
}

.ec-template-card > span {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.45;
}

.ec-template-card__actions {
  margin-top: 4px;
}

.ec-template-assignee {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
}

.ec-template-assignee input {
  width: auto !important;
  margin: 0;
}

.ec-queue-table {
  min-height: 240px;
}

.ec-queue-table td,
.ec-queue-table th {
  vertical-align: top;
}

.ec-queue-action {
  white-space: nowrap;
}

.ec-write-dialog:not([open]) {
  display: none;
}

.ec-write-dialog[open] {
  display: flex;
  flex-direction: column;
}

.ec-write-dialog {
  box-sizing: border-box;
  width: min(720px, calc(100vw - 32px));
  max-height: min(780px, calc(100vh - 40px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-elevated);
}

.ec-write-dialog::backdrop {
  background: rgba(15, 23, 42, 0.68);
}

.ec-write-dialog__header,
.ec-write-dialog__footer {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-color: var(--border);
}

.ec-write-dialog__header {
  border-bottom: 1px solid var(--border);
}

.ec-write-dialog__header h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

.ec-write-dialog__body {
  display: grid;
  flex: 1 1 auto;
  gap: 16px;
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
}

.ec-write-dialog__footer {
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-card) 88%, var(--surface-muted));
}

.ec-write-dialog__footer button {
  min-width: 112px;
}

.ec-write-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ec-write-summary > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.ec-write-summary strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ec-write-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.ec-write-dialog .filter-field {
  gap: 7px;
}

.ec-write-dialog .filter-field label,
.ec-mention-panel > label {
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ec-write-dialog .filter-field input,
.ec-write-dialog .filter-field select,
.ec-write-dialog .filter-field textarea,
.ec-mention-panel input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.ec-mention-panel input {
  border: 1px solid var(--ec-line);
  background: var(--surface-card);
  color: var(--text-primary);
  color-scheme: inherit;
}

.ec-write-body {
  min-height: 120px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
}

.ec-confirm-live {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
  font-weight: 700;
}

.ec-confirm-live input {
  flex: 0 0 auto;
  margin-top: 3px;
}

.ec-mention-panel,
.ec-call-log-panel {
  display: grid;
  gap: 12px;
}

.ec-mention-panel[hidden],
.ec-call-log-panel[hidden] {
  display: none;
}

.ec-mention-panel {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.ec-mention-panel .ec-results {
  min-height: 0;
  max-height: 180px;
  overflow: auto;
}

.ec-selected-mentions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.ec-call-log-panel {
  grid-template-columns: minmax(0, 1fr);
}

.ec-call-log-panel textarea {
  min-height: 130px;
  resize: vertical;
}

.ec-mention-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-primary);
  font-size: 0.88rem;
}

.ec-mention-chip button {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

/* Escalated Comms uses the same layered workspace language as Kanban while
   preserving the existing native form and table controls. */
.ec-workspace {
  --ec-panel: color-mix(in srgb, var(--surface-card) 94%, transparent);
  --ec-panel-muted: color-mix(in srgb, var(--surface-muted) 88%, transparent);
  --ec-line: color-mix(in srgb, var(--accent) 22%, var(--border));
  --ec-grid-line: color-mix(in srgb, var(--accent) 14%, transparent);
  --ec-shadow: 0 18px 34px color-mix(in srgb, var(--text-primary) 13%, transparent);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 8%, var(--accent-soft), transparent 26rem),
    linear-gradient(132deg, transparent 0 48%, var(--ec-grid-line) 48.12% 48.2%, transparent 48.32%),
    linear-gradient(168deg, transparent 0 74%, var(--ec-grid-line) 74.1% 74.18%, transparent 74.3%),
    var(--surface-elevated);
}

.ec-workspace::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.9;
  background:
    radial-gradient(circle at 22% 16%, var(--ec-grid-line) 0 1px, transparent 1.6px),
    radial-gradient(circle at 74% 42%, var(--ec-grid-line) 0 1px, transparent 1.6px),
    radial-gradient(circle at 48% 78%, var(--ec-grid-line) 0 1px, transparent 1.6px);
  background-size: 22rem 18rem, 28rem 24rem, 25rem 21rem;
}

.ec-workspace__header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin: -0.4rem -0.4rem 1rem;
  padding: 1.05rem 1.2rem 1rem;
  border: 1px solid var(--ec-line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface-card) 90%, transparent);
  box-shadow: var(--ec-shadow);
}

.ec-workspace__header h2 {
  margin-top: 0.1rem;
}

.ec-workspace__eyebrow,
.ec-pane__eyebrow,
.ec-workspace__mode {
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ec-workspace__mode {
  flex: 0 0 auto;
  padding: 0.38rem 0.55rem;
  border: 1px solid var(--ec-line);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.ec-status-strip {
  gap: 0.7rem;
  margin-bottom: 0.85rem;
}

.ec-status-strip > div.ec-status-card {
  position: relative;
  overflow: hidden;
  padding: 0.82rem 0.9rem;
  border-color: var(--ec-line);
  border-radius: var(--radius-lg);
  background: var(--ec-panel);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--text-primary) 7%, transparent);
  transition: transform 180ms var(--ease-standard), border-color 180ms var(--ease-standard), box-shadow 180ms var(--ease-standard);
}

.ec-status-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  content: "";
  background: var(--accent);
  opacity: 0.7;
}

.ec-status-card--rforce::before { background: var(--success); }
.ec-status-card--monitor::before { background: var(--warning); }

.ec-status-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--ec-shadow);
}

.ec-status-label,
.ec-pane__eyebrow {
  margin-bottom: 0.3rem;
  font-size: 0.7rem;
}

.ec-status-strip strong {
  font-size: 0.98rem;
  font-variant-numeric: tabular-nums;
}

.ec-status-strip > .ghost-button {
  align-self: stretch;
  min-height: 100%;
  border-color: var(--ec-line);
  background: var(--ec-panel);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--text-primary) 7%, transparent);
}

.ec-connect-card {
  margin: 0 0 1rem;
  padding: 1rem;
  border-color: var(--ec-line);
  border-radius: var(--radius-lg);
  background: var(--ec-panel-muted);
  box-shadow: var(--ec-shadow);
}

.ec-connect-card .filter-field label,
.ec-pane .filter-field label,
.ec-search label {
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ec-connect-card input,
.ec-pane input,
.ec-pane textarea,
.ec-pane select {
  border-color: var(--ec-line);
  background: color-mix(in srgb, var(--surface-card) 94%, transparent);
}

.ec-layout {
  grid-template-columns: minmax(19rem, 0.82fr) minmax(28rem, 1.18fr);
  gap: 1rem;
}

.ec-pane {
  gap: 1rem;
  min-height: 100%;
  padding: 1.05rem;
  border: 1px solid var(--ec-line);
  border-radius: var(--radius-lg);
  background: var(--ec-panel);
  box-shadow: var(--ec-shadow);
  animation: ec-workspace-enter 360ms var(--ease-standard) both;
}

.ec-pane--queue { animation-delay: 70ms; }

.ec-pane__header {
  padding-bottom: 0.82rem;
  border-bottom: 1px solid var(--ec-line);
}

.ec-pane__header h3 {
  margin-top: 0.08rem;
  font-family: var(--font-family-display);
  font-size: 1.18rem;
}

.ec-pane__header p {
  margin-top: 0.35rem;
  font-size: 0.9rem;
}

.ec-search,
.ec-create-form {
  gap: 0.9rem;
}

.ec-create-form .actions {
  margin-top: 0.15rem;
}

.ec-result {
  position: relative;
  border-color: var(--ec-line);
  background: color-mix(in srgb, var(--surface-card) 94%, transparent);
  box-shadow: 0 5px 12px color-mix(in srgb, var(--text-primary) 6%, transparent);
  transition: transform 170ms var(--ease-standard), border-color 170ms var(--ease-standard), box-shadow 170ms var(--ease-standard), background-color 170ms var(--ease-standard);
}

.ec-result:hover {
  transform: translateX(3px);
  box-shadow: 0 10px 18px color-mix(in srgb, var(--text-primary) 10%, transparent);
}

.ec-queue-table {
  min-height: 18rem;
  border: 1px solid var(--ec-line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface-card) 92%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 24%, transparent);
}

.ec-queue-table table {
  border-collapse: separate;
  border-spacing: 0;
}

.ec-queue-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
  border-bottom-color: var(--ec-line);
  background: color-mix(in srgb, var(--surface-muted) 92%, var(--surface-card));
  color: var(--text-secondary);
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.ec-queue-table tbody td {
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom-color: color-mix(in srgb, var(--ec-line) 76%, transparent);
}

.ec-queue-table tbody tr {
  transition: background-color 150ms var(--ease-standard), transform 150ms var(--ease-standard);
}

.ec-queue-table tbody tr:hover {
  background: var(--accent-soft);
}

.ec-queue-action {
  border-color: var(--ec-line);
  font-size: 0.82rem;
}

.ec-queue-record__meta {
  display: grid;
  gap: 0.18rem;
  min-width: 10rem;
}

.ec-queue-record__meta strong {
  color: var(--text-primary);
  font-size: 0.9rem;
}

.ec-queue-record__meta span {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ec-queue-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 1.62rem;
  padding: 0.18rem 0.45rem;
  border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, currentColor 9%, transparent);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
  text-wrap: balance;
}

.ec-queue-chip--accent { color: var(--accent-strong); }
.ec-queue-chip--success { color: var(--success); }
.ec-queue-chip--warning { color: var(--warning); }
.ec-queue-chip--danger { color: var(--danger); }

.ec-queue-due {
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.ec-queue-review {
  min-height: 2rem;
  padding: 0.35rem 0.65rem;
  border-color: var(--ec-line);
  font-size: 0.78rem;
}

.ec-write-dialog {
  border-color: var(--ec-line);
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  box-shadow: 0 24px 72px color-mix(in srgb, var(--text-primary) 38%, transparent);
  animation: ec-dialog-enter 220ms var(--ease-standard) both;
}

.ec-write-dialog__header {
  background: var(--ec-panel-muted);
}

.ec-write-summary > div,
.ec-write-body,
.ec-confirm-live,
.ec-mention-panel {
  border-color: var(--ec-line);
  background: var(--ec-panel-muted);
}

.ec-workspace :is(button, input, textarea, select):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

@keyframes ec-workspace-enter {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ec-dialog-enter {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .ec-pane,
  .ec-write-dialog,
  .ec-status-card,
  .ec-result,
  .ec-queue-table tbody tr {
    animation: none;
    transition-duration: 0.01ms;
  }
}

@media (max-width: 980px) {
  .ec-layout {
    grid-template-columns: 1fr;
  }

  .ec-pane--queue {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .ec-workspace__header {
    display: grid;
    margin: -0.2rem -0.2rem 0.75rem;
    padding: 0.9rem;
  }

  .ec-workspace__mode {
    justify-self: start;
  }

  .ec-status-strip > .ghost-button {
    min-height: 2.75rem;
  }

  .ec-pane,
  .ec-connect-card {
    padding: 0.85rem;
  }

  .ec-queue-table {
    min-height: 13rem;
  }

  .ec-queue-table table,
  .ec-queue-table tbody,
  .ec-queue-table tr,
  .ec-queue-table td {
    display: block;
    width: 100%;
  }

  .ec-queue-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .ec-queue-table tbody {
    display: grid;
    gap: 0.65rem;
    padding: 0.65rem;
  }

  .ec-queue-table tbody tr {
    overflow: hidden;
    border: 1px solid var(--ec-line);
    border-radius: var(--radius-md);
    background: var(--ec-panel-muted);
  }

  .ec-queue-table tbody td {
    display: grid;
    grid-template-columns: minmax(5.75rem, 0.7fr) minmax(0, 1.3fr);
    gap: 0.65rem;
    align-items: center;
    padding: 0.56rem 0.65rem;
    border-bottom: 1px solid color-mix(in srgb, var(--ec-line) 72%, transparent);
  }

  .ec-queue-table tbody td:last-child {
    border-bottom: 0;
  }

  .ec-queue-table tbody td::before {
    content: attr(data-label);
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .ec-queue-action .ec-queue-review {
    justify-self: start;
  }
}

@media (max-width: 760px) {
  .ec-write-dialog[open] {
    display: block;
  }

  .ec-write-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    overflow-y: auto;
  }

  .ec-write-dialog__header,
  .ec-write-dialog__body,
  .ec-write-dialog__footer {
    padding: 14px;
  }

  .ec-write-dialog__body {
    overflow: visible;
  }

  .ec-write-summary,
  .ec-write-controls {
    grid-template-columns: 1fr;
  }

  .ec-mention-panel .ec-inline {
    grid-template-columns: 1fr;
  }

  .ec-mention-panel .ghost-button {
    width: 100%;
  }

  .ec-write-dialog__footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .ec-write-dialog__footer button {
    width: 100%;
  }
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.channel-options {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.channel-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.offers-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
}

.offers-search {
  display: flex;
  align-items: center;
  gap: 12px;
}

.offers-search input {
  min-width: 260px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text-primary);
}

.offers-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.offers-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.offers-filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.offers-filters select {
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
}

.offers-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.offers-select-all {
  display: flex;
  align-items: center;
  gap: 8px;
}

.offers-summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.offers-table-wrapper {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  overflow: auto;
}

.table-scroll {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  overflow: auto;
}

.table-scroll table {
  min-width: 980px;
}

.calendar-management-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--surface-muted);
}

.calendar-management-section h3 {
  margin: 0;
}

.calendar-subtabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.calendar-subtab {
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  padding: 9px 12px;
  transition: background var(--transition-duration) ease, color var(--transition-duration) ease;
}

.calendar-subtab:hover,
.calendar-subtab:focus-visible {
  background: var(--surface-elevated);
  color: var(--text-primary);
}

.calendar-subtab--active {
  background: var(--brand-blue);
  color: #ffffff;
}

.calendar-workflow-panel[hidden] {
  display: none !important;
}

.calendar-workflow-heading {
  display: grid;
  gap: 4px;
}

.calendar-workflow-heading p,
.calendar-batch-panel__header p {
  margin: 0;
  color: var(--text-secondary);
}

.calendar-batch-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  padding: 14px;
}

.calendar-batch-panel[data-has-selection="true"] {
  border-color: color-mix(in srgb, var(--brand-blue) 45%, var(--border));
  box-shadow: inset 3px 0 0 var(--brand-blue);
}

.calendar-batch-panel__header h4 {
  margin: 0 0 4px;
  font-size: 0.98rem;
}

.rforce-scheduling-verify,
.rforce-scheduling-form,
.rforce-scheduling-workspace {
  display: grid;
  gap: 16px;
}

.rforce-scheduling-form > .actions {
  justify-content: flex-end;
}

.rforce-scheduling-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.rforce-scheduling-header-row .ghost-button {
  flex: 0 0 auto;
  padding: 9px 16px;
}

.rforce-queue-dashboard {
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--surface);
}

.rforce-queue-dashboard__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.rforce-queue-dashboard__header h3 {
  margin: 0 0 4px;
}

.rforce-queue-dashboard__actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.rforce-queue-dashboard__actions .filter-field {
  min-width: 220px;
}

.rforce-queue-table-wrapper {
  max-height: 324px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
}

.rforce-queue-table-wrapper:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.rforce-queue-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.rforce-queue-table th,
.rforce-queue-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.rforce-queue-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--table-header-bg-opaque);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.rforce-queue-table tbody tr:last-child td {
  border-bottom: 0;
}

.rforce-queue-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.rforce-queue-status[data-status="queued"] {
  border-color: rgba(37, 99, 235, 0.26);
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
}

.rforce-queue-status[data-status="running"] {
  border-color: rgba(217, 119, 6, 0.28);
  background: rgba(217, 119, 6, 0.1);
  color: #92400e;
}

.rforce-queue-status[data-status="completed"] {
  border-color: rgba(22, 163, 74, 0.28);
  background: rgba(22, 163, 74, 0.1);
  color: #166534;
}

.rforce-queue-status[data-status="error"],
.rforce-queue-status[data-status="failed"],
.rforce-queue-status[data-status="refused"],
.rforce-queue-status[data-status="blocked"],
.rforce-queue-status[data-status="stalled"] {
  border-color: rgba(220, 38, 38, 0.28);
  background: rgba(220, 38, 38, 0.1);
  color: #991b1b;
}

.rforce-queue-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rforce-queue-pagination .form-hint {
  margin: 0;
}

.rforce-queue-pagination__controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rforce-scheduling-verify {
  grid-template-columns: minmax(240px, 420px) minmax(280px, 1fr);
  align-items: end;
}

.rforce-scheduling-verify .actions {
  justify-content: flex-end;
}

.rforce-scheduling-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.rforce-scheduling-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--surface-muted);
}

.rforce-scheduling-section h3 {
  margin: 0;
}

.rforce-scheduling-grid,
.rforce-context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.rforce-scheduling-controls {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) repeat(2, minmax(280px, 1fr));
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.rforce-schedule-grid {
  display: contents;
  min-width: 0;
}

.rforce-resource-field,
.rforce-schedule-grid,
.rforce-schedule-grid .filter-field,
.rforce-schedule-group,
.rforce-schedule-group__grid {
  min-width: 0;
}

.rforce-resource-field,
.rforce-schedule-group {
  border: 1px solid var(--line);
  border-radius: var(--fw-radius-card);
  background: var(--surface-elevated);
  padding: 12px;
}

.rforce-schedule-group {
  display: grid;
  gap: 10px;
}

.rforce-schedule-group__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.rforce-schedule-group h4,
.rforce-schedule-group__header h4 {
  margin: 0;
  color: var(--text-primary);
  font-size: 0.92rem;
}

.rforce-schedule-group__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.rforce-schedule-group__grid .filter-field > label {
  display: flex;
  align-items: flex-start;
  color: var(--text-secondary);
  font-size: 0.72rem;
  line-height: 1.25;
  white-space: normal;
}

.rforce-schedule-grid .filter-field[hidden],
.rforce-schedule-group__grid .filter-field[hidden] {
  display: none;
}

.rforce-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.filter-field .rforce-toggle input {
  width: 15px;
  height: 15px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.rforce-resource-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.rforce-resource-search select {
  width: 100%;
  min-width: 0;
}

.rforce-schedule-grid input,
.rforce-schedule-grid select {
  width: 100%;
  min-width: 0;
}

@media (max-width: 1200px) {
  .rforce-queue-dashboard__header,
  .rforce-queue-dashboard__actions {
    align-items: stretch;
    flex-direction: column;
  }

  .rforce-queue-dashboard__actions .filter-field {
    min-width: 0;
  }

  .rforce-queue-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .rforce-queue-pagination__controls {
    justify-content: flex-end;
  }

  .rforce-scheduling-controls {
    grid-template-columns: 1fr;
  }

  .rforce-schedule-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 900px) {
  .rforce-scheduling-verify {
    grid-template-columns: 1fr;
  }

  .rforce-scheduling-verify .actions,
  .rforce-scheduling-form > .actions {
    justify-content: stretch;
  }

  .rforce-scheduling-verify .actions .primary-button,
  .rforce-scheduling-verify .actions .ghost-button,
  .rforce-scheduling-form > .actions .primary-button {
    width: 100%;
  }

  .rforce-schedule-group__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .rforce-schedule-group__grid {
    grid-template-columns: 1fr;
  }

  .rforce-schedule-group__header {
    align-items: flex-start;
    flex-direction: column;
  }

  .rforce-toggle {
    align-self: flex-start;
  }
}

.rforce-scheduling-grid .rforce-field--wide {
  grid-column: span 2;
}

.rforce-scheduling-grid .rforce-field--wide textarea {
  min-height: 180px;
  resize: vertical;
}

.rforce-field-helper {
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.35;
}

.rforce-field-draft-status {
  min-height: 16px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.25;
}

.rforce-help-dialog {
  width: min(780px, 100%);
}

.rforce-help-body {
  gap: 16px;
}

.rforce-help-search {
  margin: 0;
}

.rforce-help-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rforce-help-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rforce-help-section h4 {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rforce-help-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rforce-help-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.rforce-help-item[open] {
  background: var(--surface-elevated);
}

.rforce-help-item[data-tone="warning"] {
  border-color: rgba(245, 158, 11, 0.65);
  background: rgba(245, 158, 11, 0.08);
}

.rforce-help-item summary {
  cursor: pointer;
  padding: 13px 15px;
  color: var(--text-primary);
  font-weight: 700;
}

.rforce-help-item summary:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.rforce-help-item p {
  margin: 0;
  padding: 0 15px 15px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.rforce-help-empty {
  margin: 0;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  color: var(--text-secondary);
  text-align: center;
}

.rforce-field-draft-status[data-state="dirty"] {
  color: var(--text-secondary);
}

.rforce-field-draft-status[data-state="error"] {
  color: var(--danger);
}

.rforce-context-item {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--surface-elevated);
}

.rforce-context-item span {
  display: block;
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.rforce-context-item strong {
  display: block;
  overflow-wrap: anywhere;
}

.calendar-preview-controls,
.calendar-day-controls,
.calendar-batch-controls {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.calendar-detail-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calendar-detail-panel h4 {
  margin: 0;
  font-size: 1rem;
}

.calendar-detail-controls {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.calendar-detail-json {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  padding: 12px;
  min-height: 140px;
  max-height: 360px;
  overflow: auto;
  font-size: 0.82rem;
  line-height: 1.35;
}

.calendar-detail-disclosure {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  padding: 10px 12px;
}

.calendar-detail-disclosure summary {
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 800;
}

.calendar-detail-disclosure .calendar-detail-json {
  margin-top: 10px;
}

.native-calendar-diagnostics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.native-calendar-diagnostics span {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 9px;
}

.native-calendar-readiness {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
}

.native-calendar-conflict-audit {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
}

.native-calendar-latest-comparison {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
}

.native-calendar-google-comparison {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
}

.native-calendar-cutover-evidence {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
}

.native-calendar-readiness[hidden],
.native-calendar-conflict-audit[hidden],
.native-calendar-latest-comparison[hidden],
.native-calendar-google-comparison[hidden],
.native-calendar-cutover-evidence[hidden] {
  display: none !important;
}

.native-calendar-readiness__header,
.native-calendar-conflict-audit__header,
.native-calendar-latest-comparison__header,
.native-calendar-google-comparison__header,
.native-calendar-cutover-evidence__header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.native-calendar-readiness__header h3,
.native-calendar-conflict-audit__header h3,
.native-calendar-latest-comparison__header h3,
.native-calendar-google-comparison__header h3,
.native-calendar-cutover-evidence__header h3 {
  margin: 0;
  font-size: 1rem;
}

.native-calendar-readiness__header span,
.native-calendar-conflict-audit__header span,
.native-calendar-latest-comparison__header span,
.native-calendar-google-comparison__header span,
.native-calendar-cutover-evidence__header span {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 6px 9px;
}

.native-calendar-readiness-summary {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
}

.native-calendar-readiness-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  display: grid;
  gap: 4px;
  padding: 10px;
}

.native-calendar-readiness-card strong {
  font-size: 1.15rem;
}

.native-calendar-readiness-card span {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.native-calendar-readiness-messages {
  display: grid;
  gap: 6px;
}

.native-calendar-readiness-message {
  border-left: 3px solid var(--accent);
  color: var(--text-secondary);
  font-size: 0.84rem;
  padding-left: 9px;
  overflow-wrap: anywhere;
}

.native-calendar-conflict-audit-list {
  display: grid;
  gap: 8px;
}

.native-calendar-conflict-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  display: grid;
  gap: 5px;
  padding: 10px 12px;
}

.native-calendar-conflict-item strong,
.native-calendar-conflict-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.native-calendar-conflict-item span {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.native-calendar-panel {
  margin-top: 0;
}

.native-calendar-panel[hidden] {
  display: none !important;
}

.native-calendar-toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.native-calendar-filter-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(150px, 0.8fr) minmax(160px, 0.8fr) minmax(240px, 1.4fr) minmax(140px, 0.7fr) minmax(150px, 0.8fr) minmax(220px, 1.2fr);
  align-items: start;
}

.native-calendar-filter-grid .filter-field {
  min-width: 0;
}

.native-calendar-date-control {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 40px;
  gap: 6px;
  min-width: 0;
}

.native-calendar-date-control input {
  width: 100%;
  min-width: 150px;
}

.native-calendar-date-actions {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  gap: 6px;
  margin-top: 6px;
}

.native-calendar-date-step,
.native-calendar-date-picker {
  display: grid;
  place-items: center;
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  color: var(--text-primary);
  cursor: pointer;
}

.native-calendar-date-step svg,
.native-calendar-date-picker svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.native-calendar-date-step:hover,
.native-calendar-date-step:focus-visible,
.native-calendar-date-picker:hover,
.native-calendar-date-picker:focus-visible,
.native-calendar-date-today:hover,
.native-calendar-date-today:focus-visible {
  background: var(--accent-soft);
}

.native-calendar-date-today {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  color: var(--text-primary);
  cursor: pointer;
  font-weight: 700;
}

.native-calendar-search-field input {
  min-width: 0;
  text-overflow: ellipsis;
}

.native-calendar-field-hint {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.native-calendar-action-cluster {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.native-calendar-action-cluster .ghost-button {
  min-height: 44px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.native-calendar-combobox {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
}

.native-calendar-combobox input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  min-width: 0;
  text-overflow: ellipsis;
}

.native-calendar-combobox__toggle {
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-elevated);
  cursor: pointer;
}

.native-calendar-combobox__toggle span {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-secondary);
  border-bottom: 2px solid var(--text-secondary);
  transform: rotate(45deg) translateY(-2px);
}

.native-calendar-combobox__toggle:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.native-calendar-installer-field {
  position: relative;
}

.native-calendar-installer-menu {
  position: absolute;
  z-index: 30;
  top: 74px;
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  box-shadow: var(--shadow-elevated);
}

.native-calendar-installer-option {
  width: 100%;
  display: grid;
  gap: 3px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  padding: 9px 11px;
  text-align: left;
}

.native-calendar-installer-option:last-child {
  border-bottom: 0;
}

.native-calendar-installer-option strong,
.native-calendar-installer-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.native-calendar-installer-option strong {
  font-size: 0.86rem;
}

.native-calendar-installer-option span {
  color: var(--text-secondary);
  font-size: 0.76rem;
}

.native-calendar-installer-option:hover,
.native-calendar-installer-option[data-active="true"] {
  background: var(--accent-soft);
}

.native-calendar-installer-empty {
  margin: 0;
  padding: 10px 11px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.native-calendar-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(170px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}

[data-native-calendar-mode="installer"] .native-calendar-week-grid {
  grid-template-columns: repeat(7, minmax(190px, 1fr));
  gap: 12px;
}

.native-calendar-day {
  min-height: 260px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  padding: 10px;
}

[data-native-calendar-mode="installer"] .native-calendar-day {
  min-height: 220px;
}

.native-calendar-day h3 {
  margin: 0 0 10px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.native-calendar-empty-day {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.native-calendar-event {
  width: 100%;
  display: grid;
  gap: 3px;
  margin-bottom: 8px;
  padding: 9px;
  text-align: left;
  border: 1px solid rgba(20, 94, 165, 0.24);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text-primary);
  box-shadow: none;
}

.native-calendar-event[data-status="cancelled"] {
  border-left-color: var(--danger);
  background: rgba(185, 28, 28, 0.08);
}

.native-calendar-event[data-status="completed"] {
  border-left-color: var(--success);
  background: rgba(22, 101, 52, 0.08);
}

.native-calendar-event[data-status="confirmed"] {
  border-left-color: var(--warning);
}

.native-calendar-event__time {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
}

.native-calendar-event strong {
  font-size: 0.9rem;
}

.native-calendar-event span:last-child {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

[data-native-calendar-mode="installer"] .native-calendar-event {
  padding: 10px;
}

[data-native-calendar-mode="installer"] .native-calendar-event strong {
  line-height: 1.25;
}

.native-calendar-detail-list {
  display: grid;
  grid-template-columns: minmax(130px, 180px) minmax(0, 1fr);
  gap: 8px 14px;
  margin: 0 0 14px;
}

.native-calendar-detail-list dt {
  color: var(--text-secondary);
  font-weight: 700;
}

.native-calendar-detail-list dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.native-calendar-shadow-controls {
  border-top: 1px solid var(--border);
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.native-calendar-shadow-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.native-calendar-shadow-grid input,
.native-calendar-shadow-grid select {
  min-width: 0;
  width: 100%;
}

.native-calendar-shadow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.native-calendar-shadow-actions .ghost-button {
  min-height: 42px;
}

.native-calendar-shadow-warnings {
  display: grid;
  gap: 6px;
}

.native-calendar-shadow-warning {
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  background: rgba(217, 119, 6, 0.1);
  color: var(--text-primary);
  display: grid;
  font-size: 0.82rem;
  gap: 4px;
  padding: 8px 10px;
  overflow-wrap: anywhere;
}

.native-calendar-shadow-warning strong,
.native-calendar-shadow-warning span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.native-calendar-shadow-warning span {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.native-calendar-audit-panel {
  border-top: 1px solid var(--border);
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

.native-calendar-audit-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.native-calendar-audit-heading h4 {
  margin: 0;
}

.native-calendar-audit-list {
  display: grid;
  gap: 8px;
}

.native-calendar-audit-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  display: grid;
  gap: 6px;
  padding: 10px 12px;
}

.native-calendar-audit-item__topline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.native-calendar-audit-item strong,
.native-calendar-audit-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.native-calendar-audit-item span {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.native-calendar-audit-empty {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  margin: 0;
  padding: 10px 12px;
}

@media (max-width: 720px) {
  .native-calendar-filter-grid {
    grid-template-columns: 1fr;
  }

  .native-calendar-action-cluster {
    justify-content: stretch;
  }

  .native-calendar-action-cluster .ghost-button {
    flex: 1 1 160px;
  }

  .native-calendar-detail-list {
    grid-template-columns: 1fr;
  }

  .native-calendar-shadow-actions {
    justify-content: stretch;
  }

  .native-calendar-shadow-actions .ghost-button {
    flex: 1 1 150px;
  }

  .native-calendar-audit-heading {
    align-items: stretch;
  }

  .native-calendar-audit-heading .ghost-button {
    flex: 1 1 150px;
  }
}

.admin-board-access {
  display: grid;
  grid-column: 1 / -1;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-card);
}

.admin-board-access[hidden] {
  display: none;
}

.admin-board-access__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.admin-board-access__header h4,
.admin-board-access__header p,
.admin-board-access__empty {
  margin: 0;
}

.admin-board-access__header p,
.admin-board-access__identity span,
.admin-board-access__empty {
  color: var(--text-secondary);
  font-size: 0.84rem;
}

.admin-board-access__refresh {
  min-width: 88px;
  white-space: nowrap;
}

.admin-board-access__list {
  display: grid;
}

.admin-board-access__row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(120px, 150px) minmax(120px, auto);
  gap: 12px;
  align-items: center;
  padding-block: 12px;
  border-bottom: 1px solid var(--border);
}

.admin-board-access__row:first-child {
  border-top: 1px solid var(--border);
}

.admin-board-access__identity {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-board-access__identity strong,
.admin-board-access__identity span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-board-access__role,
.admin-board-access__field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  color: var(--text-primary);
  padding: 8px 32px 8px 10px;
}

.admin-board-access__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.admin-board-access__actions span {
  color: var(--text-secondary);
  font-size: 0.78rem;
  white-space: nowrap;
}

.admin-board-access__remove-confirm {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
  color: var(--danger);
}

.admin-board-access__add {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(120px, 150px) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.admin-board-access__field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.admin-board-access__field label {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
}

.admin-board-access__add .primary-button {
  min-height: 40px;
  white-space: nowrap;
}

.admin-board-access__empty {
  padding: 14px 0;
}

.admin-board-access__skeleton {
  display: grid;
  gap: 10px;
}

.admin-board-access__skeleton span {
  height: 56px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--surface-muted), var(--surface-elevated), var(--surface-muted));
  background-size: 200% 100%;
  animation: admin-board-access-loading 1.4s ease-in-out infinite;
}

@keyframes admin-board-access-loading {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .admin-board-access__skeleton span {
    animation: none;
  }
}

@media (max-width: 720px) {
  .admin-board-access__row,
  .admin-board-access__add {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-board-access__actions {
    justify-content: flex-start;
  }

  .admin-board-access__add .primary-button {
    width: 100%;
  }
}

@media (min-width: 721px) and (max-width: 1180px) {
  .native-calendar-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .native-calendar-search-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .admin-role-control,
  .admin-permission-switches {
    grid-template-columns: 1fr;
  }

  .admin-user-detail-heading,
  .admin-user-detail-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

.admin-access-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(420px, 1.18fr);
  gap: 18px;
  align-items: start;
}

.admin-users-list-panel,
.admin-user-detail {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-elevated);
}

.admin-users-list-panel {
  overflow: hidden;
}

.admin-users-list-panel__header,
.admin-user-detail-heading,
.admin-user-detail-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.admin-users-list-panel__header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.admin-users-list-panel__header h3,
.admin-user-detail-heading h3,
.admin-permission-group h4,
.admin-user-empty h3 {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-family-display);
}

.admin-users-summary,
.admin-user-detail-kicker {
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-users-list {
  display: grid;
  max-height: min(68vh, 760px);
  overflow: auto;
}

.admin-user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  padding: 13px 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.admin-user-row:hover,
.admin-user-row:focus-visible,
.admin-user-row[data-selected="true"] {
  background: var(--surface-card);
}

.admin-user-row[data-selected="true"] {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.admin-user-row__identity,
.admin-user-row__meta {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-user-row__identity strong,
.admin-user-row__identity span,
.admin-user-row__meta span:not(.admin-role-badge),
.admin-user-detail-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-row__identity span,
.admin-user-row__meta span:not(.admin-role-badge),
.admin-user-detail-email,
.admin-permission-group p,
.admin-permission-note,
.admin-user-empty p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.84rem;
}

.admin-role-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-card);
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-user-detail {
  padding: 18px;
}

.admin-user-detail.is-saving {
  opacity: 0.64;
}

.admin-user-empty {
  display: grid;
  gap: 6px;
  min-height: 220px;
  align-content: center;
  justify-items: center;
  padding: 28px;
  text-align: center;
}

.admin-user-empty[hidden],
.admin-user-detail-form[hidden],
.admin-installer-resource-field[hidden],
#admin-detail-impersonate[hidden] {
  display: none;
}

.admin-user-detail-form {
  display: grid;
  gap: 18px;
}

.admin-role-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.admin-role-control legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.admin-role-control label,
.admin-permission-switch {
  display: flex;
  gap: 9px;
  align-items: center;
  min-width: 0;
}

.admin-role-control label {
  justify-content: center;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  font-weight: 800;
  cursor: pointer;
}

.admin-role-control label:has(input:checked) {
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.admin-installer-resource-field {
  display: grid;
  gap: 7px;
}

.admin-fieldwork-role-field {
  display: grid;
  gap: 7px;
}

.admin-fieldwork-role-field > label,
.admin-fieldwork-role-metadata label {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.admin-fieldwork-role-field select,
.admin-fieldwork-role-metadata input,
.admin-rbac-dialog input {
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  color: var(--text-primary);
}

.admin-installer-resource-field label {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.admin-resource-warning {
  margin: 0;
  color: var(--warning-text, var(--text-primary));
  font-size: 0.82rem;
}

.admin-permission-groups {
  display: grid;
  gap: 14px;
}

.admin-permission-note {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-card);
}

.admin-permission-group {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-card);
}

.admin-permission-group__header {
  display: grid;
  gap: 4px;
}

.admin-permission-switches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-permission-switch {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  font-weight: 700;
}

.admin-permission-switch input {
  flex: 0 0 auto;
}

.admin-user-detail-actions {
  padding-top: 4px;
}

.admin-user-save-button {
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--button-primary-text, var(--surface-elevated));
  font-weight: 800;
}

.admin-user-save-button:disabled {
  border-color: var(--border);
  background: var(--surface-card);
  color: var(--text-secondary);
  cursor: not-allowed;
}

.admin-users-empty {
  margin: 0;
  padding: 18px;
  color: var(--text-secondary);
}

.admin-fieldwork-roles {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.admin-fieldwork-roles__header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.admin-fieldwork-roles__header h3,
.admin-fieldwork-roles__header p {
  margin: 4px 0 0;
}

.admin-fieldwork-role-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.admin-fieldwork-role-card {
  display: grid;
  gap: 6px;
  min-height: 76px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  color: var(--text-primary);
  text-align: left;
}

.admin-fieldwork-role-card:hover,
.admin-fieldwork-role-card:focus-visible {
  border-color: var(--accent);
  background: var(--surface-card);
}

.admin-fieldwork-role-card span {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.admin-rbac-dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  box-sizing: border-box;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-elevated);
  color: var(--text-primary);
}

.admin-rbac-dialog--wide {
  width: min(920px, calc(100vw - 32px));
}

.admin-rbac-dialog::backdrop {
  background: rgba(15, 23, 42, 0.64);
}

.admin-rbac-dialog form {
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 64px);
  padding: 20px;
  overflow: auto;
}

.admin-rbac-dialog h3,
.admin-rbac-dialog p {
  margin: 0;
}

.admin-fieldwork-role-metadata {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 0.32fr);
  gap: 12px;
}

.admin-fieldwork-role-metadata label {
  display: grid;
  gap: 7px;
}

.admin-fieldwork-role-permissions {
  display: grid;
  gap: 12px;
}

.admin-fieldwork-permission-group {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.admin-fieldwork-permission-group legend {
  padding: 0 6px;
  font-weight: 800;
}

.admin-fieldwork-permission-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 44px;
  padding-block: 6px;
  border-bottom: 1px solid var(--border);
}

.admin-fieldwork-permission-row:last-child {
  border-bottom: 0;
}

.admin-fieldwork-scope-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-fieldwork-scope-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  font-size: 0.8rem;
  font-weight: 700;
}

@media (max-width: 720px) {
  .admin-fieldwork-roles__header,
  .admin-fieldwork-permission-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .admin-fieldwork-roles__header {
    display: grid;
  }

  .admin-fieldwork-role-metadata {
    grid-template-columns: 1fr;
  }
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.option-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 14px 16px;
}

.option-block h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.option-block h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.option-block label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(120%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 18px 28px;
  border-radius: var(--radius-md);
  background: var(--toast-bg);
  color: var(--toast-text);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.28);
  transition: transform var(--transition-duration) ease, opacity var(--transition-duration) ease;
  opacity: 0;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 520px;
  min-width: 240px;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  box-sizing: border-box;
  gap: 12px;
}

.toast--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast[data-tone="success"] {
  background: linear-gradient(135deg, #3ab97d, #2d9d66);
  color: #ffffff;
}

.toast[data-tone="error"] {
  background: linear-gradient(135deg, #f06161, #d64545);
  color: #ffffff;
}

.latest-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.latest-search {
  display: flex;
  align-items: center;
  gap: 12px;
}

.latest-search input {
  min-width: 260px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text-primary);
}

.latest-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.service-offerings-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.service-offerings-grid {
  margin-bottom: 0;
}

.service-offerings-options {
  margin-top: 4px;
}

.service-offerings-description {
  max-width: 100%;
}

.service-offerings-actions {
  gap: 12px;
}

/* Service Date Offerings: make native date/time controls feel like first-class portal controls. */
.service-offerings-options {
  align-items: stretch;
  gap: 14px;
}

.service-offerings-options .option-block {
  background:
    linear-gradient(150deg, rgba(67, 122, 184, 0.18), transparent 48%),
    var(--surface-elevated);
  border-color: color-mix(in srgb, var(--border) 76%, #6eaee6 24%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 12px 24px rgba(4, 16, 31, 0.14);
  gap: 10px;
  overflow: hidden;
  padding: 0;
  position: relative;
}

.service-offerings-options .option-block::before {
  background: #6eaee6;
  content: "";
  height: 3px;
  inset: 0 0 auto;
  position: absolute;
}

.service-offerings-options .option-block[data-service-option="2"]::before {
  background: #56c596;
}

.service-offerings-options .option-block[data-service-option="3"]::before {
  background: #b79bff;
}

.service-offerings-options .option-block h3 {
  align-items: center;
  background: rgba(5, 20, 38, 0.16);
  border-bottom: 1px solid rgba(174, 204, 235, 0.13);
  display: flex;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  margin: 0;
  min-height: 48px;
  padding: 14px 16px 10px;
}

.service-offerings-options .option-block h3::before {
  align-items: center;
  background: rgba(110, 174, 230, 0.16);
  border: 1px solid rgba(110, 174, 230, 0.28);
  border-radius: 999px;
  color: #a9d4ff;
  content: "Date";
  display: inline-flex;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-right: 9px;
  padding: 3px 7px;
  text-transform: uppercase;
}

.service-offerings-options .option-block label {
  gap: 5px;
  margin: 0 14px;
}

.service-offerings-options .option-block label:last-child {
  margin-bottom: 15px;
}

.service-offerings-options .option-block label span {
  color: var(--text-secondary);
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.service-offerings-options .option-block input[type="date"],
.service-offerings-options .option-block input[type="time"] {
  background: linear-gradient(135deg, rgba(8, 26, 47, 0.88), rgba(18, 42, 68, 0.78));
  border: 1px solid rgba(150, 185, 219, 0.28);
  border-radius: 8px;
  color: var(--text-primary);
  color-scheme: dark;
  font-variant-numeric: tabular-nums;
  min-height: 42px;
  padding: 9px 11px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background 160ms ease;
}

.service-offerings-options .option-block label:focus-within span {
  color: #a9d4ff;
}

.service-offerings-options .option-block input[type="date"]:focus,
.service-offerings-options .option-block input[type="time"]:focus {
  background: linear-gradient(135deg, rgba(14, 42, 70, 0.96), rgba(24, 57, 89, 0.9));
  border-color: #6eaee6;
  box-shadow: 0 0 0 3px rgba(110, 174, 230, 0.2), 0 8px 18px rgba(5, 19, 35, 0.24);
  transform: translateY(-1px);
}

.service-offerings-options .option-block input[type="date"]::-webkit-calendar-picker-indicator,
.service-offerings-options .option-block input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.86;
}

body.theme-light .service-offerings-options .option-block {
  background:
    linear-gradient(150deg, rgba(67, 122, 184, 0.1), transparent 48%),
    var(--surface-elevated);
  border-color: rgba(58, 91, 132, 0.16);
  box-shadow: 0 10px 22px rgba(41, 72, 111, 0.1);
}

body.theme-light .service-offerings-options .option-block h3 {
  background: rgba(62, 104, 156, 0.08);
  border-bottom-color: rgba(58, 91, 132, 0.12);
}

body.theme-light .service-offerings-options .option-block h3::before {
  background: rgba(47, 107, 255, 0.1);
  border-color: rgba(47, 107, 255, 0.2);
  color: #24579d;
}

body.theme-light .service-offerings-options .option-block input[type="date"],
body.theme-light .service-offerings-options .option-block input[type="time"] {
  background: #ffffff;
  border-color: rgba(58, 91, 132, 0.24);
  box-shadow: inset 0 1px 2px rgba(25, 49, 79, 0.04);
  color: var(--text-primary);
  color-scheme: light;
}

body.theme-light .service-offerings-options .option-block label:focus-within span {
  color: var(--accent-strong);
}

body.theme-light .service-offerings-options .option-block input[type="date"]:focus,
body.theme-light .service-offerings-options .option-block input[type="time"]:focus {
  background: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 8px 18px rgba(41, 72, 111, 0.12);
}

@media (max-width: 720px) {
  .service-offerings-options .option-block h3 {
    min-height: 44px;
  }
}

.latest-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.latest-filter {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--surface-elevated);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.latest-filter legend {
  font-weight: 600;
  font-size: 0.95rem;
}

.latest-filter select,
.latest-filter input {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  padding: 8px;
}

.latest-bulk-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  background: var(--surface-elevated);
  margin-bottom: 16px;
}

.latest-bulk-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.latest-table-wrapper {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  overflow: auto;
}

.latest-table-wrapper .react-table-root,
.offers-table-wrapper .react-table-root,
.run-status .react-table-root {
  overflow: auto;
}

.latest-table-wrapper .react-table-root .MuiTable-root,
.offers-table-wrapper .react-table-root .MuiTable-root {
  min-width: 100%;
  width: max-content;
}
.latest-table-wrapper .react-table-root {
  overflow: auto;
}

.my-schedule-root {
  min-height: 420px;
}

.my-schedule-fallback {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--fw-radius-card);
  background: var(--surface-elevated);
  color: var(--text-secondary);
  text-align: center;
}

.my-schedule-fallback[hidden] {
  display: none;
}

.my-schedule-fallback strong {
  color: var(--text-primary);
  font-size: 1.05rem;
}

.my-schedule-fallback[data-state="error"] {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
}

.my-schedule-shell {
  width: 100%;
}

.my-schedule-toolbar,
.my-schedule-calendar-panel,
.my-schedule-empty {
  border: 1px solid var(--line);
  border-radius: var(--fw-radius-card);
  background: var(--surface-elevated);
  box-shadow: none;
}

.my-schedule-toolbar {
  padding: clamp(16px, 2vw, 22px);
}

.my-schedule-heading {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0;
}

.my-schedule-installer-select {
  min-width: min(320px, 100%);
}

.my-schedule-calendar-controls {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.my-schedule-date-search {
  min-width: 176px;
}

.my-schedule-view-toggle {
  align-self: stretch;
}

.my-schedule-view-toggle .MuiToggleButtonGroup-grouped {
  min-width: 82px;
  border-color: var(--line);
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: 0;
}

.my-schedule-view-toggle .Mui-selected,
.my-schedule-view-toggle .Mui-selected:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--surface);
}

.my-schedule-day-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(112px, 1fr);
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.my-schedule-day-button {
  min-height: 72px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text-primary);
  text-align: left;
}

.my-schedule-day-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.my-schedule-day-button--selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 22%, var(--surface-elevated));
}

.my-schedule-day-button__weekday {
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.my-schedule-day-button__date {
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0;
}

.my-schedule-day-button__count {
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.2;
}

.my-schedule-empty {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 32px;
  text-align: center;
  color: var(--text-secondary);
}

.my-schedule-empty svg {
  color: var(--accent);
  font-size: 34px;
}

.my-schedule-empty h3 {
  color: var(--text-primary);
  font-size: 1.08rem;
  letter-spacing: 0;
}

.my-schedule-calendar-panel {
  padding: clamp(10px, 1.4vw, 16px);
  overflow: hidden;
}

.my-schedule-calendar-panel .fc {
  color: var(--text-primary);
  font-family: inherit;
}

.my-schedule-calendar-panel .fc-theme-standard td,
.my-schedule-calendar-panel .fc-theme-standard th,
.my-schedule-calendar-panel .fc-theme-standard .fc-scrollgrid {
  border-color: var(--line);
}

.my-schedule-calendar-panel .fc-col-header-cell,
.my-schedule-calendar-panel .fc-timegrid-axis,
.my-schedule-calendar-panel .fc-list-day-cushion {
  background: var(--table-header-bg);
}

.my-schedule-calendar-panel .fc-toolbar-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0;
}

.my-schedule-calendar-panel .fc-button {
  border-radius: var(--radius-sm);
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--text-primary);
  box-shadow: none;
  text-transform: none;
}

.my-schedule-calendar-panel .fc-button-primary:not(:disabled).fc-button-active,
.my-schedule-calendar-panel .fc-button-primary:not(:disabled):active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--surface);
}

.my-schedule-calendar-panel .fc-timegrid-event,
.my-schedule-calendar-panel .fc-v-event,
.my-schedule-calendar-panel .fc-list-event-dot {
  border-color: #366f49;
  background: #4b9663;
}

.my-schedule-calendar-panel .fc-timegrid-event {
  border-width: 1px;
  border-radius: 6px;
  overflow: hidden;
}

.my-schedule-calendar-panel .fc-event-main {
  color: #06130a;
}

.my-schedule-calendar-panel .fc-list-event {
  cursor: pointer;
}

.my-schedule-calendar-panel .fc-list-event-title,
.my-schedule-calendar-panel .fc-list-event-time {
  color: var(--text-primary);
}

.my-schedule-event-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 5px;
  font-size: 0.72rem;
  line-height: 1.18;
  white-space: normal;
  overflow: visible;
}

.my-schedule-event-card__title,
.my-schedule-event-card__line {
  display: block;
  overflow: visible;
  white-space: normal;
}

.my-schedule-event-card__title {
  font-weight: 800;
}

.my-schedule-detail-text {
  margin: 0;
  white-space: pre-wrap;
  font: inherit;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .my-schedule-date-search,
  .my-schedule-view-toggle,
  .my-schedule-view-toggle .MuiToggleButtonGroup-grouped {
    width: 100%;
  }

  .my-schedule-view-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .my-schedule-view-toggle .MuiToggleButtonGroup-grouped {
    border-left: 1px solid var(--line) !important;
    border-radius: var(--radius-sm) !important;
  }

  .my-schedule-day-strip {
    grid-auto-columns: minmax(96px, 40%);
  }

  .my-schedule-day-button {
    min-height: 66px;
    padding: 9px 10px;
  }

  .my-schedule-calendar-panel {
    padding: 0;
  }

  .my-schedule-calendar-panel .fc-toolbar {
    padding: 12px;
    margin-bottom: 0;
  }

  .my-schedule-calendar-panel .fc-list-event-title {
    white-space: pre-wrap;
  }
}


.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.48);
  padding: 24px;
  z-index: 999;
}

.modal[hidden] {
  display: none;
}

.modal__dialog {
  width: min(720px, 100%);
  max-height: 90vh;
  background: var(--surface-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-elevated);
  display: flex;
  flex-direction: column;
}

.modal__header,
.modal__footer {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.modal__footer {
  border-bottom: none;
  border-top: 1px solid var(--border);
}

.modal__body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal__close {
  border: none;
  background: transparent;
  font-size: 1.4rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.modal__hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.modal__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal__list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: grab;
}

.modal__list-item.dragging {
  opacity: 0.6;
}

.modal__list-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.modal__list-actions {
  display: flex;
  gap: 8px;
}

.modal__footer .modal__actions {
  display: flex;
  gap: 12px;
}

.modal__group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.95rem;
}

.modal__group > span {
  color: var(--text-secondary);
  font-weight: 600;
}

.modal__group input[type="text"],
.modal__group input[type="datetime-local"],
.modal__group textarea {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  padding: 10px 12px;
}

.modal__group--context .modal__meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal__step {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.modal__contact {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.modal__group--preview {
  gap: 12px;
}

.modal__preview-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.modal__preview-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.modal__preview-column h4 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.modal__preview-block {
  min-height: 100px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--offers-preview-border);
  background: var(--surface-muted);
  padding: 12px;
  line-height: 1.4;
  font-size: 0.9rem;
  overflow-y: auto;
  white-space: pre-wrap;
}

.modal__preview-block--disabled {
  opacity: 0.55;
  font-style: italic;
}

.modal__checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.modal__status {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.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;
}

@media (max-width: 980px) {
  .top-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .brand {
    justify-content: center;
  }

  .toolbar {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .nav-tabs {
    flex-wrap: wrap;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .jobs-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .jobs-toolbar__actions {
    justify-content: flex-end;
  }

  .panel {
    padding: 20px;
  }

  .toolbar {
    flex-direction: column;
  }

  .user-info {
    width: 100%;
    justify-content: center;
  }

  .calendar-subtabs {
    display: grid;
    width: 100%;
  }

  .calendar-subtab {
    width: 100%;
  }

  .calendar-preview-controls,
  .calendar-day-controls,
  .calendar-batch-controls,
  .calendar-detail-controls {
    grid-template-columns: 1fr;
  }
}

/* Refined dev portal visual system */
:root {
  --font-family: "Manrope", "Public Sans", "Avenir Next", "Helvetica Neue", sans-serif;
  --font-family-display: "Sora", "Manrope", "Public Sans", sans-serif;
  --transition-duration: 150ms;
  --ease-standard: cubic-bezier(0.2, 0.64, 0.2, 1);
  --radius-xl: 12px;
  --radius-lg: 8px;
  --radius-md: 4px;
  --radius-sm: 4px;
  --radius-pill: 4px;
}

body.theme-light {
  --surface: #eaf0f6;
  --surface-elevated: #f4f8fc;
  --surface-muted: #edf3f9;
  --surface-card: #ffffff;
  --text-primary: #10233a;
  --text-secondary: #4b6078;
  --accent: #145ea5;
  --accent-soft: rgba(20, 94, 165, 0.12);
  --accent-strong: #0f4a81;
  --border: rgba(16, 35, 58, 0.13);
  --panel-border: rgba(16, 35, 58, 0.12);
  --shell-border: rgba(16, 35, 58, 0.14);
  --dropzone-bg: rgba(20, 94, 165, 0.07);
  --dropzone-border: rgba(20, 94, 165, 0.4);
  --toast-bg: rgba(16, 35, 58, 0.94);
  --toast-text: #ffffff;
  --logo-bg: #ffffff;
  --toggle-track-bg: rgba(16, 35, 58, 0.14);
  --toggle-thumb-bg: #ffffff;
  --table-header-bg: #edf3fa;
  --table-row-hover: rgba(20, 94, 165, 0.09);
  --table-row-selected: rgba(20, 94, 165, 0.16);
  --offers-sent-bg: rgba(44, 138, 87, 0.2);
  --offers-preview-border: rgba(16, 35, 58, 0.14);
  --shadow-shell: 0 1px 0 rgba(255, 255, 255, 0.9), 0 18px 34px rgba(12, 30, 50, 0.14);
  --shadow-elevated: 0 1px 0 rgba(255, 255, 255, 0.7), 0 10px 20px rgba(12, 30, 50, 0.12);
  --focus-ring: rgba(20, 94, 165, 0.34);
  --atmo-one: rgba(22, 109, 186, 0.18);
  --atmo-two: rgba(14, 156, 136, 0.12);
  --success-bg: rgba(44, 138, 87, 0.18);
  --error-bg: rgba(186, 65, 65, 0.16);
}

body.theme-dark {
  --surface: #0d1522;
  --surface-elevated: #111d2f;
  --surface-muted: #162236;
  --surface-card: rgba(20, 33, 50, 0.96);
  --text-primary: #ecf2fb;
  --text-secondary: #b0c1d9;
  --accent: #5da7ec;
  --accent-soft: rgba(93, 167, 236, 0.2);
  --accent-strong: #4a8bc8;
  --border: rgba(170, 193, 223, 0.26);
  --panel-border: rgba(170, 193, 223, 0.24);
  --shell-border: rgba(170, 193, 223, 0.28);
  --dropzone-bg: rgba(93, 167, 236, 0.15);
  --dropzone-border: rgba(93, 167, 236, 0.48);
  --toast-bg: rgba(238, 244, 252, 0.95);
  --toast-text: #122236;
  --logo-bg: rgba(255, 255, 255, 0.96);
  --toggle-track-bg: rgba(236, 242, 251, 0.25);
  --toggle-thumb-bg: #0e1727;
  --table-header-bg: rgba(93, 167, 236, 0.16);
  --table-row-hover: rgba(93, 167, 236, 0.17);
  --table-row-selected: rgba(93, 167, 236, 0.24);
  --offers-sent-bg: rgba(89, 195, 139, 0.26);
  --offers-preview-border: rgba(170, 193, 223, 0.28);
  --shadow-shell: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 16px 30px rgba(2, 10, 22, 0.5);
  --shadow-elevated: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 10px 20px rgba(2, 10, 22, 0.4);
  --focus-ring: rgba(93, 167, 236, 0.42);
  --atmo-one: rgba(35, 102, 170, 0.32);
  --atmo-two: rgba(24, 154, 135, 0.18);
  --success-bg: rgba(89, 195, 139, 0.24);
  --error-bg: rgba(206, 93, 93, 0.2);
}

body {
  position: relative;
  isolation: isolate;
  line-height: 1.5;
  background: var(--surface);
}

h1,
h2,
h3 {
  letter-spacing: -0.03em;
  line-height: 1.14;
  text-wrap: balance;
}

p {
  line-height: 1.55;
  max-width: 65ch;
  text-wrap: pretty;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, var(--surface-elevated), var(--surface));
}

.app-shell {
  width: min(1860px, calc(100% - clamp(10px, 2.4vw, 40px)));
  margin: clamp(16px, 2.6vw, 30px) auto clamp(24px, 4.2vw, 54px);
  border-radius: var(--radius-xl);
  border: 1px solid var(--shell-border);
  background: var(--surface-card);
  box-shadow: var(--shadow-shell);
  overflow: clip;
}

.top-bar {
  padding: clamp(18px, 2.4vw, 28px) clamp(18px, 2.8vw, 34px) clamp(16px, 2vw, 22px);
  gap: 20px;
  border-bottom: 1px solid var(--border);
}

.brand {
  gap: 14px;
}

.brand-icon {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  border-color: var(--border);
  box-shadow: 0 10px 20px rgba(16, 35, 58, 0.08);
}

.brand-text {
  display: grid;
  gap: 2px;
}

.brand-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
}

.brand-text h1 {
  font-family: var(--font-family-display);
  font-size: clamp(1.45rem, 2.1vw, 1.95rem);
  letter-spacing: -0.01em;
}

.brand-text p {
  margin-top: 2px;
  font-size: 0.92rem;
}

.toolbar {
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dev-login {
  gap: 10px;
}

.dev-login input {
  width: min(280px, 100%);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-card);
}

.dev-login button {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-card);
}

.user-info {
  background: var(--surface-card);
  box-shadow: 0 8px 18px rgba(16, 35, 58, 0.1);
}

.auth-button,
.primary-button,
.actions button {
  border-radius: var(--radius-pill);
  font-weight: 700;
  letter-spacing: 0.01em;
  background: var(--accent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 8px 16px rgba(20, 94, 165, 0.24);
}

.ghost-button {
  border-radius: var(--radius-pill);
  background: var(--surface-card);
}

.auth-button,
.primary-button,
.ghost-button,
.actions button,
.nav-tab,
.theme-toggle,
.drop-zone,
.modal__close {
  transition:
    transform var(--transition-duration) var(--ease-standard),
    box-shadow var(--transition-duration) var(--ease-standard),
    border-color var(--transition-duration) var(--ease-standard),
    background-color var(--transition-duration) var(--ease-standard),
    color var(--transition-duration) var(--ease-standard),
    opacity var(--transition-duration) var(--ease-standard);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.drop-zone:focus-visible,
.nav-tab:focus-visible,
.theme-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.auth-button:hover:not(:disabled),
.primary-button:hover:not(:disabled),
.actions button:hover:not(:disabled),
.ghost-button:hover:not(:disabled) {
  transform: none;
}

.actions .ghost-button {
  color: var(--text-primary);
  background: var(--surface-card);
  border: 1px solid var(--border);
  box-shadow: none;
}

.actions .ghost-button:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
}

.theme-toggle {
  color: var(--text-secondary);
}

.theme-toggle__track {
  width: 66px;
  height: 34px;
  border-color: var(--border);
}

.theme-toggle__thumb {
  width: 30px;
  height: 30px;
  left: 2px;
}

.theme-toggle.theme-toggle--dark .theme-toggle__thumb {
  transform: translate(32px, -50%);
}

.nav-tabs {
  justify-content: flex-start;
  gap: 10px;
  margin: 0;
  padding: 14px clamp(18px, 2.8vw, 34px);
  border-bottom: 1px solid var(--border);
  background: var(--surface-elevated);
  overflow-x: auto;
  scrollbar-width: thin;
}

.nav-tab {
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  padding: 10px 16px;
  white-space: nowrap;
}

.nav-tab:hover:not(.nav-tab--active) {
  background: var(--surface-muted);
  color: var(--text-primary);
}

.nav-tab--active {
  background: var(--accent-soft);
  border-color: rgba(20, 94, 165, 0.36);
  color: var(--accent-strong);
}

.page-content {
  padding: clamp(14px, 2.1vw, 24px);
  align-items: flex-start;
}

.panel {
  width: 100%;
  max-width: none;
  border-radius: var(--radius-lg);
  border: 1px solid var(--panel-border);
  background: var(--surface-card);
  box-shadow: var(--shadow-elevated);
  padding: clamp(16px, 2.6vw, 26px);
  gap: 26px;
}

.panel--active {
  animation: panel-enter 220ms var(--ease-standard);
}

.panel-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.panel-header h2 {
  font-family: var(--font-family-display);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel-header p {
  max-width: 70ch;
  line-height: 1.55;
}

.upload-form {
  gap: 18px;
}

.drop-zone {
  border-radius: var(--radius-lg);
  padding: clamp(24px, 4vw, 36px) clamp(16px, 2.8vw, 28px);
  background: var(--dropzone-bg);
}

.drop-zone:hover,
.drop-zone--dragging {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(20, 94, 165, 0.35);
}

.drop-zone__icon {
  font-size: clamp(2.2rem, 3.2vw, 2.9rem);
}

.filters {
  gap: 14px;
}

.filter-field {
  gap: var(--form-field-label-gap);
}

.filter-field label {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
  min-height: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-field input,
.filter-field select,
textarea,
.modal__group input,
.modal__group textarea,
.offers-search input,
.latest-search input,
.offers-filters select,
.latest-filter input,
.latest-filter select {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-card);
}

.run-status,
.jobs-toolbar,
.offers-toolbar,
.latest-bulk-toolbar,
.latest-filter,
.calendar-management-section,
.calendar-detail-panel,
.option-block {
  background: transparent;
  border-radius: 0;
  border-color: var(--border);
  border-width: 0 0 1px;
  border-style: solid;
}

.table-scroll,
.latest-table-wrapper,
.offers-table-wrapper,
.jobs-table-wrapper {
  border-radius: var(--radius-md);
  border-color: var(--border);
  background: var(--surface-card);
}

table {
  background: var(--surface-card);
}

thead {
  background: var(--table-header-bg);
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

tbody tr:hover {
  background: var(--table-row-hover);
}

.jobs-table-wrapper tbody tr.selected,
.offers-table-wrapper tbody tr.selected {
  background: var(--table-row-selected);
}

.table-empty,
.form-hint,
.modal__status,
.modal__hint {
  color: var(--text-secondary);
}

.calendar-management-section {
  border-radius: var(--radius-md);
  padding: 16px;
  gap: 12px;
}

.calendar-management-section h3 {
  font-family: var(--font-family-display);
  font-size: 1.04rem;
  letter-spacing: -0.01em;
}

.calendar-detail-panel h4 {
  font-family: var(--font-family-display);
  font-size: 0.98rem;
}

.calendar-detail-json {
  border-color: var(--border);
  background: var(--surface-card);
}

.analytics-controls {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.analytics-subtabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.analytics-subtab {
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  padding: 9px 12px;
  transition: background var(--transition-duration) ease, color var(--transition-duration) ease;
}

.analytics-subtab:hover,
.analytics-subtab:focus-visible {
  background: var(--surface-elevated);
  color: var(--text-primary);
}

.analytics-subtab--active {
  background: var(--brand-blue);
  color: #ffffff;
}

.analytics-view-panel {
  display: grid;
  gap: 18px;
}

.analytics-view-panel[hidden] {
  display: none !important;
}

.analytics-controls .filter-field:nth-child(1),
.analytics-controls .filter-field:nth-child(2),
.analytics-controls .filter-field:nth-child(3) {
  grid-column: span 2;
}

.analytics-controls .analytics-actions {
  grid-column: span 6;
  justify-content: flex-end;
}

.analytics-advanced-filter {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  padding: 10px 12px;
}

.analytics-advanced-filter summary {
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 800;
}

.analytics-advanced-filter .analytics-targets {
  margin-top: 10px;
}

.analytics-targets textarea {
  height: 44px;
  min-height: 44px;
  resize: none;
}

.analytics-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.analytics-kpi-card {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  padding: 12px 0;
}

.analytics-kpi-card h3 {
  margin: 0;
  font-size: 0.84rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.analytics-kpi-card p {
  margin: 10px 0 0;
  font-family: var(--font-family-display);
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
  line-height: 1.1;
}

.analytics-section {
  display: grid;
  gap: 10px;
}

.analytics-section h3 {
  margin: 0;
  font-family: var(--font-family-display);
  font-size: 1rem;
}

.analytics-section__hint,
.analytics-sender-preview__empty {
  margin: 0;
  color: var(--text-secondary);
}

.analytics-sender-preview {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.analytics-sender-preview__item {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  padding: 12px;
}

.analytics-sender-preview__item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-sender-preview__item span {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.analytics-table th,
.analytics-table td {
  white-space: nowrap;
}

.analytics-pagination {
  justify-content: flex-end;
}

.modal {
  background: rgba(10, 19, 33, 0.56);
}

.modal__dialog {
  width: min(760px, 100%);
  border-radius: var(--radius-lg);
  background: var(--surface-card);
}

.modal__header,
.modal__footer {
  padding: 16px 20px;
}

.modal__body {
  padding: 20px;
}

.modal__close {
  border-radius: 8px;
  width: 30px;
  height: 30px;
}

.modal__close:hover {
  background: var(--surface-muted);
  color: var(--text-primary);
}

.modal__preview-block {
  background: var(--surface-card);
}

.sign-out-modal__dialog {
  width: min(420px, 100%);
}

.sign-out-modal .modal__header h3 {
  margin: 0;
}

.sign-out-modal .modal__footer {
  justify-content: flex-end;
}

.sign-out-modal .modal__footer .ghost-button,
.sign-out-modal .modal__footer .auth-button {
  min-width: 112px;
}

.toast {
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast[data-tone="success"] {
  background: linear-gradient(135deg, #2f9b6d, #257e59);
}

.toast[data-tone="error"] {
  background: linear-gradient(135deg, #c75151, #a53e3e);
}

@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1120px) {
  .toolbar {
    justify-content: flex-start;
  }

  .page-content {
    padding: 16px;
  }

  .admin-access-layout {
    grid-template-columns: 1fr;
  }

  .admin-users-list {
    max-height: 360px;
  }

  .analytics-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-subtabs {
    display: grid;
    width: 100%;
  }

  .analytics-subtab {
    width: 100%;
  }

  .analytics-controls .filter-field,
  .analytics-controls .analytics-actions {
    grid-column: span 1;
  }

  .analytics-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 980px) {
  .app-shell {
    width: calc(100% - 24px);
    margin-top: 12px;
    border-radius: 18px;
  }

  .top-bar {
    align-items: flex-start;
  }

  .brand {
    justify-content: flex-start;
  }

  .toolbar {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .app-shell {
    width: 100%;
    margin: 0;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .top-bar {
    padding: 16px;
  }

  .nav-tabs {
    padding: 12px 16px;
  }

  .page-content {
    padding: 12px;
  }

  .panel {
    padding: 16px;
    border-radius: 14px;
  }

  .analytics-controls,
  .analytics-kpis,
  .ec-status-strip,
  .ec-connect-form,
  .ec-write-summary,
  .ec-layout {
    grid-template-columns: 1fr;
  }

  .ec-rforce-connected-summary {
    grid-column: 1 / -1;
  }

  .ec-connect-form .actions {
    justify-content: flex-start;
  }

  .ec-inline {
    grid-template-columns: 1fr;
  }


  .toolbar,
  .dev-login {
    flex-direction: column;
    align-items: stretch;
  }

  .dev-login input,
  .dev-login button,
  .auth-button {
    width: 100%;
  }

  .user-info {
    width: 100%;
    justify-content: flex-start;
  }

  .modal {
    padding: 10px;
  }

  .modal__header,
  .modal__body,
  .modal__footer {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* TaskBook operations shell aligned with the Escalated Comms UI system. */
:root,
body.theme-light {
  --navigation-drawer-width: 268px;
  --navigation-drawer-collapsed-width: 72px;
  --app-bg: #f3f4f6;
  --surface: #f3f4f6;
  --surface-elevated: #ffffff;
  --surface-muted: #f7f8fa;
  --surface-card: #ffffff;
  --ink: #172033;
  --muted: #5d6675;
  --text-primary: #172033;
  --text-secondary: #5d6675;
  --line: #d7dce3;
  --border: #d7dce3;
  --brand-blue: #0b4f8a;
  --brand-blue-dark: #083c68;
  --sidebar-text: #5d6675;
  --sidebar-active-text: #0b4f8a;
  --brand-teal: #315f57;
  --accent: #0b4f8a;
  --accent-soft: #e9f2f8;
  --accent-strong: #083c68;
  --nav-active-bg: #e9f2f8;
  --nav-active-line: var(--brand-blue);
  --fw-radius-control: 8px;
  --fw-radius-card: 8px;
  --radius-xl: 8px;
  --radius-lg: 8px;
  --radius-md: 8px;
  --radius-sm: 4px;
  --radius-pill: 8px;
  --shadow-shell: none;
  --shadow-elevated: 0 1px 2px rgba(16, 32, 51, 0.05);
  --table-header-bg: #f0f2f5;
  --table-header-bg-opaque: #f0f2f5;
  --table-row-hover: #f0f2f5;
  --table-row-selected: #e9eef3;
  --dropzone-bg: #f7f8fa;
  --dropzone-border: #b6bec9;
  --control-disabled-text: #8a93a0;
  --focus-ring: rgba(11, 79, 138, 0.28);
}

body.theme-dark {
  --app-bg: #0f1217;
  --surface: #0f1217;
  --surface-elevated: #171c24;
  --surface-muted: #202631;
  --surface-card: #171c24;
  --ink: #f1f4f8;
  --muted: #b8c0cc;
  --text-primary: #f1f4f8;
  --text-secondary: #b8c0cc;
  --line: rgba(214, 222, 234, 0.22);
  --border: rgba(214, 222, 234, 0.22);
  --brand-blue: #75aee1;
  --brand-blue-dark: #a6d0f2;
  --sidebar-text: #b8c0cc;
  --sidebar-active-text: #a6d0f2;
  --brand-teal: #8bc4b8;
  --accent: #75aee1;
  --accent-soft: rgba(117, 174, 225, 0.14);
  --accent-strong: #a6d0f2;
  --nav-active-bg: rgba(117, 174, 225, 0.14);
  --table-header-bg: #202631;
  --table-header-bg-opaque: #202631;
  --table-row-hover: #252c37;
  --table-row-selected: #2a3441;
  --dropzone-bg: #202631;
  --dropzone-border: rgba(214, 222, 234, 0.34);
  --control-disabled-text: #8e99a8;
  --focus-ring: rgba(117, 174, 225, 0.36);
}

body.theme-dark .nav-tab--active {
  background: var(--nav-active-bg);
  color: var(--text-primary);
}

body {
  background: var(--app-bg);
  color: var(--text-primary);
}

body::before {
  display: none;
}

h1,
h2,
h3 {
  letter-spacing: 0;
}

body,
body * {
  letter-spacing: 0;
}

.appShell {
  display: grid;
  grid-template-columns: var(--navigation-drawer-width) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--app-bg);
  transition: grid-template-columns 200ms var(--ease-standard);
}

.appShell[data-sidebar-collapsed="true"] {
  grid-template-columns: var(--navigation-drawer-collapsed-width) minmax(0, 1fr);
}

.sideNav {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.8vh, 18px);
  width: var(--navigation-drawer-width);
  box-sizing: border-box;
  height: 100vh;
  min-height: 0;
  overflow: visible;
  padding: clamp(14px, 2vh, 22px) 20px;
  border-right: 1px solid var(--line);
  background: var(--surface-elevated);
  z-index: 20;
  transition:
    width 200ms var(--ease-standard),
    padding 200ms var(--ease-standard);
}

.sideNav > * {
  min-width: 0;
  max-width: 100%;
}

/* Keep the full desktop navigation fixed to its drawer width. The individual
   navigation list already owns vertical scrolling; it must not create a
   second horizontal track below the account controls. */
@media (min-width: 861px) {
  .appShell:not([data-sidebar-collapsed="true"]) .sideNav {
    overflow-x: clip;
  }

  .appShell:not([data-sidebar-collapsed="true"]) .sideNav > * {
    min-width: 0;
    max-width: 100%;
  }
}

.appShell[data-sidebar-collapsed="true"] .sideNav {
  width: var(--navigation-drawer-collapsed-width);
  padding-inline: 10px;
}

.brand-slot {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 12px;
  min-height: 56px;
}

.sidebar-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--fw-radius-control);
  background: var(--surface-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    background-color 180ms var(--ease-standard),
    border-color 180ms var(--ease-standard),
    color 180ms var(--ease-standard),
    transform 200ms var(--ease-standard);
}

.sidebar-toggle:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue-dark);
}

.sidebar-toggle__icon,
.nav-tab__icon,
.auth-button__icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.appShell[data-sidebar-collapsed="true"] .brand-slot {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 8px;
}

.appShell[data-sidebar-collapsed="true"] .sidebar-toggle {
  transform: rotate(180deg);
}

.brand-slot .brand-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--fw-radius-card);
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: none;
}

.brand-slot .brand-icon img {
  width: 86%;
  height: auto;
}

.brand-slot .brand-text {
  min-width: 0;
  transition:
    opacity 160ms var(--ease-standard),
    transform 200ms var(--ease-standard);
}

.brand-slot .brand-kicker,
.nav-group-label {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-slot .brand-text h1 {
  margin: 2px 0;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 1.18rem;
  line-height: 1.1;
}

.brand-slot .brand-text p:not(.brand-kicker) {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.nav-tabs {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  gap: clamp(8px, 1.3vh, 14px);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

/* Keep the sidebar vertically scrollable without exposing a horizontal rail. */
.sideNav .nav-tabs::-webkit-scrollbar:horizontal {
  display: none;
  height: 0;
}

.nav-group {
  position: relative;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.nav-group-label {
  padding: 0 12px 4px;
}

.nav-tab {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  width: 100%;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: var(--fw-radius-control);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 700;
  justify-content: flex-start;
  gap: 10px;
  padding: 7px 10px 7px 16px;
  text-align: left;
  white-space: normal;
  box-sizing: border-box;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}

.nav-tab--destination[aria-disabled="true"] {
  pointer-events: none;
}

.nav-tab__label,
.nav-tab__tooltip,
.auth-button__label,
.theme-toggle__text,
.nav-group-label,
.account-card .user-info,
.brand-slot .brand-text {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition:
    max-width 200ms var(--ease-standard),
    opacity 160ms var(--ease-standard),
    transform 200ms var(--ease-standard);
}

.nav-tab::before {
  content: "";
  position: absolute;
  inset: 8px auto 8px 6px;
  width: 3px;
  border-radius: 999px;
  background: transparent;
}

.nav-tab:hover:not(.nav-tab--active) {
  background: var(--surface-muted);
  color: var(--text-primary);
}

.nav-tab--fieldwork {
  min-height: 42px;
  border-color: color-mix(in srgb, var(--brand-blue) 28%, var(--line));
  color: var(--brand-blue-dark);
  background: var(--surface-elevated);
}

.nav-tab--fieldwork .nav-tab__icon {
  color: var(--brand-blue);
}

.nav-tab--fieldwork:hover:not(.nav-tab--active) {
  border-color: var(--brand-blue);
  color: var(--brand-blue-dark);
  background: color-mix(in srgb, var(--brand-blue) 12%, var(--surface-elevated));
}

.nav-tab--active {
  border-color: transparent;
  background: var(--nav-active-bg);
  color: var(--brand-blue-dark);
}

.nav-tab--active::before {
  background: var(--nav-active-line);
}

.account-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  transition: gap 200ms var(--ease-standard);
}

.account-card__body {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.account-card__identity-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.account-card .dev-login[hidden] {
  display: none;
}

.account-card .impersonation-banner[hidden] {
  display: none;
}

.account-card .user-info {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.account-card .user-meta {
  min-width: 0;
}

.account-card #user-name,
.account-card #user-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.impersonation-banner {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--warning) 42%, var(--line));
  border-radius: var(--fw-radius-control);
  background: color-mix(in srgb, var(--warning) 14%, var(--surface-elevated));
}

.impersonation-banner__body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.impersonation-banner__label {
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.impersonation-banner strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.impersonation-banner .ghost-button {
  width: auto;
  min-height: 30px;
  padding: 6px 10px;
  font-size: 0.78rem;
}

.impersonate-button {
  min-width: 78px;
  padding: 7px 10px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.account-card .auth-button,
.account-card .dev-login,
.account-card .dev-login button {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.account-card .theme-toggle {
  width: 54px;
  min-height: 40px;
  padding-inline: 3px;
  justify-self: end;
}

.dev-login {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.dev-login input,
.dev-login button,
.auth-button,
.primary-button,
.ghost-button,
.actions button {
  box-sizing: border-box;
  border-radius: var(--fw-radius-control);
}

.dev-login input {
  width: 100%;
  box-sizing: border-box;
}

.auth-button,
.primary-button,
.actions button {
  background: var(--brand-blue);
  color: #ffffff;
  box-shadow: none;
}

.auth-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-button[data-auth-mode="signout"] {
  background: var(--signout-bg);
  color: #ffffff;
}

.auth-button:hover:not(:disabled),
.primary-button:hover:not(:disabled),
.actions button:hover:not(:disabled) {
  background: var(--brand-blue-dark);
  color: #ffffff;
}

.auth-button[data-auth-mode="signout"]:hover:not(:disabled) {
  background: var(--signout-bg-hover);
  color: #ffffff;
}

.ghost-button {
  background: var(--surface-elevated);
  border: 1px solid var(--line);
}

.ghost-button:hover:not(:disabled),
.actions .ghost-button:hover:not(:disabled) {
  background: var(--surface-muted);
  border-color: color-mix(in srgb, var(--text-secondary) 55%, var(--line));
  color: var(--text-primary);
}

.auth-button:disabled,
.primary-button:disabled,
.ghost-button:disabled,
.actions button:disabled,
.actions .ghost-button:disabled {
  color: var(--control-disabled-text);
  background: var(--surface-muted);
  border-color: var(--line);
}

.theme-toggle {
  justify-content: space-between;
  min-height: 32px;
}

.appShell[data-sidebar-collapsed="true"] .brand-slot .brand-text,
.appShell[data-sidebar-collapsed="true"] .nav-group-label,
.appShell[data-sidebar-collapsed="true"] .nav-tab__label,
.appShell[data-sidebar-collapsed="true"] .account-card .user-info,
.appShell[data-sidebar-collapsed="true"] .auth-button__label,
.appShell[data-sidebar-collapsed="true"] .theme-toggle__text,
.appShell[data-sidebar-collapsed="true"] .dev-login {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-4px);
}

.appShell[data-sidebar-collapsed="true"] .brand-slot .brand-icon {
  width: 42px;
  height: 42px;
}

.appShell[data-sidebar-collapsed="true"] .nav-tabs {
  gap: 10px;
  align-items: center;
}

.appShell[data-sidebar-collapsed="true"] .nav-group {
  gap: 8px;
}

.appShell[data-sidebar-collapsed="true"] .nav-tab {
  justify-content: center;
  width: 44px;
  min-height: 44px;
  padding: 0;
}

.appShell[data-sidebar-collapsed="true"] .nav-tab::before {
  inset: auto auto 5px 50%;
  width: 20px;
  height: 3px;
  transform: translateX(-50%);
}

.appShell[data-sidebar-collapsed="true"] .nav-tab::after {
  display: none;
}

.nav-tab__tooltip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  z-index: 30;
  min-width: max-content;
  max-width: 220px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--fw-radius-control);
  background: var(--surface-elevated);
  color: var(--text-primary);
  box-shadow: 0 8px 18px rgba(16, 32, 51, 0.12);
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-4px, -50%);
  transition:
    opacity 160ms var(--ease-standard),
    transform 160ms var(--ease-standard);
}

.appShell[data-sidebar-collapsed="true"] .nav-tab:hover .nav-tab__tooltip,
.appShell[data-sidebar-collapsed="true"] .nav-tab:focus-visible .nav-tab__tooltip {
  opacity: 1;
  transform: translate(0, -50%);
}

.appShell[data-sidebar-collapsed="true"] .account-card {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 8px;
}

.appShell[data-sidebar-collapsed="true"] .auth-button,
.appShell[data-sidebar-collapsed="true"] .theme-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  padding: 0;
}

.appShell[data-sidebar-collapsed="true"] .theme-toggle__track {
  width: 34px;
  height: 20px;
}

.appShell[data-sidebar-collapsed="true"] .theme-toggle__icon {
  display: none;
}

.appShell[data-sidebar-collapsed="true"] .theme-toggle__thumb {
  width: 16px;
  height: 16px;
}

.appShell[data-sidebar-collapsed="true"] .theme-toggle.theme-toggle--dark .theme-toggle__thumb {
  transform: translate(14px, -50%);
}

.theme-toggle__track {
  width: 48px;
  height: 26px;
}

.theme-toggle__icon {
  font-size: 0.8rem;
}

.theme-toggle__icon--sun {
  left: 9px;
}

.theme-toggle__icon--moon {
  right: 9px;
}

.theme-toggle__thumb {
  width: 22px;
  height: 22px;
  left: 2px;
}

.theme-toggle.theme-toggle--dark .theme-toggle__thumb {
  transform: translate(22px, -50%);
}

.mainArea {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page-content {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: clamp(18px, 2.4vw, 30px) clamp(20px, 3vw, 36px) 36px;
}

.panel {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: var(--fw-radius-card);
  background: var(--surface-elevated);
  box-shadow: var(--shadow-elevated);
  gap: 24px;
  padding: clamp(18px, 2.2vw, 28px);
}

.panel[data-section="team-performance"] {
  gap: 0;
  overflow: hidden;
  padding: 0;
}

.panel-header h2 {
  font-size: clamp(1.25rem, 1.8vw, 1.65rem);
}

.panel-header p {
  max-width: 78ch;
}

/* Boards is a viewport-contained application surface, not a document panel. */
.page-content:has(> [data-section="kanban"].panel--active) {
  padding: 0;
}

[data-section="kanban"].panel--active {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  gap: 0;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

[data-section="kanban"].panel--active > .panel-header {
  display: none;
}

[data-section="kanban"].panel--active > .kanban-root {
  height: 100%;
  min-height: 0;
}

@media (min-width: 861px) {
  body:has([data-section="kanban"].panel--active),
  .appShell:has([data-section="kanban"].panel--active),
  .mainArea:has([data-section="kanban"].panel--active) {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .page-content:has(> [data-section="kanban"].panel--active),
  [data-section="kanban"].panel--active {
    height: 100%;
    min-height: 0;
  }
}

.drop-zone {
  min-height: 170px;
  border-radius: var(--fw-radius-card);
  background: var(--dropzone-bg);
}

.table-scroll,
.latest-table-wrapper,
.dry-run-preview__table,
.calendar-day-grid,
.calendar-preview {
  border-color: var(--line);
  border-radius: var(--fw-radius-card);
}

table th {
  background: var(--table-header-bg);
  color: var(--text-secondary);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

table td,
table th {
  border-color: var(--line);
}

.status-card,
.queue-metric-card,
.analytics-kpi,
.calendar-management-section,
.rforce-scheduling-section,
.dry-run-preview,
.request-status {
  border-color: var(--line);
  border-radius: var(--fw-radius-card);
  box-shadow: none;
}

.modal__dialog {
  border-radius: var(--fw-radius-card);
}

@media (max-width: 1100px) {
  .appShell {
    grid-template-columns: 232px minmax(0, 1fr);
  }

  .sideNav {
    width: 232px;
    padding: 18px 14px;
  }

  .nav-tab {
    font-size: 0.84rem;
    padding-right: 8px;
  }
}

@media (max-width: 860px) {
  .appShell {
    display: block;
  }

  .sideNav {
    position: sticky;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    width: 100%;
    min-height: auto;
    height: auto;
    max-height: none;
    overflow: visible;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-toggle {
    display: none;
  }

  .appShell[data-sidebar-collapsed="true"] .brand-slot .brand-text,
  .appShell[data-sidebar-collapsed="true"] .nav-group-label,
  .appShell[data-sidebar-collapsed="true"] .nav-tab__label,
  .appShell[data-sidebar-collapsed="true"] .account-card .user-info,
  .appShell[data-sidebar-collapsed="true"] .auth-button__label,
  .appShell[data-sidebar-collapsed="true"] .theme-toggle__text,
  .appShell[data-sidebar-collapsed="true"] .dev-login {
    max-width: none;
    position: static;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .brand-slot {
    grid-template-columns: 48px minmax(0, 1fr);
    min-height: 52px;
  }

  .brand-slot .brand-icon {
    width: 48px;
    height: 48px;
  }

  .brand-slot .brand-text h1 {
    font-size: 1.12rem;
  }

  .nav-tabs {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .nav-group {
    display: contents;
  }

  .nav-group-label {
    display: none;
  }

  .nav-tab {
    flex: 0 0 auto;
    width: auto;
    min-height: 44px;
    padding: 9px 12px;
    white-space: nowrap;
  }

  .appShell[data-sidebar-collapsed="true"] .brand-slot {
    grid-template-columns: 48px minmax(0, 1fr);
    justify-items: stretch;
  }

  .appShell[data-sidebar-collapsed="true"] .brand-slot .brand-icon {
    width: 48px;
    height: 48px;
  }

  .appShell[data-sidebar-collapsed="true"] .nav-tabs {
    align-items: stretch;
    gap: 8px;
  }

  .appShell[data-sidebar-collapsed="true"] .nav-tab {
    justify-content: flex-start;
    width: auto;
    min-height: 44px;
    padding: 9px 12px;
  }

  .appShell[data-sidebar-collapsed="true"] .nav-tab::after {
    display: none;
  }

  .nav-tab__tooltip {
    display: none;
  }

  .nav-tab::before {
    display: none;
  }

  .account-card {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 0;
    padding-top: 12px;
  }

  .appShell[data-sidebar-collapsed="true"] .account-card {
    grid-template-columns: minmax(0, 1fr);
    justify-items: stretch;
  }

  .account-card__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .account-card__identity-row {
    grid-template-columns: minmax(180px, 1fr) auto;
  }

  .account-card .auth-button[data-auth-mode="signout"] {
    width: 100%;
    min-height: 44px;
  }

  .account-card .theme-toggle {
    width: 54px;
    min-height: 44px;
  }

  .account-card .auth-button:not([data-auth-mode="signout"]),
  .account-card .dev-login {
    width: 100%;
  }

  .dev-login {
    grid-template-columns: minmax(160px, 1fr) auto;
  }

  .theme-toggle {
    width: auto;
  }

  .appShell[data-sidebar-collapsed="true"] .auth-button,
  .appShell[data-sidebar-collapsed="true"] .theme-toggle {
    display: flex;
    width: auto;
    min-height: 32px;
    padding: 10px 14px;
  }

  .page-content {
    padding: 12px 16px 28px;
  }
}

@media (max-width: 620px) {
  .account-card__identity-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .account-card .auth-button[data-auth-mode="signout"] {
    width: 100%;
    min-height: 44px;
  }

  .account-card .theme-toggle {
    width: 54px;
    min-height: 44px;
    padding-inline: 3px;
  }

  .account-card .auth-button:not([data-auth-mode="signout"]),
  .account-card .dev-login,
  .dev-login {
    grid-template-columns: 1fr;
  }

  .account-card .auth-button:not([data-auth-mode="signout"]),
  .dev-login button {
    width: 100%;
  }
}
.nav-disclosure {
  display: grid;
  gap: 0.25rem;
}

.nav-disclosure[hidden] {
  display: none;
}

.nav-parent {
  width: 100%;
  border: 0;
  background: var(--surface-elevated);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
  padding: 0.55rem 0.75rem;
  color: var(--sidebar-text, #b8c7d9);
  font-weight: 750;
}

.nav-parent::after { content: "▾"; margin-left: auto; transition: transform 160ms ease; }
.nav-parent[aria-expanded="false"]::after { transform: rotate(-90deg); }
.nav-parent:focus-visible { outline: 2px solid var(--sidebar-active-text, #9dcbf3); outline-offset: 2px; }

.nav-parent--active {
  background: var(--nav-active-bg);
  color: var(--sidebar-active-text, #9dcbf3);
}

.nav-subtabs {
  display: grid;
  gap: 0.2rem;
  margin-left: 2.35rem;
  padding-left: 0.7rem;
  border-left: 1px solid rgba(159, 187, 218, 0.28);
}

.nav-subtabs[hidden] { display: none; }

.nav-tab.nav-subtab {
  min-height: 2.75rem;
  padding: 0.4rem 0.65rem;
  font-size: 0.82rem;
  justify-content: flex-start;
}

.appShell[data-sidebar-collapsed="true"] .nav-subtabs,
.appShell[data-sidebar-collapsed="true"] .nav-parent .nav-tab__label {
  display: none;
}

.appShell[data-sidebar-collapsed="true"] .nav-parent {
  justify-content: center;
}

.appShell[data-sidebar-collapsed="true"] .nav-parent::after {
  display: none;
}

.appShell[data-sidebar-collapsed="true"] .nav-parent:hover .nav-tab__tooltip,
.appShell[data-sidebar-collapsed="true"] .nav-parent:focus-visible .nav-tab__tooltip {
  opacity: 1;
  transform: translate(0, -50%);
}

@media (max-width: 860px) {
  .nav-disclosure {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.25rem;
  }

  .nav-parent {
    width: auto;
    min-height: 44px;
    white-space: nowrap;
  }

  .nav-subtabs {
    display: flex;
    gap: 0.25rem;
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }

  .nav-tab.nav-subtab {
    min-height: 44px;
  }
}

/* Kanban-style Escalated Comms canvas: the workspace stays bright and
   high-contrast in light mode, while dark mode keeps the deep board surface. */
body.theme-light .ec-workspace {
  --ec-board-canvas: #1c66aa;
  --ec-board-line: rgba(21, 92, 152, 0.16);
  --ec-board-topbar: #2e63cd;
  --ec-board-topbar-strong: #2456b1;
  --ec-board-topbar-text: #f8fbff;
  --ec-board-surface: rgba(255, 255, 255, 0.94);
  --ec-board-muted: #f2f6fb;
  --ec-board-shadow: 0 14px 30px rgba(16, 53, 87, 0.13);
}

body.theme-dark .ec-workspace {
  --ec-board-canvas: #070d1c;
  --ec-board-line: rgba(108, 159, 220, 0.2);
  --ec-board-topbar: #111b2c;
  --ec-board-topbar-strong: #172842;
  --ec-board-topbar-text: #eef6ff;
  --ec-board-surface: rgba(16, 27, 45, 0.96);
  --ec-board-muted: rgba(23, 39, 64, 0.92);
  --ec-board-shadow: 0 18px 34px rgba(0, 0, 0, 0.34);
}

.ec-workspace {
  gap: 0.65rem;
  padding: 0.6rem;
  border-color: var(--ec-board-line);
  background:
    radial-gradient(circle at 18% 24%, var(--ec-board-line) 0 1px, transparent 1.5px),
    radial-gradient(circle at 82% 38%, var(--ec-board-line) 0 1px, transparent 1.5px),
    linear-gradient(169deg, transparent 0 65%, var(--ec-board-line) 65.08% 65.17%, transparent 65.26%),
    linear-gradient(141deg, transparent 0 46%, var(--ec-board-line) 46.08% 46.17%, transparent 46.26%),
    var(--ec-board-canvas);
  background-size: 19rem 16rem, 25rem 22rem, auto, auto, auto;
}

.ec-workspace::before {
  display: none;
}

.ec-workspace__header {
  align-items: center;
  min-height: 2.85rem;
  margin: 0;
  padding: 0.58rem 0.85rem;
  border-color: color-mix(in srgb, var(--ec-board-topbar-text) 16%, transparent);
  border-radius: var(--radius-md);
  background: linear-gradient(110deg, var(--ec-board-topbar), var(--ec-board-topbar-strong));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--ec-board-topbar) 30%, transparent);
  color: var(--ec-board-topbar-text);
}

.ec-workspace__header h2,
.ec-workspace__header p,
.ec-workspace__header .ec-workspace__eyebrow {
  color: var(--ec-board-topbar-text);
}

.ec-workspace__header h2 {
  font-size: clamp(1rem, 1.55vw, 1.25rem);
  letter-spacing: -0.02em;
}

.ec-workspace__header p {
  margin-top: 0.12rem;
  font-size: 0.76rem;
  opacity: 0.84;
}

.ec-workspace__header .ec-workspace__eyebrow {
  margin-bottom: 0.14rem;
  font-size: 0.62rem;
  opacity: 0.7;
}

.ec-workspace__mode {
  border-color: color-mix(in srgb, var(--ec-board-topbar-text) 28%, transparent);
  background: color-mix(in srgb, var(--ec-board-topbar-text) 13%, transparent);
  color: var(--ec-board-topbar-text);
}

.ec-status-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 0.6rem;
  margin: 0;
}

.ec-workspace__header,
.ec-status-strip,
.ec-connect-card {
  animation: ec-workspace-enter 260ms var(--ease-standard) both;
}

.ec-status-strip { animation-delay: 35ms; }
.ec-connect-card { animation-delay: 70ms; }

.ec-status-strip > div.ec-status-card,
.ec-status-strip > .ghost-button,
.ec-connect-card,
.ec-pane {
  border-color: var(--ec-board-line);
  background: var(--ec-board-surface);
  box-shadow: var(--ec-board-shadow);
}

.ec-status-strip > div.ec-status-card {
  padding: 0.68rem 0.78rem;
  border-radius: var(--radius-md);
}

.ec-status-strip > .ghost-button {
  min-width: 6.4rem;
  min-height: auto;
  padding-inline: 0.9rem;
  border-radius: var(--radius-md);
  color: var(--text-primary);
}

.ec-connect-card {
  margin: 0;
  padding: 0.9rem;
  border-radius: var(--radius-md);
}

.ec-rforce-reconnect-notice {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin: 0;
  padding: 0.8rem 0.95rem;
  border: 1px solid color-mix(in srgb, var(--warning) 55%, var(--ec-board-line));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--warning) 12%, var(--ec-board-surface));
  color: var(--text-primary);
  box-shadow: var(--ec-board-shadow);
}

.ec-rforce-reconnect-notice strong,
.ec-rforce-reconnect-notice p {
  display: block;
}

.ec-rforce-reconnect-notice p {
  margin: 0.22rem 0 0;
  color: var(--text-secondary);
}

.ec-rforce-reconnect-notice .ghost-button {
  flex: 0 0 auto;
  margin-left: auto;
}

.ec-rforce-reconnect-notice[hidden] {
  display: none;
}

.ec-layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 0.65rem;
}

.ec-pane {
  padding: 0.95rem;
  border-radius: var(--radius-md);
}

.ec-pane--composer {
  background: var(--ec-board-muted);
  gap: 0.7rem;
}

.ec-pane--composer .ec-create-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 0.65rem 0.85rem;
}

.ec-pane--composer .ec-search {
  gap: 0.38rem;
}

.ec-pane--composer .ec-results:empty {
  display: none;
}

.ec-pane--composer #ec-message {
  min-height: 5.75rem;
  height: 5.75rem;
  resize: vertical;
}

.ec-pane--composer .ec-create-form .filter-field:nth-child(2),
.ec-pane--composer .ec-create-form .form-hint {
  grid-column: 1 / -1;
}

.ec-pane--composer .ec-create-form .actions {
  justify-self: end;
  margin: 0;
}

.ec-pane--composer .ec-create-form .form-hint {
  margin: 0;
  font-size: 0.82rem;
}

.ec-pane--queue {
  min-width: 0;
}

.ec-pane--queue .ec-queue-table {
  width: 100%;
  min-height: 20rem;
}

.ec-pane--queue .ec-queue-table table {
  width: 100%;
  min-width: 52rem;
}

.ec-pane__header {
  border-bottom-color: var(--ec-board-line);
}

.ec-queue-table {
  border-color: var(--ec-board-line);
  border-radius: var(--radius-sm);
  background: var(--ec-board-surface);
}

.ec-queue-table thead th {
  background: var(--ec-board-muted);
  border-bottom-color: var(--ec-board-line);
}

.ec-queue-table tbody tr:hover {
  background: color-mix(in srgb, var(--accent-soft) 70%, transparent);
}

.ec-result,
.ec-write-summary > div,
.ec-write-body,
.ec-confirm-live,
.ec-mention-panel {
  border-color: var(--ec-board-line);
  background: var(--ec-board-surface);
}

@media (max-width: 980px) {
  .ec-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .ec-workspace {
    padding: 0.4rem;
  }

  .ec-workspace__header {
    align-items: flex-start;
  }

  .ec-status-strip {
    grid-template-columns: 1fr 1fr;
  }

  .ec-status-strip > .ghost-button {
    grid-column: 1 / -1;
    min-height: 2.6rem;
  }

  .ec-pane--composer .ec-create-form {
    grid-template-columns: 1fr;
  }

  .ec-pane--composer .ec-create-form .filter-field:nth-child(2),
  .ec-pane--composer .ec-create-form .form-hint {
    grid-column: auto;
  }

  .ec-pane--composer .ec-create-form .actions {
    justify-self: stretch;
  }

  .ec-pane--composer .ec-create-form .actions button {
    width: 100%;
  }
}

/* A disabled review action must communicate unavailable state in both themes,
   not inherit the light-theme black disabled color. */
.ec-workspace .ec-queue-review:disabled {
  opacity: 1;
  color: var(--text-secondary);
  border-color: color-mix(in srgb, var(--ec-board-line) 78%, var(--text-secondary));
  background: color-mix(in srgb, var(--ec-board-muted) 88%, transparent);
  box-shadow: none;
}

body.theme-dark .ec-workspace .ec-queue-review:disabled {
  color: #91a4be;
  border-color: rgba(145, 164, 190, 0.28);
  background: rgba(24, 38, 59, 0.8);
}

.ec-workspace #ec-create-submit:disabled {
  opacity: 1;
  color: var(--text-secondary);
  border: 1px solid color-mix(in srgb, var(--ec-board-line) 78%, var(--text-secondary));
  background: color-mix(in srgb, var(--ec-board-muted) 88%, transparent);
  box-shadow: none;
}

body.theme-dark .ec-workspace #ec-create-submit:disabled {
  color: #91a4be;
  border-color: rgba(145, 164, 190, 0.28);
  background: rgba(24, 38, 59, 0.8);
}

.hr-management,
.hr-import-preview {
  width: min(100%, 1480px);
  margin-inline: auto;
}

.hr-management > .hr-import-preview {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.hr-management-header,
.hr-management-header__actions,
.hr-profile-header,
.hr-profile-header__actions,
.hr-staff-list-heading,
.hr-profile-section__heading,
.hr-time-off-card > div,
.hr-note-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hr-management-header__actions,
.hr-profile-header__actions {
  flex: 0 0 auto;
}

.hr-management-title-group {
  display: grid;
  gap: 6px;
}

.hr-data-scope {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.hr-data-scope__badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 8px;
  border: 1px solid rgba(96, 165, 250, 0.42);
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  font-weight: 700;
  white-space: nowrap;
}

.hr-data-scope__badge[data-status="production"] {
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(20, 184, 166, 0.12);
  color: #5eead4;
}

.hr-status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 10px;
  border: 1px solid rgba(94, 234, 212, 0.45);
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.12);
  color: #5eead4;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.hr-status-badge[data-status="on leave"],
.hr-status-badge[data-status="planned"],
.hr-status-badge[data-status="requested"],
.hr-status-badge[data-status="unknown"] {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}

.hr-status-badge[data-status="inactive"],
.hr-status-badge[data-status="disabled"],
.hr-status-badge[data-status="cancelled"] {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

.hr-directory-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.hr-directory-metric {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.hr-directory-metric strong {
  font-size: 24px;
}

.hr-directory-metric span,
.hr-staff-list-heading span {
  color: var(--muted);
  font-size: 13px;
}

.hr-directory-toolbar {
  display: grid;
  grid-template-columns: minmax(224px, 2fr) repeat(2, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.hr-directory-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.hr-directory-toolbar input,
.hr-directory-toolbar select {
  width: 100%;
}

.hr-directory-empty {
  padding: 32px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.hr-directory-workspace {
  display: grid;
  grid-template-columns: minmax(272px, 0.75fr) minmax(0, 2fr);
  min-height: 544px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-1);
}

.hr-directory-workspace[hidden] {
  display: none;
}

/* HR uses a desktop master/detail workspace: the roster and selected record
   scroll independently so a long record never expands the browser page. */
@media (min-width: 861px) {
  .appShell:has([data-section="hr-management"].panel--active) {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .appShell:has([data-section="hr-management"].panel--active) .mainArea {
    display: grid;
    height: 100%;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  .page-content:has(> [data-section="hr-management"].panel--active),
  .panel[data-section="hr-management"].panel--active {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .page-content:has(> [data-section="hr-management"].panel--active) {
    padding: 16px;
  }

  .panel[data-section="hr-management"].panel--active {
    gap: 12px;
    padding: 16px;
  }

  .panel[data-section="hr-management"] .hr-directory-summary {
    gap: 8px;
    margin: 0;
  }

  .panel[data-section="hr-management"] .hr-directory-metric {
    gap: 0;
    padding: 8px 12px;
  }

  .panel[data-section="hr-management"] .hr-directory-metric strong {
    font-size: 20px;
  }

  .panel[data-section="hr-management"] .hr-directory-toolbar {
    gap: 8px;
    margin: 0;
  }

  .panel[data-section="hr-management"] .hr-directory-workspace {
    flex: 1 1 auto;
    min-height: 0;
    grid-template-columns: minmax(230px, 0.7fr) minmax(0, 1.8fr);
  }

  .panel[data-section="hr-management"] .hr-staff-list-panel,
  .panel[data-section="hr-management"] .hr-staff-profile {
    display: grid;
    min-height: 0;
  }

  .panel[data-section="hr-management"] .hr-staff-list-panel {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .panel[data-section="hr-management"] .hr-staff-list {
    min-height: 0;
    max-height: none;
  }

  .panel[data-section="hr-management"] .hr-staff-profile {
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .panel[data-section="hr-management"] .hr-profile-content {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

.hr-staff-list-panel {
  min-width: 0;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
}

.hr-staff-list-heading {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.hr-staff-list-heading h3,
.hr-profile-header h3,
.hr-profile-header p {
  margin: 0;
}

.hr-staff-list {
  display: flex;
  flex-direction: column;
  max-height: 704px;
  overflow-y: auto;
}

.hr-staff-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.hr-staff-list-item:hover,
.hr-staff-list-item[data-active="true"] {
  border-left-color: var(--accent);
  background: rgba(59, 130, 246, 0.12);
}

.hr-staff-list-item__identity {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hr-staff-list-item__identity strong,
.hr-staff-list-item__identity span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hr-staff-list-item__identity span,
.hr-profile-header p {
  color: var(--muted);
  font-size: 13px;
}

.hr-staff-profile {
  container: hr-staff-profile / inline-size;
  min-width: 0;
  overflow-x: hidden;
}

.hr-profile-header {
  min-height: 80px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.hr-profile-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 20px 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}

.hr-profile-tabs button {
  flex: 1 1 0;
  min-width: max-content;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.hr-profile-tabs button[aria-pressed="true"] {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.hr-profile-content {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.hr-profile-section {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.hr-profile-section h4,
.hr-profile-section p {
  margin-top: 0;
}

.hr-profile-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
  margin: 0;
}

.hr-profile-field-grid div {
  min-width: 0;
}

.hr-profile-field-grid dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.hr-profile-field-grid dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.hr-time-off-list,
.hr-note-list,
.hr-account-list {
  display: grid;
  gap: 10px;
}

.hr-time-off-card,
.hr-note-card {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-1);
}

.hr-time-off-card p,
.hr-note-card p {
  margin: 6px 0;
}

.hr-time-off-card small,
.hr-note-card small,
.hr-team-time-off-card small {
  color: var(--muted);
}

.hr-team-time-off-dialog {
  width: min(92vw, 780px);
  max-height: 90vh;
}

.hr-team-time-off-list {
  display: grid;
  gap: 10px;
  overflow-y: auto;
}

.hr-annual-leave-sheet {
  width: 100%;
  overflow-x: auto;
}

.hr-annual-leave-sheet table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.hr-annual-leave-sheet th,
.hr-annual-leave-sheet td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.hr-team-time-off-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.hr-team-time-off-card__details,
.hr-team-time-off-card__actions {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.hr-team-time-off-card__details p {
  margin: 0;
}

.hr-team-time-off-card__details strong,
.hr-team-time-off-card__details p,
.hr-team-time-off-card__details small {
  overflow-wrap: anywhere;
}

.hr-team-time-off-card__actions {
  justify-items: end;
}

.hr-team-time-off-card__actions button {
  min-height: 40px;
  white-space: normal;
}

.hr-account-list > div {
  display: grid;
  grid-template-columns: minmax(128px, 1fr) minmax(144px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.hr-account-list > div:last-child {
  border-bottom: 0;
}

.hr-profile-empty {
  margin: 0;
  color: var(--muted);
}

.hr-local-editor-dialog {
  width: min(92vw, 640px);
  max-height: 90vh;
  overflow: hidden;
}

.hr-local-editor-dialog form {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.hr-local-editor-dialog .modal__body {
  overflow-y: auto;
}

.hr-local-editor-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.hr-local-editor-fields label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.hr-local-editor-fields label:has(textarea) {
  grid-column: 1 / -1;
}

.hr-local-editor-fields label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.hr-local-editor-fields input,
.hr-local-editor-fields select,
.hr-local-editor-fields textarea {
  width: 100%;
}

.admin-hr-role-templates {
  display: grid;
  gap: 16px;
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.admin-hr-role-template-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.admin-hr-role-template-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-1);
}

.admin-hr-role-template-card > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.admin-hr-role-template-card > div > div {
  display: grid;
  gap: 4px;
}

.admin-hr-role-template-card p {
  margin: 0;
  color: var(--muted);
}

/* The roster/profile split can leave the selected profile narrow even when the
   browser viewport is wide (for example, a half-window at non-default zoom).
   These rules therefore respond to the profile pane itself. */
@container hr-staff-profile (max-width: 560px) {
  .hr-profile-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(140px, 170px);
    grid-template-areas:
      "identity edit"
      "status toggle";
    align-items: start;
    gap: 8px 16px;
  }

  .hr-profile-header__identity {
    grid-area: identity;
    min-width: 0;
  }

  .hr-profile-header__actions {
    display: contents;
  }

  #hr-profile-status {
    grid-area: status;
    align-self: start;
  }

  #hr-edit-staff {
    grid-area: edit;
  }

  #hr-toggle-staff-active {
    grid-area: toggle;
  }

  .hr-profile-header__actions .ghost-button {
    width: 100%;
    max-width: none;
    min-width: 0;
    white-space: normal;
  }

  .hr-profile-tabs {
    padding-inline: 8px;
    overflow-x: hidden;
  }

  .hr-profile-tabs button {
    min-width: 0;
    padding-inline: 6px;
    line-height: 1.2;
    white-space: normal;
  }

  .hr-profile-content {
    overflow-x: hidden;
  }

  .hr-profile-field-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hr-profile-section__heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 12px;
  }

  .hr-profile-section__heading .hr-management-header__actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    width: 100%;
    min-width: 0;
    gap: 10px;
  }

  .hr-profile-section__heading .hr-management-header__actions .ghost-button {
    width: 100%;
    max-width: none;
    min-width: 0;
    white-space: normal;
  }

  .hr-account-list > div {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .hr-account-list > div > :nth-child(2) {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .hr-account-list > div > .hr-status-badge {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
  }
}

@media (max-width: 1200px) {
  .hr-directory-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hr-directory-workspace {
    grid-template-columns: 1fr;
  }

  .hr-staff-list-panel {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .hr-staff-list {
    max-height: 288px;
  }
}

@media (min-width: 701px) and (max-width: 1200px) {
  .hr-directory-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 16px;
  }

  .hr-directory-header .hr-data-scope {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .hr-directory-header .hr-management-header__actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    width: 100%;
    gap: 12px;
  }

  .hr-directory-header .hr-management-header__actions button {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }

}

@media (max-width: 700px) {
  .hr-management-header,
  .hr-profile-header {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
  }

  .hr-profile-header__actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    align-items: stretch;
  }

  .hr-profile-header__actions > * {
    grid-area: auto !important;
  }

  .hr-profile-header__actions .ghost-button {
    width: 100%;
    max-width: none;
  }

  .hr-directory-header .hr-management-header__actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    width: 100%;
    gap: 12px;
  }

  .hr-directory-header .hr-management-header__actions button {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }

  .hr-directory-header .hr-data-scope {
    align-items: flex-start;
  }

  .hr-directory-summary,
  .hr-directory-toolbar,
  .hr-profile-field-grid,
  .hr-local-editor-fields {
    grid-template-columns: 1fr;
  }

  .hr-account-list > div {
    grid-template-columns: 1fr;
  }

  .hr-profile-tabs button {
    flex: 0 0 auto;
    min-width: 132px;
  }

  .hr-team-time-off-card {
    grid-template-columns: 1fr;
  }

  .hr-team-time-off-card__actions {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    justify-items: start;
  }

}

@media (min-width: 1201px) {
  .panel[data-section="hr-management"] .hr-directory-workspace {
    grid-template-columns: minmax(230px, 0.7fr) minmax(0, 1.8fr);
  }
}

.hr-import-safety {
  display: grid;
  gap: 3px;
  margin-bottom: 20px;
  padding: 12px 14px;
  border: 1px solid rgba(56, 189, 163, 0.45);
  border-radius: 10px;
  background: rgba(56, 189, 163, 0.09);
}

.hr-import-form {
  display: grid;
  gap: 18px;
}

.hr-import-file-grid,
.hr-import-option-grid,
.hr-import-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.hr-import-file,
.hr-import-option-grid label {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
}

.hr-import-file span,
.hr-import-option-grid span {
  font-weight: 700;
}

.hr-import-file small {
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.hr-import-actions,
.hr-import-results-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.hr-import-results {
  display: grid;
  gap: 16px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.hr-import-results[hidden] {
  display: none;
}

.hr-import-results-heading h3,
.hr-import-results-heading p {
  margin: 0;
}

.hr-zero-write-badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(56, 189, 163, 0.5);
  border-radius: 999px;
  color: #49cbb0;
  font-weight: 800;
}

.hr-import-summary-card {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
}

.hr-import-summary-card h4 {
  margin: 0;
}

.hr-import-summary-card > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hr-import-summary-card span,
.hr-import-issues-table td[data-tone] {
  padding: 4px 7px;
  border-radius: 6px;
  font-weight: 700;
}

.hr-import-summary-card span[data-tone="accepted"] {
  color: #49cbb0;
  background: rgba(56, 189, 163, 0.12);
}

.hr-import-summary-card span[data-tone="warning"],
.hr-import-issues-table td[data-tone="warning"] {
  color: #e0ad47;
  background: rgba(209, 154, 42, 0.14);
}

.hr-import-summary-card span[data-tone="rejected"],
.hr-import-issues-table td[data-tone="rejected"] {
  color: #ff8d8d;
  background: rgba(220, 75, 75, 0.14);
}

.hr-import-issues-table {
  min-width: 980px;
}

.hr-import-results .table-scroll {
  max-height: min(52vh, 620px);
  overflow: auto;
}

@media (max-width: 760px) {
  .hr-import-file-grid,
  .hr-import-option-grid,
  .hr-import-summary {
    grid-template-columns: 1fr;
  }

  .hr-import-actions,
  .hr-import-results-heading {
    align-items: stretch;
    flex-direction: column;
  }
}

/* User access management: viewport-contained master/detail workspace. */
.appShell:has([data-section="admin"].panel--active) {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.appShell:has([data-section="admin"].panel--active) .mainArea {
  display: grid;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.page-content:has(> [data-section="admin"].panel--active) {
  height: auto;
  max-height: none;
  min-height: 0;
  overflow: hidden;
}

.panel[data-section="admin"] {
  --admin-role-admin: #7c3f95;
  --admin-role-installer: #8a5a00;
  --admin-role-user: #176b63;
  --admin-role-fieldwork: var(--admin-role-user);
  width: min(100%, 1680px);
  margin-inline: auto;
}

body.theme-dark .panel[data-section="admin"] {
  --admin-role-admin: #d0a6e8;
  --admin-role-installer: #f0c66e;
  --admin-role-user: #79d2c5;
}

.panel[data-section="admin"].panel--active {
  height: 100%;
  max-height: none;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.admin-access-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 0;
}

.admin-user-filters {
  display: grid;
  grid-template-columns: minmax(280px, 2fr) minmax(170px, 1fr);
  gap: 12px;
  width: min(100%, 640px);
  min-width: 0;
}

.admin-filter-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.admin-user-filters .latest-search {
  align-items: stretch;
}

.admin-user-filters .latest-search input,
.admin-role-filter-field select {
  min-width: 0;
  min-height: 44px;
  width: 100%;
  box-sizing: border-box;
}

.admin-user-filters .latest-search input {
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  padding: 8px 11px;
}

.admin-filter-field label {
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-role-filter-field select {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  color: var(--text-primary);
  padding: 8px 34px 8px 11px;
}

.admin-toolbar-actions {
  display: grid;
  grid-template-columns: repeat(2, 120px);
  gap: 10px;
}

.admin-control-button {
  display: inline-flex;
  width: 120px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  white-space: nowrap;
}

.admin-access-layout {
  flex: 0 0 auto;
  grid-template-columns: minmax(330px, 5fr) minmax(480px, 7fr);
  height: 58vh;
  min-height: 360px;
  max-height: 720px;
  align-items: stretch;
}

.admin-users-list-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.admin-users-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  align-content: start;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.admin-user-role-group {
  --admin-role-color: var(--admin-role-user);
  display: grid;
  min-width: 0;
}

.admin-user-role-group[data-role="admin"] {
  --admin-role-color: var(--admin-role-admin);
}

.admin-user-role-group[data-role="installer"] {
  --admin-role-color: var(--admin-role-installer);
}

.admin-user-role-group + .admin-user-role-group {
  border-top: 1px solid var(--border);
}

.admin-user-role-group__heading {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--admin-role-color) 8%, var(--surface-muted));
  box-shadow: inset 3px 0 0 var(--admin-role-color);
  color: var(--text-primary);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}

.admin-user-role-group__heading span:last-child {
  min-width: 24px;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--admin-role-color) 30%, var(--border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--admin-role-color) 12%, var(--surface-elevated));
  color: var(--admin-role-color);
  text-align: center;
}

.admin-user-row {
  position: relative;
  border-left: 3px solid transparent;
  padding: 12px 14px 12px 13px;
}

.admin-user-row:hover {
  background: var(--surface-muted);
}

.admin-user-row:focus-visible {
  z-index: 1;
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.admin-user-row[data-role="admin"] {
  --admin-role-color: var(--admin-role-admin);
}

.admin-user-row[data-role="installer"] {
  --admin-role-color: var(--admin-role-installer);
}

.admin-user-row[data-role="user"] {
  --admin-role-color: var(--admin-role-user);
}

.admin-user-row .admin-role-badge {
  border-color: color-mix(in srgb, var(--admin-role-color) 35%, var(--border));
  background: color-mix(in srgb, var(--admin-role-color) 10%, var(--surface-elevated));
  color: var(--admin-role-color);
}

.admin-user-row[data-selected="true"] {
  border-left-color: var(--admin-role-color);
  background: color-mix(in srgb, var(--admin-role-color) 11%, var(--surface-elevated));
  box-shadow: none;
}

.admin-user-detail {
  --admin-role-color: var(--border);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border-top-color: var(--admin-role-color);
}

.admin-user-detail[data-role="admin"] {
  --admin-role-color: var(--admin-role-admin);
}

.admin-user-detail[data-role="installer"] {
  --admin-role-color: var(--admin-role-installer);
}

.admin-user-detail[data-role="user"] {
  --admin-role-color: var(--admin-role-user);
}

.admin-user-detail-heading {
  position: sticky;
  top: -18px;
  z-index: 3;
  margin: -18px -18px 0;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-elevated) 94%, transparent);
  backdrop-filter: blur(10px);
}

.admin-user-detail[data-role]:not([data-role="none"]) .admin-user-detail-heading {
  box-shadow: inset 0 3px 0 var(--admin-role-color);
}

.admin-role-control label {
  --admin-role-option-color: var(--admin-role-user);
}

.admin-role-control label:has(input[value="installer"]) {
  --admin-role-option-color: var(--admin-role-installer);
}

.admin-role-control label:has(input[value="admin"]) {
  --admin-role-option-color: var(--admin-role-admin);
}

.admin-role-control label:has(input:checked) {
  border-color: var(--admin-role-option-color);
  background: color-mix(in srgb, var(--admin-role-option-color) 10%, var(--surface-card));
  box-shadow: inset 0 0 0 1px var(--admin-role-option-color);
}

.admin-user-detail-actions {
  position: sticky;
  bottom: -18px;
  z-index: 3;
  margin: 0 -18px -18px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-elevated) 94%, transparent);
  backdrop-filter: blur(10px);
}

.admin-user-detail-actions .ghost-button,
.admin-user-save-button {
  width: 160px;
  min-width: 160px;
  min-height: 44px;
  white-space: nowrap;
}

.admin-fieldwork-roles {
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--admin-role-fieldwork) 28%, var(--border));
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--admin-role-fieldwork) 6%, var(--surface-elevated));
}

.admin-fieldwork-roles__header {
  align-items: center;
}

.admin-fieldwork-role-card[data-role="fieldwork"]:hover,
.admin-fieldwork-role-card[data-role="fieldwork"]:focus-visible {
  border-color: var(--admin-role-fieldwork);
  background: color-mix(in srgb, var(--admin-role-fieldwork) 9%, var(--surface-elevated));
}

.account-card__body {
  width: 100%;
}

.account-card__identity-row .user-info {
  min-width: 0;
}

.appShell[data-sidebar-collapsed="true"] .account-card__identity-row {
  display: flex;
  justify-content: center;
}

@media (max-width: 1120px) {
  .panel[data-section="admin"].panel--active {
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
  }

  .admin-access-toolbar {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .admin-toolbar-actions {
    justify-content: start;
  }

  .admin-access-layout {
    height: auto;
    min-height: 0;
    max-height: none;
    grid-template-columns: 1fr;
  }

  .admin-users-list-panel {
    height: min(40vh, 440px);
    min-height: 280px;
  }

  .admin-user-detail {
    height: min(58vh, 720px);
    min-height: 360px;
    max-height: none;
  }
}

@media (max-width: 860px) {
  .appShell:has([data-section="admin"].panel--active) {
    display: grid;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }

  .appShell:has([data-section="admin"].panel--active) .mainArea {
    min-height: 0;
    overflow: hidden;
  }

  .page-content:has(> [data-section="admin"].panel--active) {
    height: 100%;
    max-height: none;
    min-height: 0;
    overflow: hidden;
  }

  .panel[data-section="admin"].panel--active {
    height: 100%;
    max-height: 100%;
  }
}

@media (max-width: 720px) {
  .page-content:has(> [data-section="admin"].panel--active) {
    height: 100%;
    max-height: none;
    min-height: 0;
    overflow: hidden;
  }

  .panel[data-section="admin"].panel--active {
    height: 100%;
    max-height: 100%;
  }

  .admin-user-filters {
    grid-template-columns: 1fr;
    min-width: 100%;
  }

  .admin-access-toolbar,
  .admin-access-toolbar .offers-actions {
    width: 100%;
  }

  .admin-toolbar-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-access-toolbar .offers-actions button {
    width: 100%;
  }

  .admin-users-list-panel {
    height: 36vh;
  }

  .admin-user-detail {
    height: 58vh;
  }

  .admin-fieldwork-roles {
    padding: 14px;
  }

  .admin-user-detail-actions .ghost-button,
  .admin-user-save-button {
    width: 100%;
    min-width: 0;
  }

  .admin-fieldwork-roles__header {
    align-items: stretch;
  }

  #admin-fieldwork-role-create {
    width: 100%;
  }
}
