:root {
  --bg: #eef2f5;
  --ink: #17212b;
  --muted: #62707d;
  --line: #d6dee5;
  --panel: #ffffff;
  --panel-soft: #f6f8fa;
  --dark: #14232c;
  --dark-soft: #20333e;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #cf2e2e;
  --danger: #cf2e2e;
  --amber: #a36300;
  --green: #18743a;
  --blue: #215f9a;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --shadow: 0 10px 26px rgba(20, 35, 44, 0.08);
  --shadow-soft: 0 6px 18px rgba(20, 35, 44, 0.06);
}

body[data-theme="night"] {
  --bg: #0f171d;
  --ink: #e8f0f2;
  --muted: #9fb0b8;
  --line: #314550;
  --panel: #17242c;
  --panel-soft: #1d2d36;
  --dark: #0a1116;
  --dark-soft: #15242c;
  --brand: #16a394;
  --brand-dark: #78ded5;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

body[data-theme="night"] input[type="text"],
body[data-theme="night"] select {
  background: #101b22;
  color: var(--ink);
}

body[data-theme="night"] .terminal,
body[data-theme="night"] .command-output {
  background: #070c10;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.42;
  letter-spacing: 0;
}

body.auth-blocked .app-shell {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

body.auth-pending .app-shell,
body.auth-pending .login-gate {
  visibility: hidden;
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 17, 22, 0.72);
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 4px 0 8px;
  font-size: 28px;
}

.login-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.login-card label {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  color: var(--muted);
  font-weight: 700;
}

.login-card input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  color: var(--ink);
}

.login-card button {
  width: 100%;
  margin-top: 8px;
}

.login-card small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
}

.login-logo {
  width: 70px;
  height: 70px;
  margin-bottom: 12px;
}

.login-logo img {
  display: block;
  width: 100%;
  height: 100%;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.24);
  outline-offset: 2px;
}

button:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.app-shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px 20px;
  background: var(--dark);
  color: #eef5f7;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(111, 211, 202, 0.55);
  border-radius: 7px;
  background: #14232c;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 10px 18px rgba(0, 0, 0, 0.18);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: #aac0c8;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  min-height: 44px;
  border: 1px solid transparent;
  padding: 0 12px 0 6px;
  background: transparent;
  color: #dfebef;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.nav-item:hover,
.nav-item.is-active {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
}

.nav-code {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: #9ee0db;
  font-size: 12px;
  font-weight: 800;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 20px 22px 22px;
}

.topbar,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  border: 1px solid rgba(214, 222, 229, 0.82);
  padding: 10px 12px;
  background: rgba(238, 242, 245, 0.96);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-sm);
}

.topbar h1,
.panel h2 {
  margin: 0;
}

.topbar h1 {
  font-size: 31px;
  line-height: 1.1;
}

.panel h2 {
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.global-status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.global-status-card {
  display: grid;
  gap: 4px;
  min-height: 74px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  background: var(--panel);
  border-left: 5px solid var(--muted);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
}

.global-status-card span,
.global-status-card small {
  color: var(--muted);
  font-size: 12px;
}

.global-status-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-status-card span {
  font-weight: 900;
  text-transform: uppercase;
}

.global-status-card strong {
  font-size: 17px;
  line-height: 1.15;
}

.global-status-card.ok {
  border-left-color: var(--green);
}

.global-status-card.warn {
  border-left-color: var(--amber);
}

.global-status-card.error {
  border-left-color: var(--danger);
}

.global-status-card.neutral {
  border-left-color: var(--blue);
}

.compact-actions {
  justify-content: flex-start;
  margin: 0 0 12px;
}

.primary-button,
.secondary-button {
  min-height: 38px;
  border: 1px solid var(--line);
  padding: 0 14px;
  background: var(--panel);
  color: var(--ink);
  border-radius: var(--radius-sm);
  transition: transform 0.08s ease, background-color 0.12s ease, border-color 0.12s ease;
}

.secondary-button:hover {
  background: #f4f8fb;
  border-color: #c2d0db;
}

.primary-button {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
  font-weight: 800;
}

.primary-button:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.primary-button:active,
.secondary-button:active {
  transform: translateY(1px);
}

.secondary-button.small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.secondary-button.tiny {
  min-height: 26px;
  padding: 0 8px;
  margin-top: 6px;
  font-size: 12px;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.quick-action-card {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  padding: 13px;
  background: var(--panel-soft);
  border-radius: var(--radius-sm);
}

.quick-action-card strong,
.quick-action-card small {
  display: block;
}

.quick-action-card small {
  color: var(--muted);
  line-height: 1.42;
}

.ops-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 14px;
}

.ops-strip article {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: var(--panel-soft);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm);
}

