:root {
  /* EPayRoll brand — teal + navy */
  --brand-teal: #1cb8c4;
  --brand-teal-dark: #17a3ae;
  --brand-teal-light: #e6f7f9;
  --brand-navy: #1a2e50;
  --brand-navy-mid: #243b5c;
  --brand-navy-light: #2d4a6f;

  --bg: #eef2f7;
  --surface: #ffffff;
  --surface2: #f5f8fb;
  --border: #d4dee8;
  --text: #1a2e50;
  --muted: #5a7189;
  --accent: var(--brand-teal);
  --accent-hover: var(--brand-teal-dark);
  --success: #0d9488;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 10px;
  --font: "Segoe UI", system-ui, sans-serif;

  --sidebar-bg: var(--brand-navy);
  --sidebar-text: #e8f0f8;
  --sidebar-muted: #8fa8c4;
  --sidebar-w: 220px;
  --sidebar-w-collapsed: 64px;
  --header-h: 52px;
  --content-max: 1280px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}

.layout.sidebar-collapsed {
  grid-template-columns: var(--sidebar-w-collapsed) 1fr;
}

.sidebar {
  background: linear-gradient(180deg, var(--brand-navy) 0%, #152238 100%);
  border-right: none;
  padding: 0.75rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 2px 0 12px rgba(26, 46, 80, 0.15);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.brand-compact {
  display: block;
  padding: 0.55rem 0.65rem;
  text-decoration: none;
  border-radius: 10px;
  background: #fff;
  border: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  flex-shrink: 0;
}

.brand-logo-sidebar {
  display: block;
  width: 100%;
  height: 56px;
  object-fit: contain;
  object-position: center center;
}

.brand-logo-sm {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  background: #fff;
  border-radius: 6px;
  padding: 2px;
}

.brand-text {
  font-weight: 700;
  font-size: 1rem;
  color: var(--sidebar-text);
  white-space: nowrap;
}

.brand-text em {
  font-style: normal;
  color: var(--brand-teal);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.nav-section-label {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-muted);
  padding: 0.65rem 0.5rem 0.25rem;
  white-space: nowrap;
}

.sidebar-nav button {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: transparent;
  border: none;
  color: var(--sidebar-muted);
  text-align: left;
  padding: 0.5rem 0.65rem;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.84rem;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  width: 100%;
}

.nav-icon {
  display: inline-flex;
  flex-shrink: 0;
  opacity: 0.9;
}

.nav-icon svg {
  display: block;
}

.sidebar-nav button.active .nav-icon {
  opacity: 1;
}

.sidebar-nav button:hover {
  background: rgba(28, 184, 196, 0.12);
  color: var(--sidebar-text);
}

.sidebar-nav button.active {
  background: var(--brand-teal);
  color: #fff;
  font-weight: 600;
}

.sidebar-collapse {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  margin-top: auto;
  padding: 0.45rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  color: var(--sidebar-muted);
  cursor: pointer;
  font-size: 0.75rem;
  transition: background 0.15s, color 0.15s;
}

.sidebar-collapse:hover {
  background: rgba(28, 184, 196, 0.12);
  color: var(--sidebar-text);
}

.layout.sidebar-collapsed .brand-text,
.layout.sidebar-collapsed .nav-section-label,
.layout.sidebar-collapsed .collapse-label,
.layout.sidebar-collapsed .nav-label {
  display: none;
}

.layout.sidebar-collapsed .sidebar-nav button {
  justify-content: center;
  padding: 0.5rem;
}

.layout.sidebar-collapsed .brand-compact {
  padding: 0.4rem;
}

.layout.sidebar-collapsed .brand-logo-sidebar {
  height: 40px;
  object-position: center center;
}

.main-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--header-h);
  padding: 0 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.app-header-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.api-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
}

.org-switcher {
  max-width: 220px;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--brand-navy);
  font-weight: 600;
}

.org-switcher:focus {
  outline: 2px solid var(--brand-teal);
  outline-offset: 1px;
}

.header-user {
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-logout-btn {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brand-navy);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}

.header-logout-btn:hover {
  border-color: var(--brand-teal);
  color: var(--brand-teal);
}

.header-user.hidden,
.header-logout-btn.hidden {
  display: none;
}

@media (max-width: 720px) {
  .header-user {
    display: none;
  }
}

@media (max-width: 768px) {
  .org-switcher {
    max-width: 140px;
  }
}

