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

:root {
  --bg: #f5f7fb;
  --surface: #fff;
  --surface-2: #f8fafc;
  --text: #182230;
  --muted: #6c7787;
  --line: #e5e9f0;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --success: #16845b;
  --warning: #b7791f;
  --danger: #c2415a;
  --info: #2878b5;
  --shadow: 0 12px 30px rgba(31, 41, 55, 0.07);
  --radius: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
.app-shell {
  min-height: 100vh;
  display: flex;
}
.sidebar {
  width: 250px;
  background: #111827;
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 10px 28px;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #fff;
  color: #111827;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
}
.brand strong {
  display: block;
  font-family: Manrope;
  font-size: 15px;
}
.brand span {
  display: block;
  color: #9ca3af;
  font-size: 11px;
  margin-top: 2px;
}
.main-nav {
  display: grid;
  gap: 5px;
}
.nav-item {
  border: 0;
  background: transparent;
  color: #aeb7c6;
  text-align: left;
  padding: 12px 13px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 600;
  font-size: 13px;
  transition: 0.18s;
}
.nav-item span {
  width: 20px;
  text-align: center;
  font-size: 17px;
}
.nav-item:hover {
  background: #1f2937;
  color: #fff;
}
.nav-item.active {
  background: #fff;
  color: #111827;
}
.sidebar-bottom {
  margin-top: auto;
}
.role-card {
  margin: 10px 6px 14px;
  padding: 14px;
  border: 1px solid #293244;
  border-radius: 13px;
  background: #182130;
}
.role-label,
.role-card span:last-child {
  display: block;
  color: #8d98a8;
  font-size: 10px;
}
.role-card strong {
  display: block;
  font-size: 12px;
  margin: 5px 0;
}
.main-content {
  margin-left: 250px;
  width: calc(100% - 250px);
  min-width: 0;
}
.topbar {
  height: 70px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.breadcrumb {
  font-family: Manrope;
  font-weight: 700;
  font-size: 15px;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 13px;
}
.global-search {
  width: 300px;
  height: 39px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  padding: 0 11px;
  gap: 7px;
  color: #9aa3b1;
}
.global-search input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  font-size: 12px;
  color: var(--text);
}
.icon-btn {
  width: 39px;
  height: 39px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  color: #5f6978;
  position: relative;
}
.notification-dot {
  display: block;
}
#notificationDot {
  position: absolute;
  width: 7px;
  height: 7px;
  background: #e05262;
  border-radius: 50%;
  right: 8px;
  top: 7px;
  border: 1px solid #fff;
}
.avatar {
  width: 37px;
  height: 37px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e9e7ff;
  color: #4f46e5;
  font-size: 11px;
  font-weight: 800;
}
.content {
  padding: 30px;
  max-width: 1500px;
  margin: auto;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 25px;
}
.page-heading h1 {
  font: 800 27px Manrope;
  margin: 4px 0;
}
.page-heading p {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  color: var(--primary);
  font-weight: 800;
}
.heading-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}
.btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  background: #fff;
  color: var(--text);
}
.btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn.primary:hover {
  background: var(--primary-dark);
}
.btn.secondary:hover {
  background: #f3f4f6;
}
.btn.small {
  padding: 7px 10px;
  font-size: 11px;
}
.btn.danger {
  color: var(--danger);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.stat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.stat-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.stat-icon {
  width: 33px;
  height: 33px;
  border-radius: 9px;
  background: #eef0ff;
  color: var(--primary);
  display: grid;
  place-items: center;
}
.stat-value {
  font: 800 26px Manrope;
  margin: 12px 0 4px;
}
.stat-note {
  font-size: 10px;
  color: var(--muted);
}
.stat-note.good {
  color: var(--success);
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 18px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 18px;
  border-bottom: 1px solid var(--line);
}
.card-header h3 {
  font: 700 14px Manrope;
  margin: 0;
}
.card-header span {
  font-size: 10px;
  color: var(--muted);
}
.card-body {
  padding: 17px 18px;
}
.activity {
  display: grid;
  gap: 17px;
}
.activity-item {
  display: flex;
  gap: 12px;
}
.activity-icon {
  width: 31px;
  height: 31px;
  border-radius: 9px;
  background: #f0f1ff;
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 12px;
  flex: none;
}
.activity-item strong {
  font-size: 12px;
}
.activity-item p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
}
.mini-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-head {
  text-align: center;
  color: #929aa7;
  font-size: 9px;
  padding: 4px;
}
.cal-day {
  height: 30px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 10px;
}
.cal-day.muted {
  color: #c3c8d0;
}
.cal-day.today {
  background: #111827;
  color: #fff;
  font-weight: 700;
}
.cal-day.event {
  outline: 1px solid #c7c9ff;
  background: #f0f1ff;
  color: var(--primary);
}
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-input,
.filter-select {
  height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 0 11px;
  font-size: 11px;
  outline: none;
}
.filter-input {
  min-width: 230px;
}
.filter-select {
  min-width: 150px;
}
.table-card {
  overflow: hidden;
}
.table-wrap {
  overflow: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 850px;
}
.data-table th {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8992a0;
  text-align: left;
  background: #fafbfc;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
}
.data-table td {
  font-size: 11px;
  padding: 13px 15px;
  border-bottom: 1px solid #eef1f4;
  vertical-align: middle;
}
.data-table tr:last-child td {
  border-bottom: 0;
}
.data-table tr:hover td {
  background: #fbfcfe;
}
.person {
  display: flex;
  align-items: center;
  gap: 9px;
}
.person-avatar {
  width: 31px;
  height: 31px;
  border-radius: 9px;
  background: #eef0ff;
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
}
.person-name {
  font-weight: 700;
}
.subtext {
  font-size: 9px;
  color: var(--muted);
  margin-top: 2px;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}
