@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg-app: #0e0e11;
  --bg-panel: #131316;
  --bg-panel-alt: #19191d;
  --bg-hover: #202024;
  --border: #27272c;
  --text-primary: #f1f2f6;
  --text-muted: #8b93a7;
  --accent: #2f6fed;
  --accent-soft: rgba(47, 111, 237, 0.15);
  --danger: #ef5865;
  --success: #35c48b;
  --radius: 14px;
  --input-bg: #e9ecfb;
  --input-ink: #20202b;
  color-scheme: dark;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

:root[data-theme="light"] {
  --bg-app: #f3f3f6;
  --bg-panel: #ffffff;
  --bg-panel-alt: #f6f7fb;
  --bg-hover: #eef0fa;
  --border: #e4e5ef;
  --field-border: #4d5069;
  --text-primary: #1a1a24;
  --text-muted: #6b6d80;
  --accent: #2f6fed;
  --accent-soft: rgba(47, 111, 237, 0.12);
  --input-bg: #eceef1;
  color-scheme: light;
}

:root[data-theme="light"] .sidebar,
:root[data-theme="light"] .stat-card,
:root[data-theme="light"] .login-card,
:root[data-theme="light"] .table-card,
:root[data-theme="light"] .topbar {
  box-shadow: 0 1px 2px rgba(23, 23, 52, 0.04), 0 4px 14px rgba(23, 23, 52, 0.05);
}

:root[data-theme="light"] .dropdown-menu,
:root[data-theme="light"] .row-menu-list,
:root[data-theme="light"] .modal {
  box-shadow: 0 8px 28px rgba(23, 23, 52, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-app);
  color: var(--text-primary);
}

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

/* ---------- Login ---------- */

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}

.login-logo-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}

.login-logo span {
  font-weight: 600;
  font-size: 17px;
}

.login-card h1 {
  font-size: 20px;
  margin: 0 0 6px;
}

.login-card p.subtitle {
  color: var(--text-muted);
  margin: 0 0 24px;
  font-size: 14px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.field input,
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--field-border);
  background: var(--input-bg);
  color: var(--input-ink);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.field textarea {
  resize: vertical;
}

.field-memo-textarea {
  min-height: 220px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-spacing: 1px;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--danger);
}

.btn-primary {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: #1d5bd8;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  margin-top: 6px;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.alert {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 18px;
  transition: opacity 0.3s ease;
}

.alert-fade-out {
  opacity: 0;
}

.alert-error {
  background: rgba(239, 88, 101, 0.12);
  color: #ff8992;
  border: 1px solid rgba(239, 88, 101, 0.3);
}

.login-hint {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ---------- App shell ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease;
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: 76px;
}

.sidebar.collapsed .label,
.sidebar.collapsed .brand-name,
.sidebar.collapsed .badge,
.sidebar.collapsed .chevron,
.sidebar.collapsed .user-meta,
.sidebar.collapsed .submenu,
.sidebar.collapsed .sidebar-toggle-top {
  display: none;
}

.sidebar.collapsed .nav-item,
.sidebar.collapsed .brand,
.sidebar.collapsed .user-card {
  justify-content: center;
}

.sidebar.collapsed .sidebar-header {
  padding: 0 12px;
  justify-content: center;
}

