/* CoreTrack look: the layout and style language of the Minimal dashboard (side navigation, soft
   card shadows, 16px corners, dashed table rows, soft "label" pills) with the Appril brand
   (Manual de marca): Corbeau #171022, Limonade #05E664, Violet #5204C8, Bell #EFEDF2; Poppins.
   Limonade is the main action of each screen and the active item; Violet, links and focus. */
:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --neutral: #F4F6F8;           /* table heads, quiet boxes */
  --grey-100: #F9FAFB;
  --grey-300: #DFE3E8;
  --grey-500: #919EAB;
  --grey-600: #637381;
  --text: #171022;
  --text-muted: #637381;
  --text-disabled: #919EAB;
  --border: rgba(145, 158, 171, 0.2);
  --border-strong: rgba(145, 158, 171, 0.32);
  --hover: rgba(145, 158, 171, 0.08);
  --primary: #5204C8;
  --primary-dark: #3E0399;
  --primary-soft: rgba(82, 4, 200, 0.08);
  --accent: #05E664;
  --accent-hover: #04CF5A;
  --accent-soft: rgba(5, 230, 100, 0.12);
  --accent-text: #037A36;
  --on-accent: #171022;
  --corbeau: #171022;
  --danger: #D81E4B;
  --danger-soft: rgba(216, 30, 75, 0.1);
  --success: #118D57;
  --success-soft: rgba(34, 197, 94, 0.16);
  --warning: #B76E00;
  --warning-soft: rgba(255, 171, 0, 0.16);
  --radius: 8px;
  --radius-lg: 16px;
  --shadow-card: 0 0 2px 0 rgba(145, 158, 171, 0.2), 0 12px 24px -4px rgba(145, 158, 171, 0.12);
  --shadow-dropdown: 0 0 2px 0 rgba(145, 158, 171, 0.24), -20px 20px 40px -4px rgba(145, 158, 171, 0.24);
  --shadow-dialog: -40px 40px 80px -8px rgba(0, 0, 0, 0.24);
  --sidebar-width: 280px;
  --header-height: 72px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.57;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text); }
.spacer { flex: 1; }
.muted { color: var(--text-muted); }
.small-text { font-size: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: var(--radius); padding: 0 16px; min-height: 36px;
  font-size: 14px; font-weight: 600; line-height: 1; transition: background 0.15s, box-shadow 0.15s; white-space: nowrap;
}
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn-lg { min-height: 48px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 8px 16px 0 rgba(5, 230, 100, 0.24); }
.btn-dark { background: var(--corbeau); color: #fff; }
.btn-dark:hover { background: #2C2240; }
.btn-secondary { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.btn-secondary:hover { background: var(--hover); box-shadow: inset 0 0 0 1px var(--text); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--hover); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: rgba(216, 30, 75, 0.18); }
.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover { background: var(--danger-soft); }
.btn:focus-visible, .nav-item:focus-visible, .sub-tab:focus-visible, .icon-btn:focus-visible, .user-menu-item:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
.btn-link { background: none; border: none; color: var(--primary); font-size: 13px; font-weight: 600; padding: 4px 0; display: inline-block; margin-top: 4px; }
.btn-link:hover { text-decoration: underline; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: none; border-radius: 50%; background: transparent; color: var(--text-muted); }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- Loading: busy buttons and the top bar (see api() in app.js) ---------- */
.is-busy { pointer-events: none; }
.is-loading { cursor: progress; opacity: 0.85; }
.is-loading::before {
  content: ''; display: inline-block; width: 0.9em; height: 0.9em; margin-right: 4px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; box-sizing: border-box;
  animation: tt-spin 0.6s linear infinite;
}
@keyframes tt-spin { to { transform: rotate(360deg); } }
.global-loader { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 10000; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity 0.2s; }
.global-loader.active { opacity: 1; }
.global-loader::before { content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; background: var(--accent); border-radius: 0 3px 3px 0; animation: tt-loader 1.1s ease-in-out infinite; }
@keyframes tt-loader { from { left: -40%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .is-loading::before { animation-duration: 1.5s; }
  .global-loader::before { animation-duration: 2.5s; }
}

/* ---------- Login: split screen ---------- */
.login-screen { min-height: 100vh; display: flex; background: var(--surface); }
.login-aside {
  width: 100%; max-width: 480px; padding: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 48px;
  position: relative;
  background: linear-gradient(0deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.92)), url("/img/background-3-blur.webp") center / cover;
}
.login-brand { position: absolute; top: 24px; left: 24px; height: 32px; width: auto; }
.login-aside-text { text-align: center; }
.login-aside-text h2 { margin: 0; font-size: 30px; font-weight: 700; line-height: 1.4; }
.login-aside-text p { margin: 12px 0 0; color: var(--text-muted); }
.login-illustration { width: 100%; max-width: 432px; aspect-ratio: 4 / 3; object-fit: cover; }
.login-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 420px; }
.login-brand-mobile { display: none; height: 32px; margin-bottom: 32px; }
.login-logo h1 { font-size: 19px; font-weight: 600; margin: 0 0 8px; }
.login-sub { color: var(--text-muted); font-size: 14px; margin: 0 0 24px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin: 0 0 6px; }
#form-request-otp input, #form-verify-otp input {
  width: 100%; height: 54px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; font-size: 15px;
}
#form-request-otp input:hover, #form-verify-otp input:hover { border-color: var(--text); }
#form-request-otp input:focus, #form-verify-otp input:focus { outline: none; border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
#input-otp { text-align: center; font-size: 22px; letter-spacing: 8px; }
.login-message { margin-top: 20px; padding: 12px 14px; border-radius: var(--radius); font-size: 13px; }
.login-message.error { background: var(--danger-soft); color: var(--danger); }
.login-message.success { background: var(--success-soft); color: var(--success); }
@media (max-width: 900px) {
  .login-aside { display: none; }
  .login-brand-mobile { display: block; }
}