.header-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--brand-navy);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.header-icon-btn:hover,
.header-icon-btn.active {
  background: var(--brand-teal-light);
  border-color: var(--brand-teal);
  color: var(--brand-teal-dark);
}

#page-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  padding: 1rem 1.25rem 1.5rem;
}

.page-inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

.brand-block {
  background: #fff;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.brand-logo {
  width: 100%;
  max-width: 320px;
  max-height: 160px;
  object-fit: contain;
  object-position: center center;
  display: block;
  margin: 0 auto;
}

.brand-tagline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.65rem;
  padding: 0 0.25rem;
}

.brand-tagline::before,
.brand-tagline::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--brand-teal);
  opacity: 0.6;
}

.brand-tagline span {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--brand-teal);
  white-space: nowrap;
}

#api-status.loading {
  color: var(--muted);
}

.page-header {
  margin-bottom: 1rem;
}

.page-header h1,
.page-header-sub h1 {
  display: none;
}

.page-header p {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0;
}

.dash-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.grid-kpi {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.grid-metric {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

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

@media (max-width: 640px) {
  .grid-kpi,
  .grid-metric {
    grid-template-columns: 1fr;
  }
}

.dash-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.dash-header h1 {
  display: none;
}

.dash-header p {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  align-items: start;
}

.settings-section .field {
  margin-bottom: 1rem;
}

.settings-section .field:last-of-type {
  margin-bottom: 0;
}

.settings-section label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.settings-section input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: ui-monospace, monospace;
}

.settings-section input:focus {
  outline: none;
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 3px rgba(28, 184, 196, 0.15);
}

.settings-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.session-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.session-badge.ok {
  background: var(--brand-teal-light);
  color: #0f5c63;
  border: 1px solid var(--brand-teal);
}

.session-badge.guest {
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.settings-kv {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.5rem 0 0;
  line-height: 1.6;
}

.settings-kv strong {
  color: var(--brand-navy);
  font-weight: 600;
}

.dash-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem;
}

.dash-filter label {
  display: flex;
  flex-direction: column;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  gap: 0.25rem;
}

.dash-filter input[type="date"] {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.dash-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

table.compact td {
  padding: 0.35rem 0;
}

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

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  box-shadow: 0 1px 3px rgba(26, 46, 80, 0.06);
}

.card .label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card .value {
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 0.25rem;
  color: var(--brand-navy);
}

.card .sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 3px rgba(26, 46, 80, 0.06);
}

.panel h2 {
  font-size: 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
  color: var(--brand-navy);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--brand-teal);
  color: white;
  border: none;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s, box-shadow 0.15s;
}

.btn:hover {
  background: var(--brand-teal-dark);
  box-shadow: 0 2px 8px rgba(28, 184, 196, 0.35);
}

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

.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--brand-navy);
  font-weight: 500;
}

.btn-secondary:hover {
  background: var(--brand-teal-light);
  border-color: var(--brand-teal);
  color: var(--brand-navy);
  box-shadow: none;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.alert {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.alert-warning {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.alert-error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.alert-success {
  background: var(--brand-teal-light);
  border: 1px solid var(--brand-teal);
  color: #0f5c63;
}

.hidden {
  display: none !important;
}

.loading {
  color: var(--muted);
  font-size: 0.9rem;
}

.payroll-progress {
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--brand-teal);
  border-radius: 8px;
  background: linear-gradient(135deg, #f0faf9 0%, #fff 100%);
}

.payroll-progress.is-error {
  border-color: #c62828;
  background: #fff5f5;
}

.payroll-progress-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
  color: var(--brand-navy);
}

.payroll-progress-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--brand-teal);
  border-radius: 50%;
  animation: payroll-spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes payroll-spin {
  to { transform: rotate(360deg); }
}

.payroll-progress-track {
  height: 10px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.payroll-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand-teal), #2a9d8f);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.payroll-progress.is-error .payroll-progress-bar {
  background: #c62828;
}

.att-grid-table .att-row-pending {
  background: #fffbeb;
}

.att-grid-table .att-row-error {
  background: #fff5f5;
}

.att-grid-table input[type="time"],
.att-grid-table select {
  min-width: 5.5rem;
}

.att-matrix-wrap {
  max-height: min(70vh, 640px);
  overflow: auto;
}

.att-matrix-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.78rem;
}

.att-matrix-table th,
.att-matrix-table td {
  border: 1px solid var(--border);
  padding: 0;
  vertical-align: middle;
  text-align: center;
}

.att-matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface2);
  padding: 0.35rem 0.2rem;
}