.status:before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.status.active,
.status.in-progress,
.status.interview {
  color: var(--info);
  background: #eaf5fc;
}
.status.new,
.status.pending {
  color: #9b6a0a;
  background: #fff5dc;
}
.status.reviewed,
.status.candidate {
  color: #6d4dc5;
  background: #f1edff;
}
.status.rejected,
.status.discarded {
  color: var(--danger);
  background: #fdecef;
}
.status.completed,
.status.portfolio {
  color: var(--success);
  background: #e7f7ef;
}
.actions {
  display: flex;
  gap: 5px;
}
.table-action {
  width: 29px;
  height: 29px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #657083;
}
.table-action:hover {
  background: #f3f4f6;
}
.progress {
  height: 6px;
  background: #edf0f4;
  border-radius: 10px;
  overflow: hidden;
  width: 100px;
}
.progress span {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 10px;
}
.doc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}
.doc-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}
.doc-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: #f0f1ff;
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 17px;
  margin-bottom: 14px;
}
.doc-card h3 {
  font: 700 13px Manrope;
  margin: 0 0 5px;
}
.doc-card p {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
  min-height: 30px;
}
.doc-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 13px;
  font-size: 9px;
  color: var(--muted);
}
.calendar-layout {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 18px;
}
.big-calendar {
  padding: 18px;
}
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.calendar-toolbar h2 {
  font: 700 17px Manrope;
  margin: 0;
}
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.month-cell {
  min-height: 105px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px;
  position: relative;
}
.month-cell > strong {
  font-size: 10px;
}
.month-cell.muted {
  color: #c1c6cf;
  background: #fafbfc;
}
.event-pill {
  display: block;
  margin-top: 7px;
  padding: 4px 5px;
  border-radius: 5px;
  background: #eef0ff;
  color: #4f46e5;
  font-size: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-pill.green {
  background: #e7f7ef;
  color: #16845b;
}
.event-pill.orange {
  background: #fff3df;
  color: #9b6a0a;
}
.event-list {
  display: grid;
  gap: 10px;
}
.event-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.event-item strong {
  font-size: 11px;
}
.event-item small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  margin-top: 4px;
}
.roles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}
.role-permission {
  padding: 18px;
}
.role-permission h3 {
  font: 700 13px Manrope;
  margin: 0 0 5px;
}
.role-permission p {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
}
.permission-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.permission-list li {
  font-size: 10px;
  padding: 6px 0;
  border-top: 1px solid #eef1f4;
}
.permission-list li:before {
  content: "✓";
  color: var(--success);
  font-weight: 800;
  margin-right: 7px;
}
.empty {
  padding: 35px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.mobile-menu {
  display: none;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 100;
}
.modal-backdrop.hidden {
  display: none;
}
.modal {
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}
.modal-header h2 {
  font: 800 20px Manrope;
  margin: 4px 0 0;
}
.close-btn {
  border: 0;
  background: #f3f4f6;
  width: 33px;
  height: 33px;
  border-radius: 9px;
  font-size: 20px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 13px;
  padding: 20px;
}
.field {
  display: grid;
  gap: 6px;
}
.field.full {
  grid-column: 1/-1;
}
.field label {
  font-size: 10px;
  font-weight: 700;
  color: #556071;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 10px;
  outline: 0;
  background: #fff;
  font-size: 11px;
}
.field textarea {
  min-height: 75px;
  resize: vertical;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 15px 20px;
  border-top: 1px solid var(--line);
}
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 8px;
  z-index: 200;
}
.toast {
  background: #111827;
  color: #fff;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 11px;
  box-shadow: var(--shadow);
  animation: toast 0.2s ease;
}
.toast.success {
  background: #176b4d;
}
@keyframes toast {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.checklist {
  display: grid;
  gap: 8px;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
}
.check-item input {
  accent-color: var(--primary);
}
@media (max-width: 1000px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-grid,
  .calendar-layout {
    grid-template-columns: 1fr;
  }
  .doc-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .global-search {
    width: 220px;
  }
}
@media (max-width: 720px) {
  .sidebar {
    transform: translateX(-100%);
    transition: 0.2s;
  }
  .sidebar.open {
    transform: none;
  }
  .main-content {
    margin-left: 0;
    width: 100%;
  }
  .mobile-menu {
    display: block;
  }
  .topbar {
    padding: 0 15px;
  }
  .breadcrumb {
    display: none;
  }
  .global-search {
    display: none;
  }
  .content {
    padding: 20px 14px;
  }
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }
  .stat-card {
    padding: 14px;
  }
  .stat-value {
    font-size: 21px;
  }
  .doc-grid,
  .roles-grid {
    grid-template-columns: 1fr;
  }
  .month-cell {
    min-height: 75px;
    padding: 5px;
  }
  .event-pill {
    font-size: 7px;
  }
  .modal {
    max-height: 95vh;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .field.full {
    grid-column: auto;
  }
}
@media (max-width: 430px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .heading-actions {
    width: 100%;
  }
  .heading-actions .btn {
    flex: 1;
  }
  .filters > * {
    width: 100%;
  }
  .filter-input {
    min-width: 0;
  }
}

.hidden {
  display: none !important;
}
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f4f6fb, #eef0ff);
  padding: 20px;
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 30px;
  box-shadow: 0 25px 70px rgba(31, 41, 55, 0.12);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 28px;
}
.login-brand strong {
  display: block;
  font-family: Manrope;
  font-size: 15px;
}
.login-brand span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}
.login-card h1 {
  font: 800 25px Manrope;
  margin: 6px 0;
}
.login-card > p {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 22px;
}
.login-card form {
  display: grid;
  gap: 13px;
}
.login-btn {
  width: 100%;
  padding: 12px;
}
.login-error {
  background: #fdecef;
  color: var(--danger);
  border-radius: 9px;
  padding: 9px;
  font-size: 10px;
  text-align: center;
}
.demo-credentials {
  margin-top: 18px;
  padding: 11px;
  background: var(--surface-2);
  border-radius: 10px;
  font-size: 10px;
  color: var(--muted);
  display: grid;
  gap: 3px;
}
.demo-credentials strong {
  color: var(--text);
}
.user-menu-wrap {
  position: relative;
}
.avatar-btn {
  border: 0;
  cursor: pointer;
}
.user-menu {
  position: absolute;
  right: 0;
  top: 46px;
  width: 220px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px;
  z-index: 50;
}
.user-menu strong {
  display: block;
  font-size: 11px;
}
.user-menu span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  margin: 3px 0 10px;
}
.user-menu button {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 9px 0 2px;
  background: #fff;
  text-align: left;
  font-size: 10px;
  color: var(--danger);
  font-weight: 700;
}
.notifications-panel {
  position: fixed;
  right: 22px;
  top: 62px;
  width: min(380px, calc(100vw - 30px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 22px 55px rgba(31, 41, 55, 0.18);
  z-index: 80;
  overflow: hidden;
}
.notifications-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.notifications-head strong {
  display: block;
  font-size: 12px;
}
.notifications-head span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  margin-top: 3px;
}
.notification-item {
  display: flex;
  gap: 10px;
  padding: 13px;
  border-bottom: 1px solid #eef1f4;
  cursor: pointer;
}
.notification-item:hover {
  background: #fafbfc;
}
.notification-item.unread {
  background: #f7f7ff;
}
.notification-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #eef0ff;
  color: var(--primary);
  display: grid;
  place-items: center;
  flex: none;
}
.notification-item strong {
  font-size: 10px;
}
.notification-item p {
  font-size: 9px;
  color: var(--muted);
  margin: 3px 0 0;
  line-height: 1.4;
}
.notification-item small {
  font-size: 8px;
  color: #9aa3b1;
}
.notification-empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  font-size: 10px;
}
.mark-read-btn {
  width: 100%;
  border: 0;
  background: #fff;
  color: var(--primary);
  padding: 11px;
  font-size: 10px;
  font-weight: 700;
}
.notifications-list-wrap {
  max-height: min(52vh, 430px);
  overflow: hidden;
}
.notifications-list-wrap #notificationsList {
  max-height: min(52vh, 430px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}