/* ---------- App shell: side navigation + header ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar-width); z-index: 60;
  background: var(--surface); border-right: 1px solid rgba(145, 158, 171, 0.12);
  display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar-top { padding: 22px 28px 12px; }
.sidebar-logo { height: 30px; width: auto; display: block; }
.tenant-box { margin: 8px 16px 8px; padding: 10px 12px; border-radius: 12px; background: var(--neutral); display: flex; align-items: center; gap: 10px; }
.tenant-mark {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: var(--corbeau); color: var(--accent); font-size: 11px; font-weight: 700;
}
.tenant-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-nav { padding: 8px 16px 24px; }
.nav-section + .nav-section { margin-top: 8px; }
.nav-subheader { padding: 16px 12px 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-disabled); }
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 16px; min-height: 44px; padding: 4px 8px 4px 12px; margin-bottom: 4px;
  border: none; border-radius: var(--radius); background: none; color: var(--text-muted); font-size: 14px; font-weight: 500; text-align: left;
}
.nav-item svg { width: 22px; height: 22px; flex-shrink: 0; }
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-item.active:hover { background: rgba(5, 230, 100, 0.18); }
.sidebar-backdrop { display: none; }
.app-main { flex: 1; min-width: 0; margin-left: var(--sidebar-width); display: flex; flex-direction: column; }
.app-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-height); display: flex; align-items: center; gap: 8px; padding: 0 40px;
  background: rgba(255, 255, 255, 0.8); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.menu-btn { display: none; margin-left: -8px; }
.main-content { flex: 1; width: 100%; max-width: 1320px; margin: 0 auto; padding: 8px 40px 64px; display: flex; flex-direction: column; min-height: 0; }
/* Collapsed (large screens): icons with a short label below; the logo shows only its isotype. */
.sidebar, .app-main { transition: width 0.2s ease, margin-left 0.2s ease; }
.sidebar-logo-wrap { overflow: hidden; width: 104px; transition: width 0.2s ease; }
.sidebar-toggle {
  position: fixed; top: 26px; left: calc(var(--sidebar-width) - 13px); z-index: 61; width: 26px; height: 26px; padding: 0;
  display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid rgba(145, 158, 171, 0.24);
  background: var(--surface); color: var(--text-muted); cursor: pointer; transition: left 0.2s ease;
}
.sidebar-toggle:hover { color: var(--text); background: var(--neutral); }
.sidebar-toggle svg { width: 14px; height: 14px; transition: transform 0.2s ease; }
@media (min-width: 1200px) {
  .app.sidebar-collapsed { --sidebar-width: 100px; }
  .app.sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }
  .app.sidebar-collapsed .sidebar-top { padding: 22px 0 12px; display: flex; justify-content: center; }
  .app.sidebar-collapsed .sidebar-logo-wrap { width: 30px; }
  .app.sidebar-collapsed .tenant-box { margin: 8px auto; padding: 6px; background: none; justify-content: center; }
  .app.sidebar-collapsed .tenant-name, .app.sidebar-collapsed .nav-subheader { display: none; }
  .app.sidebar-collapsed .sidebar-nav { padding: 8px 6px 24px; }
  .app.sidebar-collapsed .nav-section + .nav-section { margin-top: 12px; padding-top: 12px; border-top: 1px dashed rgba(145, 158, 171, 0.24); }
  .app.sidebar-collapsed .nav-item { flex-direction: column; justify-content: center; gap: 4px; min-height: 58px; padding: 8px 4px; text-align: center; font-size: 10px; font-weight: 600; line-height: 1.2; }
  .app.sidebar-collapsed .nav-item span { max-width: 100%; overflow-wrap: anywhere; }
}
@media (max-width: 1199px) {
  .sidebar-toggle { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: none; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-dialog); }
  .sidebar-backdrop.open { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(23, 16, 34, 0.48); }
  .app-main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .app-header { padding: 0 24px; height: 64px; }
  .main-content { padding: 8px 24px 48px; }
}
@media (max-width: 600px) {
  .app-header { padding: 0 16px; }
  .main-content { padding: 4px 16px 40px; }
}