.att-emp-col {
  position: sticky;
  left: 0;
  z-index: 4;
  min-width: 9.5rem;
  max-width: 9.5rem;
  text-align: left !important;
  padding: 0.45rem 0.55rem !important;
  background: var(--surface);
  box-shadow: 2px 0 4px rgba(26, 46, 80, 0.06);
}

.att-matrix-table thead .att-emp-col {
  z-index: 5;
  background: var(--surface2);
}

.att-emp-name {
  font-weight: 600;
  color: var(--brand-navy);
  line-height: 1.2;
}

.att-emp-cedula {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.att-date-col {
  min-width: 6.8rem;
  line-height: 1.15;
}

.att-date-num {
  display: block;
  font-weight: 700;
  color: var(--brand-navy);
}

.att-date-dow {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
}

.att-day-cell {
  min-width: 6.8rem;
  background: #fff;
}

.att-times-split {
  margin-bottom: 0.12rem;
}

.att-cell-box {
  padding: 0.25rem 0.2rem;
}

.att-times {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  margin-bottom: 0.2rem;
}

.att-times input[type="time"],
.att-times input.att-time-text {
  width: 4.1rem;
  min-width: 0;
  padding: 0.12rem 0.1rem;
  font-size: 0.68rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.att-sep {
  color: var(--muted);
  font-size: 0.65rem;
}

.att-times input.att-time-text.att-time-late {
  border-color: #ef4444 !important;
  background: #fef2f2;
  box-shadow: 0 0 0 1px #fecaca;
}

.att-times input.att-time-text.att-time-early {
  border-color: #ea580c !important;
  background: #fff7ed;
  box-shadow: 0 0 0 1px #fed7aa;
}

.att-descuento-banner {
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: #fff1f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 0.85rem;
}

.att-descuento-panel {
  margin: 0.18rem 0 0.12rem;
  padding: 0.28rem 0.32rem;
  border-radius: 6px;
  text-align: center;
  line-height: 1.25;
}

.att-descuento-zero {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
}

.att-descuento-has {
  background: #fff1f2;
  border: 1px solid #fca5a5;
}

.att-descuento-total {
  font-size: 0.68rem;
  font-weight: 600;
  color: #475569;
}

.att-descuento-has .att-descuento-total {
  color: #991b1b;
}

.att-descuento-total strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 800;
  color: #b91c1c;
  font-variant-numeric: tabular-nums;
}

.att-descuento-zero .att-descuento-total strong {
  color: #15803d;
}

.att-descuento-detail {
  margin-top: 0.12rem;
  font-size: 0.58rem;
  color: #64748b;
  line-height: 1.2;
}

.att-descuento-has .att-descuento-detail {
  color: #b91c1c;
  font-weight: 600;
}

.att-flags {
  display: flex;
  justify-content: center;
  gap: 0.15rem;
}

.att-flag {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.05rem;
}

.att-flag input {
  width: 0.75rem;
  height: 0.75rem;
  margin: 0;
}

.att-cell-ok { background: #f6fffb; }
.att-cell-pending { background: #fffbeb; }
.att-cell-error { background: #fff5f5; }

.att-col-dom {
  background: #f3f4f6 !important;
  color: var(--muted);
}

.att-col-dom .att-cell-box {
  opacity: 0.55;
}

.att-matrix-legend {
  margin-top: 0.5rem;
  font-size: 0.78rem;
}

.btn.is-busy {
  opacity: 0.65;
  pointer-events: none;
  cursor: wait;
}

pre.output {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.75rem;
  overflow-x: auto;
  max-height: 320px;
  overflow-y: auto;
  color: var(--muted);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.4rem;
}

.status-dot.ok {
  background: var(--brand-teal);
}

.status-dot.err {
  background: var(--danger);
}

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

  .sidebar {
    position: relative;
    height: auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .nav-section-label {
    width: 100%;
  }

  .sidebar-collapse {
    display: none;
  }

  .brand-logo {
    max-height: 80px;
  }
}

.login-modal {
  position: fixed;
  inset: 0;
  background: rgba(26, 46, 80, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.login-modal.hidden {
  display: none !important;
}

.login-card {
  width: 100%;
  max-width: 400px;
}

.login-card .brand-block {
  margin-bottom: 1rem;
}

.login-card h2 {
  color: var(--brand-navy);
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.login-subtitle {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.login-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0.2rem 0 0.35rem;
  line-height: 1.35;
}

.login-card label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0.6rem 0 0.25rem;
  font-weight: 500;
}

.login-card input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.login-card input:focus {
  outline: none;
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 3px rgba(28, 184, 196, 0.15);
}

.login-card select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.login-card select:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.login-card select:focus {
  outline: none;
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 3px rgba(28, 184, 196, 0.15);
}

#login-error:not(:empty) {
  display: block !important;
}

.emp-select {
  width: 100%;
  max-width: 420px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.inline-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  gap: 0.25rem;
}

.inline-form input,
.inline-form select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  font-size: 0.85rem;
  min-width: 120px;
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.crud-actions {
  display: flex;
  gap: 0.25rem;
  white-space: nowrap;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--brand-navy);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-icon:hover {
  background: var(--brand-teal-light);
  border-color: var(--brand-teal);
  color: var(--brand-teal-dark);
}

.btn-icon-danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.crud-form-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand-navy);
  margin-bottom: 0.65rem;
}

.table-crud th:last-child,
.table-crud td:last-child {
  width: 1%;
}

code {
  color: var(--brand-navy-mid);
  background: var(--brand-teal-light);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
}

.planilla-scroll {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.planilla-grid {
  min-width: 2400px;
  font-size: 0.78rem;
}

.planilla-grid th,
.planilla-grid td {
  white-space: nowrap;
}

.planilla-grid th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.planilla-grid th:nth-child(-n+4),
.planilla-grid td:nth-child(-n+4) {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 2;
}

.planilla-grid th:nth-child(2),
.planilla-grid td:nth-child(2) { left: 4rem; }
.planilla-grid th:nth-child(3),
.planilla-grid td:nth-child(3) { left: 14rem; }
.planilla-grid th:nth-child(4),
.planilla-grid td:nth-child(4) { left: 20rem; }

/* Verificación planilla — scroll horizontal sin solapamiento */
.planilla-verify-wrap {
  max-height: min(72vh, 580px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.planilla-verify-table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: max-content;
  width: max-content;
  font-size: 0.78rem;
}

.planilla-verify-table th:nth-child(-n+4),
.planilla-verify-table td:nth-child(-n+4) {
  position: static;
  left: auto;
}

.planilla-verify-table th,
.planilla-verify-table td {
  padding: 0.45rem 0.6rem;
  vertical-align: middle;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.planilla-verify-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.3;
  white-space: normal;
  hyphens: auto;
  box-shadow: 0 1px 0 var(--border);
}

.planilla-verify-table tbody td {
  white-space: nowrap;
}

.planilla-verify-table .planilla-col-sticky {
  position: sticky;
  z-index: 3;
}

.planilla-verify-table thead th.planilla-col-sticky {
  z-index: 5;
}

.planilla-verify-table .planilla-col-ficha {
  min-width: 3.5rem;
  width: 3.5rem;
  max-width: 3.5rem;
  left: 0;
  text-align: center;
}

.planilla-verify-table .planilla-col-nombre_completo {
  min-width: 11rem;
  max-width: 13rem;
  left: 3.5rem;
  white-space: normal;
  box-shadow: 4px 0 10px -6px rgba(15, 37, 64, 0.18);
}

.planilla-verify-table .planilla-col-telefono {
  min-width: 7rem;
}

.planilla-verify-table .planilla-col-cedula {
  min-width: 8.5rem;
}

.planilla-verify-table .planilla-col-money {
  min-width: 7.5rem;
  text-align: right;
}

.planilla-verify-table .planilla-col-num {
  min-width: 5.75rem;
  text-align: center;
}

.planilla-verify-table .planilla-editable {
  min-width: 5.75rem;
  padding: 0.2rem 0.35rem !important;
}

.planilla-verify-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: #eef3f9;
  font-weight: 600;
  border-top: 2px solid var(--border);
  box-shadow: 0 -2px 6px rgba(15, 37, 64, 0.06);
}

.planilla-verify-table tfoot .planilla-col-sticky {
  z-index: 4;
}

.planilla-verify-table td.planilla-col-nombre_completo {
  white-space: normal;
  word-break: break-word;
}

.planilla-verify-table.planilla-grid {
  min-width: max-content;
}

.planilla-verify-table .planilla-cell-input {
  min-width: 0;
  max-width: 100%;
}

#emp-table th:nth-child(-n+4),
#emp-table td:nth-child(-n+4) {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 2;
}

#emp-table th:nth-child(1),
#emp-table td:nth-child(1) {
  left: 0;
  z-index: 3;
  min-width: 4.25rem;
}

#emp-table th:nth-child(2),
#emp-table td:nth-child(2) { left: 4.25rem; }

#emp-table th:nth-child(3),
#emp-table td:nth-child(3) { left: 8.25rem; }

#emp-table th:nth-child(4),
#emp-table td:nth-child(4) { left: 18rem; }

.crud-actions-col {
  width: 4.25rem;
  min-width: 4.25rem;
  padding: 0.35rem !important;
}

.form-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 0 0 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}

.form-section legend {
  font-weight: 600;
  color: var(--brand-navy);
  padding: 0 0.35rem;
}

.planilla-editable {
  padding: 0.15rem !important;
  min-width: 5rem;
}

.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.page-header-actions .page-header-sub {
  margin-bottom: 0;
}

.emp-list-panel {
  margin-top: 0;
}

.emp-list-panel .panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.crud-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 46, 80, 0.35);
  z-index: 90;
  display: flex;
  justify-content: flex-end;
}