.notification-scroll-controls {
  display: flex;
  gap: 7px;
  padding: 8px 13px;
  border-top: 1px solid #eef1f4;
  background: #fafbfc;
}
.notification-scroll-controls button {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--primary);
  height: 28px;
  font-weight: 800;
  cursor: pointer;
}
.notification-scroll-controls button:disabled {
  color: #c3c8d0;
  cursor: default;
  background: #f7f8fa;
}
@media (max-width: 720px) {
  .notifications-panel {
    right: 14px;
    top: 62px;
  }
  .login-card {
    padding: 24px;
  }
}

/* ===== DOCUMENTACIÓN REDISEÑADA ===== */
.doc-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.doc-card {
  position: relative;
  overflow: hidden;
  padding: 20px;
  transition: 0.18s;
}
.doc-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 38px rgba(31, 41, 55, 0.11);
  border-color: #d7dcf4;
}
.doc-card:before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: var(--primary);
}
.doc-card:nth-child(2):before {
  background: var(--info);
}
.doc-card:nth-child(3):before {
  background: var(--success);
}
.doc-card:nth-child(4):before {
  background: var(--warning);
}
.doc-card:nth-child(5):before {
  background: #7c5ac7;
}
.doc-card:nth-child(6):before {
  background: #52677f;
}
.doc-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 14px;
}
.doc-template-badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f4f5f8;
  color: #667085;
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.doc-card h3 {
  font-size: 14px;
}
.doc-card p {
  font-size: 10.5px;
  min-height: 36px;
}
.doc-card .doc-meta {
  margin-top: 16px;
}
.doc-card .table-action {
  width: auto;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  font-size: 9px;
  font-weight: 800;
}
.doc-edit-action {
  background: #f1edff;
  color: var(--primary);
  border-color: #ddd7ff;
}
.doc-download-action {
  background: #eaf7f1;
  color: var(--success);
  border-color: #cfeadd;
}
.document-editor-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
  z-index: 150;
  padding: 18px;
  display: grid;
  place-items: center;
}
.document-editor-backdrop.hidden {
  display: none;
}
.document-editor {
  width: min(1250px, 100%);
  height: min(92vh, 900px);
  background: #eef1f6;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.32);
  display: flex;
  flex-direction: column;
}
.document-editor-header {
  background: #fff;
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
}
.document-editor-header h2 {
  font: 800 19px Manrope;
  margin: 4px 0 2px;
}
.document-editor-header p {
  font-size: 10px;
  color: var(--muted);
  margin: 0;
}
.document-editor-toolbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 9px 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.editor-toolbar-group {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.editor-tool {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #4d5868;
  font-size: 10px;
  font-weight: 700;
}
.editor-tool:hover {
  background: #f3f4f6;
  color: var(--primary);
}
select.editor-tool {
  cursor: pointer;
}
.editor-color-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.editor-color-tool input[type="color"] {
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  background: none;
}
.document-editor-body {
  display: grid;
  grid-template-columns: 245px 1fr;
  min-height: 0;
  flex: 1;
}
.document-editor-sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 17px;
  overflow: auto;
}
.editor-side-title {
  font: 800 10px Manrope;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #778193;
  margin: 2px 0 9px;
}
.editor-template-select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  padding: 0 9px;
  font-size: 10px;
  margin-bottom: 20px;
}
.editor-side-field {
  display: grid;
  gap: 5px;
  font-size: 9px;
  font-weight: 700;
  color: #5b6575;
  margin-bottom: 12px;
}
.editor-side-field input {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
  font-size: 10px;
  outline: none;
  width: 100%;
}
.editor-downloads {
  display: grid;
  gap: 7px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.editor-download {
  width: 100%;
  font-size: 10px;
}
.document-page-wrap {
  overflow: auto;
  padding: 30px;
  background: #e9edf3;
}
.document-page {
  width: min(794px, 100%);
  min-height: 1050px;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 10px 30px rgba(31, 41, 55, 0.12);
  padding: 54px 62px 42px;
  display: flex;
  flex-direction: column;
}
.document-page-head {
  display: flex;
  align-items: center;
  gap: 15px;
}
.document-logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: #111827;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
}
.document-kicker {
  font-size: 8px;
  letter-spacing: 0.13em;
  color: var(--primary);
  font-weight: 800;
}
.document-page h1 {
  font: 800 25px Manrope;
  margin: 4px 0;
}
.document-author {
  font-size: 9px;
  color: var(--muted);
}
.document-divider {
  height: 1px;
  background: #dfe3ea;
  margin: 25px 0 20px;
}
.document-editable {
  font-family: "DM Sans", sans-serif;
  font-size: 11px;
  line-height: 1.72;
  color: #293241;
  outline: none;
  min-height: 700px;
}
.document-editable:focus {
  box-shadow: inset 0 0 0 1px #d8d7fb;
  border-radius: 5px;
}
.document-editable h2 {
  font: 800 15px Manrope;
  margin: 24px 0 8px;
}
.document-editable p {
  margin: 0 0 11px;
}
.document-editable ul,
.document-editable ol {
  padding-left: 20px;
}
.document-editable li {
  margin: 4px 0;
}
.document-page-footer {
  margin-top: auto;
  padding-top: 25px;
  border-top: 1px solid #eef1f4;
  color: #929aa7;
  font-size: 8px;
  text-align: center;
}
@media (max-width: 900px) {
  .doc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .document-editor-body {
    grid-template-columns: 1fr;
  }
  .document-editor-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 210px;
  }
  .editor-downloads {
    display: flex;
    flex-wrap: wrap;
  }
  .editor-download {
    width: auto;
    flex: 1;
  }
}
@media (max-width: 600px) {
  .doc-grid {
    grid-template-columns: 1fr;
  }
  .document-editor-backdrop {
    padding: 0;
  }
  .document-editor {
    height: 100vh;
    border-radius: 0;
  }
  .document-page-wrap {
    padding: 12px;
  }
  .document-page {
    padding: 32px 25px;
    min-height: 900px;
  }
}

