:root {
  --font-family-base: "Roboto", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --color-bg: #f7f8fa;
  --color-bg-strong: #eef2f5;
  --color-surface: #ffffff;
  --color-surface-muted: #f3f5f7;
  --color-surface-raised: #ffffff;
  --color-surface-subtle: #f8fafc;
  --color-text: #17202a;
  --color-heading: #101828;
  --color-muted: #667085;
  --color-subtle: #8a94a3;
  --color-border: #d7dce2;
  --color-accent: #0f766e;
  --color-accent-strong: #115e59;
  --color-accent-soft: #d9f0ec;
  --color-info: #2563eb;
  --color-info-soft: #dbeafe;
  --color-warning: #b45309;
  --color-warning-soft: #fef3c7;
  --color-danger: #dc2626;
  --color-danger-strong: #b91c1c;
  --color-danger-soft: #fee2e2;
  --color-danger-contrast: #ffffff;
  --color-success: #15803d;
  --color-success-strong: #166534;
  --color-success-soft: #dcfce7;
  --color-topbar: #f7f8fa;
  --color-control-bg: #ffffff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow-focus: 0 0 0 3px var(--color-accent-soft);
  --shadow-button: 0 1px 2px rgba(15, 23, 42, 0.12);
  --shadow-button-hover: 0 8px 18px rgba(15, 23, 42, 0.14);
  --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.08);
  --radius-sm: 4px;
  --radius-md: 8px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --sidebar-width: 288px;
  --control-height: 42px;
  --button-height: 34px;
  --button-padding-x: 12px;
}

html[data-theme="sage"] {
  --color-accent: #0f766e;
  --color-accent-strong: #115e59;
  --color-accent-soft: #d9f0ec;
}

html[data-theme="ocean"] {
  --color-accent: #2563eb;
  --color-accent-strong: #1d4ed8;
  --color-accent-soft: #dbeafe;
}

html[data-theme="ruby"] {
  --color-accent: #be123c;
  --color-accent-strong: #9f1239;
  --color-accent-soft: #ffe4e6;
}

html[data-color-mode="dark"] {
  --color-bg: #111827;
  --color-bg-strong: #0b1220;
  --color-surface: #182230;
  --color-surface-muted: #202c3d;
  --color-surface-raised: #1f2937;
  --color-surface-subtle: #111827;
  --color-text: #e5e7eb;
  --color-heading: #f8fafc;
  --color-muted: #a8b3c2;
  --color-subtle: #7c8796;
  --color-border: #334155;
  --color-info: #93c5fd;
  --color-info-soft: #1e3a5f;
  --color-warning: #fbbf24;
  --color-warning-soft: #4a3413;
  --color-danger: #f87171;
  --color-danger-strong: #fca5a5;
  --color-danger-soft: #4c1d1d;
  --color-danger-contrast: #111827;
  --color-success: #4ade80;
  --color-success-strong: #86efac;
  --color-success-soft: #173f2a;
  --color-topbar: #111827;
  --color-control-bg: #111827;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.22);
  --shadow-focus: 0 0 0 3px var(--color-accent-soft);
  --shadow-button: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-button-hover: 0 10px 24px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 14px 36px rgba(0, 0, 0, 0.28);
}

html[data-color-mode="dark"][data-theme="sage"] {
  --color-accent: #2dd4bf;
  --color-accent-strong: #5eead4;
  --color-accent-soft: #123c3a;
}

html[data-color-mode="dark"][data-theme="ocean"] {
  --color-accent: #60a5fa;
  --color-accent-strong: #93c5fd;
  --color-accent-soft: #1e3a5f;
}

html[data-color-mode="dark"][data-theme="ruby"] {
  --color-accent: #fb7185;
  --color-accent-strong: #fda4af;
  --color-accent-soft: #4c1724;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family-base);
  font-size: 15px;
  line-height: 1.5;
}

.auth-shell {
  align-items: center;
  background:
    radial-gradient(circle at top left, var(--color-accent-soft), transparent 34%),
    var(--color-bg);
  display: grid;
  min-height: 100vh;
  padding: var(--space-6);
}

.auth-panel {
  margin: 0 auto;
  max-width: 440px;
  width: 100%;
}

.auth-brand {
  justify-content: center;
  margin-bottom: var(--space-6);
}

.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: var(--space-8);
}

.auth-header {
  margin-bottom: var(--space-6);
  text-align: center;
}

.auth-header h1 {
  color: var(--color-heading);
  font-size: 28px;
  line-height: 1.2;
  margin: 0;
}

.auth-description {
  color: var(--color-muted);
  margin: var(--space-2) 0 0;
}

.auth-form {
  display: grid;
  gap: var(--space-4);
}

.auth-form .form-actions {
  justify-content: stretch;
}

.auth-form .btn {
  width: 100%;
}

.questionnaire-public-card {
  border-radius: var(--radius-md);
}

.auth-panel:has(.questionnaire-public-card) {
  max-width: 1040px;
}

.questionnaire-public-form {
  display: grid;
  gap: var(--space-6);
}

.questionnaire-public-section {
  border-top: 1px solid var(--color-border);
  display: grid;
  gap: var(--space-4);
  padding-top: var(--space-6);
}

.questionnaire-confirmations,
.questionnaire-leaflet-confirmation {
  display: grid;
  gap: var(--space-3);
}

.questionnaire-confirmation {
  justify-content: start;
}

.questionnaire-confirmation a {
  margin-left: var(--space-2);
}

.signature-pad {
  display: grid;
  gap: var(--space-3);
}

.signature-pad-canvas {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
  cursor: crosshair;
  display: block;
  min-height: 180px;
  touch-action: none;
  width: 100%;
}

.signature-pad-actions {
  align-items: center;
  color: var(--color-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: var(--space-3);
  justify-content: space-between;
}

.questionnaire-signature-preview {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: block;
  max-height: 180px;
  max-width: 100%;
  object-fit: contain;
  padding: var(--space-3);
}

.definition-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.definition-grid > div {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.definition-grid dt {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.definition-grid dd {
  color: var(--color-heading);
  margin: 0;
  overflow-wrap: anywhere;
}

.definition-grid-wide {
  grid-column: 1 / -1;
}

.button-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.mfa-setup-body {
  display: grid;
  gap: var(--space-6);
}

.mfa-setup-section {
  display: grid;
  gap: var(--space-4);
}

.mfa-qr-panel {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  justify-content: center;
  padding: var(--space-6);
}

.mfa-qr-svg {
  display: block;
  height: auto;
  max-width: 240px;
  width: 100%;
}

.mfa-qr-svg path {
  fill: #111827;
}

.mfa-manual-setup {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.mfa-manual-setup summary {
  color: var(--color-muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.mfa-manual-setup .form-field {
  margin-top: var(--space-4);
}

.mfa-code-form {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-6);
}

.recovery-code-list {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.recovery-code-list code {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-heading);
  display: block;
  font-size: 13px;
  overflow-wrap: anywhere;
  padding: var(--space-2);
  text-align: center;
}

a {
  color: inherit;
  text-decoration: none;
}

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

input,
select,
textarea {
  -webkit-appearance: none;
  appearance: none;
  color-scheme: light;
}

html[data-color-mode="dark"] input,
html[data-color-mode="dark"] select,
html[data-color-mode="dark"] textarea {
  color-scheme: dark;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.mobile-nav-backdrop,
.btn.mobile-nav-toggle {
  display: none;
}

.app-sidebar {
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  height: 100vh;
  overflow-y: auto;
  padding: var(--space-6);
  position: sticky;
  top: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-wordmark {
  display: block;
  width: auto;
  height: 28px;
  max-width: 150px;
}

.nav-list {
  display: grid;
  gap: var(--space-1);
}

.nav-item {
  border-radius: var(--radius-md);
  color: var(--color-muted);
  display: block;
  font-weight: 600;
  padding: 10px 12px;
}

.nav-item:hover,
.nav-item.is-active {
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
}

.nav-group {
  display: grid;
  gap: var(--space-1);
}

.nav-group summary {
  list-style: none;
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}

.nav-caret {
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
  display: inline-block;
  height: 8px;
  transform: rotate(45deg);
  transition: transform 160ms ease;
  width: 8px;
}

.nav-group[open] > .nav-summary .nav-caret,
.nav-subgroup[open] > .nav-summary .nav-caret {
  transform: rotate(225deg);
}

.nav-subgroup summary {
  list-style: none;
}

.nav-subgroup {
  display: grid;
  gap: var(--space-1);
}

.nav-subgroup summary::-webkit-details-marker {
  display: none;
}

.nav-subitem.nav-subgroup-summary {
  align-items: center;
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
  width: 100%;
}

.nav-subitem.nav-subgroup-summary span:first-child {
  min-width: 0;
}

.nav-sublist {
  border-left: 1px solid var(--color-border);
  display: grid;
  gap: var(--space-1);
  margin-left: 18px;
  padding-left: var(--space-3);
}

.nav-subitem {
  border-radius: var(--radius-md);
  color: var(--color-muted);
  display: block;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 10px;
}

.nav-subitem:hover,
.nav-subitem.is-active {
  background: var(--color-surface-muted);
  color: var(--color-text);
}

.app-main {
  min-width: 0;
}

.app-topbar {
  align-items: center;
  background: var(--color-topbar);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-4);
  padding: var(--space-6) var(--space-8);
  position: sticky;
  top: 0;
  z-index: 30;
}

.section-header h2 {
  color: var(--color-heading);
  margin: 0;
}

.topbar-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
  min-width: 0;
}

.topbar-menu {
  position: relative;
}

.user-menu-button {
  align-items: center;
  background: var(--color-control-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text);
  display: inline-flex;
  font-weight: 800;
  min-height: 38px;
  padding: 8px 14px;
}

.topbar-menu summary {
  list-style: none;
}

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

.menu-trigger {
  border-radius: 999px;
}

.icon-dots,
.icon-dots::before,
.icon-dots::after {
  background: currentColor;
  border-radius: 999px;
  display: inline-block;
  height: 4px;
  width: 4px;
}

.icon-dots {
  position: relative;
}

.icon-dots::before,
.icon-dots::after {
  content: "";
  position: absolute;
  top: 0;
}

.icon-dots::before {
  left: -7px;
}

.icon-dots::after {
  right: -7px;
}

.icon-menu,
.icon-menu::before,
.icon-menu::after {
  background: currentColor;
  border-radius: 999px;
  display: block;
  height: 2px;
  width: 18px;
}

.icon-menu {
  position: relative;
}

.icon-menu::before,
.icon-menu::after {
  content: "";
  left: 0;
  position: absolute;
}

.icon-menu::before {
  top: -6px;
}

.icon-menu::after {
  top: 6px;
}

.topbar-menu-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  display: grid;
  gap: var(--space-4);
  max-width: calc(100vw - (var(--space-4) * 2));
  min-width: 260px;
  padding: var(--space-4);
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-2));
  z-index: 40;
}

.notification-trigger {
  position: relative;
}

.icon-bell {
  border: 2px solid currentColor;
  border-radius: 999px 999px 8px 8px;
  display: inline-block;
  height: 17px;
  position: relative;
  width: 15px;
}

.icon-bell::before {
  background: currentColor;
  border-radius: 999px;
  content: "";
  height: 4px;
  left: 50%;
  position: absolute;
  top: -6px;
  transform: translateX(-50%);
  width: 4px;
}

.icon-bell::after {
  background: currentColor;
  border-radius: 999px;
  bottom: -6px;
  content: "";
  height: 4px;
  left: 50%;
  position: absolute;
  transform: translateX(-50%);
  width: 8px;
}

.notification-badge {
  align-items: center;
  background: var(--color-danger);
  border: 2px solid var(--color-topbar);
  border-radius: 999px;
  color: var(--color-danger-contrast);
  display: inline-flex;
  font-size: 0.68rem;
  font-weight: 900;
  justify-content: center;
  line-height: 1;
  min-height: 18px;
  min-width: 18px;
  padding: 2px 5px;
  position: absolute;
  right: -5px;
  top: -5px;
}

.notification-panel {
  width: min(360px, calc(100vw - (var(--space-4) * 2)));
}

.notification-panel-header {
  align-items: center;
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
}

.notification-list {
  display: grid;
  gap: var(--space-2);
  max-height: min(420px, 70vh);
  overflow: auto;
}

.notification-item {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  color: var(--color-text);
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3);
  text-decoration: none;
}

.notification-item:hover {
  background: var(--color-surface-muted);
}

.notification-item.is-unread {
  border-color: var(--color-primary);
}

.notification-item span,
.notification-item small {
  color: var(--color-muted);
}

.preference-menu-form {
  display: grid;
  gap: var(--space-4);
}

.menu-field {
  display: grid;
  gap: var(--space-2);
}

.menu-switch {
  justify-content: space-between;
}

.menu-logout-form {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-3);
}