.sidebar-header {
  height: 68px;
  display: flex;
  align-items: center;
  padding: 0 12px 0 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.brand-name {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.brand-name strong {
  font-weight: 800;
}

.brand-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.sidebar-company {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.company-switcher {
  position: relative;
}

.company-switcher-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-panel-alt);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.company-switcher-btn:hover {
  background: var(--bg-hover);
}

.company-switcher-icon {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.company-switcher-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-switcher .dropdown-menu {
  left: 0;
  right: 0;
  width: auto;
  min-width: 0;
  max-height: 260px;
  overflow-y: auto;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 2px;
}

.sidebar.collapsed .company-switcher-name,
.sidebar.collapsed .company-switcher .chevron-down {
  display: none;
}

.sidebar.collapsed .company-switcher-btn {
  justify-content: center;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-toggle-bottom {
  display: none;
  margin: 12px auto 0;
}

.sidebar.collapsed .sidebar-toggle-bottom {
  display: flex;
}

.theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-moon {
  display: flex;
}

.sidebar.collapsed .theme-toggle {
  display: none;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 12px;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-block {
  margin-bottom: 18px;
}

.nav-section-title {
  display: block;
  padding: 0 12px;
  margin-bottom: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar.collapsed .nav-section-title {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(90deg, var(--accent-soft), rgba(47, 111, 237, 0.02));
  color: var(--text-primary);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.nav-item.active .icon {
  color: var(--accent);
}

.nav-item .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.nav-item .label {
  flex: 1;
}

.badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.chevron {
  transition: transform 0.15s ease;
  color: var(--text-muted);
}

.nav-group.open .chevron {
  transform: rotate(180deg);
}

.submenu {
  list-style: none;
  margin: 4px 0 8px;
  padding: 0 0 0 42px;
  display: none;
  flex-direction: column;
  gap: 8px;
}

.nav-group.open .submenu {
  display: flex;
}

.submenu li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.submenu .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.blue { background: #2f6fed; }
.dot.orange { background: #5b9df9; }
.dot.gray { background: #55555f; }

.submenu li.disabled {
  text-decoration: line-through;
  opacity: 0.6;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 4px;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--bg-panel-alt);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5b9df9, #2f6fed);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: #fff;
}

.user-meta {
  flex: 1;
  min-width: 0;
}

.user-meta .name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta .role {
  font-size: 11px;
  color: var(--text-muted);
}

.logout-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}

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

/* ---------- Top bar ---------- */

.topbar {
  height: 68px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 32px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-username {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}

.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

/* ---------- Main content ---------- */

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main-content-inner {
  padding: 32px 40px;
}

.main-content h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.main-content p.subtitle {
  color: var(--text-muted);
  margin: 0 0 28px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card .stat-label {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
}

/* ---------- Employees ---------- */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-title-group h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.page-title-group .subtitle {
  color: var(--text-muted);
  margin: 0;
}

.year-select-form {
  flex-shrink: 0;
}

.year-select {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  appearance: none;
  text-align: center;
}

.alert-success {
  background: rgba(53, 196, 139, 0.12);
  color: var(--success);
  border: 1px solid rgba(53, 196, 139, 0.3);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pills {
  display: flex;
  gap: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}

.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.pill:hover {
  color: var(--text-primary);
}

.pill.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.pill-count {
  font-size: 11px;
  opacity: 0.8;
}

.search-form {
  position: relative;
  display: flex;
  align-items: center;
}

.search-form .search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  display: flex;
}

.search-form input {
  padding: 9px 14px 9px 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  min-width: 240px;
}

.search-form input:focus {
  border-color: var(--accent);
}

.btn-ghost {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.btn-ghost:hover {
  background: var(--bg-hover);
}

.btn-ghost[hidden] {
  display: none;
}

.btn-inline {
  width: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  font-size: 13px;
  margin-top: 0;
}

.btn-inline[hidden] {
  display: none;
}

.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 190px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  padding: 6px;
  display: none;
  z-index: 20;
}

.dropdown.open .dropdown-menu {
  display: block;
}

.chevron-down {
  transition: transform 0.15s ease;
}

.dropdown.open .chevron-down {
  transform: rotate(180deg);
}

.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
}

.dropdown-item:hover {
  background: var(--bg-hover);
}

.dropdown-item-danger {
  color: var(--danger);
}

.dropdown-item.active {
  background: var(--bg-hover);
}

/* Custom select dropdown (styled like the Import dropdown) */

.field-select-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--field-border);
  background: var(--input-bg);
  color: var(--input-ink);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.field-select-toggle:focus {
  outline: none;
  border-color: var(--accent);
}

.field-select-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-select.disabled .field-select-toggle {
  opacity: 0.5;
  cursor: not-allowed;
}

.field-select .dropdown-menu {
  position: fixed;
  min-width: 0;
}

.field-select-native {
  display: none;
}

.table-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

.col-check {
  width: 36px;
}

.col-actions {
  width: 44px;
  text-align: right;
}

.employee-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.employee-name,
.company-name {
  font-weight: 600;
}

.employee-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* TEMPORAL: etiqueta del escenario de prueba del Pay (employees.test_scenario) */
.employee-scenario {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #111827;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-active {
  background: rgba(53, 196, 139, 0.14);
  color: var(--success);
}

.badge-inactive {
  background: rgba(138, 138, 151, 0.16);
  color: var(--text-muted);
}

.row-menu {
  position: relative;
  display: flex;
  justify-content: flex-end;
}

.row-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  padding: 6px;
  display: none;
  z-index: 20;
}

.row-menu-list.open {
  display: block;
}

.empty-row td {
  padding: 40px 16px;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Modal */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 16, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

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

.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 17px;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fields-mode-dropdown .dropdown-menu {
  min-width: 130px;
}

.modal-overlay.basic-mode [data-optional] {
  display: none !important;
}

.check-employee-title {
  font-weight: 400;
  color: var(--text-muted);
}

.check-employee-title:not(:empty)::before {
  content: " \2014 ";
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background-color: var(--accent);
  background-clip: padding-box;
}

.form-section {
  margin-bottom: 18px;
}

.form-section:last-child {
  margin-bottom: 0;
}

.form-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.form-grid-2col {
  grid-template-columns: repeat(2, 1fr);
}

.field-span-2 {
  grid-column: span 2;
}

.field-span-3 {
  grid-column: span 3;
}

.tax-setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 28px;
}

.tax-setup-col {
  min-width: 0;
}

.w4-step-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px 2px;
  margin-top: 4px;
  background: var(--bg-panel-alt);
}

/* Wizard */

.modal-wizard {
  max-width: 780px;
}

.wizard-progress {
  height: 1px;
  background: var(--accent-soft);
  flex-shrink: 0;
  overflow: hidden;
}

.wizard-progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 0 999px 999px 0;
  transition: width 0.3s ease;
}

.modal-wizard .modal-body {
  min-height: 460px;
  padding-left: 40px;
  padding-right: 40px;
}

.modal-small {
  max-width: 420px;
}

.modal-deduction-taxes {
  max-width: 720px;
}

.deduction-taxes-scroll {
  overflow-x: auto;
}

.deduction-taxes-table th,
.deduction-taxes-table th:last-child,
.deduction-taxes-table td {
  text-align: center;
  white-space: nowrap;
}

.deduction-taxes-table th:first-child,
.deduction-taxes-table td:first-child {
  text-align: left;
}

.deduction-tax-settings-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-muted);
}

.wizard-step-title {
  margin: 0 0 16px;
  font-size: 20px;
}

.form-subsection-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin: 20px 0 10px;
}

.form-subsection-title:first-of-type {
  margin-top: 8px;
}

.label-muted {
  color: var(--text-muted);
  font-size: 12px;
}

.field-checkbox {
  display: flex;
  align-items: center;
}

.field-checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  white-space: nowrap;
}

.field-checkbox.has-error label {
  color: var(--danger);
}

.field-checkbox-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  min-height: 44px;
}