/* ===== CALENDARIO MEJORADO ===== */
.calendar-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
}
.big-calendar {
  padding: 20px;
}
.calendar-toolbar {
  padding: 2px 2px 18px;
  margin-bottom: 0;
}
.calendar-toolbar .btn {
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 22px;
  display: grid;
  place-items: center;
}
.calendar-title-wrap {
  text-align: center;
}
.calendar-title-wrap h2 {
  font-size: 18px;
  margin: 0;
}
.calendar-title-wrap span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #f8f9fb;
}
.calendar-weekdays div {
  padding: 10px 5px;
  text-align: center;
  font-size: 9px;
  font-weight: 800;
  color: #687385;
  text-transform: uppercase;
  border-right: 1px solid var(--line);
}
.calendar-weekdays div:last-child {
  border-right: 0;
}
.month-grid {
  border: 1px solid var(--line);
  border-top: 0;
  overflow: hidden;
}
.month-cell {
  min-height: 112px;
  background: #fff;
  padding: 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transition: 0.15s;
}
.month-cell:nth-child(7n) {
  border-right: 0;
}
.month-cell:nth-last-child(-n + 7) {
  border-bottom: 0;
}
.month-cell:hover {
  background: #fbfcff;
}
.month-cell.muted {
  background: #f8f9fb;
}
.month-cell.today {
  background: #f5f4ff;
  box-shadow: inset 0 0 0 2px #d9d6ff;
}
.month-day-number {
  font-size: 11px;
  font-weight: 800;
  color: #465164;
  margin-bottom: 5px;
}
.month-cell.today .month-day-number {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
}
.event-pill {
  margin-top: 5px;
  padding: 5px 6px;
  border-radius: 6px;
  font-size: 8px;
  line-height: 1.25;
}
.event-more {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
}
.event-list {
  gap: 8px;
}
.event-item {
  padding: 11px 12px;
  border-radius: 10px;
  background: #fff;
}
.event-item strong {
  display: block;
  line-height: 1.35;
}
.event-item small {
  line-height: 1.4;
}
@media (max-width: 1000px) {
  .calendar-layout {
    grid-template-columns: 1fr;
  }
  .calendar-layout > .card:last-child {
    width: 100%;
  }
}
@media (max-width: 720px) {
  .big-calendar {
    padding: 10px;
  }
  .calendar-toolbar {
    padding: 2px 2px 12px;
  }
  .calendar-toolbar .btn {
    width: 34px;
    height: 34px;
  }
  .calendar-title-wrap h2 {
    font-size: 15px;
  }
  .calendar-weekdays div {
    font-size: 8px;
    padding: 8px 2px;
  }
  .month-cell {
    min-height: 82px;
    padding: 6px;
  }
  .month-day-number {
    font-size: 10px;
  }
  .event-pill {
    font-size: 7px;
    padding: 4px;
  }
  .event-more {
    font-size: 7px;
  }
}
@media (max-width: 480px) {
  .calendar-weekdays div {
    font-size: 0;
  }
  .calendar-weekdays div:after {
    font-size: 8px;
  }
  .calendar-weekdays div:nth-child(1):after {
    content: "L";
  }
  .calendar-weekdays div:nth-child(2):after {
    content: "M";
  }
  .calendar-weekdays div:nth-child(3):after {
    content: "X";
  }
  .calendar-weekdays div:nth-child(4):after {
    content: "J";
  }
  .calendar-weekdays div:nth-child(5):after {
    content: "V";
  }
  .calendar-weekdays div:nth-child(6):after {
    content: "S";
  }
  .calendar-weekdays div:nth-child(7):after {
    content: "D";
  }
  .month-cell {
    min-height: 68px;
    padding: 4px;
  }
  .event-pill {
    white-space: nowrap;
    font-size: 6.5px;
  }
  .month-day-number {
    font-size: 9px;
  }
}

/* Mejoras usuarios, CV y agenda rápida */
.cv-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.cv-cell > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}
.cv-download {
  width: 28px !important;
  min-width: 28px !important;
  height: 28px !important;
  padding: 0 !important;
}
.file-help {
  font-size: 9px;
  color: var(--muted);
  line-height: 1.4;
}
.field input[type="file"] {
  padding: 7px;
  background: #fafbfc;
}
.mini-calendar-wrap {
  display: grid;
  gap: 10px;
}
.mini-calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mini-calendar-toolbar strong {
  font-size: 10px;
}
.mini-calendar-toolbar .table-action {
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
}
.mini-calendar .cal-day {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}
.mini-calendar .cal-day:hover {
  background: #f1f3f8;
}
.mini-calendar .cal-day.today {
  background: #111827;
  color: #fff;
}
.mini-calendar .cal-day.event {
  outline: 1px solid #c7c9ff;
  background: #f0f1ff;
  color: var(--primary);
}
.mini-calendar .cal-day.today.event {
  color: #fff;
  background: #111827;
}
.quick-agenda {
  padding-top: 9px;
  border-top: 1px solid var(--line);
  min-height: 35px;
}
.quick-agenda > span {
  font-size: 9px;
  color: var(--muted);
}
.quick-agenda-item {
  padding: 7px 9px;
  border-radius: 8px;
  background: #f7f8fb;
  margin-bottom: 5px;
}
.quick-agenda-item strong {
  display: block;
  font-size: 9px;
}
.quick-agenda-item small {
  display: block;
  color: var(--muted);
  font-size: 8px;
  margin-top: 2px;
}
@media (max-width: 720px) {
  .cv-cell > span {
    max-width: 110px;
  }
  .quick-agenda-item {
    padding: 6px;
  }
  .mini-calendar-toolbar strong {
    font-size: 9px;
  }
}

