:root {
  color-scheme: light;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  font-synthesis: none;
  --sidebar-width: 240px;
  --sidebar-collapsed: 68px;
  --topbar-height: 62px;
  --navy-950: #101c28;
  --navy-900: #172738;
  --navy-800: #20384e;
  --navy-700: #294862;
  --blue-700: #075fc7;
  --blue-600: #0877ed;
  --blue-100: #e8f2ff;
  --surface: #f3f6f8;
  --panel: #fff;
  --line: #d8e0e7;
  --line-strong: #bdc8d2;
  --ink: #17212b;
  --muted: #64717d;
  --success: #0b7a53;
  --success-bg: #e4f6ef;
  --danger: #c42b37;
  --danger-bg: #fff0f1;
  --warning: #9a6500;
  --shadow-sm: 0 1px 3px rgba(16, 30, 43, .08);
  --shadow-md: 0 8px 22px rgba(16, 30, 43, .10);
}

* { box-sizing: border-box; }
html { font-size: 14px; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--surface); }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
svg { display: block; }

.skip-link {
  position: fixed;
  z-index: 100;
  left: 12px;
  top: -50px;
  padding: 9px 14px;
  background: #fff;
  color: var(--blue-700);
  border: 2px solid var(--blue-600);
}
.skip-link:focus { top: 10px; }

/* Estructura principal con apariencia de aplicación de escritorio */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  transition: grid-template-columns .18s ease;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--navy-900);
  color: #fff;
  border-right: 1px solid #0b1621;
  transition: width .18s ease, transform .18s ease;
}
.workspace { grid-column: 2; min-width: 0; min-height: 100vh; }