.field input:disabled,
.field select:disabled,
.field-checkbox-inline input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.field-checkbox-inline:has(input:disabled) {
  color: var(--text-muted);
}

.field-checkbox-group {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.field-label-block {
  font-weight: 600;
  margin-right: 4px;
}

.field-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-bottom: 6px;
}

.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.field-with-button {
  display: flex;
  gap: 10px;
  align-items: center;
}

.field-with-button select,
.field-with-button input,
.field-with-button .field-select {
  flex: 1;
}

.field-with-button input[type="text"] {
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--field-border);
  background: var(--input-bg);
  color: var(--input-ink);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.field-with-button input[type="text"]:focus {
  border-color: var(--accent);
}

.field-with-button .btn-inline {
  white-space: nowrap;
  width: auto;
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 420px;
  overflow-y: auto;
}

.category-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}

.category-row:last-child {
  border-bottom: none;
}

.category-checkbox {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.category-calc-type {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 90px;
}

.category-rate {
  width: 110px;
}

.wizard-footer {
  justify-content: space-between;
}

.wizard-footer #cancelEmployeeModal,
.wizard-footer #cancelCompanyModal {
  margin-right: auto;
}

.simple-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
}

.simple-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.simple-list li:last-child {
  border-bottom: none;
}

.simple-list .icon-btn {
  width: 26px;
  height: 26px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
}