/* User menu (header) */
.avatar-btn { background: none; border: 2px solid transparent; border-radius: 50%; padding: 2px; display: flex; }
.avatar-btn:hover { border-color: var(--border-strong); }
.avatar-btn[aria-expanded="true"] { border-color: var(--accent); }
.user-menu-wrap { position: relative; }
.user-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 70; width: 280px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-dropdown); padding: 8px; }
.user-menu-head { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px dashed var(--border); margin-bottom: 8px; }
.user-menu-info { min-width: 0; }
.user-menu-name { font-weight: 600; font-size: 14px; }
.user-menu-email { font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-role { display: inline-block; font-size: 11px; font-weight: 700; color: var(--primary); background: var(--primary-soft); border-radius: 6px; padding: 1px 6px; margin-top: 4px; }
.user-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: none; background: none; border-radius: var(--radius); font-size: 14px; color: var(--text); text-align: left; }
.user-menu-item:hover { background: var(--hover); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.avatar.avatar-lg { width: 56px; height: 56px; font-size: 20px; }

/* ---------- Page structure ---------- */
.view-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.view-title { font-size: 24px; font-weight: 700; margin: 0; line-height: 1.5; }
.view-hint { color: var(--text-muted); font-size: 13px; margin: -8px 0 20px; }
.search-input, .filter-select {
  height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.search-input:hover, .filter-select:hover { border-color: var(--text); }
.search-input:focus, .filter-select:focus { outline: none; border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.search-input { width: 240px; }

.card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 24px; position: relative; }
.card h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.card p { margin: 0; color: var(--text-muted); font-size: 14px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }
.empty-state {
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--grey-100);
  padding: 40px 24px; text-align: center; color: var(--text-muted); font-size: 14px;
}

/* Home: welcome banner and module cards */
.welcome-card {
  display: flex; align-items: center; gap: 24px; padding: 40px; margin-bottom: 24px; border-radius: var(--radius-lg); color: #fff; overflow: hidden;
  background: radial-gradient(circle at 85% 0%, rgba(82, 4, 200, 0.55), transparent 55%), radial-gradient(circle at 0% 100%, rgba(5, 230, 100, 0.18), transparent 50%), var(--corbeau);
}
.welcome-card h2 { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.4; }
.welcome-card p { margin: 8px 0 24px; color: rgba(255, 255, 255, 0.72); max-width: 460px; }
.welcome-card img { width: 260px; max-width: 40%; margin-left: auto; }
@media (max-width: 700px) { .welcome-card { padding: 28px; } .welcome-card img { display: none; } }
.module-card { display: flex; align-items: center; gap: 16px; border: none; text-align: left; font: inherit; color: inherit; cursor: pointer; transition: box-shadow 0.15s, transform 0.15s; }
.module-card:hover { box-shadow: 0 0 2px 0 rgba(145, 158, 171, 0.24), 0 20px 40px -4px rgba(145, 158, 171, 0.24); transform: translateY(-2px); }
.module-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.module-icon svg { width: 26px; height: 26px; }

/* ---------- Tables (inside a card, as in Minimal) ---------- */
.table-scroll { overflow-x: auto; flex-shrink: 0; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 16px; border-bottom: 1px dashed var(--border); font-size: 14px; vertical-align: middle; }
.data-table th { background: var(--neutral); font-size: 13px; font-weight: 600; color: var(--text-muted); white-space: nowrap; border-bottom: none; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table td.cell-actions { white-space: nowrap; text-align: right; }
@media (max-width: 800px) { .data-table td.cell-actions { white-space: normal; } }
/* Compact tables sit inside another card: no card of their own. */
.card .table-scroll, .settings-section .table-scroll, .area-block .table-scroll { box-shadow: none; border-radius: var(--radius); border: 1px solid var(--border); }
.data-table.compact th, .data-table.compact td { padding: 10px 14px; }
.row-link { cursor: pointer; }
.row-link:hover td { background: var(--hover); }
.row-link:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.current-row td { background: rgba(5, 230, 100, 0.06); }

/* Labels ("pills") */
.tag, .role-badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 700; white-space: nowrap; vertical-align: middle;
}
.tag-current { background: var(--success-soft); color: var(--success); }
.tag-pending { background: var(--primary-soft); color: var(--primary); }
.tag-ended, .tag-muted { background: rgba(145, 158, 171, 0.16); color: var(--text-muted); }
.role-badge { background: var(--primary-soft); color: var(--primary); }
.role-badge.admin { background: var(--warning-soft); color: var(--warning); }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.status-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.status-dot.inactive::before { background: var(--grey-500); }
.audit-detail { color: var(--text-muted); font-size: 12px; overflow-wrap: anywhere; }

/* ---------- Tabs ---------- */
.sub-tabs { display: flex; flex-shrink: 0; gap: 32px; margin-bottom: 24px; box-shadow: inset 0 -2px 0 0 rgba(145, 158, 171, 0.08); overflow-x: auto; overflow-y: hidden; }
.sub-tab { background: none; border: none; padding: 12px 0; font-size: 14px; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.sub-tab:hover { color: var(--text); }
.sub-tab.active { color: var(--text); border-bottom-color: var(--text); }

/* ---------- Modals and forms ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(23, 16, 34, 0.48); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius-lg); width: 900px; max-width: 100%; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-dialog); }
.modal.small { width: 480px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 24px 8px; font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; width: 36px; height: 36px; border-radius: 50%; font-size: 22px; color: var(--text-muted); line-height: 1; }
.modal-close:hover { background: var(--hover); }
.modal-body { padding: 8px 24px 24px; overflow-y: auto; }
.modal-body .view-hint { margin: 0 0 12px; }

.generic-form label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin: 14px 0 6px; }
.generic-form input, .generic-form select, .generic-form textarea {
  width: 100%; min-height: 44px; padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.generic-form textarea { min-height: 72px; resize: vertical; }
.generic-form input:hover, .generic-form select:hover, .generic-form textarea:hover { border-color: var(--text); }
.generic-form input:focus, .generic-form select:focus, .generic-form textarea:focus { outline: none; border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.generic-form input:disabled { background: var(--neutral); color: var(--text-muted); border-color: transparent; }
.generic-form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.form-section { margin: 24px 0 0; font-size: 15px; font-weight: 600; color: var(--text); }
.form-section:first-of-type { margin-top: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; max-width: calc(100vw - 32px);
  background: var(--corbeau); color: #fff; padding: 12px 16px 12px 14px; border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-dialog); display: flex; align-items: center; gap: 10px;
}
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.toast.error::before { background: #FF5630; }

/* ---------- Recurso humano ---------- */
.person-cell { display: flex; align-items: center; gap: 14px; }
.person-name { font-weight: 600; }
.person-email { color: var(--text-muted); font-size: 13px; }
.record-header { display: flex; align-items: center; gap: 20px; margin: 8px 0 24px; flex-wrap: wrap; }
.record-title h3 { margin: 0 0 2px; font-size: 20px; font-weight: 700; }
.record-title .muted { font-size: 14px; }
.detail-grid { margin-bottom: 32px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.detail-grid .card h3 { margin-bottom: 16px; }
/* Label above its value: long values (emails, phones) get the card's full width
   instead of wrapping beside a wide label. */
.detail-list { display: grid; gap: 14px; margin: 0; font-size: 14px; }
.detail-list > div { min-width: 0; }
.detail-list dt { color: var(--text-muted); font-size: 13px; margin-bottom: 2px; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; font-weight: 500; }
.section-toolbar { margin-bottom: 16px; }
.section-title { margin: 0; font-size: 18px; font-weight: 600; }
#hr-content > .view-hint { margin-top: 16px; }
.contract-block { margin-bottom: 20px; }
.contract-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.contract-head strong { font-size: 16px; }

/* ---------- Configuración ---------- */
.settings-section { margin-bottom: 24px; }
.settings-section h3 { margin: 0 0 8px; font-size: 18px; }
.settings-section h4 { margin: 4px 0 8px; font-size: 15px; font-weight: 600; }
.settings-section .view-toolbar { margin: 12px 0 14px; }
.settings-section .view-hint { margin: 0 0 14px; }
.settings-subtitle { margin: 28px 0 8px; font-size: 15px; }
.settings-subtitle:first-of-type { margin-top: 8px; }
.inline-form { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.inline-form input, .inline-form select { height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); flex: 1; min-width: 160px; background: var(--surface); }
.inline-form input:focus, .inline-form select:focus { outline: none; border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.inline-form .btn { min-height: 40px; }
.inline-form .short-input { flex: 0 0 140px; min-width: 0; }
.inline-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.area-block { border: 1px dashed var(--border-strong); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.area-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.area-head h4 { margin: 0; }

.company-form { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 0 16px; align-items: end; }
.company-form label { margin-top: 0; }
@media (max-width: 900px) { .company-form { grid-template-columns: 1fr; } .company-form-actions { margin-top: 16px; } }
.company-form .btn { min-height: 44px; }

/* ---------- Equipos ---------- */
.tag-warning { background: var(--warning-soft); color: var(--warning); }
.link { color: var(--primary); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 18px 20px; border: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.stat-card.selected { box-shadow: inset 0 0 0 2px var(--text), var(--shadow-card); }
.stat-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.3; }
.record-section { margin-top: 32px; }
.handover-search { width: 100%; margin: 8px 0 10px; }
.handover-items { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; padding: 2px; }
.handover-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); margin: 0 !important; color: var(--text) !important; font-weight: 400 !important; font-size: 14px !important; cursor: pointer; }
.handover-item:has(input:checked) { border-color: var(--accent-text); background: rgba(5, 230, 100, 0.06); }
.handover-item input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; flex-shrink: 0; accent-color: var(--accent-text); }
.handover-item select { width: auto; min-height: 36px; padding: 4px 8px; }
.handover-item-name { flex: 1; min-width: 0; }
.handover-links { margin-top: 12px; }
a.btn { text-decoration: none; }
.sign-notice { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; margin-bottom: 20px; border-radius: var(--radius); background: var(--warning-soft); color: var(--text); }
.sign-notice span { font-size: 14px; }
.sign-notice-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
/* Required fields: an asterisk after the label. */
.generic-form div:has(> input[required], > select[required]) > label::after { content: ' *'; color: var(--danger); }
/* The record's data (personal, work, contact): collapsed by default, like the position's functions. */
.record-data { margin: 24px 0 0; }
.record-data > summary { display: flex; align-items: center; gap: 12px; padding: 18px 24px; cursor: pointer; list-style: none; }
.record-data > summary::-webkit-details-marker { display: none; }
.record-data > summary h3 { margin: 0; font-size: 17px; font-weight: 600; }
.record-data > summary::after { content: ''; width: 8px; height: 8px; margin-left: auto; flex-shrink: 0; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg); transition: transform .15s; }
.record-data[open] > summary::after { transform: rotate(-135deg); }
.record-data .detail-grid { margin-top: 16px; margin-bottom: 0; }
@media (max-width: 600px) { .record-data > summary .muted { display: none; } }
/* Collapsed by default: a long list that would push the contracts down. */
.position-functions { margin: 24px 0 32px; }
.position-functions summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.position-functions summary::-webkit-details-marker { display: none; }
.position-functions summary::after { content: ''; width: 8px; height: 8px; margin-left: auto; border-right: 2px solid var(--text-muted, currentColor); border-bottom: 2px solid var(--text-muted, currentColor); transform: rotate(45deg); transition: transform .15s; }
.position-functions[open] summary::after { transform: rotate(-135deg); }
.position-functions summary h3 { margin: 0; }
.position-functions p { margin: 16px 0 0; white-space: pre-line; line-height: 1.7; }
/* ---------- Document templates ---------- */
.modal.xl { width: 1280px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid.four { grid-template-columns: 2fr 2fr 1.6fr 1fr; }
@media (max-width: 900px) { .form-grid.three, .form-grid.four { grid-template-columns: 1fr; } }
.template-toolbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 16px 0 8px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius); }
.template-toolbar .filter-select { margin-left: auto; min-height: 32px; max-width: 280px; }
.template-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.template-editor textarea { min-height: 56vh; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.6; resize: vertical; }
.template-preview { min-height: 56vh; max-height: 56vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; background: #fff; color: #171022; }
@media (max-width: 900px) { .template-editor { grid-template-columns: 1fr; } .template-editor textarea, .template-preview { min-height: 40vh; } }
/* The text of a generated document (also in contrato.html). */
.doc-body { font-size: 13px; line-height: 1.6; }
.doc-body h2 { font-size: 16px; text-align: center; margin: 0 0 16px; }
.doc-body h3 { font-size: 14px; margin: 18px 0 6px; }
.doc-body h4 { font-size: 13px; margin: 14px 0 4px; }
.doc-body p { margin: 0 0 8px; text-align: justify; }
.doc-body ol, .doc-body ul { margin: 0 0 8px; padding-left: 24px; }
.doc-body li { margin-bottom: 2px; text-align: justify; }
.doc-body .doc-table { width: 100%; border-collapse: collapse; margin: 0 0 12px; }
.doc-body .doc-table td { border: 1px solid #DFE3E8; padding: 5px 8px; vertical-align: top; }
.doc-body .missing { background: rgba(255, 171, 0, 0.25); color: #7A4100; border-radius: 4px; padding: 0 4px; }
.doc-body .page-break { border-top: 1px dashed #DFE3E8; margin: 16px 0; }
.contract-docs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--neutral, #F4F6F8); }
.home-notice { margin-top: 24px; }
.template-sample { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-bottom: 8px; }
.template-sample .filter-select { min-height: 32px; }
/* ---------- Vacaciones ---------- */
.stat-value.negative, td.negative { color: var(--danger); }
.error-text { color: var(--danger); }
.leave-stats { margin-bottom: 16px; }
.leave-periods { margin-bottom: 8px; }
.leave-stats .stat-card { cursor: default; }
.leave-movements { margin-top: 16px; }
.leave-movements summary { cursor: pointer; list-style: none; }
.leave-movements summary::-webkit-details-marker { display: none; }
.leave-movements summary h3 { margin: 0; font-size: 15px; }
.leave-movements[open] summary { margin-bottom: 12px; }
.weekday-picks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.check-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; cursor: pointer; }
.ab-hours-toggle { align-self: flex-start; }
.ab-hours-toggle[hidden], .ab-days[hidden], .ab-times[hidden] { display: none; }
/* ---------- Retiro ---------- */
.termination-preview { margin: 4px 0 8px; padding: 14px 16px; border-radius: var(--radius); background: var(--neutral); }
.termination-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
.warn-text { color: var(--warning); }
.termination-notice { margin-top: 16px; }
/* ---------- Side menu: an item with children (Configuración) ---------- */
.nav-item.has-children .nav-chevron { width: 16px; height: 16px; margin-left: auto; transition: transform .15s; }
.nav-item.has-children[aria-expanded="true"] .nav-chevron { transform: rotate(90deg); }
.nav-children { position: relative; margin: 0 0 6px 23px; padding-left: 14px; border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.nav-child { display: block; width: 100%; padding: 8px 12px; border: none; border-radius: 8px; background: none; color: var(--text-muted); font-size: 14px; text-align: left; cursor: pointer; }
.nav-child:hover { background: var(--hover); color: var(--text); }
.nav-child.active { color: var(--text); font-weight: 600; background: var(--neutral); }
/* The pages of Configuración as tabs only when the side menu is collapsed (its children don't show there). */
.settings-tabs { display: none; }
@media (min-width: 1200px) {
  .app.sidebar-collapsed .settings-tabs { display: flex; }
  .app.sidebar-collapsed .nav-children, .app.sidebar-collapsed .nav-chevron { display: none; }
}
[data-page][hidden] { display: none !important; }