.menu-logout-form .btn {
  width: 100%;
}

.menu-action-link {
  border-radius: var(--radius-md);
  color: var(--color-text);
  display: block;
  font-weight: 800;
  padding: var(--space-2) var(--space-3);
  text-decoration: none;
}

.menu-action-link:hover {
  background: var(--color-surface-muted);
}

.create-employee-menu-panel {
  min-width: 180px;
}

.preference-form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.theme-select {
  align-items: center;
  display: inline-flex;
  gap: var(--space-2);
}

.theme-select span,
.switch-label {
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 700;
}

.theme-select select {
  -webkit-appearance: none;
  appearance: none;
  background: var(--color-control-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: pointer;
  height: 38px;
  min-height: 38px;
  padding: 8px 32px 8px 12px;
}

.mode-switch {
  align-items: center;
  cursor: pointer;
  display: inline-flex;
  gap: var(--space-2);
  min-height: 38px;
}

.mode-switch.is-readonly,
.mode-switch:has(input:disabled) {
  cursor: default;
}

.mode-switch input {
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  position: absolute;
}

.switch-track {
  align-items: center;
  background: var(--color-border);
  border-radius: 999px;
  display: inline-flex;
  height: 24px;
  padding: 3px;
  transition: background 160ms ease;
  width: 44px;
}

.switch-thumb {
  background: var(--color-surface);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  display: block;
  height: 18px;
  transition: transform 160ms ease;
  width: 18px;
}

.mode-switch input:checked + .switch-track {
  background: var(--color-accent);
}

.mode-switch input:checked + .switch-track .switch-thumb {
  transform: translateX(20px);
}

.mode-switch input:focus-visible + .switch-track,
.theme-select select:focus-visible,
.btn:focus-visible,
.nav-item:focus-visible,
.nav-subitem:focus-visible {
  outline: 3px solid var(--color-accent-soft);
  outline-offset: 2px;
}

.content {
  padding: var(--space-8);
}

.content-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: flex-start;
  margin-bottom: var(--space-4);
}

.button-group {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
}

.page-messages {
  width: min(380px, calc(100vw - (var(--space-4, 16px) * 2)));
}

.eyebrow {
  color: var(--color-subtle);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 var(--space-1);
  text-transform: uppercase;
}

.btn {
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  gap: var(--space-2);
  justify-content: center;
  line-height: 1.2;
  min-height: var(--button-height);
  padding: 6px var(--button-padding-x);
  position: relative;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
  user-select: none;
}

.btn:hover {
  box-shadow: var(--shadow-button-hover);
  transform: translateY(-1px);
}

.btn:active {
  box-shadow: var(--shadow-button);
  transform: translateY(0);
}

.btn-primary {
  background: var(--color-accent);
  box-shadow: var(--shadow-button);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--color-accent-strong);
}

.btn-secondary {
  background: var(--color-control-bg);
  border-color: var(--color-border);
  box-shadow: var(--shadow-button);
  color: var(--color-text);
}

.btn-secondary:hover {
  background: var(--color-surface-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--color-muted);
}

.btn-ghost:hover {
  background: var(--color-surface-muted);
  box-shadow: none;
  color: var(--color-text);
}

.btn-success {
  background: var(--color-success);
  box-shadow: var(--shadow-button);
  color: #ffffff;
}

.btn-success:hover {
  background: var(--color-success-strong);
}

.btn-warning {
  background: var(--color-warning-soft);
  border-color: transparent;
  box-shadow: none;
  color: var(--color-warning);
}

.btn-warning:hover {
  background: var(--color-warning);
  border-color: var(--color-warning);
  color: #ffffff;
}

.btn-danger {
  background: var(--color-danger);
  box-shadow: var(--shadow-button);
  color: #ffffff;
}

.btn-danger:hover {
  background: var(--color-danger-strong);
}

.btn-outline {
  background: transparent;
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.btn-outline:hover {
  background: var(--color-accent-soft);
}

.btn-icon {
  aspect-ratio: 1;
  min-width: var(--button-height);
  padding: 6px;
}

.btn-icon .icon {
  display: inline-block;
  height: 15px;
  position: relative;
  width: 15px;
}

.icon-plus::before,
.icon-plus::after {
  background: currentColor;
  content: "";
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.icon-plus::before {
  height: 2px;
  width: 14px;
}

.icon-plus::after {
  height: 14px;
  width: 2px;
}

.icon-x::before,
.icon-x::after {
  background: currentColor;
  content: "";
  height: 2px;
  left: 50%;
  position: absolute;
  top: 50%;
  width: 14px;
}

.icon-x::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.icon-x::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.icon-trash::before,
.icon-trash::after {
  background: currentColor;
  content: "";
  position: absolute;
}

.icon-trash::before {
  border-radius: 1px;
  height: 11px;
  left: 4px;
  top: 5px;
  width: 9px;
}

.icon-trash::after {
  box-shadow: 0 3px 0 currentColor;
  height: 2px;
  left: 3px;
  top: 2px;
  width: 11px;
}

.icon-chevron-up,
.icon-chevron-down {
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  display: inline-block;
  height: 8px;
  width: 8px;
}

.icon-chevron-up {
  transform: translateY(2px) rotate(-135deg);
}

.icon-chevron-down {
  transform: translateY(-2px) rotate(45deg);
}

.btn:disabled,
.btn.is-disabled {
  background: var(--color-surface-muted);
  border-color: var(--color-border);
  color: var(--color-subtle);
  cursor: not-allowed;
  opacity: 1;
  transform: none;
}

.btn:disabled:hover,
.btn.is-disabled:hover {
  box-shadow: none;
  transform: none;
}

.stats-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: var(--space-6);
}

.card,
.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.card {
  overflow: visible;
}

.card-header,
.card-body,
.card-footer {
  padding: var(--space-4);
}

.card-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
}

.card-title {
  color: var(--color-heading);
  font-size: 16px;
  font-weight: 800;
  margin: 0;
}

.card-description {
  color: var(--color-muted);
  margin: var(--space-1) 0 0;
}

.text-muted {
  color: var(--color-muted);
}

.detail-list {
  display: grid;
  gap: var(--space-3);
  margin: 0;
}

.detail-list div {
  display: grid;
  gap: var(--space-1);
}

.detail-list dt {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 800;
  margin: 0;
  text-transform: uppercase;
}

.detail-list dd {
  color: var(--color-text);
  margin: 0;
  overflow-wrap: anywhere;
}

.card-footer {
  align-items: center;
  background: var(--color-surface-muted);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
}

.card-compact .card-header,
.card-compact .card-body,
.card-compact .card-footer {
  padding: var(--space-3);
}

.card-accent {
  border-color: var(--color-accent);
}

.card-accent .card-header {
  background: var(--color-accent-soft);
}

.card-action {
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.card-action:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.error-page {
  align-items: center;
  display: grid;
  min-height: min(620px, calc(100vh - 180px));
}

.error-card {
  align-items: center;
  display: grid;
  gap: var(--space-8);
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  margin: 0 auto;
  max-width: 860px;
  padding: var(--space-8);
  width: 100%;
}

.error-status {
  align-items: center;
  aspect-ratio: 1;
  background: var(--color-accent-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-accent-strong);
  display: flex;
  font-size: 46px;
  font-weight: 900;
  justify-content: center;
  line-height: 1;
}

.error-content {
  display: grid;
  gap: var(--space-3);
}

.error-content h2 {
  color: var(--color-heading);
  font-size: 28px;
  line-height: 1.2;
  margin: 0;
}

.error-content p {
  color: var(--color-text);
  margin: 0;
}

.error-hint {
  color: var(--color-muted) !important;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.empty-card {
  align-items: center;
  display: grid;
  gap: var(--space-3);
  justify-items: center;
  min-height: 180px;
  padding: var(--space-6);
  text-align: center;
}

.empty-card-icon {
  align-items: center;
  background: var(--color-accent-soft);
  border-radius: 999px;
  color: var(--color-accent-strong);
  display: inline-flex;
  font-weight: 900;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.modal-preview {
  background: rgba(15, 23, 42, 0.28);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

html[data-color-mode="dark"] .modal-preview {
  background: rgba(0, 0, 0, 0.36);
}

.modal-backdrop {
  align-items: center;
  background: rgba(15, 23, 42, 0.46);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  padding: var(--space-4);
  position: fixed;
  right: 0;
  top: 0;
  z-index: 80;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  margin: 0 auto;
  max-width: 520px;
  overflow: hidden;
}

.modal-wide {
  max-width: 720px;
  width: min(860px, calc(100vw - (var(--space-4) * 2)));
}

.modal-extra-wide {
  max-width: 1280px;
  width: min(1360px, calc(100vw - (var(--space-3) * 2)));
}

#employee-document-history-modal .datatable-body {
  overflow-x: auto;
}

#employee-document-history-modal .datatable {
  min-width: 980px;
}

.modal-overflow-visible {
  overflow: visible;
}

.modal-overflow-visible .modal-body {
  overflow: visible;
}

.document-category-pattern-modal {
  overflow: visible;
}

.document-category-pattern-modal .modal-body {
  min-height: 280px;
  overflow: visible;
}

.modal-header,
.modal-body,
.modal-footer {
  padding: var(--space-4);
}

.modal-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-4);
  justify-content: space-between;
}

.modal-title {
  color: var(--color-heading);
  font-size: 18px;
  font-weight: 800;
  margin: 0;
}

.modal-description {
  color: var(--color-muted);
  margin: var(--space-1) 0 0;
}

.modal-close {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-muted);
  cursor: pointer;
  font-size: 18px;
  height: 34px;
  line-height: 1;
  width: 34px;
}

.modal-close:hover {
  color: var(--color-text);
}

.modal-footer {
  align-items: center;
  background: var(--color-surface-muted);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

.toast-stack {
  display: grid;
  gap: var(--space-3);
}

.toast {
  align-items: flex-start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  transition: opacity 180ms ease, transform 180ms ease;
}

.flash-toast-region {
  bottom: var(--space-4, 16px);
  left: auto;
  pointer-events: none;
  position: fixed;
  right: var(--space-4, 16px);
  top: auto;
  z-index: 1200;
}

.flash-toast-region .toast {
  animation: toast-enter 180ms ease-out;
  pointer-events: auto;
}

.toast.is-dismissing {
  opacity: 0;
  transform: translateX(24px);
}

.toast-content {
  min-width: 0;
}

.toast-icon {
  align-items: center;
  background: var(--color-accent-soft);
  border-radius: 999px;
  color: var(--color-accent-strong);
  display: inline-flex;
  flex: 0 0 auto;
  font-weight: 900;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.toast-title {
  color: var(--color-heading);
  font-weight: 800;
  margin: 0;
}

.toast-close {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--color-muted);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 20px;
  height: 28px;
  justify-content: center;
  line-height: 1;
  margin: -2px -2px 0 auto;
  padding: 0;
  width: 28px;
}

.toast-close:hover,
.toast-close:focus-visible {
  background: var(--color-surface-muted);
  color: var(--color-heading);
}

.toast-message {
  color: var(--color-muted);
  margin: var(--space-1) 0 0;
}

.toast-success {
  border-left-color: var(--color-success);
}

.toast-success .toast-icon {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.toast-warning {
  border-left-color: var(--color-warning);
}

.toast-warning .toast-icon {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.toast-danger {
  border-left-color: var(--color-danger);
}

.toast-danger .toast-icon {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateX(24px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.metric-card {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4);
}

.metric-label,
.metric-meta {
  color: var(--color-muted);
}

.metric-value {
  font-size: 30px;
  line-height: 1.15;
}

.layout-grid {
  align-items: start;
  display: grid;
  gap: var(--space-6);
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
  margin-bottom: var(--space-6);
}

.layout-grid-2 {
  align-items: stretch;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.layout-grid-2 > .card {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.layout-grid-2 > .card > .card-body {
  flex: 1;
}

.company-settings-grid {
  display: grid;
  gap: var(--space-6);
}

.form-page-stack {
  display: grid;
  gap: var(--space-6);
  padding-bottom: 96px;
}

.company-location-list {
  display: grid;
  gap: var(--space-4);
}

.section-footer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-4);
}

.company-detail-page {
  display: grid;
  gap: var(--space-6);
}

.detail-hero-card {
  align-items: center;
  display: flex;
  gap: var(--space-6);
  justify-content: space-between;
  padding: var(--space-6);
}

.detail-hero-main {
  align-items: center;
  display: flex;
  gap: var(--space-4);
  min-width: 0;
}

.company-logo-mark {
  align-items: center;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-strong));
  border-radius: 18px;
  color: #ffffff;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 34px;
  font-weight: 900;
  height: 76px;
  justify-content: center;
  width: 76px;
}

.employee-profile-mark {
  font-size: 42px;
  height: 104px;
  overflow: hidden;
  width: 104px;
}

.employee-profile-mark img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.own-profile-hero-card,
.profile-image-hero-card {
  align-items: stretch;
  gap: 0;
  justify-content: flex-start;
  min-height: 176px;
  overflow: hidden;
  padding: 0;
}

.own-profile-hero-card .own-profile-image-tile,
.profile-image-hero-card .profile-image-tile {
  appearance: none;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  flex: 0 0 clamp(150px, 22vw, 230px);
  font-size: 56px;
  height: auto;
  min-height: 176px;
  padding: 0;
  position: relative;
  width: auto;
}

.own-profile-hero-content,
.profile-image-hero-content {
  align-items: center;
  display: flex;
  flex: 1;
  min-width: 0;
  padding: var(--space-6);
}

.employee-profile-hero-content {
  gap: var(--space-4);
  justify-content: space-between;
}

.own-profile-image-plus,
.profile-image-plus {
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
  color: var(--color-heading);
  display: inline-flex;
  font-size: 24px;
  font-weight: 800;
  height: 44px;
  justify-content: center;
  opacity: 0;
  position: absolute;
  right: var(--space-4);
  transform: translateY(6px);
  transition: opacity 160ms ease, transform 160ms ease;
  width: 44px;
}

.own-profile-image-tile:hover .own-profile-image-plus,
.own-profile-image-tile:focus-visible .own-profile-image-plus,
.profile-image-tile:hover .profile-image-plus,
.profile-image-tile:focus-visible .profile-image-plus {
  opacity: 1;
  transform: translateY(0);
}

.own-profile-image-form .modal-body,
.profile-image-form .modal-body {
  display: block;
}

.detail-hero-card h2 {
  color: var(--color-heading);
  font-size: 30px;
  line-height: 1.1;
  margin: 0;
}

.detail-hero-meta,
.detail-hero-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.detail-hero-meta {
  margin-top: var(--space-3);
}

.detail-hero-actions {
  justify-content: flex-end;
}

.detail-card-grid {
  display: grid;
  gap: var(--space-4);
}

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

.detail-card-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-info-card,
.detail-section-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail-section-card:has(.contract-summary-card),
.detail-section-card:has(.contract-summary-card) .card-body,
.detail-section-card:has(.contract-summary-card) .detail-card-grid {
  overflow: visible;
}

.task-status-card,
.task-status-card .card-body {
  overflow: visible;
}

.detail-info-card .card-body,
.detail-section-card .card-body {
  background: var(--color-surface-muted);
  flex: 1;
}

.detail-value-list {
  display: grid;
  gap: var(--space-3);
}

.detail-value-list-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.inline-help-title {
  align-items: center;
  display: inline-flex;
  gap: var(--space-2);
}

.detail-value,
.detail-value-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4);
}