.modal-footer .btn-primary {
  width: auto;
  margin-top: 0;
  padding: 10px 22px;
}

/* Check Details modal */

.modal-check {
  max-width: 880px;
}

.modal-check .modal-body {
  min-height: 420px;
}

.field select {
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--field-border);
  background: var(--input-bg);
  color: var(--input-ink);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.field select:focus {
  border-color: var(--accent);
}

/* --- Check modal: step-by-step flow --- */

.check-body {
  background: var(--bg-panel);
}

.check-flow {
  max-width: 720px;
  margin: 0 auto;
}

.check-intro {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.check-card {
  /* stronger outline than the generic --border so each step reads as its own block */
  --check-border: #3f3f4b;
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--check-border);
  border-radius: 12px;
  margin-bottom: 36px;
}

:root[data-theme="light"] .check-card {
  --check-border: #b7bbd2;
}

.check-card:last-child {
  margin-bottom: 0;
}

.check-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-panel-alt);
  border-bottom: 1px solid var(--check-border);
  border-radius: 12px 12px 0 0;
}

.check-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.check-step-plain {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 15px;
}

.check-card-heading {
  flex: 1;
  min-width: 0;
}

.check-card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.check-card-sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-muted);
}

.check-card-sub strong {
  color: var(--text-primary);
  font-weight: 600;
}

.check-card-sub .check-warning-icon {
  vertical-align: -3px;
}

.check-card-aside {
  display: flex;
  align-items: center;
  align-self: flex-end;
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.check-card-body {
  padding: 14px;
  overflow-x: auto;
}

.check-card-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.check-card-link:hover {
  color: var(--accent);
}

/* Collapsible sub-sections */

.check-sub {
  border-top: 1px solid var(--check-border);
}

.check-sub-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  border-radius: 0 0 12px 12px;
}

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

.check-sub-summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
  margin-left: 2px;
}

.check-sub[open] > .check-sub-summary::before {
  transform: rotate(45deg);
}

.check-sub-summary:hover {
  color: var(--accent);
}

.check-sub-summary:hover::before {
  border-color: var(--accent);
}

.check-sub-tag {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
}

.check-sub-body {
  padding: 0 14px 14px;
  overflow-x: auto;
}

.check-sub-note {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-muted);
}

.check-memo-view {
  margin: 0;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary, #1f2937);
}

/* Glossary of terms modal */

.modal-glossary {
  max-width: 560px;
}

.glossary-section + .glossary-section {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--border, #e5e7eb);
}

.glossary-section-title {
  margin: 0 0 14px;
  padding-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.glossary-list {
  margin: 0;
}

.glossary-list dt {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary, #1f2937);
}

.glossary-list dd {
  margin: 2px 0 10px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-muted);
}

.glossary-list dd:last-child {
  margin-bottom: 0;
}

/* "Explicar" modal: step-by-step math behind the check */

.modal-footer-split {
  justify-content: space-between;
}

/* Sits on top of the memo popup it is opened from. */
#checkExplainModal {
  z-index: 110;
}

/* Same lift as the memo popup it is opened from. */
#checkExplainModal .modal {
  box-shadow: 0 10px 40px rgba(10, 10, 16, 0.35), 0 0 0 1px var(--border);
}