/* ===== ACCIONES DE USUARIO MEJORADAS ===== */
.user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}
.user-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: #475467;
  font-family: inherit;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
  box-shadow: 0 1px 1px rgba(16, 24, 40, 0.03);
}
.user-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(16, 24, 40, 0.08);
}
.user-action-edit {
  background: #f4f1ff;
  border-color: #ddd6fe;
  color: #5b4acb;
}
.user-action-edit:hover {
  background: #ebe7ff;
  border-color: #cfc7ff;
}
.user-action-password {
  background: #f2f7ff;
  border-color: #d8e5ff;
  color: #3565a8;
}
.user-action-password:hover {
  background: #e8f1ff;
  border-color: #bfd5ff;
}
.user-action-delete {
  background: #fff4f4;
  border-color: #ffd5d5;
  color: #c63b3b;
}
.user-action-delete:hover {
  background: #ffe8e8;
  border-color: #ffbdbd;
}
.user-action-icon {
  font-size: 13px;
  line-height: 1;
  font-weight: 900;
}
@media (max-width: 850px) {
  .user-actions {
    justify-content: flex-start;
  }
  .user-action-btn {
    height: 32px;
    padding: 0 9px;
  }
}
@media (max-width: 560px) {
  .user-action-btn span:last-child {
    display: none;
  }
  .user-action-btn {
    width: 34px;
    padding: 0;
  }
  .user-action-icon {
    font-size: 14px;
  }
}