.ops-strip strong,
.ops-strip small {
  display: block;
}

.ops-strip small {
  color: var(--muted);
  line-height: 1.38;
}

.status-tile,
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  border-radius: var(--radius-md);
}

.status-tile {
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 14px;
}

.status-tile span,
.status-tile small,
.risk-card small,
.process-card small,
.roadmap-card small,
.idea-card small {
  color: var(--muted);
}

.status-tile strong {
  font-size: 21px;
  line-height: 1.1;
}

.status-tile.caution strong {
  color: var(--amber);
}

.grid-two,
.bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.78fr);
  gap: 14px;
}

.grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 14px;
}

body[data-view="route-lab"] .grid-main {
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 0.55fr);
}

body[data-view="route-lab"] .bottom-grid {
  display: none;
}

.panel {
  padding: 14px;
}

.panel-header.compact {
  margin-bottom: 10px;
}

.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border: 1px solid #d7e4e7;
  background: #f3f8f9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  border-radius: 999px;
}

.process-map,
.roadmap-list,
.idea-list,
.risk-stack {
  display: grid;
  gap: 12px;
}

.process-card,
.roadmap-card,
.idea-card,
.risk-card {
  border: 1px solid var(--line);
  padding: 14px;
  background: var(--panel-soft);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
}

.process-card {
  position: relative;
  padding-right: 48px;
}

.process-card.is-favorite {
  border-color: var(--accent);
}

.icon-button.favorite-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.icon-button.favorite-toggle:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-soft);
}

.process-card strong,
.process-card small,
.roadmap-card strong,
.roadmap-card small,
.idea-card strong,
.idea-card small {
  display: block;
}

.process-card small,
.roadmap-card small,
.idea-card small {
  margin-top: 4px;
  line-height: 1.45;
}

.check-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 10px;
}

.check,
.state {
  display: inline-grid;
  min-height: 22px;
  place-items: center;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
}

.done {
  background: #e6f4ea;
  color: var(--green);
}

.todo {
  background: #e8f1fb;
  color: var(--blue);
}

.hold {
  background: #fff1d7;
  color: var(--amber);
}

.command-builder {
  display: grid;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.45fr);
  gap: 14px;
}

.form-grid.single {
  grid-template-columns: 1fr;
}

.form-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input[type="text"],
select {
  min-height: 38px;
  border: 1px solid var(--line);
  padding: 0 12px;
  background: #ffffff;
  color: var(--ink);
  border-radius: var(--radius-sm);
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.option-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--line);
  padding: 0 12px;
  background: var(--panel-soft);
  border-radius: var(--radius-sm);
}

.note-box {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  border-left: 4px solid var(--brand);
  padding: 12px 14px;
  background: #edf7f5;
  line-height: 1.45;
  border-radius: var(--radius-sm);
}

.inspector {
  display: grid;
  align-content: start;
  gap: 14px;
}

.panel-subsection {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}

.settings-panel {
  margin-top: 20px;
}

.terminal,
.command-output {
  overflow: auto;
  min-height: 132px;
  border: 1px solid #22313a;
  padding: 14px;
  background: #101820;
  color: #e6f0f2;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  border-radius: var(--radius-sm);
}

.command-output {
  min-height: 74px;
  margin: 0;
}

.terminal .prompt {
  color: #5eead4;
}

.terminal .muted {
  color: #9fb0b7;
}

.audit-selector,
.utility-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.choice-card {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  padding: 13px;
  background: var(--panel-soft);
  border-radius: var(--radius-sm);
}

.choice-card.is-selected {
  border-color: var(--brand);
  background: #e7f5f3;
}

.choice-card input {
  position: absolute;
  opacity: 0;
}