.modal-explain {
  max-width: 620px;
}

.explain-intro {
  margin: 0 0 20px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
}

.explain-group + .explain-group {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.explain-group-title {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.explain-card {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-panel-alt);
}

.explain-card + .explain-card {
  margin-top: 10px;
}

.explain-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.explain-card-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.explain-card-amount {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.explain-steps {
  margin: 10px 0 0;
  padding-left: 18px;
}

.explain-steps li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-muted);
}

.explain-steps li:last-child {
  margin-bottom: 0;
}

.explain-steps li::marker {
  color: var(--text-muted);
  font-size: 11px;
}

.explain-step-text {
  flex: 1 1 auto;
}

.explain-step-value {
  flex: 0 0 auto;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.explain-note {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

.explain-note-warn {
  color: var(--danger);
}

/* Draggable popups (memo, glossary) */

.modal-header-draggable {
  cursor: move;
  user-select: none;
}

/* Memo, Glossary and Explicar are reference popups meant to sit alongside the
   Pay modal for comparison, so they skip the dark backdrop and let clicks
   pass through to whatever is behind them. */
#checkMemoModal,
#checkGlossaryModal,
#checkExplainModal {
  background: transparent;
  pointer-events: none;
}

#checkMemoModal .modal,
#checkGlossaryModal .modal,
#checkExplainModal .modal {
  pointer-events: auto;
  box-shadow: 0 10px 40px rgba(10, 10, 16, 0.35), 0 0 0 1px var(--border);
}

/* Optional extras block */

.check-card-extras > .check-extras-summary {
  cursor: pointer;
  list-style: none;
  border-radius: 12px;
}

.check-card-extras[open] > .check-extras-summary {
  border-radius: 12px 12px 0 0;
}

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

.check-extras-summary:hover .check-card-title {
  color: var(--accent);
}

.check-extras-body {
  display: grid;
  gap: 18px;
}

.check-extras-block .check-subhead {
  margin-bottom: 8px;
}

.check-extras-note {
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}

/* Summary card */

.check-card-summary {
  --check-border: rgba(53, 196, 139, 0.55);
}

.check-card-summary .check-card-head {
  background: rgba(53, 196, 139, 0.1);
}

.check-card-summary .check-step {
  background: var(--success);
}

.check-sign {
  display: inline-block;
  width: 14px;
  color: var(--text-muted);
  font-weight: 700;
}