/* ===== TEMA OSCURO Y CALENDARIO RESPONSIVE ===== */
html[data-theme="dark"] {
  --bg: #111827;
  --surface: #1f2937;
  --surface-2: #273449;
  --text: #f3f4f6;
  --muted: #aeb9c8;
  --line: #3a475b;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}
html[data-theme="dark"] body {
  background: var(--bg);
  color: var(--text);
}
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .card,
html[data-theme="dark"] .doc-card,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .user-menu,
html[data-theme="dark"] .notifications-panel,
html[data-theme="dark"] .document-editor-header,
html[data-theme="dark"] .document-editor-toolbar,
html[data-theme="dark"] .document-editor-sidebar,
html[data-theme="dark"] .event-item,
html[data-theme="dark"] .month-cell,
html[data-theme="dark"] .table-action,
html[data-theme="dark"] .icon-btn,
html[data-theme="dark"] .mark-read-btn {
  background: var(--surface);
  color: var(--text);
}
html[data-theme="dark"] .login-screen {
  background: linear-gradient(135deg, #111827, #1e1b4b);
}
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .document-page {
  background: var(--surface);
  color: var(--text);
}
html[data-theme="dark"] .global-search,
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .editor-side-field input,
html[data-theme="dark"] .editor-template-select {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line);
}
html[data-theme="dark"] .month-cell.muted,
html[data-theme="dark"] .calendar-weekdays,
html[data-theme="dark"] .quick-agenda-item,
html[data-theme="dark"] .notification-item:hover {
  background: #263247;
}
html[data-theme="dark"] .notification-item.unread,
html[data-theme="dark"] .month-cell.today {
  background: #292659;
}
html[data-theme="dark"] .document-editor,
html[data-theme="dark"] .document-page-wrap {
  background: #172033;
}
html[data-theme="dark"] .document-editable {
  color: var(--text);
}
html[data-theme="dark"] .theme-toggle {
  color: #facc15;
}
html[data-theme="dark"] .main-content,
html[data-theme="dark"] .content {
  background: var(--bg);
}
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .btn,
html[data-theme="dark"] .filter-input,
html[data-theme="dark"] .filter-select,
html[data-theme="dark"] .close-btn,
html[data-theme="dark"] .editor-tool,
html[data-theme="dark"] .user-action-btn,
html[data-theme="dark"] .notification-scroll-controls,
html[data-theme="dark"] .notification-scroll-controls button {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}
html[data-theme="dark"] .data-table th {
  background: #263247;
  color: #c7d0dc;
  border-color: var(--line);
}
html[data-theme="dark"] .data-table td,
html[data-theme="dark"] .notification-item,
html[data-theme="dark"] .permission-list li {
  border-color: var(--line);
}
html[data-theme="dark"] .data-table tr:hover td,
html[data-theme="dark"] .table-action:hover,
html[data-theme="dark"] .btn.secondary:hover,
html[data-theme="dark"] .editor-tool:hover {
  background: #2c3a50;
}
html[data-theme="dark"] .field label,
html[data-theme="dark"] .calendar-weekdays div,
html[data-theme="dark"] .month-day-number,
html[data-theme="dark"] .editor-side-title,
html[data-theme="dark"] .editor-side-field {
  color: #c7d0dc;
}
html[data-theme="dark"] .avatar {
  background: #302b64;
  color: #c9c5ff;
}
html[data-theme="dark"] .stat-icon,
html[data-theme="dark"] .activity-icon,
html[data-theme="dark"] .person-avatar,
html[data-theme="dark"] .doc-icon,
html[data-theme="dark"] .notification-icon,
html[data-theme="dark"] .mini-calendar .cal-day.event {
  background: #2d2a61;
  color: #c9c5ff;
}
html[data-theme="dark"] .doc-template-badge {
  background: #2b374a;
  color: #c7d0dc;
}
html[data-theme="dark"] .event-pill {
  background: #302b64;
  color: #d5d2ff;
}
html[data-theme="dark"] .event-pill.green,
html[data-theme="dark"] .status.completed,
html[data-theme="dark"] .status.portfolio {
  background: #153d31;
  color: #8ee0b6;
}
html[data-theme="dark"] .event-pill.orange,
html[data-theme="dark"] .status.new,
html[data-theme="dark"] .status.pending {
  background: #4a3518;
  color: #f7ce7a;
}
html[data-theme="dark"] .status.active,
html[data-theme="dark"] .status.in-progress,
html[data-theme="dark"] .status.interview {
  background: #183a50;
  color: #8fd3ff;
}
html[data-theme="dark"] .status.reviewed,
html[data-theme="dark"] .status.candidate {
  background: #332651;
  color: #cdb6ff;
}
html[data-theme="dark"] .status.rejected,
html[data-theme="dark"] .status.discarded {
  background: #4b2632;
  color: #ffaabe;
}
html[data-theme="dark"] .user-menu button {
  background: transparent;
  color: #ffb4c2;
  border-color: var(--line);
}
html[data-theme="dark"] .progress {
  background: #364257;
}
html[data-theme="dark"] .login-error {
  background: #4b2632;
  color: #ffaabe;
}
html[data-theme="dark"] .document-page {
  background: #f8fafc;
  color: #182230;
}
html[data-theme="dark"] .document-page .document-editable {
  color: #293241;
}
html[data-theme="dark"] .document-page .document-author,
html[data-theme="dark"] .document-page-footer {
  color: #6c7787;
}
html[data-theme="dark"] .mini-calendar .cal-head {
  color: #b8c3d2;
}
html[data-theme="dark"] .mini-calendar .cal-day {
  color: var(--text);
}
html[data-theme="dark"] .mini-calendar .cal-day:hover {
  background: #2c3a50;
}
html[data-theme="dark"] .mini-calendar .cal-day.today,
html[data-theme="dark"] .mini-calendar .cal-day.today.event {
  background: var(--primary);
  color: #fff;
}
html[data-theme="dark"] .quick-agenda {
  border-color: var(--line);
}
html[data-theme="dark"] .quick-agenda-item {
  background: #263247;
  color: var(--text);
}
html[data-theme="dark"] .mini-calendar-toolbar .table-action {
  background: #263247;
  color: var(--text);
}
.favorite-action {
  font-size: 17px;
  line-height: 1;
  color: #8a94a3;
}
.favorite-action.is-favorite {
  color: #e5a817;
  background: #fff8de;
  border-color: #f0cf70;
}
.pdf-action {
  width: auto;
  min-width: 34px;
  padding: 0 6px;
  font-size: 8px;
  font-weight: 800;
  color: #4f46e5;
}
html[data-theme="dark"] .favorite-action.is-favorite {
  background: #4a3518;
  border-color: #8a6b21;
  color: #f7ce7a;
}
@media (max-width: 600px) {
  .big-calendar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .calendar-toolbar,
  .calendar-weekdays,
  .month-grid {
    min-width: 560px;
  }
  .month-cell {
    min-height: 88px;
    padding: 6px;
  }
  .event-pill {
    font-size: 7px;
  }
  .calendar-layout > .card:last-child {
    min-width: 0;
  }
}

/* ===== Buscador de contratos ===== */
.contract-search {
  padding: 14px;
  margin-bottom: 18px;
}
.contract-search-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.contract-search-main:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .10);
}
.contract-search-main .filter-input {
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  width: 100%;
  min-width: 0;
  padding: 10px 0;
}
.search-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #eef0ff;
  color: var(--primary-dark);
  font-weight: 800;
  flex: 0 0 auto;
}
.contract-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.contract-filters .filter-select {
  width: 100%;
}
.contract-type,
.contract-origin {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.contract-origin { color: var(--muted); }
@media (max-width: 800px) {
  .contract-summary,
  .contract-filters { grid-template-columns: 1fr; }
}

/* ===== ADMINISTRACIÓN Y SEGURIDAD ===== */
.security-page {
  --security-accent: #4f46e5;
}
.security-page .page-heading {
  margin-bottom: 18px;
}
.security-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: -6px 0 16px;
}
.security-page .dashboard-grid {
  gap: 18px;
}
.security-page .card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.security-page .card-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}
.security-page .card-header h3 {
  margin: 0;
  color: var(--text);
  font-family: "Manrope", sans-serif;
}
.security-page .card-header span {
  color: var(--muted);
  font-size: .82rem;
}
.security-page .card-body {
  color: var(--text);
}
.security-page .stack-form {
  display: grid;
  gap: 14px;
}
.security-page .stack-form label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 600;
}
.security-page .stack-form input,
.security-page .stack-form select,
.security-page .stack-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}
.security-page .stack-form input:focus,
.security-page .stack-form select:focus,
.security-page .stack-form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.13);
}
.security-page .feature-list {
  display: grid;
  gap: 10px;
  padding-left: 20px;
  margin: 0;
}
.security-page .feature-list li::marker {
  color: var(--primary);
}
.security-page .activity {
  display: grid;
  gap: 10px;
}
.security-page .activity-item {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 12px;
  padding: 12px;
}
.security-page .activity-icon {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--line);
}
.security-page .data-table {
  color: var(--text);
}
.security-page .data-table td small {
  color: var(--muted);
}
.security-page .empty {
  color: var(--muted);
}
.security-page .stats-grid {
  margin-bottom: 18px;
}
html[data-theme="dark"] .security-page .card,
html[data-theme="dark"] .security-page .stat-card {
  background: #1f2937;
  border-color: #3a475b;
  box-shadow: 0 12px 30px rgba(0,0,0,.24);
}
html[data-theme="dark"] .security-page .card-header {
  background: #202b3d;
  border-bottom-color: #3a475b;
}
html[data-theme="dark"] .security-page .card-body {
  background: #1f2937;
  color: #f3f4f6;
}
html[data-theme="dark"] .security-page .stack-form input,
html[data-theme="dark"] .security-page .stack-form select,
html[data-theme="dark"] .security-page .stack-form textarea {
  background: #273449;
  color: #f3f4f6;
  border-color: #46556c;
}
html[data-theme="dark"] .security-page .activity-item {
  background: #273449;
  border-color: #46556c;
}
html[data-theme="dark"] .security-page .activity-icon {
  background: #1f2937;
  border-color: #46556c;
  color: #a5b4fc;
}
html[data-theme="dark"] .security-page .security-protection .card-body {
  background: linear-gradient(135deg, #1f2937, #202b3d);
}
html[data-theme="dark"] .security-page .data-table th {
  background: #273449;
  color: #d8dee9;
}
html[data-theme="dark"] .security-page .data-table td {
  background: #1f2937;
  color: #f3f4f6;
}
html[data-theme="dark"] .security-page .data-table tr:hover td {
  background: #29384e;
}
html[data-theme="dark"] .security-page .filter-select {
  background: #273449;
  color: #f3f4f6;
  border-color: #46556c;
}

/* Panel de administración: listas largas contenidas para evitar que la pantalla crezca sin límite. */
.security-scroll {
  max-height: 330px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-width: thin;
}
.security-scroll-table {
  max-height: 310px;
  overflow: auto;
}
.security-scroll::-webkit-scrollbar { width: 7px; height: 7px; }
.security-scroll::-webkit-scrollbar-thumb { border-radius: 10px; background: rgba(120, 130, 140, .45); }
.security-scroll::-webkit-scrollbar-track { background: transparent; }
.security-scroll .activity { margin: 0; }
.security-scroll .activity-item:last-child { border-bottom: 0; }
.security-page .card-body { min-width: 0; }
.security-page .data-table { min-width: 720px; }
.security-page .backup-create { position: sticky; top: 0; z-index: 2; background: var(--card, inherit); padding-bottom: 8px; }

/* Administración y seguridad: panel compacto, sin grandes huecos entre bloques */
.security-page > .dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 10px;
}
.security-page > .dashboard-grid > .card {
  margin: 0;
  align-self: start;
}
.security-page > .dashboard-grid > .card .card-body {
  gap: 10px;
}
.security-page > .dashboard-grid > .card .card-header {
  padding: 11px 14px;
}
.security-page > .dashboard-grid > .card .card-body {
  padding: 12px 14px;
}
.security-page .security-scroll {
  margin-top: 0;
}
.security-page .roles-grid {
  gap: 10px;
}
@media (max-width: 900px) {
  .security-page > .dashboard-grid { grid-template-columns: 1fr; }
}
/* Ajuste de distribución del panel: evita huecos verticales cuando una tarjeta es más corta que su vecina. */
.security-page > .dashboard-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-items: start;
}
.security-page > .dashboard-grid > .card {
  height: fit-content;
}
@media (max-width: 1180px) {
  .security-page > .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .security-page > .dashboard-grid { grid-template-columns: 1fr; }
}