.choice-card strong,
.choice-card small {
  display: block;
}

.choice-card small {
  color: var(--muted);
}

.risk-card {
  display: grid;
  gap: 5px;
}

.risk-card strong {
  color: var(--accent);
}

.job-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

.job-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.job-table code {
  display: block;
  max-width: 440px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-scroll {
  overflow: auto;
  max-height: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.compact-table {
  min-width: 680px;
}

.compact-table th,
.compact-table td {
  padding: 8px;
  font-size: 12px;
}

.script-inventory-scroll {
  max-height: 620px;
}

.script-inventory-table {
  min-width: 1040px;
}

.script-inventory-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.inventory-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  background: var(--soft);
  padding: 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.inventory-badge.risk-bajo,
.inventory-badge.status-inventariado {
  border-color: rgba(24, 116, 58, 0.25);
  background: #e6f4ea;
  color: var(--green);
}

.inventory-badge.risk-medio,
.inventory-badge.status-pendiente_preflight,
.inventory-badge.status-pendiente_allowlist {
  border-color: rgba(180, 111, 0, 0.28);
  background: #fff3d7;
  color: #8a5700;
}

.inventory-badge.risk-alto,
.inventory-badge.risk-critico,
.inventory-badge.status-no_integrar {
  border-color: rgba(207, 46, 46, 0.28);
  background: #ffe7e7;
  color: var(--danger);
}

.inventory-badge.status-oculto {
  border-color: rgba(92, 106, 115, 0.35);
  background: #eef3f5;
  color: var(--muted);
}

.log-summary-grid,
.route-case-grid,
.check-grid,
.health-strip,
.insight-grid,
.change-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.recent-files {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 320px;
  overflow: auto;
}

.operator-brief-panel {
  margin-top: 20px;
}

.work-queue-panel {
  margin-top: 20px;
}

.safety-radar-panel {
  margin-top: 20px;
}

.operator-brief-panel h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.brief-alerts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.compact-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  margin-top: 16px;
}

.compact-list {
  margin-top: 0;
}

.compact-list li {
  margin-bottom: 8px;
}

.work-task-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.focus-step-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.run-plan-list {
  display: grid;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.run-plan-step {
  display: grid;
  gap: 12px;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: flex-start;
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  background: var(--panel-soft);
  padding: 12px;
}

.run-plan-step.warn {
  border-left-color: var(--amber);
  background: #fff8e8;
}

.run-plan-step.blocker {
  border-left-color: var(--danger);
  background: #ffe7e7;
}

.run-plan-step p {
  margin: 6px 0;
}

.run-plan-step code {
  display: block;
  padding: 7px 9px;
  background: #ffffff;
  border: 1px solid var(--line);
  word-break: break-word;
}

.session-checkpoint-panel .recent-files,
.session-checkpoint-panel .command-board-list {
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.focus-step {
  display: grid;
  gap: 12px;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: flex-start;
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  background: var(--panel-soft);
  padding: 12px;
}

.focus-step.warn {
  border-left-color: #d39500;
}

.focus-step.blocker {
  border-left-color: var(--danger);
  background: #ffe7e7;
}

.focus-step-order {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--green);
  color: #ffffff;
  font-weight: 800;
}

.focus-step p {
  margin: 6px 0;
}

.focus-step code {
  display: block;
  padding: 7px 9px;
  background: #ffffff;
  border: 1px solid var(--line);
  word-break: break-word;
}

.work-task {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  background: var(--panel-soft);
  padding: 12px;
}

.work-task.warn {
  border-left-color: #d39500;
}

.work-task.blocker {
  border-left-color: var(--danger);
  background: #ffe7e7;
}

.work-task-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.work-task p {
  margin: 0;
}

.work-task code {
  display: block;
  padding: 7px 9px;
  background: #ffffff;
  border: 1px solid var(--line);
  word-break: break-word;
}

.safety-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.safety-check {
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  background: var(--panel-soft);
  padding: 11px 12px;
}

.safety-check.warn {
  border-left-color: #d39500;
}

.safety-check.blocker {
  border-left-color: var(--danger);
  background: #ffe7e7;
}

.safety-check strong,
.safety-check small {
  display: block;
}

.safety-check small {
  margin-top: 4px;
  color: var(--muted);
}

.favorite-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.favorite-button {
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: var(--panel-soft);
  color: var(--ink);
  text-align: left;
}

.recent-file {
  border: 1px solid var(--line);
  padding: 9px 10px;
  background: var(--panel-soft);
  font-size: 12px;
  word-break: break-word;
}

.recent-file strong,
.recent-file small {
  display: block;
}

.log-summary-grid,
.insight-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.log-card,
.route-case,
.health-card {
  border: 1px solid var(--line);
  padding: 14px;
  background: var(--panel-soft);
  border-radius: var(--radius-sm);
}

.log-card {
  display: grid;
  gap: 7px;
}

.mini-status-grid,
.security-role-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  margin-bottom: 12px;
}

.tight-grid {
  gap: 12px;
  margin-top: 12px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  text-transform: uppercase;
}

.log-card button {
  justify-self: start;
}

.route-case {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
}

.route-case .case-status {
  display: grid;
  min-height: 58px;
  place-items: center;
  background: #fff1d7;
  color: var(--amber);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.route-case .case-status.validado {
  background: #e6f4ea;
  color: var(--green);
}

.route-case .case-status.bloqueado {
  background: #ffe7e7;
  color: var(--accent);
}

.route-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.route-form {
  margin-top: 14px;
}

.route-selector-stack {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.route-selector-stack label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.route-selector-stack select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  padding: 0 12px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.route-selection-status {
  display: grid;
  gap: 8px;
}

.route-status-row {
  display: grid;
  gap: 3px;
  border-left: 4px solid var(--amber);
  padding: 9px 11px;
  background: var(--panel-soft);
  font-size: 12px;
}

.route-status-row.ok {
  border-left-color: var(--green);
}

.route-status-row.block {
  border-left-color: var(--accent);
  background: #ffe7e7;
}

.route-status-row span,
.route-status-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-result {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

body[data-view="route-lab"] .route-result {
  max-height: 260px;
  overflow: auto;
}

.route-review-image {
  display: block;
  width: 100%;
  max-height: 580px;
  object-fit: contain;
  border: 1px solid var(--line);
  background: #ffffff;
}

.route-paths {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.route-canvas-wrap {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.route-canvas-info {
  border: 1px solid var(--line);
  padding: 8px 10px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
}

.route-source-image {
  display: block;
  width: auto;
  max-width: none;
  max-height: none;
  object-fit: contain;
  border: 1px solid var(--line);
  background: #ffffff;
  cursor: crosshair;
  user-select: none;
}

.route-canvas-stage {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.route-live-overlay {
  position: absolute;
  top: 0;
  left: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 2;
}

.route-source-image[hidden] {
  display: none;
}

.route-canvas-viewport {
  width: 100%;
  min-height: 520px;
  max-height: 78vh;
  overflow: auto;
  border: 1px solid var(--line);
  background: #ffffff;
}

.route-canvas-viewport.panning {
  cursor: grabbing;
}

.route-page-panel {
  align-content: start;
}

.route-coverage-panel {
  display: grid;
  gap: 10px;
}

.route-coverage-cards {
  display: grid;
  gap: 8px;
}

.route-missing-block {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.route-missing-block strong {
  font-size: 13px;
}

.route-missing-block small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.route-saved-edge-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.route-saved-edge-row span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.route-suggestion-button {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 8px;
  text-align: left;
  border: 1px solid var(--line);
  background: #ffffff;
  cursor: pointer;
}

.route-suggestion-button:hover {
  border-color: var(--green);
  background: #f1fbf8;
}

.route-suggestion-button[data-missing-anchor="1"] {
  border-color: #f59e0b;
  background: #fff8eb;
}

.route-page-thumbs {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  max-height: 72vh;
  overflow: auto;
  padding-right: 4px;
}

.route-page-thumb {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 10px;
  text-align: left;
  border: 1px solid var(--line);
  background: #ffffff;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.route-page-thumb.active {
  border-color: var(--green);
  box-shadow: inset 4px 0 0 var(--green);
}

.route-page-thumb img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid var(--line);
}

.route-candidate-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(10, 24, 31, 0.48);
}

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

.route-candidate-card {
  width: min(620px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.24);
  border-radius: var(--radius-md);
}

.route-candidate-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.route-candidate-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.route-candidate-option:hover {
  border-color: var(--green);
}

.route-candidate-option .compact-actions {
  justify-content: flex-end;
  margin-left: auto;
}

.route-manual-section {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 800;
}

.health-card.ok {
  border-color: rgba(24, 116, 58, 0.35);
  background: #e6f4ea;
}

.health-card.warn {
  border-color: rgba(163, 99, 0, 0.35);
  background: #fff1d7;
}

.health-card.block {
  border-color: rgba(207, 46, 46, 0.35);
  background: #ffe7e7;
}

.preflight-item {
  border-left: 5px solid var(--green);
  padding: 10px 12px;
  background: var(--panel-soft);
}

.preflight-item.warn {
  border-left-color: var(--amber);
  background: #fff8e8;
}

.preflight-item.block {
  border-left-color: var(--accent);
  background: #ffe7e7;
}

.preflight-item strong,
.preflight-item small {
  display: block;
}

.preflight-item small {
  margin-top: 4px;
  color: var(--muted);
}

.risk-card.blocker {
  border-color: rgba(207, 46, 46, 0.35);
  background: #ffe7e7;
}

.insight-card {
  border: 1px solid var(--line);
  padding: 14px;
  background: #eef6fb;
  border-radius: var(--radius-sm);
}

.command-catalog {
  display: grid;
  gap: 10px;
  max-height: 430px;
  overflow: auto;
  padding-right: 4px;
}

.command-help {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  padding: 12px;
  background: var(--panel-soft);
}

.command-help code {
  display: block;
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.command-help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.command-help.warn {
  border-left-color: var(--amber);
}

.command-help.block {
  border-left-color: var(--accent);
}

.command-help strong,
.command-help small {
  display: block;
}

.command-help small {
  color: var(--muted);
  line-height: 1.45;
}

.command-board-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.risk-ledger-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.manual-review-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.manual-review-item {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  padding: 12px;
  background: var(--panel-soft);
}

.manual-review-item.warn {
  border-left-color: var(--amber);
  background: #fff8e8;
}

.manual-review-item p {
  margin: 0;
}

.manual-review-item code {
  display: block;
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.activity-list {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.activity-row {
  display: grid;
  grid-template-columns: minmax(90px, 140px) 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  padding: 10px;
  background: var(--panel-soft);
}

.activity-row strong,
.activity-row small {
  display: block;
}

.activity-row small {
  margin-top: 3px;
  color: var(--muted);
  word-break: break-word;
}

.risk-ledger-item {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  padding: 12px;
  background: var(--panel-soft);
}

.risk-ledger-item.blocker {
  border-left-color: var(--accent);
  background: #ffe7e7;
}

.risk-ledger-item.warn {
  border-left-color: var(--amber);
  background: #fff8e8;
}

.risk-ledger-item p {
  margin: 0;
  color: var(--ink);
}

.command-board-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  padding: 12px;
  background: var(--panel-soft);
}

.command-board-item.warn {
  border-left-color: var(--amber);
}

.command-board-item p {
  margin: 0;
}

.command-board-item code {
  display: block;
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.change-item {
  border-left: 4px solid var(--blue);
  padding: 10px 12px;
  background: var(--panel-soft);
  word-break: break-word;
}

.change-item.created {
  border-left-color: var(--green);
}

.change-item.modified {
  border-left-color: var(--amber);
}

.change-item.deleted {
  border-left-color: var(--accent);
}

.compact-change-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 320px;
  overflow: auto;
}

.pdf-preview-frame {
  width: 100%;
  min-height: 620px;
  margin-top: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.pdf-preview-panel input[readonly] {
  color: var(--muted);
  background: var(--panel-soft);
}

body[data-theme="night"] .health-card,
body[data-theme="night"] .insight-card,
body[data-theme="night"] .file-row,
body[data-theme="night"] .recent-file,
body[data-theme="night"] .change-item,
body[data-theme="night"] .activity-row,
body[data-theme="night"] .risk-card,
body[data-theme="night"] .choice-card,
body[data-theme="night"] .manual-review-item,
body[data-theme="night"] .risk-ledger-item,
body[data-theme="night"] .command-board-item {
  background: var(--panel-soft);
  color: var(--ink);
}

body[data-theme="night"] .tag {
  background: #0f1d27;
  color: var(--ink);
}

body[data-theme="night"] .health-card.warn,
body[data-theme="night"] .insight-card.warn,
body[data-theme="night"] .manual-review-item.warn,
body[data-theme="night"] .risk-ledger-item.warn {
  background: #2b2519;
}

body[data-theme="night"] .health-card.block,
body[data-theme="night"] .insight-card.block,
body[data-theme="night"] .risk-ledger-item.blocker {
  background: #321b1f;
}

body[data-theme="night"] table,
body[data-theme="night"] th,
body[data-theme="night"] td,
body[data-theme="night"] .pdf-preview-frame {
  border-color: var(--line);
}

.insight-card strong,
.insight-card small {
  display: block;
}

.insight-card small {
  margin-top: 4px;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
}

.toast {
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  padding: 12px 14px;
  background: var(--dark);
  color: #ffffff;
  box-shadow: var(--shadow);
  border-radius: var(--radius-sm);
}

.toast.ok {
  border-left-color: var(--green);
}

.toast.warn {
  border-left-color: var(--amber);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast strong,
.toast small {
  display: block;
}

.toast small {
  margin-top: 3px;
  color: #c7d7dc;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(24, 116, 58, 0.28);
  padding: 0 10px;
  background: #e6f4ea;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.mode-badge[data-mode="execute"] {
  border-color: rgba(207, 46, 46, 0.35);
  background: #ffe7e7;
  color: var(--accent);
}

@media (max-width: 1180px) {
  body {
    min-width: 0;
  }

  .app-shell,
  .grid-two,
  .grid-main,
  .bottom-grid,
  .status-grid,
  .global-status-strip,
  .quick-action-grid,
  .ops-strip,
  .form-grid,
  .option-grid,
  .audit-selector,
  .utility-grid {
    grid-template-columns: 1fr;
  }

  .log-summary-grid,
  .insight-grid,
  .route-case {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 14px;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .global-status-card small {
    white-space: normal;
  }
}

/* UX integration closure: night mode and compact work screens. */
body[data-theme="night"] .workspace {
  background: var(--bg);
}

body[data-theme="night"] .topbar {
  border-color: var(--line);
  background: rgba(15, 23, 29, 0.96);
}

body[data-theme="night"] .panel,
body[data-theme="night"] .status-tile,
body[data-theme="night"] .global-status-card,
body[data-theme="night"] .quick-action-card,
body[data-theme="night"] .route-map-card,
body[data-theme="night"] .route-thumb-card,
body[data-theme="night"] .route-lab-info-card,
body[data-theme="night"] .pdf-preview-panel,
body[data-theme="night"] .table-scroll,
body[data-theme="night"] .job-table {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

body[data-theme="night"] input,
body[data-theme="night"] select,
body[data-theme="night"] textarea {
  border-color: var(--line);
  background: #101b22;
  color: var(--ink);
}

body[data-theme="night"] input::placeholder,
body[data-theme="night"] textarea::placeholder {
  color: #8ea1aa;
}

body[data-theme="night"] .secondary-button {
  border-color: var(--line);
  background: #14242c;
  color: var(--ink);
}

body[data-theme="night"] .secondary-button:hover {
  background: #1d3038;
}

body[data-theme="night"] th {
  background: #13232b;
  color: var(--ink);
}

body[data-theme="night"] td {
  color: var(--ink);
}

body[data-theme="night"] .mode-badge {
  border-color: rgba(120, 222, 213, 0.35);
  background: #102c2b;
  color: var(--brand-dark);
}

body[data-theme="night"] .mode-badge[data-mode="execute"] {
  border-color: rgba(255, 121, 121, 0.38);
  background: #351b20;
  color: #ffb0b0;
}

body[data-theme="night"] .inventory-badge {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(217, 231, 235, 0.14);
  color: #b8c7cc;
}

body[data-theme="night"] .inventory-badge.risk-bajo,
body[data-theme="night"] .inventory-badge.status-inventariado {
  background: rgba(36, 155, 140, 0.16);
  border-color: rgba(123, 214, 201, 0.24);
  color: #7bd6c9;
}

body[data-theme="night"] .inventory-badge.risk-medio,
body[data-theme="night"] .inventory-badge.status-pendiente_preflight,
body[data-theme="night"] .inventory-badge.status-pendiente_allowlist {
  background: rgba(255, 176, 54, 0.16);
  border-color: rgba(255, 176, 54, 0.28);
  color: #ffd27a;
}

body[data-theme="night"] .inventory-badge.risk-alto,
body[data-theme="night"] .inventory-badge.risk-critico,
body[data-theme="night"] .inventory-badge.status-no_integrar {
  background: rgba(255, 99, 99, 0.15);
  border-color: rgba(255, 99, 99, 0.28);
  color: #ff9b9b;
}

body[data-theme="night"] .toast {
  border-color: #2f4650;
  background: #091017;
  color: var(--ink);
}

button,
.primary-button,
.secondary-button,
.favorite-button {
  white-space: nowrap;
}

.health-card,
.insight-card,
.global-status-card,
.status-tile {
  overflow-wrap: anywhere;
}

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

.job-result-panel {
  margin-top: 18px;
}

.job-result-empty {
  border: 1px dashed var(--line);
  color: var(--muted);
  padding: 16px;
  background: var(--panel-soft);
}

.job-result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
}

.job-result-main,
.job-preview-side {
  min-width: 0;
}

.evidence-list {
  display: grid;
  gap: 10px;
}

.evidence-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  padding: 10px;
}

.evidence-icon {
  display: grid;
  min-height: 44px;
  place-items: center;
  background: var(--green);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.evidence-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.evidence-body strong,
.evidence-body small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.evidence-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.job-preview-box iframe {
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.job-preview-text {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--ink);
  color: #f7fbfb;
  padding: 12px;
  white-space: pre-wrap;
}

.job-stdout summary {
  cursor: pointer;
  font-weight: 900;
}

@media (max-width: 1366px) {
  .app-shell {
    grid-template-columns: 238px minmax(0, 1fr);
  }

  .workspace {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar h1 {
    font-size: 25px;
  }

  .panel {
    padding: 14px;
  }

  .route-canvas-viewport {
    max-height: 62vh;
  }

  .job-result-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 214px minmax(0, 1fr);
  }

  .sidebar {
    padding: 16px 12px;
  }

  .nav-item {
    grid-template-columns: 30px 1fr;
    min-height: 40px;
    padding-right: 8px;
  }

  .global-status-strip,
  .status-grid,
  .quick-action-grid,
  .health-strip,
  .insight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-two,
  .grid-main,
  .bottom-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .top-actions,
  .button-row,
  .route-toolbar,
  .compact-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 12px;
    padding: 10px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand span {
    display: none;
  }

  .nav-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .nav-item {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
    min-height: 36px;
    padding: 0 10px;
    white-space: nowrap;
  }

  .nav-code {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }

  .workspace {
    width: 100%;
    max-width: 100%;
    padding: 10px;
    overflow-x: hidden;
  }

  .topbar,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .topbar h1 {
    font-size: 26px;
  }

  .panel {
    max-width: 100%;
    padding: 12px;
    overflow: hidden;
  }

  .pill {
    max-width: 100%;
    white-space: normal;
    line-height: 1.25;
  }

  .ops-strip,
  .global-status-strip,
  .status-grid,
  .quick-action-grid,
  .health-strip,
  .insight-grid,
  .form-grid,
  .option-grid,
  .grid-two,
  .grid-main,
  .bottom-grid,
  .compact-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .option-grid label,
  .form-grid label,
  .health-card,
  .risk-card,
  .terminal,
  .mini-list {
    min-width: 0;
    max-width: 100%;
  }

  .top-actions,
  .button-row {
    width: 100%;
    justify-content: stretch;
  }

  .top-actions > button,
  .button-row > button {
    flex: 1 1 auto;
  }

  input,
  select,
  textarea,
  .primary-button,
  .secondary-button {
    max-width: 100%;
  }
}