.check-empty {
  display: none;
  margin: 0;
  padding: 10px 2px 2px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.check-card-body:has(.check-table tbody:empty) .check-empty {
  display: block;
}

.check-card-body:has(.check-table tbody:empty) .check-table thead {
  opacity: 0.55;
}

/* Step 1 fields */

.check-general-grid {
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 0;
}

.check-general-grid .field {
  margin-bottom: 0;
}

.check-general-grid .field input {
  background: #fff;
}

.check-freq-label {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.check-freq-label strong {
  color: var(--text-primary);
}

/* Tables */

.check-subhead {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

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

.check-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 0;
}

.check-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.check-table th:last-child {
  text-align: right;
}

.check-table td {
  padding: 7px 8px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.check-table tbody tr:last-child td {
  border-bottom: none;
}

.check-table-compact td:first-child {
  color: var(--text-muted);
}

.check-type-label {
  color: var(--text-muted);
  font-size: 12px;
}

.check-ytd {
  color: var(--text-muted);
  text-align: right;
}

.check-mini-input,
.check-table input[type="number"],
.check-table input[type="text"] {
  width: 100%;
  max-width: 100px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--field-border);
  background: var(--input-bg);
  color: var(--input-ink);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.check-table input:focus {
  border-color: var(--accent);
}

.check-table input:disabled {
  opacity: 1;
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
  padding-left: 0;
}

.check-amount-static {
  font-weight: 500;
}

.check-tax-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.check-warning-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(239, 158, 39, 0.16);
  color: #ef9e27;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  cursor: help;
}

/* OBBBA fields */

.obbba-fields {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}

.obbba-fields .field {
  margin-bottom: 0;
  min-width: 220px;
}

.obbba-help {
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

/* Summary table */

.check-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.check-summary-table th {
  text-align: right;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.check-summary-table th:first-child {
  text-align: left;
}

.check-summary-table td {
  padding: 8px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

.check-summary-table td:first-child {
  text-align: left;
  color: var(--text-muted);
}

.check-summary-net td {
  font-weight: 700;
  font-size: 16px;
  border-bottom: none;
  color: var(--success);
  padding-top: 12px;
}

.check-summary-net td:first-child {
  color: var(--text-primary);
}

/* Footer with live net pay */

.check-footer {
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.check-footer .btn-primary {
  padding: 9px 16px;
  border: 1px solid transparent;
}

.check-footer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-success {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: #1e9e6a;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.btn-success:hover {
  filter: brightness(1.06);
}

@media (max-width: 900px) {
  .check-general-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .check-card-head {
    flex-wrap: wrap;
  }

  .check-card-aside {
    width: 100%;
    justify-content: flex-start;
    padding-left: 36px;
  }
}

/* Toast */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--text-primary);
  color: var(--bg-app);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 720px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .sidebar.collapsed {
    width: 100%;
  }

  .main-content-inner {
    padding: 24px;
  }

  .topbar {
    padding: 0 16px;
  }

  .topbar-username {
    display: none;
  }

  .toolbar-left,
  .toolbar-right {
    width: 100%;
  }

  .search-form input {
    min-width: 0;
    width: 100%;
  }

  .form-grid,
  .tax-setup-grid {
    grid-template-columns: 1fr;
  }

  .field-span-2,
  .field-span-3 {
    grid-column: span 1;
  }

  .modal-wizard {
    max-width: 100%;
  }

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

  .data-table {
    min-width: 640px;
  }
}

/* Remove number input spinners app-wide */
input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ---------- Onboarding ---------- */

.onboarding-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
}

.onboarding-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
}

.onboarding-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
}

.onboarding-brand img {
  border-radius: 6px;
}

.onboarding-help {
  font-size: 13px;
  color: var(--accent);
  text-decoration: underline;
}

.onboarding-progress {
  height: 4px;
  background: var(--border);
}

.onboarding-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.25s ease;
}

.onboarding-main {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 56px 24px 40px;
}

.onboarding-step {
  width: 100%;
  max-width: 560px;
}

.onboarding-step-label {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.onboarding-question-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.onboarding-clear-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: underline;
}

.onboarding-question {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.35;
}

.onboarding-question-hint {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 24px;
  line-height: 1.5;
}

.onboarding-step .field {
  margin-top: 24px;
}

.onboarding-step .field label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.onboarding-step .field input {
  max-width: 320px;
  margin-top: 10px;
}

/* Welcome / done screens */

.onboarding-step-welcome,
.onboarding-step-done {
  max-width: 480px;
}

.onboarding-welcome {
  text-align: center;
  padding-top: 24px;
}

.onboarding-welcome-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  overflow: hidden;
}

.onboarding-welcome-icon-success {
  color: var(--success);
}

.onboarding-welcome h1 {
  font-size: 26px;
  margin: 0 0 12px;
}

.onboarding-welcome-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 28px;
}

.onboarding-step-welcome .btn-primary,
.onboarding-step-done .btn-primary {
  width: auto;
  padding: 12px 28px;
}

/* Radio list (plain rows) */

.radio-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.radio-option {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 12px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
}

.radio-option:hover {
  background: var(--bg-hover);
}