.detail-value-card {
  gap: var(--space-4);
}

.detail-value span,
.detail-value-card-header span {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-value strong,
.detail-value-card-header strong {
  color: var(--color-text);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.detail-value-card-header {
  align-items: flex-start;
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
}

.contract-overview {
  display: grid;
  gap: var(--space-4);
}

.contract-overview-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.contract-filter-button {
  align-items: center;
  background: var(--color-control-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  gap: var(--space-2);
  min-height: 34px;
  padding: 6px 12px;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.contract-filter-button span {
  background: var(--color-surface-muted);
  border-radius: 999px;
  color: var(--color-text);
  font-size: 12px;
  line-height: 1;
  min-width: 22px;
  padding: 5px 7px;
  text-align: center;
}

.contract-filter-button:hover,
.contract-filter-button.is-active {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
  color: var(--color-accent-strong);
}

.contract-filter-button.is-active span {
  background: var(--color-accent);
  color: #ffffff;
}

.contract-overview-list,
.contract-summary-list {
  display: grid;
  gap: var(--space-4);
}

.contract-summary-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: grid;
  gap: var(--space-4);
  overflow: visible;
  padding: var(--space-4);
  position: relative;
  z-index: 1;
}

.contract-summary-card[hidden] {
  display: none;
}

.contract-summary-card:has(.topbar-menu[open]) {
  z-index: 120;
}

.contract-summary-card-header {
  align-items: flex-start;
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
}

.contract-summary-title {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.contract-summary-title span {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.contract-summary-title strong {
  color: var(--color-heading);
  font-size: 18px;
  overflow-wrap: anywhere;
}

.contract-summary-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.contract-summary-data {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.contract-summary-data-item {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3);
}

.contract-summary-data-item span {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.contract-summary-data-item strong {
  color: var(--color-text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.contract-card-menu {
  flex: 0 0 auto;
}

.contract-card-menu .topbar-menu-panel {
  min-width: 180px;
  right: 0;
  z-index: 140;
}

.datatable-row-menu {
  display: inline-block;
}

.datatable-row-menu .topbar-menu-panel {
  min-width: 190px;
  right: 0;
  z-index: 180;
}

.datatable-row-menu .topbar-menu-panel.is-floating {
  position: fixed;
  right: auto;
  top: auto;
  z-index: 360;
}

.contract-history-card .card-body {
  background: var(--color-surface-muted);
}

.contract-history-timeline {
  display: grid;
  gap: var(--space-4);
  position: relative;
}

.contract-history-item {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 24px minmax(0, 1fr);
  position: relative;
}

.contract-history-item::before {
  background: var(--color-border);
  bottom: calc(-1 * var(--space-4));
  content: "";
  left: 11px;
  position: absolute;
  top: 28px;
  width: 2px;
}

.contract-history-item:last-child::before {
  display: none;
}

.contract-history-marker {
  background: var(--color-accent);
  border: 4px solid var(--color-surface-muted);
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--color-border);
  height: 24px;
  margin-top: var(--space-3);
  width: 24px;
  z-index: 1;
}

.contract-history-item.is-warning .contract-history-marker {
  background: var(--color-warning);
}

.contract-history-item.is-danger .contract-history-marker {
  background: var(--color-danger);
}

.contract-history-content {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: grid;
  gap: var(--space-4);
  padding: var(--space-4);
}

.contract-history-head {
  align-items: flex-start;
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
}

.contract-history-head h3 {
  color: var(--color-heading);
  font-size: 17px;
  margin: var(--space-1) 0 0;
}

.contract-history-date {
  color: var(--color-muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.contract-history-details {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.contract-history-detail {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  display: grid;
  gap: var(--space-1);
  min-height: 62px;
  padding: var(--space-3);
}

.contract-history-detail span {
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.contract-history-detail strong {
  color: var(--color-text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.menu-action {
  border-radius: var(--radius-sm);
  color: var(--color-text);
  display: block;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 10px;
  text-decoration: none;
}

.menu-action-button {
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.menu-action:hover {
  background: var(--color-surface-muted);
}

.menu-action-danger {
  color: var(--color-danger);
}

.menu-action.is-disabled {
  color: var(--color-muted);
  cursor: not-allowed;
}

.datev-settings-layout {
  display: grid;
  gap: var(--space-6);
}

.datev-settings-layout [data-datev-company] {
  scroll-margin-top: 96px;
}

.datev-settings-layout > .datatable-card {
  margin-top: 0;
}

.datev-assignment-table {
  min-width: 860px;
  table-layout: fixed;
}

.datev-assignment-col-location {
  width: 28%;
}

.datev-assignment-col-city {
  width: 20%;
}

.datev-assignment-col-client {
  width: 36%;
}

.datev-assignment-col-action {
  width: 140px;
}

.datev-assignment-table th,
.datev-assignment-table td {
  overflow-wrap: anywhere;
}

.datev-assignment-table .custom-select-trigger {
  min-width: 0;
  width: 100%;
}

.datev-assignment-table [data-selected-label] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payroll-page {
  display: grid;
  gap: var(--space-6);
}

.payroll-selection-grid {
  align-items: end;
}

.payroll-single-form {
  align-items: end;
}

.payroll-single-actions {
  justify-content: flex-start;
  margin-top: 0;
}

.payroll-month-header {
  align-items: end;
  gap: var(--space-4);
}

.payroll-year-form {
  margin-left: auto;
  min-width: 160px;
}

.payroll-year-form .form-field {
  margin: 0;
}

.payroll-empty-selection {
  color: var(--color-muted);
  padding: var(--space-4);
}

.payroll-feedback-body {
  display: grid;
  gap: var(--space-5);
}

.payroll-feedback-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.payroll-feedback-summary span {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  padding: var(--space-2) var(--space-3);
}

.payroll-feedback-group {
  display: grid;
  gap: var(--space-3);
}

.payroll-feedback-group h3 {
  font-size: var(--font-size-base);
  margin: 0;
}

.payroll-feedback-list {
  display: grid;
  gap: var(--space-3);
}

.payroll-feedback-item {
  border: 1px solid var(--color-border);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
}

.payroll-feedback-item-danger {
  border-left-color: var(--color-danger);
}

.payroll-feedback-item-warning {
  border-left-color: var(--color-warning);
}

.payroll-feedback-item-header {
  align-items: center;
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
}

.payroll-feedback-item p {
  margin: 0;
}

.payroll-feedback-meta {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin: 0;
}

.payroll-feedback-meta div {
  display: grid;
  gap: 2px;
}

.payroll-feedback-meta dt {
  color: var(--color-muted);
  font-size: var(--font-size-sm);
}

.payroll-feedback-meta dd {
  margin: 0;
}

.payroll-feedback-recommendation {
  color: var(--color-muted);
}

.payroll-month-table[hidden],
.payroll-month-card[hidden],
.payroll-single-card[hidden],
.payroll-single-panel[hidden] {
  display: none;
}

.btn-sm {
  min-height: 32px;
  padding: 6px 10px;
}

.inline-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.table-action-column {
  text-align: right;
  width: 1%;
}

.action-menu {
  position: relative;
}

.action-menu > summary {
  list-style: none;
}

.action-menu > summary::-webkit-details-marker {
  display: none;
}

.action-menu-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  padding: var(--space-2);
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
}

.datev-modal-full,
.datev-modal-toggle {
  align-items: start;
  grid-column: 1 / -1;
}

.datev-summary-actions {
  align-items: center;
  display: flex;
  gap: var(--space-3);
  margin-left: auto;
}

.detail-location-title {
  color: var(--color-heading);
  font-size: 19px;
  line-height: 1.25;
  margin: 0;
}

.employee-profile-page {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
}

.profile-layout {
  align-items: start;
  display: grid;
  gap: var(--space-4);
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
}

.profile-section-nav {
  display: grid;
  gap: var(--space-3);
  position: sticky;
  top: calc(var(--topbar-height) + var(--space-4));
}

.profile-nav-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3);
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.profile-nav-card:hover,
.profile-nav-card:focus-visible {
  background: var(--color-surface-muted);
  border-color: var(--color-accent);
  transform: translateY(-1px);
}

.profile-nav-card strong {
  color: var(--color-heading);
  font-size: 14px;
}

.profile-nav-card span {
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.4;
}

.profile-nav-card.is-muted {
  border-style: dashed;
}

.profile-section-stack {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

[data-employee-detail-panels] .detail-section-card {
  display: none;
}

[data-employee-detail-panels] .detail-section-card.is-active {
  display: flex;
}

[data-employee-detail-panels] .detail-section-card.is-active,
[data-employee-detail-panels] .detail-section-card.is-active > .card-body {
  overflow: visible;
}

.document-category-stack {
  display: grid;
  gap: var(--space-3);
}

.document-category-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.document-category-card > summary {
  align-items: center;
  color: var(--color-heading);
  cursor: pointer;
  display: flex;
  font-weight: 800;
  gap: var(--space-3);
  justify-content: space-between;
  list-style: none;
  padding: var(--space-3) var(--space-4);
}

.document-category-card > summary::-webkit-details-marker {
  display: none;
}

.document-category-card[open] > summary {
  border-bottom: 1px solid var(--color-border);
}

.document-category-card > .employee-document-datatable,
.document-category-card > .table-responsive,
.document-category-card > .lookup-placeholder {
  border: 0;
  border-radius: 0;
}

.employee-form-layout {
  align-items: start;
  display: grid;
  gap: var(--space-4);
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  padding-bottom: 88px;
}

.employee-form-nav {
  display: grid;
  gap: var(--space-3);
  position: sticky;
  top: calc(var(--topbar-height) + var(--space-4));
}

.employee-form-nav-card {
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  gap: var(--space-3);
  justify-content: space-between;
  min-height: 48px;
  padding: var(--space-3);
  text-align: left;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.employee-form-nav-card:hover,
.employee-form-nav-card:focus-visible,
.employee-form-nav-card.is-active {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
  color: var(--color-heading);
}

.employee-form-nav-card.has-error {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-danger) 34%, transparent);
}

.nav-error-mark {
  align-items: center;
  background: var(--color-danger);
  border-radius: 999px;
  color: #fff;
  display: none;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 900;
  height: 22px;
  justify-content: center;
  line-height: 1;
  width: 22px;
}

.employee-form-nav-card.has-error .nav-error-mark {
  display: inline-flex;
}

.form-control.is-invalid {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-danger) 18%, transparent);
}

.form-field-wide {
  grid-column: 1 / -1;
}

.field-validation-message {
  color: var(--color-danger);
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
}

.employee-form-panels {
  min-width: 0;
}

.employee-form-panel {
  display: none;
}

.employee-form-panel.is-active {
  display: block;
}

.employee-form-layout > .floating-action-bar {
  grid-column: 2;
}

.company-department-builder {
  border-top: 1px solid var(--color-border);
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
}

.company-department-list {
  display: grid;
  gap: var(--space-3);
}

.company-department-entry {
  align-items: end;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.location-card-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
}

.radio-card {
  align-items: center;
  background: var(--color-control-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  gap: var(--space-2);
  min-height: var(--button-height);
  padding: 6px 10px;
}

.radio-card input {
  -webkit-appearance: none;
  appearance: none;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
  height: 22px;
  margin: 0;
  position: relative;
  transition: background-color 160ms ease, border-color 160ms ease;
  width: 40px;
}

.radio-card input::after {
  background: var(--color-muted);
  border-radius: 999px;
  content: "";
  height: 16px;
  left: 2px;
  position: absolute;
  top: 2px;
  transition: background-color 160ms ease, transform 160ms ease;
  width: 16px;
}

.radio-card input:checked {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.radio-card input:checked::after {
  background: #ffffff;
  transform: translateX(18px);
}

.radio-card input:focus-visible {
  outline: 3px solid var(--color-accent-soft);
  outline-offset: 2px;
}

.segmented-control {
  align-items: center;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  display: inline-flex;
  gap: var(--space-1);
  padding: 3px;
  width: fit-content;
}

.segmented-control-compact {
  margin-bottom: var(--space-2);
}

.segment {
  background: transparent;
  border: 0;
  border-radius: calc(var(--radius-sm) - 2px);
  color: var(--color-text-muted);
  cursor: pointer;
  font: inherit;
  font-size: var(--font-size-sm);
  font-weight: 800;
  min-height: 30px;
  padding: 0 var(--space-3);
}

.segment:hover,
.segment:focus-visible {
  color: var(--color-text);
}

.segment:disabled {
  color: var(--color-subtle);
  cursor: not-allowed;
}

.segment:focus-visible {
  outline: 3px solid var(--color-accent-soft);
  outline-offset: 2px;
}

.segment.is-active {
  background: var(--color-accent);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.job-coverage-page,
.job-coverage-stack,
.job-coverage-location-stack,
.job-coverage-job-list {
  display: grid;
  gap: var(--space-4);
}

.job-coverage-company,
.job-coverage-location,
.job-coverage-department {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
}

.job-coverage-company {
  overflow: hidden;
}

.job-coverage-company summary,
.job-coverage-location summary,
.job-coverage-department summary,
.job-collapse summary {
  cursor: pointer;
  list-style: none;
}

.job-coverage-company summary::-webkit-details-marker,
.job-coverage-location summary::-webkit-details-marker,
.job-coverage-department summary::-webkit-details-marker,
.job-collapse summary::-webkit-details-marker {
  display: none;
}

.job-coverage-company-header,
.job-coverage-location-header,
.job-coverage-department-header {
  align-items: center;
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
}

.job-coverage-company-header,
.job-coverage-location-header {
  padding: var(--space-4);
}

.job-coverage-company-header {
  border-bottom: 1px solid var(--color-border);
}

.job-coverage-location-stack {
  padding: var(--space-4);
}

.job-coverage-location {
  background: var(--color-surface);
}

.job-coverage-location-header {
  border-bottom: 1px solid var(--color-border);
}

.job-coverage-company-header h3,
.job-coverage-location-header h4 {
  color: var(--color-heading);
  margin: 0;
}

.job-coverage-department-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: var(--space-4);
}

.job-coverage-department {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
}

.job-coverage-department-header span,
.job-coverage-job span,
.job-hierarchy-node span {
  color: var(--color-muted);
  font-size: 13px;
}

.job-coverage-department-header strong,
.job-coverage-job strong,
.job-hierarchy-node strong {
  color: var(--color-heading);
}

.job-coverage-header-meta,
.job-hierarchy-node-meta {
  align-items: center;
  display: inline-flex;
  gap: var(--space-2);
}

.job-coverage-job {
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: inherit;
  cursor: pointer;
  display: flex;
  gap: var(--space-3);
  font: inherit;
  justify-content: space-between;
  min-height: 58px;
  padding: var(--space-3);
  text-align: left;
  width: 100%;
}

.job-coverage-job:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.job-coverage-job > div,
.job-hierarchy-node > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.job-hierarchy-occupants {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.job-occupant-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 0 var(--space-1);
}

.job-coverage-job + .job-occupant-list {
  margin-top: calc(var(--space-2) * -1);
  padding: 0 var(--space-3) var(--space-2);
}

.job-hierarchy-node + .job-occupant-list {
  padding: 0 var(--space-4);
}

.job-collapse > .job-occupant-list {
  padding: 0 var(--space-4);
}

.job-hierarchy-list {
  display: grid;
  gap: var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}

.job-hierarchy-root {
  gap: var(--space-3);
}

.job-collapse {
  display: grid;
  gap: 0;
}

.job-hierarchy-item {
  display: grid;
  gap: var(--space-3);
}

.job-hierarchy-list .job-hierarchy-list {
  border-left: 1px dashed var(--color-border-strong);
  margin-left: var(--space-4);
  margin-top: var(--space-3);
  padding-left: var(--space-4);
}

.job-hierarchy-node {
  align-items: center;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
  min-height: 62px;
  padding: var(--space-3) var(--space-4);
}

.collapse-caret {
  border-bottom: 2px solid var(--color-muted);
  border-right: 2px solid var(--color-muted);
  display: inline-block;
  flex: 0 0 auto;
  height: 10px;
  transform: rotate(45deg);
  transition: transform 160ms ease;
  width: 10px;
}

details[open] > summary .collapse-caret {
  transform: rotate(225deg);
}

.job-hierarchy-node.is-highlighted {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.section-toolbar {
  align-items: center;
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
}

.section-title {
  color: var(--color-heading);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  margin: 0;
}

.company-card {
  scroll-margin-top: 96px;
}

.location-card {
  min-height: 100%;
}

.section-divider {
  border-top: 1px solid var(--color-border);
  margin: var(--space-6) 0 var(--space-4);
  padding-top: var(--space-4);
}

.stack-list {
  display: grid;
  gap: var(--space-2);
}

.stack-item {
  align-items: center;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
  padding: var(--space-3);
  text-decoration: none;
}

.stack-item:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-sm);
}

.stack-item span:first-child {
  display: grid;
  gap: 2px;
}

.stack-item small {
  color: var(--color-muted);
}

.inline-card-form {
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
}

.panel {
  padding: var(--space-6);
}

.section-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  border-collapse: collapse;
  min-width: 100%;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--color-border);
  padding: 12px;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 700;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.badge {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  gap: var(--space-1);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  min-height: 24px;
  padding: 5px 9px;
}

.badge-neutral {
  background: var(--color-surface-muted);
  border-color: var(--color-border);
  color: var(--color-muted);
}

.badge-info {
  background: var(--color-info-soft);
  color: var(--color-info);
}

.badge-success {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.badge-warning {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.badge-danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.badge-accent {
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
}

.badge-outline {
  background: transparent;
  border-color: currentColor;
  color: var(--color-muted);
}

.badge-dot::before {
  background: currentColor;
  border-radius: 999px;
  content: "";
  height: 7px;
  width: 7px;
}

.alert {
  border-radius: var(--radius-md);
  font-weight: 600;
  margin-top: var(--space-4);
  padding: var(--space-4);
}

.alert-info {
  background: var(--color-info-soft);
  color: #1e40af;
}

.task-list {
  display: grid;
  gap: var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}

.task-list li {
  align-items: center;
  display: flex;
  gap: var(--space-3);
}

.task-check {
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  display: inline-block;
  flex: 0 0 auto;
  height: 18px;
  width: 18px;
}

.form-demo-panel {
  margin-top: var(--space-6);
}

.component-preview-panel {
  margin-top: var(--space-6);
}

.card-preview-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.button-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.badge-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.datatable-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  margin-top: var(--space-6);
  overflow: hidden;
}

.datatable-header {
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-4);
  justify-content: space-between;
  padding: var(--space-6);
}

.datatable-header h2 {
  color: var(--color-heading);
  margin: 0;
}

.datatable-header-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: flex-end;
}

.section-description {
  color: var(--color-muted);
  margin: var(--space-1) 0 0;
}

.datatable-body {
  padding: var(--space-6);
}

.filter-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
  overflow: visible;
}

.filter-summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
  list-style: none;
  min-height: 72px;
  padding: var(--space-4) var(--space-6);
}

.filter-summary::-webkit-details-marker {
  display: none;
}

.filter-summary h2 {
  color: var(--color-heading);
  font-size: 18px;
  line-height: 1.25;
  margin: 0;
}

.filter-summary p {
  color: var(--color-muted);
  margin: var(--space-1) 0 0;
}

.filter-summary-content {
  display: grid;
  gap: 2px;
}

.filter-card[open] .filter-caret {
  transform: rotate(180deg);
}

.filter-caret {
  border-bottom: 2px solid var(--color-muted);
  border-right: 2px solid var(--color-muted);
  flex: 0 0 auto;
  display: inline-block;
  height: 8px;
  transform: rotate(45deg);
  transition: transform 160ms ease;
  width: 8px;
}

.filter-body {
  border-top: 1px solid var(--color-border);
  padding: var(--space-6);
}

.filter-form {
  display: grid;
  gap: var(--space-6);
}

.filter-grid {
  align-items: end;
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.document-template-settings {
  display: grid;
  gap: var(--space-6);
}

.document-template-settings > .filter-card,
.document-template-settings > .datatable-card,
.document-template-settings > .card {
  margin: 0;
}

.document-template-form-section {
  display: grid;
  gap: var(--space-4);
}

.document-template-detail-main-grid {
  align-items: start;
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.document-template-maintenance-card {
  max-width: none;
}

.document-template-maintenance-grid {
  display: grid;
  gap: var(--space-6);
}

.document-preview-backdrop {
  align-items: center;
  background: rgba(2, 6, 23, 0.78);
  bottom: 0;
  display: flex;
  inset-inline: 0;
  justify-content: center;
  padding: var(--space-6);
  position: fixed;
  top: 0;
  z-index: 120;
}

.document-preview-backdrop[hidden] {
  display: none;
}

.document-preview-modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: min(92vh, 1100px);
  max-width: 1180px;
  overflow: hidden;
  width: min(1180px, calc(100vw - (var(--space-6) * 2)));
}

.document-preview-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-6);
  justify-content: space-between;
  padding: var(--space-6);
}

.document-preview-title {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
}

.document-preview-header h3 {
  color: var(--color-heading);
  font-size: 20px;
  margin: 0;
}

.document-preview-header p {
  color: var(--color-muted);
  margin: 0;
}

.document-preview-header .modal-close {
  flex: 0 0 auto;
  margin-left: var(--space-4);
}

.datatable-row-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.document-preview-body {
  background: var(--color-surface-muted);
  overflow: auto;
  padding: var(--space-6);
}

.document-preview-pdf {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  display: block;
  height: 76vh;
  width: 100%;
}

.document-preview-warning {
  align-items: flex-start;
  background: color-mix(in srgb, var(--color-warning) 12%, var(--color-surface));
  border: 1px solid color-mix(in srgb, var(--color-warning) 40%, var(--color-border));
  border-radius: var(--radius-sm);
  color: var(--color-text);
  display: grid;
  gap: var(--space-1);
  margin: 0 auto var(--space-5);
  max-width: 820px;
  padding: var(--space-4);
}

.document-preview-warning strong {
  color: var(--color-heading);
}

.document-preview-warning span {
  color: var(--color-muted);
}

.document-preview-pages {
  display: grid;
  gap: var(--space-6);
}

.document-preview-page {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  display: grid;
  gap: var(--space-5);
  margin: 0 auto;
  max-width: 820px;
  min-height: 980px;
  padding: var(--space-8);
  width: 100%;
}

.document-preview-page-meta {
  border-bottom: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 800;
  padding-bottom: var(--space-3);
  text-transform: uppercase;
}

.document-preview-page-content {
  color: var(--color-text);
  font-family: var(--font-family-base);
  font-size: 14px;
  line-height: 1.65;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.dashboard-page {
  display: grid;
  gap: var(--space-6);
}

.dashboard-page-header {
  align-items: flex-start;
  gap: var(--space-4);
  padding-right: 56px;
  position: relative;
}

.dashboard-page-header > div {
  min-width: 0;
}

.dashboard-page-menu {
  flex: 0 0 auto;
  position: absolute;
  right: 0;
  top: 0;
}

.dashboard-page-menu-panel {
  min-width: 210px;
  right: 0;
  z-index: 160;
}

.dashboard-layout-form {
  display: grid;
  gap: var(--space-4);
}

.dashboard-toolbar {
  align-items: center;
  display: flex;
  gap: var(--space-4);
  justify-content: space-between;
}

.dashboard-edit-actions {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: var(--space-3);
}

.dashboard-toolbar[hidden],
.dashboard-edit-actions[hidden] {
  display: none !important;
}

.dashboard-widget-grid {
  display: grid;
  gap: 0;
  grid-auto-flow: row;
  grid-auto-rows: 56px;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  position: relative;
}

.dashboard-layout-form.is-editing .dashboard-widget-grid {
  background-image: radial-gradient(circle, color-mix(in srgb, var(--color-muted) 52%, transparent) 1.4px, transparent 1.6px);
  background-position: 0 0;
  background-size: calc(100% / 24) 56px;
  border-radius: var(--radius-md);
  padding: 0;
}

.dashboard-widget {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  background-clip: padding-box;
  grid-column: var(--widget-col-start, auto) / span var(--widget-col-span, 12);
  grid-row: var(--widget-row-start, auto) / span var(--widget-row-span, 1);
  margin: var(--space-2);
  min-height: calc((var(--widget-row-span, 1) * 56px) - (var(--space-2) * 2));
  overflow: visible;
  position: relative;
  transition: border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease, transform 160ms ease;
  user-select: auto;
}

.dashboard-widget:hover {
  border-color: color-mix(in srgb, var(--color-accent) 28%, var(--color-border));
  box-shadow: var(--shadow-md);
}

.dashboard-layout-form.is-editing .dashboard-widget {
  cursor: grab;
  grid-column: var(--widget-col-start, auto) / span var(--widget-col-span, 12);
  grid-row: var(--widget-row-start, auto) / span var(--widget-row-span, 1);
  outline: 1px dashed color-mix(in srgb, var(--color-accent) 38%, transparent);
  outline-offset: -5px;
  user-select: none;
}

.dashboard-widget.is-dragging {
  opacity: 0.72;
  transform: scale(0.995);
}

.dashboard-widget.is-resizing {
  box-shadow: var(--shadow-md);
  cursor: nwse-resize;
}

.dashboard-widget-header {
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-3);
  min-height: 50px;
  padding: var(--space-3) var(--space-4);
}

.dashboard-widget-header .card-title {
  flex: 1;
  font-size: 15px;
  line-height: 1.3;
  min-width: 0;
}

.dashboard-widget-info {
  align-items: center;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-muted);
  cursor: help;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 900;
  height: 24px;
  justify-content: center;
  position: relative;
  width: 24px;
}

.dashboard-widget-info:hover,
.dashboard-widget-info:focus {
  background: var(--color-accent-soft);
  border-color: color-mix(in srgb, var(--color-accent) 35%, var(--color-border));
  color: var(--color-heading);
}

.dashboard-widget-info-popover {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  color: var(--color-text);
  display: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  max-width: 260px;
  min-width: 210px;
  padding: var(--space-3);
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-2));
  z-index: 220;
}

.dashboard-widget-info:hover .dashboard-widget-info-popover,
.dashboard-widget-info:focus .dashboard-widget-info-popover {
  display: block;
}

.dashboard-widget > .card-body {
  align-content: space-between;
  display: grid;
  flex: 1;
  gap: var(--space-3);
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  padding: var(--space-4);
}

.dashboard-widget-metric {
  align-content: end;
  display: grid;
  gap: var(--space-2);
  min-height: 0;
}

.dashboard-widget-metric .metric-value {
  font-size: 30px;
  letter-spacing: 0;
  line-height: 1;
}

.dashboard-widget-metric .metric-meta {
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.45;
}

.dashboard-widget-list {
  display: grid;
  gap: var(--space-2);
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  padding-right: var(--space-1);
  scrollbar-gutter: stable;
  scrollbar-color: color-mix(in srgb, var(--color-muted) 55%, transparent) transparent;
  scrollbar-width: thin;
}

.dashboard-widget-list::-webkit-scrollbar {
  width: 10px;
}

.dashboard-widget-list::-webkit-scrollbar-track {
  background: transparent;
}

.dashboard-widget-list::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--color-muted) 35%, transparent);
  border: 3px solid var(--color-surface);
  border-radius: 999px;
}