.brand {
  min-height: var(--topbar-height);
  padding: 0 17px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: linear-gradient(145deg, #1590ff, #0665ce);
  box-shadow: inset 0 1px rgba(255, 255, 255, .25);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .05em;
}
.brand-copy { min-width: 0; display: flex; flex-direction: column; }
.brand-copy strong { font-size: 1.17rem; letter-spacing: .06em; }
.brand-copy small { margin-top: 2px; color: #a9bfd2; font-size: .69rem; }
.sidebar-divider { height: 1px; margin: 0 15px 10px; background: rgba(255, 255, 255, .10); }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0 0 12px; scrollbar-width: thin; }
.menu-module { border: 0; }
.menu-module summary {
  min-height: 46px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  list-style: none;
  cursor: pointer;
  color: #edf5fc;
  background: var(--navy-800);
  border-top: 1px solid rgba(255, 255, 255, .035);
  border-bottom: 1px solid rgba(0, 0, 0, .12);
  font-weight: 600;
  user-select: none;
}
.menu-module summary::-webkit-details-marker { display: none; }
.menu-module summary:hover { background: var(--navy-700); }
.menu-icon { width: 19px; height: 19px; color: #2da4ff; flex: 0 0 19px; }
.menu-icon svg, .menu-chevron { width: 100%; height: 100%; fill: currentColor; }
.menu-module-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-chevron { width: 17px; height: 17px; margin-left: auto; color: #afc0cf; transition: transform .16s ease; }
.menu-module[open] .menu-chevron { transform: rotate(180deg); }
.menu-options { padding: 5px 0; background: var(--navy-950); }
.menu-options a {
  min-height: 38px;
  padding: 8px 16px 8px 45px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c9d5df;
  text-decoration: none;
  font-size: .82rem;
  border-left: 3px solid transparent;
}
.menu-options a:hover { color: #fff; background: #1d3346; }
.menu-options a.active {
  color: #fff;
  background: #23445f;
  border-left-color: #29a3ff;
  font-weight: 700;
}
.menu-option-icon { width: 16px; height: 16px; flex: 0 0 16px; color: #7897af; transition: color .15s ease, transform .15s ease; }
.menu-option-icon svg { width: 100%; height: 100%; display: block; fill: currentColor; }
.menu-options a:hover .menu-option-icon { color: #55b9ff; transform: translateX(1px); }
.menu-options a.active .menu-option-icon { color: #42b2ff; filter: drop-shadow(0 0 4px rgba(66, 178, 255, .28)); }
.menu-group summary {
  min-height: 39px;
  padding: 8px 17px 8px 27px;
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  color: #d6e4ef;
  cursor: pointer;
  font-size: .83rem;
  font-weight: 600;
}
.menu-group summary::-webkit-details-marker { display: none; }
.menu-group summary:hover { background: #1d3346; color: #fff; }
.menu-group[open] > summary .menu-chevron { transform: rotate(180deg); }
.menu-group-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-group-options a { padding-left: 55px; }
.sidebar-collapsed .menu-group-name, .sidebar-collapsed .menu-group .menu-chevron { display: none; }
.sidebar-collapsed .menu-group summary { justify-content: center; padding: 8px 0; }
.sidebar-collapsed .menu-group-options a { justify-content: center; padding: 8px 0; }
@media (max-width: 760px) {
  .sidebar-collapsed .menu-group-name, .sidebar-collapsed .menu-group .menu-chevron { display: inline; }
  .sidebar-collapsed .menu-group summary { justify-content: flex-start; padding: 8px 17px 8px 27px; }
  .sidebar-collapsed .menu-group-options a { justify-content: flex-start; padding: 8px 16px 8px 55px; }
}

.session-diagnostics { margin-top: 5px; max-width: 280px; font-weight: 400; }
.session-diagnostics summary { cursor: pointer; color: #235f92; font-size: .7rem; }
.session-diagnostics small { display: block; overflow-wrap: anywhere; margin-top: 3px; color: var(--muted); }

.logout-form { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .10); }
.sidebar-action {
  width: 100%;
  min-height: 52px;
  padding: 0 17px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #ff8a91;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
.sidebar-action:hover { background: rgba(255, 255, 255, .06); color: #ffb1b6; }
.sidebar-action svg { width: 19px; height: 19px; flex: 0 0 19px; fill: currentColor; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-height);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 4px rgba(16, 30, 43, .05);
}
.topbar-leading { min-width: 0; display: flex; align-items: center; gap: 14px; }
.menu-toggle {
  width: 36px;
  height: 34px;
  padding: 8px;
  display: grid;
  place-items: center;
  border: 1px solid #d2dae1;
  border-radius: 5px;
  background: #f7f9fa;
  color: #263542;
  cursor: pointer;
}
.menu-toggle:hover { background: #edf2f5; border-color: #b7c3ce; }
.menu-toggle svg { width: 19px; height: 19px; fill: currentColor; }
.application-title { min-width: 0; display: flex; flex-direction: column; }
.application-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .93rem; }
.application-title span { margin-top: 2px; color: var(--muted); font-size: .68rem; }
.user-summary { display: flex; align-items: center; gap: 9px; min-width: 0; }
.user-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: var(--blue-100);
  color: var(--blue-700);
  font-weight: 800;
}
.user-copy { max-width: 230px; display: flex; flex-direction: column; text-align: right; }
.user-copy small { color: var(--muted); font-size: .65rem; }
.user-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu-chevron { color: #607484; font-size: .9rem; transition: transform .15s ease; }
.user-menu[open] .user-menu-chevron { transform: rotate(180deg); }
.user-menu-panel { position: absolute; top: calc(100% + 10px); right: 0; z-index: 40; width: 205px; padding: 5px; border: 1px solid #c5d1db; border-radius: 5px; background: #fff; box-shadow: 0 10px 26px rgba(17, 41, 61, .18); }
.user-menu-panel a,
.user-menu-panel button { width: 100%; min-height: 36px; padding: 8px 10px; display: flex; justify-content: flex-start; border: 0; border-radius: 3px; background: transparent; color: #243d50; box-shadow: none; font-size: .78rem; text-decoration: none; }
.user-menu-panel a:hover,
.user-menu-panel button:hover { background: #edf5fb; color: #075fae; }
.user-menu-panel form { margin: 0; border-top: 1px solid #e2e8ed; }
.compact-form-panel { width: min(680px, 100%); margin: 0 auto; }
.compact-form-panel form { display: grid; gap: 16px; }

.content { width: 100%; max-width: 1680px; margin: 0 auto; padding: 18px 22px 32px; outline: none; }
.sidebar-backdrop { display: none; }

/* Cabeceras y paneles reutilizables */
.page-heading {
  min-height: 72px;
  margin: 0 0 14px;
  padding: 12px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(#f8fbfe, #e8f0f6);
  border: 1px solid #c5d4e1;
  border-left: 4px solid var(--blue-600);
  box-shadow: var(--shadow-sm);
}
.page-heading h1 { margin: 2px 0 3px; color: #123e69; font-size: 1.42rem; font-weight: 600; }
.page-heading p { margin: 0; color: var(--muted); font-size: .78rem; }
.eyebrow { color: #46718f; font-size: .62rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.panel, .feature-card {
  margin-bottom: 14px;
  padding: 15px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  box-shadow: var(--shadow-sm);
}
.panel > h2 { margin: -15px -15px 14px; padding: 10px 13px; background: linear-gradient(#f8fafb, #edf2f5); border-bottom: 1px solid var(--line); color: #263f54; font-size: .95rem; font-weight: 650; }
.split-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.feature-card { border-top: 3px solid var(--blue-600); }
.feature-card > span { color: var(--blue-700); font-size: .72rem; font-weight: 800; }
.feature-card h2 { margin: 7px 0 6px; font-size: 1rem; }
.feature-card p { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.55; }

/* Formularios compactos */
.form-stack { display: grid; gap: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 14px; }
.form-grid label, .form-stack label, .filter-bar label { display: grid; gap: 4px; color: #293d4e; font-size: .76rem; font-weight: 650; }
.full { grid-column: 1 / -1; }
input, select, textarea {
  width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid #aebdca;
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(25, 48, 67, .05);
}
textarea { min-height: 72px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #899dac; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c9e3ff; border-color: var(--blue-600); }
input::placeholder, textarea::placeholder { color: #8a969f; }
button, .button {
  min-height: 34px;
  padding: 7px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #0563cb;
  border-radius: 4px;
  background: linear-gradient(#1688ff, #066ee1);
  color: #fff;
  text-decoration: none;
  font-weight: 650;
  cursor: pointer;
  box-shadow: inset 0 1px rgba(255, 255, 255, .2), 0 1px 2px rgba(20, 63, 108, .12);
}
button:hover, .button:hover { background: linear-gradient(#0877ed, #055fc3); }
.button.secondary { border-color: #a9b7c2; background: linear-gradient(#fff, #e6ecef); color: #344b5d; }
.button.secondary:hover { background: #e6ecef; }
.danger { border-color: #b7232e; background: linear-gradient(#db4450, #be2935); }
.danger:hover { background: linear-gradient(#c93642, #a91f2a); }
.compact { min-height: 29px; padding: 4px 9px; font-size: .73rem; }
.filter-bar { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.filter-bar label { min-width: 175px; }

/* Tablas de alta densidad */
.table-header { min-height: 38px; margin: -15px -15px 0; padding: 8px 11px; display: flex; align-items: center; justify-content: space-between; background: linear-gradient(#fafcfd, #e8eef2); border-bottom: 1px solid var(--line-strong); }
.table-header h2 { margin: 0; color: #28455e; font-size: .86rem; }
.table-header span { color: var(--muted); font-size: .7rem; }
.table-scroll { margin: 0 -15px -15px; overflow: auto; }
.panel > .table-scroll:first-child { margin-top: -15px; }
table { width: 100%; min-width: 720px; border-collapse: collapse; background: #fff; font-size: .76rem; }
th, td { padding: 7px 9px; text-align: left; vertical-align: middle; border-right: 1px solid #dfe5ea; border-bottom: 1px solid #d9e0e6; }
th:last-child, td:last-child { border-right: 0; }
th { position: sticky; top: 0; z-index: 1; background: linear-gradient(#f8fafb, #e5eaee); color: #29465e; font-size: .66rem; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; white-space: nowrap; }
tbody tr:nth-child(even) { background: #fafcfd; }
tbody tr:hover { background: #edf6ff; }
td strong, td small { display: block; }
td small { margin-top: 2px; color: var(--muted); }
code { color: #174f80; font-family: Consolas, "Cascadia Code", monospace; font-size: .72rem; }
.badge { display: inline-flex; align-items: center; border: 1px solid #79bba2; border-radius: 999px; padding: 3px 8px; background: var(--success-bg); color: var(--success); font-size: .67rem; font-weight: 800; }
.inline-form { min-width: 410px; display: flex; align-items: center; gap: 6px; }
.inline-form input, .inline-form select { min-height: 29px; padding: 4px 7px; }

/* Mensajes */
.notice { margin: 0 0 12px; padding: 9px 11px; display: flex; align-items: center; gap: 9px; border: 1px solid; border-radius: 3px; font-size: .78rem; font-weight: 600; }
.notice > span:first-child { width: 19px; height: 19px; display: grid; place-items: center; border-radius: 50%; color: #fff; }
.notice.success { border-color: #a9d8c7; background: var(--success-bg); color: #145c44; }
.notice.success > span:first-child { background: var(--success); }
.notice.error { border-color: #efbcc0; background: var(--danger-bg); color: #92232c; }
.notice.error > span:first-child { background: var(--danger); }
.validation { color: var(--danger); font-size: .72rem; }
.validation:empty { display: none; }

/* Estados vacíos y páginas públicas */
.empty-state { max-width: 650px; margin: 10vh auto; padding: 32px; text-align: center; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-md); }
.empty-state h1 { margin: 8px 0; color: #244862; }
.empty-state p { color: var(--muted); }
.status-code { color: var(--blue-700); font-size: 1rem; font-weight: 900; }
.public-shell { background: radial-gradient(circle at 85% 0, #dcecff 0, transparent 35%), #f1f5f8; }
.public-header { height: 64px; padding: 0 clamp(18px, 5vw, 70px); display: flex; align-items: center; gap: 11px; background: var(--navy-900); color: #fff; box-shadow: 0 2px 8px rgba(12, 27, 40, .18); }
.public-brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 4px; background: var(--blue-600); font-size: .72rem; font-weight: 800; }
.public-header > span:last-child { display: flex; flex-direction: column; }
.public-header strong { font-size: 1.05rem; letter-spacing: .06em; }
.public-header small { margin-top: 1px; color: #b8c8d7; font-size: .68rem; }
.public-content { width: min(460px, calc(100% - 28px)); margin: clamp(42px, 9vh, 90px) auto; }
.auth-card { padding: 26px; background: #fff; border: 1px solid var(--line-strong); border-top: 4px solid var(--blue-600); border-radius: 5px; box-shadow: var(--shadow-md); }
.auth-card h1 { margin: 5px 0 7px; color: #173e61; font-size: 1.65rem; }
.auth-card > p { margin: 0 0 20px; color: var(--muted); line-height: 1.55; }
.auth-card form button { margin-top: 7px; }
.login-public-content { width: 100%; margin: 0; }
.login-experience {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 56%) minmax(390px, 44%);
  overflow: hidden;
  background: #fff;
}
.login-visual { position: relative; min-height: 100vh; overflow: hidden; background: #163f67; }
.login-visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, rgba(13, 48, 80, .96), rgba(19, 65, 105, .89) 58%, rgba(13, 51, 85, .82)); }
.login-visual img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 60% center; filter: saturate(.7) contrast(.95); }
.login-visual-brand { position: absolute; z-index: 2; top: 5.5vh; left: clamp(34px, 7vw, 105px); display: flex; align-items: center; gap: 12px; color: #fff; letter-spacing: .08em; }
.login-visual-brand span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: linear-gradient(145deg,#65adff,#1b6de3); font-size: .73rem; font-weight: 800; box-shadow: 0 8px 22px rgba(0,0,0,.16); }
.login-visual-brand strong { font-size: 1.02rem; }
.login-visual-copy { position: absolute; z-index: 2; top: 38%; left: clamp(34px, 7vw, 105px); right: clamp(34px, 7vw, 105px); color: #fff; transform: translateY(-30%); }
.login-visual-kicker { display: inline-block; margin-bottom: 9px; color: #8ed2ff; font-size: .72rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.login-visual-copy h2 { margin: 7px 0 13px; font-size: clamp(2.25rem, 3.5vw, 3.35rem); font-weight: 650; line-height: 1.12; letter-spacing: -.025em; }
.login-visual-copy p { max-width: 620px; margin: 0; color: #e5f3fd; font-size: clamp(.88rem, 1.1vw, 1.02rem); line-height: 1.65; }
.login-visual-footer { position: absolute; z-index: 2; left: clamp(34px, 7vw, 105px); bottom: 4.5vh; margin: 0; color: #bed6e9; font-size: .72rem; }
.login-panel { min-width: 0; padding: clamp(34px, 7vw, 90px); display: flex; flex-direction: column; justify-content: center; background: #fff; }
.login-card { width: min(100%, 420px); margin: auto; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
.login-card h1 { margin-top: 8px; color: #13243a; font-size: 2rem; }
.login-card form { margin-top: 4px; }
.login-card input { min-height: 43px; background: #eef4fd; border-color: #bdcbe0; border-radius: 7px; }
.login-card form button { min-height: 41px; margin-top: 10px; border-radius: 7px; }
.login-form-options { min-height: 25px; display: flex; justify-content: flex-end; align-items: center; }
.login-form-options a { color: var(--blue-700); font-size: .74rem; text-decoration: none; }
.login-form-options a:hover { text-decoration: underline; }
.login-footer-message { width: min(100%, 420px); margin: auto auto 0; padding-top: 30px; color: #456075; text-align: center; font-size: .74rem; font-weight: 650; line-height: 1.5; }
.login-footer-message span { color: #7a8995; font-size: .68rem; font-weight: 400; }
.recovery-card { width: min(620px, 100%); margin-inline: auto; }
.recovery-card form .button { width: 100%; }
.recovery-confirm-card { width: min(720px, 100%); }

/* Barra lateral contraída */
.sidebar-collapsed { grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr); }
.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
.sidebar-collapsed .brand { padding-inline: 17px; }
.sidebar-collapsed .brand-copy,
.sidebar-collapsed .menu-module-name,
.sidebar-collapsed .menu-chevron,
.sidebar-collapsed .sidebar-action span { display: none; }
.sidebar-collapsed .menu-module summary { justify-content: center; padding: 0; }
.sidebar-collapsed .menu-module > .menu-options {
  display: block;
  padding: 4px 0 8px;
  border-top: 1px solid rgba(255, 255, 255, .05);
}
.sidebar-collapsed .menu-options a {
  min-height: 42px;
  padding: 0;
  justify-content: center;
  gap: 0;
}
.sidebar-collapsed .menu-options a > span:last-child { display: none; }
.sidebar-collapsed .menu-option-icon { width: 18px; height: 18px; flex-basis: 18px; }
.sidebar-collapsed .sidebar-action { justify-content: center; padding: 0; }

@media (max-width: 1050px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .split-grid { grid-template-columns: 1fr; }
  .application-title span { display: none; }
}

@media (max-width: 760px) {
  .app-shell, .sidebar-collapsed { display: block; }
  .workspace { min-height: 100vh; }
  .sidebar, .sidebar-collapsed .sidebar { width: min(280px, 86vw); transform: translateX(-102%); box-shadow: 10px 0 30px rgba(8, 20, 31, .28); }
  .sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-open .sidebar-backdrop { position: fixed; inset: 0; z-index: 25; display: block; border: 0; border-radius: 0; background: rgba(5, 17, 27, .45); box-shadow: none; }
  .sidebar-collapsed .brand-copy, .sidebar-collapsed .menu-module-name, .sidebar-collapsed .menu-chevron, .sidebar-collapsed .sidebar-action span { display: flex; }
  .sidebar-collapsed .menu-module summary, .sidebar-collapsed .sidebar-action { justify-content: flex-start; padding-inline: 16px; }
  .sidebar-collapsed .menu-module:not([open]) > .menu-options { display: none; }
  .sidebar-collapsed .menu-module[open] > .menu-options { display: block; padding: 5px 0; border-top: 0; }
  .sidebar-collapsed .menu-options a { min-height: 38px; padding: 8px 16px 8px 45px; justify-content: flex-start; gap: 10px; }
  .sidebar-collapsed .menu-options a > span:last-child { display: inline; }
  .sidebar-collapsed .menu-option-icon { width: 16px; height: 16px; flex-basis: 16px; }
  .topbar { padding: 0 12px; }
  .application-title strong { font-size: .8rem; }
  .user-copy { display: none; }
  .content { padding: 12px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
  .login-public-content { width: 100%; margin: 0; }
  .login-experience { min-height: 0; grid-template-columns: 1fr; }
  .login-visual { min-height: 300px; }
  .login-visual img { position: absolute; inset: 0; object-position: 58% 48%; }
  .login-visual-brand { top: 22px; left: 22px; }
  .login-visual-copy { top: auto; left: 22px; right: 22px; bottom: 38px; transform: none; }
  .login-visual-copy h2 { font-size: 1.7rem; }
  .login-visual-copy p { font-size: .8rem; line-height: 1.45; }
  .login-visual-footer { display: none; }
  .login-panel { min-height: 500px; padding: 36px 25px 24px; }
  .login-footer-message { padding-top: 26px; }
}

@media (max-width: 460px) {
  .application-title { display: none; }
  .public-header small { display: none; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .filter-bar label { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* Patrón maestro: listado primero, formularios de trabajo bajo demanda */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.page-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.list-panel { padding-top: 0; }
.list-panel .table-header { margin-top: 0; }
.table-header > div { display: flex; flex-direction: column; gap: 2px; }
.table-header > .table-controls { flex-direction: row; align-items: center; justify-content: flex-end; gap: 9px; }
.table-search { width: min(280px, 42vw); }
.table-search input { min-height: 30px; padding: 5px 9px; background: #fff; font-size: .74rem; }
.page-size { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: .72rem; white-space: nowrap; }
.page-size select { width: auto; min-height: 30px; padding: 4px 24px 4px 7px; background: #fff; font-size: .72rem; }
.list-panel:has(.table-pager) .table-scroll { margin-bottom: 0; }
.table-pager { min-height: 44px; margin: 0 -15px -15px; padding: 7px 11px; display: flex; align-items: center; justify-content: flex-end; gap: 9px; background: #f4f7f9; border-top: 1px solid var(--line); }
.table-pager[hidden] { display: none; }
.table-pager span { min-width: 150px; text-align: center; color: var(--muted); font-size: .72rem; }
.table-pager button { min-height: 29px; padding: 4px 9px; font-size: .72rem; }
.table-pager button:disabled { opacity: .45; cursor: default; }
.checkbox-label { display: flex !important; align-items: center; align-self: end; min-height: 36px; grid-template-columns: auto 1fr; }
.checkbox-label input { width: 17px; min-height: 17px; }
.access-matrix { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; max-height: 52vh; overflow: auto; padding: 2px; }
.branch-access-choice { display: grid; grid-template-columns: auto 1fr auto; align-items: center; }
.default-choice { display: inline-flex; align-items: center; gap: 5px; color: #31546c; font-size: .72rem; white-space: nowrap; }
.access-group { border: 1px solid var(--line); background: #f8fbfe; }
.access-group h3 { margin: 0; padding: 10px 12px; color: var(--navy); font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; background: #e8f2fb; border-bottom: 1px solid var(--line); }
.access-choice { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #e2eaf1; cursor: pointer; }
.access-choice:last-child { border-bottom: 0; }
.access-choice:hover { background: #eef7ff; }
.access-choice input { width: auto; margin-top: 3px; }
.access-choice span { display: grid; gap: 3px; }
.access-choice small { color: var(--muted); line-height: 1.35; }
.form-note { margin: 0; padding: 9px 11px; border-left: 3px solid var(--blue); background: #edf6ff; color: var(--navy); font-size: .78rem; }
.password-policy { padding: 11px 12px; border: 1px solid #c9d6e0; border-radius: 4px; background: #f7fafc; }
.password-policy h3 { margin: 0 0 8px; color: #294f6d; font-size: .78rem; }
.password-policy ul { margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; list-style: none; }
.password-policy li { display: flex; align-items: center; gap: 7px; color: #667887; font-size: .73rem; }
.password-policy li span { width: 17px; height: 17px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 17px; border: 1px solid #a8b7c3; border-radius: 50%; background: #fff; color: #718392; font-size: .68rem; font-weight: 800; }
.password-policy li.is-valid { color: #08734d; font-weight: 650; }
.password-policy li.is-valid span { border-color: #159868; background: #dff5eb; color: #08734d; }
.password-visibility-toggle { min-height: 24px; align-self: start; color: #42596c; font-size: .74rem; cursor: pointer; }
.account-security-panel { width: min(760px, 100%); margin: 0 auto; }
.actions-column { width: 1%; text-align: right; white-space: nowrap; }
.state-badge { display: inline-flex; align-items: center; border: 1px solid; border-radius: 999px; padding: 3px 8px; font-size: .67rem; font-weight: 750; }
.state-badge.active { border-color: #84c6ae; background: var(--success-bg); color: var(--success); }
.state-badge.inactive { border-color: #cbd3da; background: #f0f2f4; color: #697680; }
.row-actions { display: flex; justify-content: flex-end; align-items: center; gap: 5px; }
.row-action-form { display: inline-flex; margin: 0; }
.action-button {
  min-height: 27px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid #aebdca;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  font-weight: 650;
  box-shadow: none;
  font-size: .69rem;
  text-decoration: none;
  color: #294f6d;
}
.action-button:hover { background: #eef4f8; color: #163b58; }
.action-button svg { width: 14px; height: 14px; fill: currentColor; }
.action-button.edit-action { border-color: #438bd3; color: #0868c8; }
.action-button.edit-action:hover { background: #eaf4ff; }
.action-button.view-action { border-color: #8098ac; color: #294f6d; }
.action-button.view-action:hover { background: #eef4f8; }
.action-button.delete-action { border-color: #dc7f86; color: #b92732; }
.action-button.delete-action:hover { background: #fff0f1; }
.action-button:disabled, .action-button:disabled:hover { opacity: .5; cursor: not-allowed; background: #eef1f4; color: #627587; border-color: #b8c4ce; }
.muted-text { color: var(--muted); font-size: .7rem; }

.app-dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: min(86vh, 760px);
  padding: 0;
  overflow: hidden;
  border: 1px solid #8ea8bd;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 22px 60px rgba(9, 28, 43, .30);
}
.app-dialog-wide { width: min(920px, calc(100vw - 28px)); }
.inactivation-messagebox { width: min(460px, calc(100vw - 28px)); }
.inactivation-messagebox .dialog-body { padding: 20px; }
.inactivation-messagebox .dialog-body > p { margin: 12px 0; font-size: .86rem; line-height: 1.5; }
.inactivation-messagebox .dialog-body > .muted-text { margin-top: -5px; overflow-wrap: anywhere; }
.inactivation-messagebox-intro { display: flex; align-items: center; gap: 10px; color: #804b13; font-size: .82rem; }
.inactivation-messagebox-icon { display: inline-grid; place-items: center; flex: 0 0 30px; height: 30px; border-radius: 50%; background: #fff0d4; color: #9b5400; font-weight: 800; }
.inactivation-messagebox-confirm { background: #bb2d38; border-color: #a9222d; color: #fff; }
.inactivation-messagebox-confirm:hover:not(:disabled), .inactivation-messagebox-confirm:focus-visible { background: #9f202b; color: #fff; }
.inactivation-messagebox button:disabled { opacity: .55; cursor: not-allowed; }
.inactivation-messagebox [hidden] { display: none !important; }
.assignment-fieldset { margin: 16px 0 0; padding: 14px; border: 1px solid var(--border); background: #f8fbfe; }
.assignment-fieldset legend { padding: 0 6px; color: var(--navy); font-weight: 700; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(210px,1fr)); gap: 10px 18px; }
.checkbox-grid label,.assignment-table label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.assignment-table { display: grid; grid-template-columns: minmax(220px,1fr) minmax(150px,.45fr); gap: 8px 18px; align-items: center; }
@media (max-width: 680px) { .assignment-table { grid-template-columns: 1fr; } }
.app-dialog::backdrop { background: rgba(10, 27, 41, .48); backdrop-filter: blur(1px); }
.dialog-header {
  min-height: 60px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(#f5f9fc, #dce9f3);
  border-bottom: 1px solid #adc1d1;
}
.dialog-header h2 { margin: 2px 0 0; color: #173f61; font-size: 1.08rem; }
.dialog-header p { margin: 2px 0 0; color: var(--muted); font-size: .72rem; }
.dialog-close { min-width: 30px; min-height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 30px; border: 1px solid #a9b9c6; border-radius: 3px; background: #fff; color: #4c5f6e; text-decoration: none; cursor: pointer; font-size: 1.25rem; line-height: 1; box-shadow: none; }
.dialog-close:hover { background: #e9eff3; }
.app-dialog > .dialog-header > .dialog-close { display: none; }
.dialog-body { padding: 16px; overflow-y: auto; min-height: 0; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-actions { margin-top: 17px; padding-top: 12px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.dialog-body > label { display: grid; gap: 4px; color: #293d4e; font-size: .76rem; font-weight: 650; }
.audit-information { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.audit-information[hidden] { display: none; }
.audit-information h3 { margin: 0 0 9px; color: #31536e; font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
.audit-information-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 12px; }
.audit-information-grid label { display: grid; gap: 4px; color: #42596c; font-size: .72rem; font-weight: 650; }
.audit-information-grid input[readonly] { background: #eef3f7; color: #42596c; cursor: default; }
.audit-information-grid label:last-child { grid-column: 2; }
body:has(dialog[open]) { overflow: hidden; }

.app-dialog[open] { display: flex; flex-direction: column; }
.app-dialog[open] > .dialog-body { max-height: calc(min(86vh, 760px) - 61px); }
.staff-dialog { width: min(1080px, calc(100vw - 28px)); max-height: 90vh; }
.staff-dialog[open] > .staff-dialog-body { max-height: calc(90vh - 61px); }
.staff-form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 11px 14px; }
.staff-form-grid label { display: grid; gap: 4px; color: #293d4e; font-size: .76rem; font-weight: 650; min-width: 0; }
.staff-col-2 { grid-column: span 2; }
.staff-col-3 { grid-column: span 3; }
.staff-col-4 { grid-column: span 4; }
.staff-col-6 { grid-column: span 6; }
.staff-col-9 { grid-column: span 9; }
.staff-functions { margin-top: 14px; }
.fieldset-help { margin: -3px 0 11px; color: var(--muted); font-size: .71rem; }
.staff-functions-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.staff-functions-grid label { min-height: 38px; padding: 8px 10px; display: flex; align-items: center; gap: 9px; border: 1px solid #cbd8e3; border-radius: 3px; background: #fff; color: #29465e; font-size: .75rem; font-weight: 600; cursor: pointer; }
.staff-functions-grid label:hover { border-color: #75a7d3; background: #f1f7fc; }
.staff-functions-grid input[type="checkbox"] { width: 18px; height: 18px; min-height: 18px; padding: 0; margin: 0; flex: 0 0 18px; box-shadow: none; accent-color: var(--blue-600); }
.staff-functions-grid label span { min-width: 0; display: block; line-height: 1.25; overflow-wrap: anywhere; }
.procedure-form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 11px 12px; }
.procedure-form-grid label { min-width: 0; display: grid; align-content: start; gap: 4px; color: #293d4e; font-size: .76rem; font-weight: 650; }
.procedure-form-grid .procedure-reference { grid-template-columns: auto 1fr; column-gap: 4px; }
.procedure-form-grid .procedure-reference > input,
.procedure-form-grid .procedure-reference > .validation { grid-column: 1 / -1; }
.procedure-form-grid .procedure-reference small { min-width: 0; overflow: hidden; color: var(--muted); font-size: .64rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.procedure-col-2 { grid-column: span 2; }
.procedure-col-4 { grid-column: span 4; }
.procedure-col-6 { grid-column: span 6; }
.procedure-col-12 { grid-column: 1 / -1; }
.patient-form-panel { padding: 0; }
.patient-form-sections { display: grid; gap: 13px; }
.patient-section { min-width: 0; margin: 0; padding: 13px; border: 1px solid #c7d4df; border-radius: 4px; background: #fbfdff; }
.patient-section legend { padding: 0 7px; color: #174f80; font-size: .76rem; font-weight: 800; letter-spacing: .025em; text-transform: uppercase; }
.patient-form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 11px 12px; }
.patient-form-grid + .patient-form-grid { margin-top: 11px; padding-top: 11px; border-top: 1px dashed #cfdae3; }
.patient-form-grid label { min-width: 0; display: grid; align-content: start; gap: 4px; color: #293d4e; font-size: .76rem; font-weight: 650; }
.patient-form-grid label small { color: var(--muted); font-size: .68rem; font-weight: 500; }
.patient-col-1 { grid-column: span 1; }
.patient-col-2 { grid-column: span 2; }
.patient-col-3 { grid-column: span 3; }
.patient-col-4 { grid-column: span 4; }
.patient-col-5 { grid-column: span 5; }
.patient-col-6 { grid-column: span 6; }
.patient-col-8 { grid-column: span 8; }
.patient-col-12 { grid-column: 1 / -1; }
.patient-integration-fields[hidden] { display: none; }
.patient-search-form label { min-width: min(360px, 38vw); }
.system-parameter-form-panel { width: min(920px, 100%); }
.parameter-value-field[hidden] { display: none; }
.parameter-value-field small { color: var(--muted); font-size: .68rem; font-weight: 500; }
.parameter-value { max-width: 360px; overflow-wrap: anywhere; }
.uppercase-input { text-transform: uppercase; }
.parameter-filter-form label:first-child { min-width: min(310px, 34vw); }
.surgery-request-filter { flex-wrap: wrap; }
.surgery-request-filter > label:first-child { min-width: min(380px, 36vw); }
.surgery-request-filter > label { display: grid; gap: 3px; color: var(--muted); font-size: .68rem; }
.patient-search-panel { margin-bottom: 12px; }
.surgery-patient-search label { min-width: min(520px, 55vw); display: grid; gap: 4px; }
.surgery-request-form-panel { padding: 0; }
.surgery-patient-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.surgery-patient-option { min-width: 0; padding: 10px 12px; display: flex; align-items: flex-start; gap: 9px; border: 1px solid #c7d4df; border-radius: 4px; background: #fff; cursor: pointer; }
.surgery-patient-option:hover { border-color: #6b9fc9; background: #f3f8fc; }
.surgery-patient-option:has(input:checked) { border-color: var(--blue-600); background: #eaf4ff; box-shadow: inset 0 0 0 1px var(--blue-600); }
.surgery-patient-option input { width: auto; min-height: 0; margin-top: 2px; accent-color: var(--blue-600); }
.surgery-patient-option span { min-width: 0; display: grid; gap: 3px; }
.surgery-patient-option strong { color: #183f60; overflow-wrap: anywhere; }
.surgery-patient-option small { color: var(--muted); font-size: .69rem; overflow-wrap: anywhere; }
.empty-selection { margin: 0; padding: 12px; border: 1px dashed #b9c9d5; background: #f7fafc; color: var(--muted); }
.request-status-bor { border-color: #aeb9c2; background: #f0f2f4; color: #52616d; }
.request-status-sol { border-color: #76aee0; background: #e9f4ff; color: #075fae; }
.request-status-rev { border-color: #e5a45d; background: #fff4e6; color: #9b5306; }
.request-status-apr { border-color: #84c6ae; background: var(--success-bg); color: var(--success); }
.request-status-obs { border-color: #d4b34d; background: #fff9db; color: #735d00; }
.request-status-rec { border-color: #dc7f86; background: #fff0f1; color: #a91f2a; }
.request-status-pro { border-color: #9d8bd3; background: #f2efff; color: #5b469d; }
.request-status-can { border-color: #aeb9c2; background: #eef1f3; color: #596872; }
.notice.info { border-color: #9fc3df; background: #edf7ff; color: #245474; }
.notice.info > span:first-child { background: #3b82b6; }
.surgery-header-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.surgery-header-fieldset:disabled { opacity: .82; }
.surgery-detail-panel { margin-top: 14px; padding: 0; overflow: hidden; }
.surgery-detail-heading { min-height: 70px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); background: linear-gradient(#fbfdff, #eef5fa); }
.surgery-detail-heading h2 { margin: 2px 0; color: #173f61; font-size: 1rem; }
.surgery-detail-heading p { margin: 0; color: var(--muted); font-size: .72rem; }
.surgery-detail-table { width: 100%; }
.surgery-detail-table td { vertical-align: top; }
.surgery-detail-table .row-actions { white-space: nowrap; }
.table-subtext { margin-top: 2px; display: block; color: var(--muted); font-size: .66rem; }
.empty-cell { padding: 18px !important; color: var(--muted); text-align: center; }
.inline-action-form { display: inline-flex; margin: 0; }
.form-grid label small { color: var(--muted); font-size: .68rem; font-weight: 500; }
.success-button { border-color: #197653; background: linear-gradient(#26966b, #197653); }
.success-button:hover { background: linear-gradient(#21845f, #155f44); }
.surgery-state-panel { margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.surgery-state-summary { display: flex; align-items: center; gap: 14px; }
.surgery-state-summary h2 { margin: 2px 0 0; color: #173f61; font-size: .92rem; }
.surgery-current-state { padding: 7px 12px; font-size: .78rem; }
.surgery-state-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.surgery-state-actions form { display: inline-flex; margin: 0; }
.surgery-state-empty { margin: 0; color: var(--muted); font-size: .73rem; }
.surgery-history-table td:first-child { white-space: nowrap; }
.surgery-history-transition { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.surgery-history-transition > span:nth-child(2) { color: var(--muted); }
.surgery-history-user { color: #173f61; font-weight: 600; }
.readiness-program-filters { flex-wrap: wrap; }
.readiness-program-filters > label { display: grid; gap: 3px; color: var(--muted); font-size: .68rem; }
.readiness-program-summary { margin-bottom: 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; padding: 1px; background: var(--border); }
.readiness-program-summary > div { min-width: 0; padding: 11px 13px; display: grid; gap: 3px; background: #fff; }
.readiness-program-summary span { color: var(--muted); font-size: .66rem; font-weight: 700; text-transform: uppercase; }
.readiness-program-summary strong { color: #173f61; overflow-wrap: anywhere; }
.readiness-empty { padding: 34px; text-align: center; }
.readiness-empty h2 { color: #173f61; font-size: 1rem; }
.readiness-status { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-left: 4px solid #7a8c9b; }
.readiness-status h2 { margin: 3px 0; color: #173f61; font-size: 1.12rem; }
.readiness-state-lis { border-left-color: #16865b; background: #f2fbf7; }
.readiness-state-blo, .readiness-state-can { border-left-color: #b82a35; background: #fff7f7; }
.readiness-state-obs { border-left-color: #d39b16; background: #fffdf3; }
.readiness-counters { display: grid; grid-template-columns: repeat(4, minmax(80px, 1fr)); gap: 7px; }
.readiness-counters > div { padding: 8px 10px; display: grid; text-align: center; border: 1px solid var(--border); background: #fff; }
.readiness-counters strong { color: #173f61; font-size: 1.08rem; }
.readiness-counters span { color: var(--muted); font-size: .63rem; }
.readiness-actions-panel { margin-bottom: 12px; padding: 10px 12px; }
.readiness-actions-panel form { display: inline-flex; margin: 0; }
.readiness-evaluate-button:not(:disabled) {
  border-color: var(--blue-700);
  background: #fff;
  color: var(--blue-700);
  box-shadow: none;
}
.readiness-evaluate-button:not(:disabled):hover {
  border-color: #0555ae;
  background: var(--blue-700);
  color: #fff;
}
.readiness-evaluate-button:not(:disabled):focus-visible {
  outline: 3px solid #74b8ff;
  outline-offset: 2px;
}
.readiness-evaluate-button:disabled,
.readiness-evaluate-button:disabled:hover {
  border-color: #b9c4cf;
  background: #e9edf1;
  color: #697987;
  box-shadow: none;
  cursor: not-allowed;
  opacity: .55;
}
.readiness-category { margin-bottom: 12px; padding: 0; }
.readiness-category-header { min-width: 0; padding: 12px 14px; display: grid; align-content: center; gap: 4px; border-bottom: 1px solid var(--line-strong); border-radius: 2px 2px 0 0; background: linear-gradient(#fafcfd, #e8eef2); }
.readiness-category-header .eyebrow { display: block; line-height: 1.35; }
.readiness-category-header h2 { min-width: 0; margin: 0; color: #28455e; font-size: .92rem; line-height: 1.35; overflow-wrap: anywhere; }
.readiness-control-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; }
.readiness-control { min-width: 0; padding: 11px; border: 1px solid var(--border); border-left: 4px solid #9aa9b5; background: #fff; }
.readiness-control.readiness-conforme { border-left-color: #16865b; }
.readiness-control.readiness-no-conforme { border-left-color: #c62e3a; }
.readiness-control.readiness-no-aplica { border-left-color: #728391; }
.readiness-control-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.readiness-control-heading > div { min-width: 0; }
.readiness-control-heading h3 { margin: 0 0 6px; color: #173f61; font-size: .82rem; }
.required-mark { margin-left: 4px; color: #b52430; font-size: .59rem; text-transform: uppercase; }
.readiness-result { flex: none; padding: 4px 7px; border-radius: 999px; background: #edf1f4; color: #52616d; font-size: .65rem; font-weight: 700; }
.readiness-result.readiness-conforme { background: #dff5eb; color: #126744; }
.readiness-result.readiness-no-conforme { background: #ffe7e9; color: #a81f2a; }
.readiness-result.readiness-no-aplica { background: #edf1f4; color: #52616d; }
.readiness-control-form { margin-top: 10px; display: grid; grid-template-columns: minmax(140px, .35fr) 1fr; gap: 8px; }
.readiness-control-form label { display: grid; gap: 4px; color: #29475f; font-size: .68rem; font-weight: 700; }
.readiness-control-form .form-actions { grid-column: 1 / -1; padding-top: 0; border: 0; }
.readiness-observation { margin: 8px 0; color: #465d70; white-space: pre-wrap; }
.execution-program-summary { margin-bottom: 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; padding: 1px; background: var(--border); }
.execution-program-summary > div { min-width: 0; padding: 11px 13px; display: grid; gap: 3px; background: #fff; }
.execution-program-summary span, .execution-time-summary span { color: var(--muted); font-size: .66rem; font-weight: 700; text-transform: uppercase; }
.execution-program-summary strong { color: #173f61; overflow-wrap: anywhere; }
.execution-empty { padding: 30px; text-align: center; }
.execution-empty h2 { color: #173f61; font-size: 1rem; }
.execution-status { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-left: 4px solid #81909d; }
.execution-status h2 { margin: 2px 0 8px; color: #173f61; font-size: 1.15rem; }
.execution-state-pen { border-color: #96a5b0; background: #f2f5f7; color: #52616d; }
.execution-state-cur { border-color: #2386cb; background: #eaf6ff; color: #075d9b; }
.execution-state-sus { border-color: #d39817; background: #fff8df; color: #7b5a08; }
.execution-state-fin { border-color: #16865b; background: #e6f7ef; color: #126744; }
.execution-state-can { border-color: #bd3340; background: #fff0f1; color: #a31f2a; }
.execution-time-summary { display: grid; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: 7px; }
.execution-time-summary > div { padding: 8px 10px; display: grid; gap: 3px; border: 1px solid var(--border); background: #fff; }
.execution-time-summary strong { color: #173f61; font-size: .76rem; }
.execution-actions { margin-bottom: 12px; padding: 10px 12px; }
.program-confirm-disabled, .program-confirm-disabled:hover { border-color: #a9b7c2; background: #e6ecef; color: #617487; box-shadow: none; cursor: not-allowed; opacity: .78; }
.execution-section { margin-bottom: 12px; }
.safety-summary,.safety-overall{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-bottom:12px}
.safety-summary div,.safety-overall div{display:flex;flex-direction:column;gap:4px}.safety-summary span,.safety-overall span{color:#52697e;font-size:.78rem}.safety-summary strong,.safety-overall strong{color:#153f62}
.safety-overall{align-items:center;border-left:4px solid #2683d8}.safety-stage-grid{display:grid;gap:14px}.safety-stage{border-left:4px solid #9aa9b6}.safety-stage.safety-state-blo{border-left-color:#cf2638}.safety-stage.safety-state-com{border-left-color:#159066}.safety-stage.safety-state-pro{border-left-color:#1678d2}
.safety-stage-heading{display:flex;justify-content:space-between;gap:20px;align-items:flex-start;margin-bottom:14px}.safety-stage-heading h2{margin:2px 0 8px;color:#123f64}.safety-counts{display:flex;gap:8px;flex-wrap:wrap}.safety-counts span{background:#f0f5f9;border:1px solid #ccdae5;border-radius:4px;padding:7px 9px;color:#36536b;font-size:.78rem}.safety-counts strong{color:#103f65}
.safety-stage-meta{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:12px 0}.safety-stage-meta div{background:#f7fafc;border:1px solid #d8e2ea;padding:9px}.safety-stage-meta dt{font-size:.7rem;color:#587086;text-transform:uppercase}.safety-stage-meta dd{margin:3px 0 0;color:#153f62;font-weight:700}
.safety-control{border:1px solid #cfdae4;border-radius:4px;margin:8px 0;background:#fff}.safety-control.blocking{border:2px solid #c92f40}.safety-control summary{cursor:pointer;display:flex;justify-content:space-between;gap:12px;align-items:center;padding:12px;list-style:none}.safety-control summary span:first-child{display:flex;flex-direction:column;gap:3px}.safety-control summary small{color:#60768a}.safety-control-body{border-top:1px solid #d6e1e9;padding:12px}.safety-control-form textarea{min-height:70px}.result-badge{border-radius:12px;padding:4px 9px;font-weight:700;font-size:.75rem}.result-c{background:#dff5eb;color:#08734f}.result-n{background:#ffe5e8;color:#a8182b}.result-x{background:#e6eef5;color:#3d5870}.result-p{background:#fff1ce;color:#7a5700}.safety-stage-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:14px;padding-top:12px;border-top:1px solid #d9e3eb}.audit-inline{display:flex;gap:18px;flex-wrap:wrap;color:#557086;font-size:.78rem;margin-top:8px}
.safety-state-blo{background:#ffe5e8;color:#a8182b}.safety-state-com{background:#dff5eb;color:#08734f}.safety-state-pro{background:#dfeeff;color:#075da7}.safety-state-pen{background:#fff1ce;color:#7a5700}.safety-state-can{background:#e7eaed;color:#4b5965}
.execution-timeline { padding: 10px 14px 14px; }
.execution-milestone { position: relative; display: grid; grid-template-columns: 34px 1fr; gap: 8px; min-height: 74px; }
.execution-milestone:not(:last-child)::before { content: ""; position: absolute; left: 16px; top: 31px; bottom: -4px; width: 2px; background: #ccd8e1; }
.timeline-marker { z-index: 1; width: 32px; height: 32px; display: grid; place-items: center; border: 2px solid #9eacb7; border-radius: 50%; background: #fff; color: #738491; font-weight: 800; }
.execution-milestone.registered .timeline-marker { border-color: #16865b; background: #e6f7ef; color: #126744; }
.timeline-content { min-width: 0; padding: 2px 0 14px; }
.timeline-heading { display: flex; justify-content: space-between; gap: 12px; }
.timeline-heading h3 { margin: 0; color: #173f61; font-size: .84rem; }
.timeline-heading span, .timeline-content small { color: var(--muted); font-size: .65rem; }
.timeline-heading strong { color: #214962; font-size: .76rem; }
.timeline-content p { margin: 5px 0; color: #526878; font-size: .7rem; }
.timeline-observation { margin: 6px 0; padding: 7px 9px; border-left: 3px solid #d39817; background: #fff9e8; color: #594b20; font-size: .7rem; white-space: pre-wrap; }
.timeline-content .action-button { margin-top: 7px; }
.wide-dialog { width: min(780px, calc(100vw - 24px)); }


@media (max-width: 760px) {
  .list-heading .page-actions { width: 100%; justify-content: stretch; }
  .list-heading .page-actions > * { flex: 1; }
  .table-header { align-items: stretch; gap: 8px; flex-direction: column; }
  .table-header > .table-controls { align-items: stretch; flex-direction: column; }
  .table-search { width: 100%; }
  .page-size { justify-content: space-between; }
  .table-pager { justify-content: center; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .password-policy ul { grid-template-columns: 1fr; }
  .audit-information-grid { grid-template-columns: 1fr; }
  .audit-information-grid label:last-child { grid-column: auto; }
  .action-button span { display: none; }
  .action-button .action-icon { display: inline; }
  .action-button { width: 29px; padding: 4px; }
  .staff-form-grid { grid-template-columns: 1fr; }
  .staff-form-grid > label { grid-column: auto; }
  .staff-functions-grid { grid-template-columns: 1fr; }
  .procedure-form-grid { grid-template-columns: 1fr; }
  .procedure-form-grid > label { grid-column: auto; }
  .patient-search-form { width: 100%; min-width: 0; flex-wrap: wrap; }
  .patient-search-form label { width: 100%; min-width: 0; }
  .patient-form-grid { grid-template-columns: 1fr; }
  .patient-form-grid > label { grid-column: auto; }
  .parameter-filter-form { width: 100%; flex-wrap: wrap; }
  .parameter-filter-form label { width: 100%; min-width: 0 !important; }
  .surgery-request-filter, .surgery-patient-search { width: 100%; }
  .surgery-request-filter > label, .surgery-patient-search label { width: 100%; min-width: 0; }
  .surgery-patient-results { grid-template-columns: 1fr; }
  .surgery-detail-heading { align-items: stretch; flex-direction: column; }
  .surgery-detail-heading .button { width: 100%; }
  .surgery-state-panel, .surgery-state-summary { align-items: stretch; flex-direction: column; }
  .surgery-state-actions { justify-content: stretch; }
  .surgery-state-actions > *, .surgery-state-actions form, .surgery-state-actions button { width: 100%; }
  .readiness-program-summary, .readiness-control-list { grid-template-columns: 1fr; }
  .readiness-status { align-items: stretch; flex-direction: column; }
  .readiness-counters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readiness-control-form { grid-template-columns: 1fr; }
  .execution-program-summary, .execution-time-summary { grid-template-columns: 1fr; }
  .execution-status { align-items: stretch; flex-direction: column; }
  .safety-summary,.safety-overall,.safety-stage-meta{grid-template-columns:1fr 1fr}.safety-stage-heading{flex-direction:column}
  .timeline-heading { flex-direction: column; gap: 4px; }
}

@media (max-width: 640px) { .safety-summary,.safety-overall,.safety-stage-meta{grid-template-columns:1fr} }

@media (min-width: 761px) and (max-width: 980px) {
  .staff-col-2, .staff-col-3, .staff-col-4 { grid-column: span 6; }
  .staff-col-9 { grid-column: span 6; }
  .staff-functions-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .procedure-form-grid > .procedure-code { grid-column: span 3; }
  .procedure-form-grid > .procedure-name { grid-column: span 9; }
  .procedure-form-grid > .procedure-reference { grid-column: span 8; }
  .procedure-form-grid > .procedure-state { grid-column: span 4; }
  .procedure-form-grid > .procedure-specialty,
  .procedure-form-grid > .procedure-duration,
  .procedure-form-grid > .procedure-anesthesia,
  .procedure-form-grid > .procedure-surgical { grid-column: span 6; }
  .procedure-form-grid > .procedure-col-12 { grid-column: 1 / -1; }
  .patient-form-grid > .patient-col-1,
  .patient-form-grid > .patient-col-2,
  .patient-form-grid > .patient-col-3,
  .patient-form-grid > .patient-col-4,
  .patient-form-grid > .patient-col-5,
  .patient-form-grid > .patient-col-6,
  .patient-form-grid > .patient-col-8 { grid-column: span 6; }
}