.radio-option input[type="radio"] {
  accent-color: var(--accent);
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.radio-option-hint {
  flex-basis: 100%;
  margin-left: 27px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Radio cards (bordered boxes) */

.radio-card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.radio-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
}

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

.radio-card input[type="radio"] {
  accent-color: var(--accent);
  width: 17px;
  height: 17px;
}

.onboarding-subquestion {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.onboarding-subquestion h3 {
  font-size: 16px;
  margin: 0 0 12px;
}

/* Tag input (state multi-select) */

.tag-input {
  position: relative;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.tag-input-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 12px;
  border-radius: 999px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  font-size: 13px;
}

.tag-pill button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px;
}

.tag-input-field {
  flex: 1;
  min-width: 140px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--input-ink);
  font-size: 14px;
  font-family: inherit;
  padding: 6px 4px;
}

.tag-input-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  padding: 6px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 20;
}

.tag-input-suggestion {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
}

.tag-input-suggestion:hover {
  background: var(--bg-hover);
}

/* Footer actions */

.onboarding-actions {
  max-width: 560px;
  margin: 32px auto 0;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.onboarding-actions .btn-ghost,
.onboarding-actions .btn-primary {
  width: auto;
  padding: 11px 26px;
  margin-top: 0;
}

@media (max-width: 640px) {
  .onboarding-header {
    padding: 16px 20px;
  }

  .onboarding-main {
    padding: 32px 20px;
  }

  .onboarding-question {
    font-size: 19px;
  }
}

/* ---------- Onboarding: Add payroll details (sidebar-step layout) ---------- */

.payroll-ob-shell {
  min-height: 100vh;
  background: var(--bg-app);
  display: flex;
  flex-direction: column;
}

.payroll-ob-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
}

.payroll-ob-header-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.payroll-ob-header-title h1 {
  font-size: 21px;
  font-weight: 700;
  margin: 0;
}

.payroll-ob-faq-btn {
  width: auto;
}

.payroll-ob-body {
  flex: 1;
  display: flex;
  align-items: flex-start;
}

.payroll-ob-steps {
  width: 260px;
  flex-shrink: 0;
  padding: 32px 20px;
}

.payroll-ob-steps-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 14px 4px;
}

.payroll-ob-step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 10px 8px;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  font-family: inherit;
}

.payroll-ob-step-item:hover {
  background: var(--bg-hover);
}

.payroll-ob-step-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.payroll-ob-step-item.current {
  color: var(--text-primary);
  font-weight: 600;
}

.payroll-ob-step-item.current .payroll-ob-step-circle {
  border-color: var(--accent);
}

.payroll-ob-step-item.complete .payroll-ob-step-circle {
  border-color: var(--accent);
  background: var(--accent);
}

.payroll-ob-content {
  flex: 1;
  padding: 40px 48px 60px;
}

.payroll-ob-content h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 12px;
}

.payroll-ob-copy {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 24px;
  max-width: 640px;
}

.payroll-ob-copy a {
  color: var(--accent);
  text-decoration: underline;
}

.payroll-ob-question {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
}

.payroll-ob-question-hint {
  margin: 0 0 16px !important;
}

.payroll-ob-step .field {
  max-width: 480px;
}

.payroll-ob-checkbox {
  min-height: auto;
}

.payroll-ob-checkbox input[type="checkbox"] {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
}

.payroll-ob-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
}

.payroll-ob-actions .btn-ghost,
.payroll-ob-actions .btn-primary {
  width: auto;
  padding: 11px 26px;
  margin-top: 0;
}

.setup-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 8px 0 24px;
  max-width: 640px;
  background: var(--bg-panel);
}

.setup-card h3 {
  font-size: 17px;
  margin: 12px 0 8px;
}

.setup-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 18px;
}

.setup-card .btn-primary {
  width: auto;
  padding: 11px 22px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.payroll-ob-manual-link {
  max-width: 640px;
}

/* Pay schedule detail screen */

.schedule-recommend {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  border-radius: var(--radius);
  background: rgba(53, 196, 139, 0.12);
  border: 1px solid rgba(53, 196, 139, 0.3);
  font-size: 15px;
  font-weight: 600;
  margin: 8px 0 28px;
}

.schedule-recommend-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--success);
  color: var(--success);
  flex-shrink: 0;
}