.dashboard-widget-list:hover::-webkit-scrollbar-thumb,
.dashboard-widget-list:focus-within::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--color-muted) 55%, transparent);
}

.dashboard-widget-list-item {
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: inherit;
  display: grid;
  gap: var(--space-3);
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  text-decoration: none;
}

.dashboard-widget-list-item:hover,
.dashboard-widget-list-item:focus-visible {
  background: var(--color-surface-muted);
  border-color: color-mix(in srgb, var(--color-accent) 28%, var(--color-border));
}

.dashboard-widget-list-copy,
.dashboard-widget-list-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.dashboard-widget-list-copy strong,
.dashboard-widget-list-copy small,
.dashboard-widget-list-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-widget-list-copy strong {
  color: var(--color-heading);
  font-size: 13px;
  line-height: 1.3;
}

.dashboard-widget-list-copy small,
.dashboard-widget-list-meta {
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.3;
}

.dashboard-widget-list-meta {
  justify-items: end;
}

.dashboard-widget-empty {
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
}

.dashboard-widget-drag-hint {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-muted);
  display: none;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.dashboard-layout-form.is-editing .dashboard-widget-drag-hint {
  display: inline-flex;
}

.dashboard-widget-resize {
  background:
    linear-gradient(135deg, transparent 0 45%, var(--color-muted) 46% 52%, transparent 53% 100%),
    linear-gradient(135deg, transparent 0 62%, var(--color-muted) 63% 69%, transparent 70% 100%);
  border: 0;
  bottom: 8px;
  cursor: nwse-resize;
  display: none;
  height: 22px;
  opacity: 0.7;
  padding: 0;
  position: absolute;
  right: 8px;
  width: 22px;
}