/* Administración: distribución compacta tipo masonry para evitar huecos verticales. */
.security-page > .dashboard-grid {
  display: block;
  column-count: 3;
  column-gap: 10px;
}
.security-page > .dashboard-grid > .card {
  display: inline-block;
  width: 100%;
  margin: 0 0 10px;
  vertical-align: top;
  break-inside: avoid;
}
.security-page .card-header { min-height: 0; }
.security-page .card-body { padding: 10px 12px; }
.security-page .security-scroll { max-height: 260px; }
.security-page .backup-create { margin-bottom: 8px !important; padding-bottom: 6px !important; }
.security-page .backup-item { padding: 8px 0; }
.security-page .backup-item p { margin: 3px 0 6px; line-height: 1.25; }
.security-page .backup-actions { display:flex; gap:6px; flex-wrap:wrap; }
@media (max-width: 1180px) {
  .security-page > .dashboard-grid { column-count: 2; }
}
@media (max-width: 760px) {
  .security-page > .dashboard-grid { column-count: 1; }
}

/* Administración y seguridad: distribución fija izquierda/derecha, compacta */
.security-page > .dashboard-grid { display:none !important; }
.security-columns {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:12px;
  align-items:start;
}
.security-column { display:flex; flex-direction:column; gap:12px; min-width:0; }
.security-column .card { margin:0; min-width:0; }
.security-column .card-header { min-height:0; padding:10px 13px; }
.security-column .card-body { padding:10px 13px; }
.security-column .security-scroll { max-height:280px; overflow:auto; }
.security-column .audit-scroll { max-height:330px; }
.security-column .backup-scroll { max-height:260px; }
.backup-create { display:flex; gap:7px; align-items:center; margin:0 0 8px !important; padding:0 !important; background:transparent !important; position:static !important; }
.backup-create .filter-input { flex:1; min-width:0; }
.backup-item { padding:7px 0 !important; }
.backup-item p { margin:3px 0 5px !important; line-height:1.2; }
.report-buttons { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
.report-buttons .btn { min-width:0; white-space:normal; }
.security-column .data-table th, .security-column .data-table td { padding:7px 8px; }
.security-column .activity-item { padding:7px 0; }
@media (max-width: 900px) { .security-columns { grid-template-columns:1fr; } }
@media (max-width: 560px) { .report-buttons { grid-template-columns:1fr; } .backup-create { flex-direction:column; align-items:stretch; } }


/* Selector para generar el Dossier de bienvenida */
.dossier-pdf-modal{max-width:620px}
.dossier-pdf-body{padding:4px 26px 8px}
.dossier-pdf-intro{margin:0 0 20px;color:var(--muted);line-height:1.55}
.dossier-pdf-select{width:100%;min-height:44px}
.dossier-pdf-preview{margin-top:16px;padding:14px 16px;border:1px solid var(--line);border-radius:12px;background:var(--surface-2);font-size:13px;line-height:1.6}
.dossier-pdf-preview strong{color:var(--text)}

/* Editores de documentos */
.pdf-editor-modal,.word-editor-modal{width:min(1500px,97vw);height:min(94vh,980px);max-height:94vh;overflow:hidden}
.pdf-editor-toolbar,.word-editor-toolbar{display:flex;align-items:center;gap:10px;padding:12px 16px;border-top:1px solid var(--line);border-bottom:1px solid var(--line);background:var(--surface)}
.pdf-editor-size{display:flex;align-items:center;gap:7px;font-size:13px}.pdf-editor-size input{width:70px}
.pdf-editor-workspace{height:calc(94vh - 150px);overflow:auto;background:#dfe4e8;padding:28px;display:flex;flex-direction:column;align-items:center;gap:24px}
.pdf-page-shell{position:relative;background:#fff;box-shadow:0 8px 30px rgba(0,0,0,.16);flex:none}
.pdf-page-canvas{position:absolute;inset:0;display:block}.pdf-text-layer{position:absolute;inset:0;overflow:hidden;color:transparent;line-height:1;pointer-events:auto}
.pdf-text-layer span{position:absolute;white-space:pre-wrap;overflow:hidden;cursor:text;color:transparent;outline:0;border-radius:2px;min-width:2px;padding:0;margin:0;box-sizing:border-box;font-family:Arial,sans-serif;font-weight:400;letter-spacing:0}
.pdf-text-layer span:hover{background:rgba(45,108,223,.10)}
.pdf-text-layer span:focus,.pdf-text-layer span.editing{color:#111;background:rgba(255,255,255,.98);box-shadow:0 0 0 2px #2d6cdf;z-index:20;overflow:visible;min-width:20px}
.pdf-text-layer span.edited{color:#111;background:rgba(255,255,255,.98);z-index:15;overflow:visible;min-width:20px;box-shadow:0 0 0 1px rgba(45,108,223,.22)}
.pdf-text-layer span.edited:hover{box-shadow:0 0 0 2px rgba(45,108,223,.35)}
.pdf-edit-hint{position:absolute;right:10px;top:10px;background:rgba(0,0,0,.62);color:#fff;font-size:11px;padding:5px 8px;border-radius:6px;opacity:.35;pointer-events:none}.pdf-page-shell:hover .pdf-edit-hint{opacity:.9}
.pdf-loading{padding:50px;color:var(--muted)}
.word-editor-canvas{margin:22px auto;padding:60px 70px;background:#fff;min-height:700px;width:min(900px,90%);box-shadow:0 4px 24px rgba(0,0,0,.12);outline:0;overflow:auto;color:#111}
.word-editor-canvas:focus{box-shadow:0 0 0 2px #2d6cdf,0 4px 24px rgba(0,0,0,.12)}
.word-editor-modal{overflow:auto}.word-editor-modal .modal-header{position:sticky;top:0;z-index:5;background:var(--surface)}
@media(max-width:800px){.pdf-editor-toolbar,.word-editor-toolbar{flex-wrap:wrap}.pdf-editor-workspace{padding:12px}.word-editor-canvas{width:94%;padding:30px 22px}}


/* ===== ADMINISTRACIÓN Y SEGURIDAD · BARRAS EN MODO OSCURO ===== */
html[data-theme="dark"] .security-page .security-scroll,
html[data-theme="dark"] .security-page .security-scroll-table,
html[data-theme="dark"] .security-page .audit-scroll,
html[data-theme="dark"] .security-page .backup-scroll,
html[data-theme="dark"] .security-page .data-table-wrap {
  scrollbar-color: #64748b #202b3d;
  scrollbar-width: thin;
}
html[data-theme="dark"] .security-page .security-scroll::-webkit-scrollbar,
html[data-theme="dark"] .security-page .security-scroll-table::-webkit-scrollbar,
html[data-theme="dark"] .security-page .audit-scroll::-webkit-scrollbar,
html[data-theme="dark"] .security-page .backup-scroll::-webkit-scrollbar,
html[data-theme="dark"] .security-page .data-table-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
html[data-theme="dark"] .security-page .security-scroll::-webkit-scrollbar-track,
html[data-theme="dark"] .security-page .security-scroll-table::-webkit-scrollbar-track,
html[data-theme="dark"] .security-page .audit-scroll::-webkit-scrollbar-track,
html[data-theme="dark"] .security-page .backup-scroll::-webkit-scrollbar-track,
html[data-theme="dark"] .security-page .data-table-wrap::-webkit-scrollbar-track {
  background: #202b3d;
  border-radius: 10px;
}
html[data-theme="dark"] .security-page .security-scroll::-webkit-scrollbar-thumb,
html[data-theme="dark"] .security-page .security-scroll-table::-webkit-scrollbar-thumb,
html[data-theme="dark"] .security-page .audit-scroll::-webkit-scrollbar-thumb,
html[data-theme="dark"] .security-page .backup-scroll::-webkit-scrollbar-thumb,
html[data-theme="dark"] .security-page .data-table-wrap::-webkit-scrollbar-thumb {
  background: #64748b;
  border: 2px solid #202b3d;
  border-radius: 10px;
}
html[data-theme="dark"] .security-page .security-scroll::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] .security-page .security-scroll-table::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] .security-page .audit-scroll::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] .security-page .backup-scroll::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] .security-page .data-table-wrap::-webkit-scrollbar-thumb:hover {
  background: #818cf8;
}

/* Las barras de herramientas y filtros también conservan contraste en oscuro. */
html[data-theme="dark"] .security-page .filter-input,
html[data-theme="dark"] .security-page .filter-select,
html[data-theme="dark"] .security-page .table-action,
html[data-theme="dark"] .security-page .btn.secondary {
  background: #273449;
  color: #f3f4f6;
  border-color: #46556c;
}
html[data-theme="dark"] .security-page .table-action:hover,
html[data-theme="dark"] .security-page .btn.secondary:hover {
  background: #33435b;
  border-color: #64748b;
}

/* Editor PDF: selección y herramientas de formato */
.pdf-editor-toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.pdf-editor-color{display:inline-flex;align-items:center;gap:7px;font-size:12px;font-weight:700;color:#475467}
.pdf-editor-color input[type="color"]{width:38px;height:34px;padding:2px;border:1px solid #d8dee8;border-radius:8px;background:#fff;cursor:pointer}
.pdf-text-layer span.pdf-selected{outline:2px solid rgba(79,70,229,.55);outline-offset:2px;background:rgba(79,70,229,.06);z-index:4}
.pdf-text-layer span.edited{background:rgba(255,249,232,.35)}
@media print{
  .pdf-editor-modal,.modal-backdrop{display:none!important}
}

.pdf-add-layer{position:absolute;inset:0;pointer-events:none;z-index:18}.pdf-added-text{position:absolute;pointer-events:auto;cursor:pointer;white-space:pre;transform-origin:left bottom;padding:2px 3px;border-radius:3px;background:rgba(255,255,180,.16);font-family:Arial,sans-serif}.pdf-added-text:hover{background:rgba(45,108,223,.12)}.pdf-added-text.selected{background:rgba(255,235,59,.35);box-shadow:0 0 0 2px #2d6cdf;z-index:30}