.schedule-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 40px;
  align-items: start;
}

.schedule-summary h3 {
  font-size: 17px;
  margin: 0 0 8px;
}

.schedule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  max-width: 480px;
  font-size: 14px;
}

.schedule-row span:first-child {
  font-weight: 600;
}

.schedule-row span:last-child {
  color: var(--text-muted);
}

.schedule-edit-btn {
  width: 100%;
  max-width: 480px;
  justify-content: center;
  margin-top: 20px;
}

.schedule-calendar-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  padding: 20px;
}

.schedule-calendar-title {
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 14px;
}

.schedule-calendar-month {
  font-weight: 700;
  font-size: 14px;
  margin: 0 0 8px;
}

.schedule-calendar-table {
  width: 100%;
  border-collapse: collapse;
}

.schedule-calendar-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 0;
}

.schedule-calendar-table tr {
  border-top: 2px solid var(--border);
}

.schedule-calendar-table thead tr {
  border-top: none;
}

.cal-day {
  position: relative;
  text-align: center;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
}

.cal-day-muted {
  color: var(--text-muted);
  font-weight: 400;
}

.cal-day-period {
  background: var(--bg-hover);
}

.cal-day-deadline {
  background: rgba(239, 88, 101, 0.18);
  color: var(--danger);
}

.cal-day-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
}

.cal-day-holiday::before {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-primary);
}

.schedule-legend {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.schedule-legend li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
}

.legend-deadline {
  background: rgba(239, 88, 101, 0.35);
}

.legend-payday {
  background: var(--accent);
}

.legend-period {
  background: var(--bg-hover);
  border: 1px solid var(--border);
}

.legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-primary);
  flex-shrink: 0;
  margin: 0 5px;
}

@media (max-width: 900px) {
  .schedule-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  .payroll-ob-body {
    flex-direction: column;
  }

  .payroll-ob-steps {
    width: 100%;
    padding: 20px 24px 0;
  }

  .payroll-ob-content {
    padding: 24px 24px 48px;
  }
}

/* ---------- Help and Tutorials ---------- */

.help-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 16px;
}

.help-card {
  display: flex;
  gap: 16px;
  padding: 22px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.help-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.help-card-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.help-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.help-card-title {
  font-size: 16px;
  font-weight: 700;
}

.help-card-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.help-card-link {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.help-back {
  display: inline-block;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.help-back:hover {
  text-decoration: underline;
}

.help-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.help-toc {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.help-toc-title {
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.help-toc a {
  overflow-wrap: anywhere;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-primary);
  text-decoration: none;
}

.help-toc a:hover {
  background: #e5e7eb;
  color: #000;
}

.help-toc a.is-active,
.help-toc a.is-active:hover {
  background: #e5e7eb;
  color: #000;
  font-weight: 700;
}

.help-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 880px;
}

.help-note {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  font-size: 14px;
  line-height: 1.55;
}

.help-section {
  padding: 24px 26px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  scroll-margin-top: 20px;
}

.help-section h2 {
  margin: 0 0 12px;
  font-size: 19px;
}

.help-section h3 {
  margin: 20px 0 8px;
  font-size: 15px;
}

.help-section p {
  margin: 0 0 10px;
}

.help-section ul,
.help-section ol {
  margin: 0 0 12px;
  padding-left: 22px;
}

.help-section li {
  margin-bottom: 5px;
}

.help-section a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.help-formula {
  margin: 10px 0 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--bg-panel-alt);
  font-family: Consolas, 'Courier New', monospace;
  font-size: 13px;
}

.help-table-wrap {
  overflow-x: auto;
  margin: 8px 0 14px;
}

.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.help-table th,
.help-table td {
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.help-table th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.help-table tbody tr:last-child td {
  border-bottom: none;
}

.help-warn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

.help-refs {
  margin-top: 14px !important;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.help-ref-list li {
  margin-bottom: 7px;
}

@media (max-width: 900px) {
  .help-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .help-toc {
    position: static;
  }
}