.crud-drawer-backdrop.hidden {
  display: none !important;
}

.crud-drawer {
  width: min(32rem, 100vw);
  height: 100%;
  background: var(--surface);
  box-shadow: -4px 0 24px rgba(26, 46, 80, 0.15);
  display: flex;
  flex-direction: column;
  animation: crud-drawer-in 0.2s ease;
}

@keyframes crud-drawer-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.crud-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #f0faf9 0%, #fff 100%);
}

.crud-drawer-header h2 {
  font-size: 1.05rem;
  margin: 0;
  color: var(--brand-navy);
}

.crud-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.1rem 1.5rem;
}

.crud-drawer-body .form-section {
  flex-direction: column;
  align-items: stretch;
}

.crud-drawer-body .form-section label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 0;
}

.crud-drawer-body .form-section input,
.crud-drawer-body .form-section select {
  width: 100%;
}

.crud-drawer-footer {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

.table-crud tr.is-selected {
  background: #f0faf9;
}

.planilla-cell-input {
  width: 100%;
  min-width: 4.5rem;
  max-width: 7rem;
  font-size: inherit;
  padding: 0.2rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fffef8;
}

.planilla-cell-input:focus {
  outline: 2px solid var(--brand-teal);
  border-color: var(--brand-teal);
}

/* Comprobante de pago */
.badge-ok {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: #e6f7f4;
  color: #0d6b5c;
  font-size: 0.75rem;
  font-weight: 600;
}

.comprobante-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 46, 80, 0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.comprobante-modal-backdrop.hidden {
  display: none !important;
}

.comprobante-modal-card {
  background: var(--surface);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(26, 46, 80, 0.2);
  width: min(42rem, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.comprobante-modal-header,
.comprobante-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.comprobante-modal-footer {
  border-bottom: none;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

.comprobante-modal-body {
  padding: 1rem;
  overflow-y: auto;
}

.comprobante-doc-header {
  text-align: center;
  margin-bottom: 1rem;
}

.comprobante-doc-header h3 {
  margin: 0 0 0.35rem;
  color: var(--brand-navy);
  letter-spacing: 0.04em;
}

.comprobante-org {
  margin: 0;
  font-weight: 600;
}

.comprobante-meta {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: #666;
}

.comprobante-block {
  margin-bottom: 1rem;
}

.comprobante-block h4 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--brand-navy);
  border-bottom: 2px solid var(--brand-teal);
  padding-bottom: 0.25rem;
}

.comprobante-block p {
  margin: 0.2rem 0;
  font-size: 0.9rem;
}

.comprobante-note {
  font-size: 0.82rem !important;
  color: #666;
  font-style: italic;
}

.comprobante-table td.num {
  text-align: right;
  white-space: nowrap;
}

.comprobante-totals {
  border-top: 2px solid var(--brand-navy);
  padding-top: 0.65rem;
}

.comprobante-totals p {
  display: flex;
  justify-content: space-between;
  margin: 0.25rem 0;
}

.comprobante-neto {
  font-size: 1.05rem;
  color: var(--brand-navy);
}

.comprobante-foot {
  margin-top: 1rem;
  font-size: 0.78rem;
  color: #888;
  text-align: center;
}

.sidebar-nav button.hidden,
.nav-section-label.hidden {
  display: none;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  cursor: pointer;
}
  .comprobante-modal-backdrop {
    position: static;
    background: none;
    padding: 0;
  }
  .comprobante-modal-card {
    box-shadow: none;
    max-height: none;
  }
}