.dashboard-layout-form.is-editing .dashboard-widget-resize {
  display: block;
}

.dashboard-widget-resize:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.dashboard-settings-page {
  gap: var(--space-6);
}

.dashboard-settings-page-header {
  align-items: flex-start;
  display: flex;
  gap: var(--space-6);
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.dashboard-settings-page-header > div {
  min-width: 0;
}

.dashboard-settings-page-header .btn {
  flex: 0 0 auto;
}

.dashboard-settings-workspace {
  align-items: start;
  display: grid;
  gap: var(--space-6);
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
}

.dashboard-settings-sidebar {
  overflow: visible;
  position: sticky;
  top: 96px;
}

.dashboard-settings-sidebar .card-header,
.dashboard-settings-sidebar .card-body,
.dashboard-settings-card-header,
.dashboard-settings-card-body {
  padding: var(--space-6);
}

.dashboard-settings-sidebar .card-body {
  display: grid;
  gap: var(--space-3);
}

.dashboard-settings-detail,
.dashboard-settings-form {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

.dashboard-settings-card {
  min-width: 0;
}

.dashboard-settings-card-header {
  align-items: flex-start;
  gap: var(--space-6);
}

.dashboard-settings-card-header > div {
  min-width: 0;
}

.dashboard-settings-section-header {
  align-items: flex-start;
  display: flex;
  gap: var(--space-4);
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.dashboard-settings-section-header > div {
  min-width: 0;
}

.dashboard-settings-section-header .chip {
  flex: 0 0 auto;
}

.dashboard-settings-widget-grid {
  align-items: stretch;
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-settings-widget-option {
  gap: var(--space-4);
  grid-template-columns: minmax(0, 1fr) auto;
  height: 100%;
  min-height: 120px;
  padding: var(--space-5);
}

.dashboard-settings-widget-copy {
  min-width: 0;
}

.dashboard-settings-widget-copy strong {
  line-height: 1.3;
}

.dashboard-settings-widget-copy small {
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.4;
}

.dashboard-settings-actions {
  gap: var(--space-3);
  justify-content: flex-end;
  padding-top: var(--space-2);
}

.dashboard-settings-actions .btn {
  flex: 0 0 auto;
}

.assignment-option.is-disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.floating-action-bar {
  align-items: center;
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  bottom: var(--space-4);
  box-shadow: var(--shadow-md);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  margin-top: var(--space-6);
  padding: var(--space-3);
  position: sticky;
  z-index: 20;
}

.datatable-toolbar {
  align-items: center;
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.document-bulk-download,
.datatable-page-size-control {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.document-bulk-download[hidden] {
  display: none;
}

.document-bulk-download-global {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  padding: var(--space-3);
}

.table-page-size {
  align-items: center;
  background: var(--color-control-bg);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  color: var(--color-text);
  display: inline-flex;
  font-weight: 700;
  gap: var(--space-3);
  height: var(--control-height);
  min-width: 86px;
  padding: 0 14px;
}

.document-selection-control {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  min-height: 34px;
  min-width: 34px;
  margin: 0;
}

.document-selection-input {
  -webkit-appearance: none;
  appearance: none;
  background: var(--color-surface);
  border: 3px solid var(--color-accent);
  border-radius: 7px;
  box-shadow: 0 0 0 3px var(--color-accent-soft);
  cursor: pointer;
  display: grid;
  height: 24px;
  margin: 0;
  place-content: center;
  width: 24px;
}

.datatable th .document-selection-input {
  background: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.document-selection-input:checked {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.datatable th .document-selection-input:checked {
  background: #ffffff;
  border-color: #ffffff;
}

.document-selection-input:checked::after {
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  content: "";
  height: 11px;
  margin-bottom: 2px;
  transform: rotate(45deg);
  width: 6px;
}

.datatable th .document-selection-input:checked::after {
  border-color: var(--color-accent);
}

.document-selection-input:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.document-selection-input:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 4px;
}

.employee-document-datatable .datatable th:first-child,
.employee-document-datatable .datatable td:first-child {
  display: none;
  padding-left: var(--space-3);
  padding-right: var(--space-3);
  text-align: center;
  width: 54px;
}

.employee-document-datatable .datatable th:nth-child(2) {
  border-top-left-radius: 12px;
}

.is-document-download-mode .employee-document-datatable .datatable th:first-child,
.is-document-download-mode .employee-document-datatable .datatable td:first-child {
  display: table-cell;
}

.is-document-download-mode .employee-document-datatable .datatable th:nth-child(2) {
  border-top-left-radius: 0;
}

.sr-only {
  clip: rect(0 0 0 0);
  border: 0;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.toolbar-label {
  color: var(--color-muted);
}

.datatable-scroll {
  overflow-x: auto;
}

.datatable {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1040px;
  width: 100%;
}

.datatable th {
  background: var(--color-accent);
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  padding: 15px 14px;
  text-align: left;
  white-space: nowrap;
}

.datatable-sort {
  align-items: center;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: inherit;
  gap: var(--space-1);
  padding: 0;
  text-align: left;
}

.datatable th:first-child {
  border-top-left-radius: 12px;
}

.datatable th:last-child {
  border-right: 0;
  border-top-right-radius: 12px;
}

.datatable td {
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 17px 10px;
  vertical-align: middle;
}

.datatable tbody tr:hover td {
  background: var(--color-surface-muted);
}

.holiday-region-card {
  margin-top: 0;
}

.holiday-region-card .datatable-header {
  align-items: flex-end;
}

.holiday-year-form {
  flex: 0 0 150px;
  margin-left: auto;
}

.holiday-year-form .form-field {
  margin: 0;
}

.year-picker-select .custom-select-trigger {
  font-weight: 800;
}

.holiday-region-card .datatable-body {
  padding: var(--space-4);
}

.holiday-region-table {
  min-width: 980px;
  table-layout: fixed;
}

.holiday-region-table th,
.holiday-region-table td {
  padding-left: var(--space-3);
  padding-right: var(--space-3);
}

.holiday-region-table td {
  padding-bottom: var(--space-3);
  padding-top: var(--space-3);
}

.holiday-col-region {
  width: 22%;
}

.holiday-col-status {
  width: 14%;
}

.holiday-col-count {
  width: 10%;
}

.holiday-col-import {
  width: 22%;
}

.holiday-col-upload {
  width: 32%;
}

.holiday-region-name {
  color: var(--color-heading);
}

.holiday-import-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.holiday-import-meta strong {
  color: var(--color-heading);
  font-size: 13px;
}

.holiday-import-meta span {
  color: var(--color-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holiday-upload-form {
  align-items: center;
  display: grid;
  gap: var(--space-2);
  grid-template-columns: minmax(0, 1fr) auto;
}

.holiday-upload-form .form-field,
.holiday-upload-form .form-actions {
  grid-column: auto;
  margin: 0;
}

.holiday-upload-form .form-field {
  min-width: 0;
}

.holiday-upload-form .form-actions {
  justify-content: flex-end;
}

.holiday-upload-form .btn {
  min-height: 42px;
}

.permission-matrix td {
  vertical-align: top;
}

.permission-matrix .chip-list {
  justify-content: flex-start;
}

.permission-hero,
.permission-create-card,
.permission-sidebar,
.permission-detail {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.permission-hero {
  align-items: center;
  display: flex;
  gap: var(--space-4);
  justify-content: space-between;
  padding: var(--space-6);
}

.permission-hero h2,
.permission-create-card h2,
.permission-sidebar h2,
.permission-detail h2,
.permission-section h3 {
  color: var(--color-heading);
  margin: 0;
}

.permission-stats {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: var(--space-4);
}

.permission-stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4);
}

.permission-stat span {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.permission-stat strong {
  color: var(--color-heading);
  font-size: 24px;
  line-height: 1.1;
}

.permission-create-card {
  margin-top: var(--space-4);
  padding: var(--space-6);
}

.permission-create-form {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 0.5fr) minmax(220px, 1.4fr) auto;
}

.permission-create-form .form-actions {
  align-self: end;
}

.permission-workspace {
  align-items: start;
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 280px minmax(0, 1fr);
  margin-top: var(--space-4);
}

.permission-sidebar {
  padding: var(--space-4);
  position: sticky;
  top: 96px;
}

.permission-sidebar-header {
  margin-bottom: var(--space-3);
}

.permission-group-list {
  display: grid;
  gap: var(--space-2);
}

.permission-group-item {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.permission-group-item:hover,
.permission-group-item.is-selected {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-button-hover);
  transform: translateY(-1px);
}

.permission-group-item.is-selected {
  background: var(--color-accent-soft);
}

.permission-group-title {
  color: var(--color-heading);
  font-weight: 800;
}

.permission-group-meta,
.permission-empty-note span {
  color: var(--color-muted);
  font-size: 13px;
}

.permission-empty-note {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  display: grid;
  gap: var(--space-1);
  margin-top: var(--space-4);
  padding: var(--space-3);
}

.permission-detail {
  overflow: hidden;
}

.permission-detail-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-4);
  justify-content: space-between;
  padding: var(--space-6);
}

.permission-detail-actions {
  align-items: center;
  display: flex;
  gap: var(--space-2);
}

.permission-assignment-box {
  align-items: center;
  background: var(--color-surface-muted);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
}

.permission-readonly-note {
  align-items: center;
  background: var(--color-surface-muted);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
}

.permission-edit-form {
  display: contents;
}

.permission-edit-card {
  border-bottom: 1px solid var(--color-border);
  display: grid;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
}

.permission-edit-fields {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: minmax(0, 1fr) minmax(120px, 180px) minmax(0, 1fr);
}

.permission-section-list {
  display: grid;
  gap: var(--space-6);
  padding: var(--space-6);
}

.permission-section {
  display: grid;
  gap: var(--space-3);
}

.permission-section-header p {
  color: var(--color-muted);
  margin: var(--space-1) 0 0;
}

.permission-group-card-grid {
  display: grid;
  gap: var(--space-4);
}

.permission-group-card {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: grid;
  gap: var(--space-4);
  padding: var(--space-4);
}

.permission-group-card-header {
  align-items: flex-start;
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
}

.permission-group-card-header h4 {
  color: var(--color-heading);
  font-size: 15px;
  line-height: 1.25;
  margin: 0;
}

.permission-group-card-header p {
  color: var(--color-muted);
  font-size: 13px;
  margin: var(--space-1) 0 0;
}

.permission-tile-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.permission-tile-grid-compact {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.permission-tile {
  align-items: flex-start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
  min-height: 96px;
  padding: var(--space-3);
}

.permission-tile.is-allowed {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
}

.permission-tile.is-blocked {
  border-color: var(--color-border);
}

.permission-tile strong {
  color: var(--color-heading);
}

.permission-key {
  color: var(--color-muted);
  display: inline-flex;
  font-family: "Roboto Mono", "Consolas", monospace;
  font-size: 11px;
  line-height: 1.4;
  margin-top: var(--space-1);
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 0;
}

.permission-tile p {
  color: var(--color-muted);
  font-size: 13px;
  margin: var(--space-1) 0 0;
}

.permission-tile-selectable {
  align-items: flex-start;
  cursor: pointer;
}

.permission-tile-selectable:hover,
.permission-tile-selectable:focus-within {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-button-hover);
}

.permission-tile-selectable > input {
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

.permission-tile-selectable > span {
  display: grid;
  gap: var(--space-1);
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
}

.permission-tile-selectable strong,
.permission-tile-selectable .permission-key,
.permission-tile-selectable p {
  grid-column: 1;
}

.permission-toggle {
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  grid-column: 2;
  grid-row: 1;
  height: 22px;
  margin-top: 1px;
  position: relative;
  transition: background-color 160ms ease, border-color 160ms ease;
  width: 40px;
}

.permission-toggle::after {
  background: var(--color-muted);
  border-radius: 999px;
  content: "";
  height: 16px;
  left: 2px;
  position: absolute;
  top: 2px;
  transition: background-color 160ms ease, transform 160ms ease;
  width: 16px;
}

.permission-tile-selectable.is-checked,
.permission-tile-selectable:has(input:checked) {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
}

.permission-tile-selectable.is-checked .permission-toggle,
.permission-tile-selectable:has(input:checked) .permission-toggle {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.permission-tile-selectable.is-checked .permission-toggle::after,
.permission-tile-selectable:has(input:checked) .permission-toggle::after {
  background: #ffffff;
  transform: translateX(18px);
}

.assignment-option-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.assignment-option-grid-compact {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.assignment-option {
  align-items: flex-start;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr auto;
  min-height: 76px;
  padding: var(--space-4);
  transition: background-color 160ms ease, border-color 160ms ease;
}

.assignment-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.assignment-option strong,
.assignment-option small {
  display: block;
}

.assignment-option small {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  margin-top: var(--space-1);
}

.assignment-option.is-checked,
.assignment-option:has(input:checked) {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
}

.assignment-option.is-checked .permission-toggle,
.assignment-option:has(input:checked) .permission-toggle {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.assignment-option.is-checked .permission-toggle::after,
.assignment-option:has(input:checked) .permission-toggle::after {
  background: #ffffff;
  transform: translateX(18px);
}

.lookup-placeholder {
  align-items: center;
  background: var(--color-surface-subtle);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-muted);
  display: flex;
  justify-content: center;
  min-height: var(--control-height);
  padding: var(--space-3) var(--space-4);
  text-align: center;
  width: 100%;
}

.lookup-placeholder[hidden] {
  display: none;
}

.lookup-placeholder-warning {
  background: color-mix(in srgb, var(--color-danger-soft) 42%, var(--color-surface-subtle));
  border-color: color-mix(in srgb, var(--color-danger) 52%, var(--color-border));
  color: var(--color-danger-strong);
}

.permission-save-bar {
  align-items: center;
  background: var(--color-surface-raised);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  padding: var(--space-4) var(--space-6);
  position: sticky;
  bottom: 0;
  z-index: 5;
}

.sort-indicator {
  display: inline-block;
  height: 13px;
  margin-left: var(--space-2);
  position: relative;
  vertical-align: middle;
  width: 8px;
}

.sort-indicator::before,
.sort-indicator::after {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  content: "";
  left: 0;
  position: absolute;
}

.sort-indicator::before {
  border-bottom: 5px solid rgba(255, 255, 255, 0.42);
  top: 0;
}

.sort-indicator::after {
  border-top: 5px solid rgba(255, 255, 255, 0.42);
  bottom: 0;
}

.sort-indicator.is-active::before {
  border-bottom-color: #ffffff;
}

.sort-indicator.is-active.is-desc::before {
  border-bottom-color: rgba(255, 255, 255, 0.42);
}

.sort-indicator.is-active.is-desc::after {
  border-top-color: #ffffff;
}

.record-id {
  background: var(--color-accent-soft);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-accent-strong);
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  min-width: 38px;
  padding: 6px 10px;
}

.table-link {
  color: var(--color-accent-strong);
  font-weight: 800;
}

.table-link:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip {
  background: var(--color-accent-soft);
  border: 1px solid var(--color-accent);
  border-radius: 999px;
  color: var(--color-accent-strong);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 7px 10px;
  white-space: nowrap;
}

.datatable-footer {
  align-items: center;
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  display: flex;
  gap: var(--space-4);
  justify-content: space-between;
  margin-top: var(--space-6);
  padding-top: var(--space-4);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
}

.page-btn {
  background: var(--color-control-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: pointer;
  font-weight: 700;
  min-height: 36px;
  padding: 7px 12px;
}

.page-btn:hover {
  background: var(--color-surface-muted);
}

.page-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.page-btn:disabled:hover {
  background: var(--color-control-bg);
}

.page-btn.is-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #ffffff;
}

.page-ellipsis {
  cursor: default;
  min-width: 36px;
  text-align: center;
}

.form-grid {
  align-items: start;
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.company-department-entry {
  align-items: start;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
}

.company-department-remove {
  align-self: start;
  grid-column: 3;
  grid-row: 1;
}

.form-field {
  display: grid;
  gap: var(--space-2);
}

.form-field-full {
  grid-column: 1 / -1;
}

.task-checklist-actions {
  align-items: center;
  display: flex;
  justify-content: flex-start;
}

.task-checklist-actions [hidden] {
  display: none;
}

[data-task-autogrow] {
  overflow: hidden;
  resize: none;
}

.task-checklist-group-header,
.task-checklist-row {
  align-items: center;
  display: grid;
  gap: var(--space-2);
  grid-column: 1 / -1;
}

.task-checklist-group-header {
  grid-template-columns: minmax(0, 1fr) auto;
}

.task-checklist-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.task-checklist-toggle {
  align-items: center;
  aspect-ratio: 1;
  background: transparent;
  border: 0;
  display: inline-flex;
  justify-content: center;
  min-height: var(--button-height);
  padding: 0;
  width: var(--button-height);
}

.task-checklist-toggle input {
  appearance: none;
  background: var(--color-control-bg);
  border: 2px solid var(--color-border);
  border-radius: 5px;
  cursor: pointer;
  display: grid;
  height: 18px;
  margin: 0;
  place-content: center;
  width: 18px;
}

.task-checklist-toggle input:checked {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.task-checklist-toggle input:checked::after {
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  content: "";
  height: 9px;
  margin-bottom: 2px;
  transform: rotate(45deg);
  width: 5px;
}

.task-checklist-toggle input:focus-visible {
  outline: 2px solid var(--color-accent-soft);
  outline-offset: 2px;
}

.task-checklist-toggle span {
  margin-left: var(--space-2);
}

.task-checklist-detail-text {
  color: var(--color-text);
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
}

.task-checklist-row .task-checklist-toggle span {
  display: none;
}

.compound-control {
  align-items: stretch;
  display: grid;
  grid-template-columns: minmax(90px, 0.8fr) minmax(130px, 1fr);
}

.compound-control > .form-control {
  border-bottom-right-radius: 0;
  border-top-right-radius: 0;
}

.compound-control .custom-select-trigger {
  border-bottom-left-radius: 0;
  border-left: 0;
  border-top-left-radius: 0;
}

.form-field.is-hidden {
  display: none;
}

.label-row {
  align-items: center;
  display: flex;
  gap: var(--space-2);
}

.field-info {
  align-items: center;
  background: var(--color-accent-soft);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-accent-strong);
  cursor: help;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  height: 20px;
  justify-content: center;
  position: relative;
  width: 20px;
}

.field-popover {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  color: var(--color-text);
  display: none;
  font-size: 13px;
  font-weight: 600;
  left: 50%;
  line-height: 1.4;
  min-width: 220px;
  padding: var(--space-3);
  position: absolute;
  top: calc(100% + var(--space-2));
  transform: translateX(-50%);
  z-index: 50;
}

.field-info:hover .field-popover,
.field-info:focus .field-popover {
  display: block;
}

.form-section {
  border-bottom: 1px solid var(--color-border);
  grid-column: 1 / -1;
  margin-top: var(--space-2);
  padding-bottom: var(--space-2);
}

.form-section-title {
  color: var(--color-heading);
  font-size: 16px;
  margin: 0;
}

.questionnaire-invitation-body {
  display: grid;
  gap: var(--space-6);
}

.questionnaire-invitation-form .form-section {
  display: grid;
  gap: var(--space-4);
  margin-top: 0;
  padding-bottom: var(--space-6);
}

.questionnaire-invitation-form .form-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.form-label {
  color: var(--color-heading);
  font-size: 14px;
  font-weight: 700;
}

.form-label.is-required::after {
  color: var(--color-danger);
  content: " *";
  font-weight: 900;
}

.form-control {
  -webkit-appearance: none;
  appearance: none;
  background: var(--color-control-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 9px 12px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
  width: 100%;
}

.form-control::placeholder {
  color: var(--color-subtle);
  opacity: 1;
}

.form-control:hover {
  border-color: var(--color-muted);
}

.form-control:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
  outline: 0;
}

.form-control:disabled {
  background: var(--color-surface-muted);
  color: var(--color-subtle);
  cursor: not-allowed;
}

.file-upload {
  display: block;
  position: relative;
}

.file-upload input[type="file"] {
  block-size: 1px;
  inline-size: 1px;
  opacity: 0;
  position: absolute;
}

.file-upload-box {
  align-items: center;
  background: var(--color-control-bg);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  gap: var(--space-3);
  min-height: 70px;
  padding: var(--space-4);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.file-upload-box:hover,
.file-upload input[type="file"]:focus-visible + .file-upload-box {
  background: var(--color-surface-muted);
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.file-upload-icon {
  align-items: center;
  background: var(--color-accent-soft);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-md);
  color: var(--color-accent-strong);
  display: inline-flex;
  flex: 0 0 auto;
  height: 38px;
  justify-content: center;
  position: relative;
  width: 38px;
}

.file-upload-icon::before,
.file-upload-icon::after {
  background: currentColor;
  content: "";
  position: absolute;
}

.file-upload-icon::before {
  height: 16px;
  width: 2px;
}

.file-upload-icon::after {
  height: 2px;
  width: 16px;
}

.file-upload-content {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.file-upload-content strong {
  color: var(--color-heading);
  font-size: 14px;
}

.file-upload-content span {
  color: var(--color-muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.file-upload-compact .file-upload-box {
  border-radius: var(--radius-sm);
  border-style: solid;
  gap: var(--space-2);
  min-height: 42px;
  padding: var(--space-2) var(--space-3);
}

.file-upload-compact .file-upload-icon {
  height: 28px;
  width: 28px;
}

.file-upload-compact .file-upload-icon::before {
  height: 12px;
}

.file-upload-compact .file-upload-icon::after {
  width: 12px;
}

.file-upload-compact .file-upload-content {
  align-items: baseline;
  display: flex;
  gap: var(--space-2);
  min-width: 0;
}

.file-upload-compact .file-upload-content strong,
.file-upload-compact .file-upload-content span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select,
.custom-multiselect,
.custom-datepicker {
  display: block;
  position: relative;
}

.custom-select.is-open,
.custom-multiselect.is-open,
.custom-datepicker.is-open {
  z-index: 35;
}

.custom-select-trigger,
.custom-multiselect-trigger,
.custom-date-trigger {
  align-items: center;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  text-align: left;
}

.company-group-combobox-trigger {
  cursor: text;
  gap: var(--space-2);
}

.company-group-combobox-trigger:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.company-group-combobox-input {
  background: transparent;
  border: 0;
  color: var(--color-text);
  flex: 1 1 auto;
  font: inherit;
  min-width: 0;
  outline: 0;
  padding: 0;
}

.company-group-combobox-input::placeholder {
  color: var(--color-subtle);
  opacity: 1;
}

.select-indicator {
  border-bottom: 2px solid var(--color-muted);
  border-right: 2px solid var(--color-muted);
  flex: 0 0 auto;
  height: 9px;
  transform: rotate(45deg);
  transition: transform 160ms ease;
  width: 9px;
}

.custom-select.is-open .select-indicator {
  transform: rotate(225deg);
}

.custom-select-menu,
.custom-multiselect-menu,
.date-popover {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: none;
  left: 0;
  margin-top: var(--space-2);
  max-height: 320px;
  overflow-y: auto;
  padding: var(--space-2);
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 20;
}

.custom-select.is-open .custom-select-menu,
.custom-multiselect.is-open .custom-multiselect-menu,
.custom-datepicker.is-open .date-popover {
  display: grid;
}

.custom-select-search {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font: inherit;
  margin-bottom: var(--space-2);
  min-height: 36px;
  outline: none;
  padding: 8px 10px;
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 1;
  -webkit-appearance: none;
  appearance: none;
}

.custom-select-search:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.custom-select-empty {
  color: var(--color-muted);
  font-size: 13px;
  padding: 8px 10px;
}

.custom-option {
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  cursor: pointer;
  font-weight: 600;
  min-height: 36px;
  padding: 8px 10px;
  text-align: left;
}

.custom-multi-option {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  cursor: pointer;
  display: grid;
  font-weight: 600;
  gap: var(--space-2);
  grid-template-columns: auto 1fr;
  min-height: 38px;
  padding: 8px 10px;
  text-align: left;
}

.custom-multi-check {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  height: 18px;
  position: relative;
  width: 18px;
}

.custom-multi-option.is-selected {
  background: var(--color-accent-soft);
  color: var(--color-text);
}

.custom-multi-clear {
  color: var(--color-muted);
}

.custom-multi-option.is-selected .custom-multi-check {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.custom-multi-option.is-selected .custom-multi-check::after {
  border-bottom: 2px solid #ffffff;
  border-right: 2px solid #ffffff;
  content: "";
  height: 9px;
  left: 6px;
  position: absolute;
  top: 2px;
  transform: rotate(45deg);
  width: 5px;
}

.custom-option.is-scope-hidden,
.custom-multi-option.is-scope-hidden {
  display: none;
}

.custom-option:hover,
.custom-option.is-selected {
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
}

.document-selection-layout {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
}

.document-selection-picker {
  display: grid;
  gap: var(--space-4);
}

.document-selection-basket {
  align-self: start;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
}

.document-selection-basket-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.document-selection-list {
  display: grid;
  gap: var(--space-2);
}

.document-selection-item {
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  display: grid;
  gap: var(--space-3);
  grid-template-columns: minmax(0, 1fr) auto;
  padding: var(--space-3);
}

.document-selection-item strong,
.document-selection-item span {
  overflow-wrap: anywhere;
}

.document-selection-item-meta {
  color: var(--color-muted);
  display: block;
  font-size: 13px;
}

.document-selection-freetext-grid {
  margin-top: var(--space-4);
}

@media (max-width: 760px) {
  .document-selection-layout {
    grid-template-columns: 1fr;
  }
}

.date-indicator {
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-sm);
  flex: 0 0 auto;
  height: 20px;
  position: relative;
  width: 20px;
}

.date-indicator::before,
.date-indicator::after {
  background: var(--color-accent);
  content: "";
  position: absolute;
}

.date-indicator::before {
  height: 2px;
  left: 3px;
  right: 3px;
  top: 6px;
}

.date-indicator::after {
  background:
    linear-gradient(var(--color-accent), var(--color-accent)) 5px 0 / 2px 4px no-repeat,
    linear-gradient(var(--color-accent), var(--color-accent)) 13px 0 / 2px 4px no-repeat;
  height: 6px;
  left: 0;
  right: 0;
  top: -3px;
}

.date-popover {
  min-width: 290px;
  right: auto;
}

.date-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.date-nav {
  align-items: center;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: pointer;
  display: inline-flex;
  font-size: 20px;
  height: 32px;
  justify-content: center;
  line-height: 1;
  width: 32px;
}

.date-nav:hover {
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
}

.date-jump-row {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) 86px;
  margin-bottom: var(--space-3);
}

.custom-datepicker[data-date-mode="month"] .date-jump-row {
  grid-template-columns: minmax(140px, 1fr) 96px;
  margin-bottom: 0;
}

.date-manual-input,
.date-month-select,
.date-year-input {
  -webkit-appearance: none;
  appearance: none;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  height: 38px;
  min-width: 0;
  padding: 0 var(--space-3);
}

.date-month-select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--color-muted) 50%),
    linear-gradient(135deg, var(--color-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 15px) 16px,
    calc(100% - 10px) 16px;
  background-repeat: no-repeat;
  background-size: 5px 5px;
  padding-right: 30px;
}

.date-manual-input:focus,
.date-month-select:focus,
.date-year-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
  outline: none;
}

.date-weekdays,
.date-grid {
  display: grid;
  gap: var(--space-1);
  grid-template-columns: repeat(7, 1fr);
}

.date-weekdays {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: var(--space-1);
  text-align: center;
}

.date-cell {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  height: 34px;
  justify-content: center;
  min-width: 34px;
}

.date-cell:hover {
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
}

.date-cell.is-selected {
  background: var(--color-accent);
  color: #ffffff;
}

.date-cell.is-empty {
  pointer-events: none;
}

.custom-option:focus-visible,
.custom-select-trigger:focus-visible,
.custom-date-trigger:focus-visible,
.date-nav:focus-visible,
.date-cell:focus-visible {
  outline: 3px solid var(--color-accent-soft);
  outline-offset: 2px;
}

.form-help {
  color: var(--color-muted);
  font-size: 13px;
}

.form-help.is-danger {
  color: var(--color-danger);
}

.form-actions {
  align-items: center;
  display: flex;
  gap: var(--space-3);
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.document-import-actions {
  margin-top: var(--space-4);
}

.document-import-page > .filter-card,
.document-import-page > .datatable-card {
  margin: 0;
}

.email-template-form-grid {
  align-items: start;
  display: grid;
  gap: var(--space-6);
  grid-template-columns: minmax(0, 1fr);
}

.email-template-page-header {
  margin-bottom: var(--space-6);
}

.email-template-edit-form,
.email-template-main-card .card-body,
.email-template-canvas-card .card-body {
  display: grid;
  gap: var(--space-5);
}

.email-template-page-form-actions > span {
  display: none;
}

.email-template-page-form-actions {
  padding: var(--space-4) 0 var(--space-2);
}

.questionnaire-template-page-header {
  margin-bottom: var(--space-6);
}

.questionnaire-template-form {
  display: grid;
  gap: var(--space-6);
}

.questionnaire-compliance-options {
  display: grid;
  gap: var(--space-4);
}

.questionnaire-compliance-options .mode-switch {
  align-items: flex-start;
  min-height: 44px;
}

.questionnaire-compliance-options .form-field {
  margin: 0;
}

.questionnaire-template-form [data-conditional-field][hidden],
.questionnaire-template-form:not(:has([name="privacy_ack_required"]:checked)) [data-depends-on="privacy_ack_required"],
.questionnaire-template-form:not(:has([name="pension_exemption_enabled"]:checked)) [data-depends-on="pension_exemption_enabled"] {
  display: none !important;
}

.questionnaire-field-groups {
  display: grid;
  gap: var(--space-6);
}

.questionnaire-field-group {
  display: grid;
  gap: var(--space-4);
}

.questionnaire-field-group h3 {
  color: var(--color-heading);
  font-size: 16px;
  margin: 0;
}

.questionnaire-field-grid {
  align-items: stretch;
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.questionnaire-field-grid .assignment-option {
  height: 100%;
  min-height: 92px;
  min-width: 0;
}

.questionnaire-field-grid .assignment-option > span:first-of-type {
  min-width: 0;
}

.questionnaire-field-grid .assignment-option strong {
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.questionnaire-field-grid .assignment-option small {
  font-size: 11px;
  line-height: 1.25;
}

.email-template-builder {
  display: grid;
  gap: var(--space-3);
}

.email-template-canvas-workspace {
  align-items: start;
  background: color-mix(in srgb, var(--color-surface-muted) 82%, var(--color-border));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: grid;
  gap: var(--space-4);
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr) minmax(240px, 280px);
  min-height: 560px;
  padding: var(--space-4);
}

.email-template-canvas-workspace.is-readonly {
  grid-template-columns: minmax(0, 1fr);
}

.email-template-palette {
  align-self: start;
  display: grid;
  gap: var(--space-2);
  position: sticky;
  top: var(--space-4);
}

.email-template-palette-header {
  color: var(--color-heading);
  font-size: 13px;
}

.email-template-palette-item {
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: grab;
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 34px minmax(0, 1fr);
  font: inherit;
  font-weight: 700;
  min-height: 44px;
  padding: var(--space-2);
  text-align: left;
}

.email-template-palette-icon {
  align-items: center;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-heading);
  display: inline-flex;
  font-size: 13px;
  font-weight: 900;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.email-template-palette-item:hover,
.email-template-palette-item:focus-visible {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
  outline: 0;
}

.email-template-canvas-shell {
  align-content: start;
  align-items: start;
  align-self: start;
  display: grid;
  gap: var(--space-3);
  justify-items: center;
  min-width: 0;
  width: 100%;
}

.email-template-canvas-toolbar {
  align-items: center;
  color: var(--color-muted);
  display: flex;
  font-size: 13px;
  justify-content: space-between;
  max-width: 860px;
  width: 100%;
}

.email-template-canvas-toolbar strong {
  color: var(--color-heading);
}

.email-template-canvas {
  align-self: start;
  background: color-mix(in srgb, var(--color-surface-muted) 82%, #000000 18%);
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: none;
  min-height: 0;
  padding: 24px;
  width: min(100%, 860px);
}

.email-template-canvas.is-mobile {
  width: min(100%, 390px);
}

.email-template-preview-toggle {
  display: flex;
  gap: var(--space-2);
}

.email-template-preview-toggle .btn {
  min-height: 34px;
}

.email-template-preview-toggle .btn.is-active {
  background: var(--color-accent);
  color: #ffffff;
}

.email-template-canvas.is-drop-target {
  box-shadow: none;
}

.email-template-message-frame {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  min-height: 520px;
  overflow: visible;
  width: 100%;
}

.email-template-message-preheader {
  background: var(--color-surface-muted);
  border-bottom: 1px solid var(--color-border);
  height: 36px;
}

.email-template-block-list {
  display: grid;
  gap: 0;
  padding: 0 58px var(--space-5) var(--space-5);
}

.email-template-block {
  background: var(--color-surface);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  position: relative;
  background-position: center;
  background-size: cover;
  transition: border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.email-template-block[draggable="true"] {
  cursor: grab;
}

.email-template-block.is-dragging {
  opacity: 0.45;
}

.email-template-block:hover,
.email-template-block:focus-within,
.email-template-block.is-selected {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.email-template-block-actions {
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: var(--space-1);
  opacity: 0;
  padding: var(--space-1);
  pointer-events: none;
  position: absolute;
  right: -48px;
  top: 50%;
  transform: translateY(-50%);
  transition: opacity 160ms ease;
  z-index: 2;
}

.email-template-block:hover .email-template-block-actions,
.email-template-block:focus-within .email-template-block-actions,
.email-template-block.is-selected .email-template-block-actions {
  opacity: 1;
  pointer-events: auto;
}

.email-template-drag-handle {
  align-items: center;
  color: var(--color-muted);
  cursor: grab;
  display: inline-grid;
  font-weight: 900;
  height: 34px;
  justify-content: center;
  letter-spacing: 0;
  line-height: 1;
  width: 34px;
}

.email-template-block-preview {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-2) 0;
}

[data-email-template-inline] {
  border-radius: var(--radius-sm);
  outline: 0;
  transition: background-color 160ms ease, box-shadow 160ms ease;
}

[data-email-template-inline]:focus {
  background: var(--color-surface-muted);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

[data-email-template-inline].is-empty {
  color: var(--color-muted);
}

.email-preview-heading {
  color: var(--color-heading);
  font-size: 26px;
  font-weight: 900;
  line-height: 1.2;
  white-space: pre-wrap;
}

.email-preview-text {
  color: var(--color-text);
  line-height: 1.65;
  white-space: pre-wrap;
}

.email-preview-button {
  align-self: start;
  background: var(--color-accent);
  border-radius: var(--radius-sm);
  color: #ffffff;
  display: inline-flex;
  font-weight: 800;
  justify-self: start;
  line-height: 1;
  padding: 13px 18px;
}

.email-preview-url {
  color: var(--color-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.email-preview-notice {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  line-height: 1.55;
  padding: var(--space-4);
  white-space: pre-wrap;
}

.email-preview-notice-info {
  background: color-mix(in srgb, var(--color-info-bg, #eff6ff) 86%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-accent) 42%, var(--color-border));
}

.email-preview-notice-success {
  background: color-mix(in srgb, var(--color-success-bg, #f0fdf4) 86%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-success) 42%, var(--color-border));
}

.email-preview-notice-warning {
  background: color-mix(in srgb, var(--color-warning-bg, #fffbeb) 86%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-warning) 42%, var(--color-border));
}

.email-preview-band {
  background: color-mix(in srgb, var(--color-accent-soft) 58%, var(--color-surface));
  border-radius: var(--radius-sm);
  color: var(--color-heading);
  font-weight: 800;
  line-height: 1.5;
  padding: var(--space-4);
  text-align: center;
  white-space: pre-wrap;
}

.email-preview-divider {
  border-top: 1px solid var(--color-border);
  height: 1px;
  margin: var(--space-3) 0;
}

.email-preview-spacer {
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), var(--color-border) calc(50% - 1px), var(--color-border) calc(50% + 1px), transparent calc(50% + 1px));
  min-height: 1px;
}

.email-preview-image-frame {
  background: var(--color-surface-muted);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  display: grid;
  justify-items: center;
  margin: 0;
  min-height: 160px;
  overflow: hidden;
  place-items: center;
}

.email-preview-image {
  display: block;
  height: auto;
  max-width: 100%;
}

.email-preview-image[hidden],
.email-preview-image-frame figcaption[hidden] {
  display: none;
}

.email-preview-image-frame figcaption {
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 800;
  padding: var(--space-5);
}

.email-preview-section {
  align-items: stretch;
  display: grid;
  gap: var(--space-4);
}

.email-preview-section-column {
  background: color-mix(in srgb, var(--color-surface-muted) 54%, transparent);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  min-height: 96px;
  padding: var(--space-2);
}

.email-template-section-block-list {
  min-height: 76px;
  padding: 0;
}

.email-preview-section-30-70 {
  grid-template-columns: minmax(0, 3fr) minmax(0, 7fr);
}

.email-preview-section-50-50 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.email-preview-section-70-30 {
  grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
}

.email-template-canvas.is-mobile .email-preview-section {
  grid-template-columns: minmax(0, 1fr);
}

.email-preview-table {
  border-collapse: collapse;
  color: var(--color-text);
  font-size: 14px;
  table-layout: fixed;
  width: 100%;
}

.email-preview-table td {
  border: 1px solid var(--color-border);
  overflow-wrap: anywhere;
  padding: var(--space-2);
  vertical-align: top;
  white-space: pre-wrap;
}

.email-preview-table td:focus {
  background: var(--color-surface-muted);
  box-shadow: inset 0 0 0 2px var(--color-accent);
  outline: 0;
}

.email-preview-list {
  color: var(--color-text);
  line-height: 1.6;
  margin: 0;
  padding-left: 22px;
}

.email-preview-list li {
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-1);
}

.email-preview-list li:focus {
  background: var(--color-surface-muted);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
  outline: 0;
}

.email-preview-social {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.email-preview-social span {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-heading);
  font-size: 13px;
  font-weight: 800;
  padding: var(--space-2) var(--space-3);
}

.email-template-inspector {
  align-self: start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: var(--space-4);
  min-height: 180px;
  padding: var(--space-4);
  position: sticky;
  top: var(--space-4);
}

.email-template-inspector-empty,
.email-template-inspector-content {
  display: grid;
  gap: var(--space-3);
}

.email-template-inspector-empty {
  color: var(--color-muted);
}

.email-template-inspector-empty strong,
.email-template-inspector-header h3 {
  color: var(--color-heading);
}

.email-template-inspector-empty span {
  font-size: 13px;
  line-height: 1.5;
}

.email-template-inspector-header h3 {
  font-size: 18px;
  margin: 0;
}

.email-template-style-settings {
  display: grid;
  gap: var(--space-3);
}

.email-template-table-actions,
.email-template-table-width-fields {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.email-template-table-actions .btn {
  min-width: 0;
  white-space: normal;
}

.email-template-spacing-sides {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.email-template-spacing-sides-title {
  grid-column: 1 / -1;
}

.email-template-background-preview {
  background-color: var(--color-surface-muted);
  background-position: center;
  background-size: cover;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  display: grid;
  margin: 0;
  min-height: 84px;
  overflow: hidden;
  place-items: center;
}

.email-template-background-preview img {
  display: block;
  height: 100%;
  max-height: 160px;
  object-fit: cover;
  width: 100%;
}

.email-template-inspector-empty[hidden],
.email-template-inspector-content[hidden],
.email-template-inspector [hidden] {
  display: none;
}

.email-template-builder-empty {
  background: var(--color-surface-muted);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  min-height: 140px;
  margin: 0 var(--space-5) var(--space-5);
  width: auto;
}

.email-template-builder-empty[hidden] {
  display: none;
}

@media (max-width: 980px) {
  body.mobile-nav-open {
    overflow: hidden;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .btn.mobile-nav-toggle {
    display: inline-flex;
    flex: 0 0 auto;
  }

  .mobile-nav-backdrop {
    background: rgba(15, 23, 42, 0.42);
    border: 0;
    display: block;
    inset: 0;
    padding: 0;
    position: fixed;
    z-index: 80;
  }

  .mobile-nav-backdrop[hidden] {
    display: none;
  }

  .app-sidebar {
    border-bottom: 0;
    border-right: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    height: 100dvh;
    left: 0;
    max-width: 340px;
    overflow-y: auto;
    position: fixed;
    top: 0;
    transform: translateX(-100%);
    transition: transform 180ms ease;
    width: min(86vw, 340px);
    z-index: 90;
  }

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

  .nav-list {
    grid-template-columns: 1fr;
  }

  .app-topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .topbar-actions {
    flex-wrap: nowrap;
    grid-column: 3;
  }

  .app-topbar .topbar-menu-panel {
    min-width: 0;
    position: fixed;
    right: var(--space-4);
    top: calc(var(--space-4) + 42px);
    width: min(280px, calc(100vw - (var(--space-4) * 2)));
  }

  .user-menu-button {
    max-width: min(30vw, 220px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .stats-grid,
  .layout-grid,
  .permission-stats,
  .permission-workspace,
  .permission-create-form,
  .permission-edit-fields,
  .permission-tile-grid,
  .card-preview-grid,
  .contract-summary-data,
  .detail-card-grid-2,
  .detail-card-grid-3,
  .detail-value-list-2,
  .document-template-detail-main-grid,
  .email-template-form-grid,
  .email-template-canvas-workspace,
  .email-template-block-fields,
  .job-coverage-department-grid,
  .dashboard-settings-workspace,
  .profile-layout,
  .employee-form-layout,
  .form-grid,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .permission-sidebar {
    position: static;
  }

  .dashboard-settings-sidebar {
    position: static;
  }

  .profile-section-nav {
    position: static;
  }

  .employee-form-nav {
    position: static;
  }

  .employee-form-layout > .floating-action-bar {
    grid-column: 1;
  }

  .error-card {
    grid-template-columns: 1fr;
  }

  .document-template-maintenance-card {
    max-width: none;
  }

  .error-status {
    max-width: 160px;
  }

  .questionnaire-field-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .app-sidebar,
  .app-topbar,
  .content {
    padding: var(--space-4);
  }

  .app-topbar,
  .section-header,
  .detail-hero-card,
  .detail-hero-actions,
  .permission-hero,
  .permission-detail-header,
  .permission-detail-actions,
  .permission-assignment-box,
  .permission-readonly-note,
  .permission-edit-card,
  .datatable-header,
  .datatable-footer,
  .filter-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-topbar {
    align-items: center;
  }

  .filter-summary,
  .filter-body {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-content: flex-end;
  }

  .questionnaire-field-grid {
    grid-template-columns: 1fr;
  }

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

  .dashboard-page-header,
  .dashboard-toolbar,
  .dashboard-edit-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-page-menu,
  .dashboard-page-menu .btn,
  .dashboard-edit-actions .btn {
    width: 100%;
  }

  .dashboard-page-header {
    padding-right: 0;
  }

  .dashboard-page-menu {
    position: static;
  }

  .dashboard-page-menu-panel {
    left: 0;
    right: 0;
  }

  .dashboard-widget-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-widget {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .dashboard-settings-page-header,
  .dashboard-settings-card-header,
  .dashboard-settings-section-header,
  .dashboard-settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-settings-page-header .btn,
  .dashboard-settings-actions .btn {
    width: 100%;
  }

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

  .detail-hero-main {
    align-items: flex-start;
    flex-direction: column;
  }

  .own-profile-hero-card,
  .profile-image-hero-card {
    min-height: 0;
  }

  .own-profile-hero-card .own-profile-image-tile,
  .profile-image-hero-card .profile-image-tile {
    flex-basis: auto;
    min-height: 180px;
    width: 100%;
  }

  .own-profile-hero-content,
  .profile-image-hero-content {
    padding: var(--space-5);
    width: 100%;
  }

  .employee-profile-hero-content {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-hero-actions {
    width: 100%;
  }

  .error-card {
    padding: var(--space-6);
  }

  .error-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .document-preview-backdrop {
    padding: var(--space-3);
  }

  .document-preview-modal {
    width: calc(100vw - (var(--space-3) * 2));
  }

  .document-preview-body {
    padding: var(--space-3);
  }

  .document-preview-pdf {
    height: 72vh;
  }

  .document-preview-page {
    min-height: 68vh;
    padding: var(--space-4);
  }

  .document-preview-page-content {
    font-size: 13px;
  }
}
