/* ──────────────────────────────────────────
   Variables & Reset
────────────────────────────────────────── */
:root {
  --blue-900: #042C53;
  --blue-800: #0C447C;
  --blue-600: #185FA5;
  --blue-400: #378ADD;
  --blue-100: #B5D4F4;
  --blue-50:  #E6F1FB;

  --green-800: #27500A;
  --green-200: #97C459;
  --green-50:  #EAF3DE;

  --red-800: #791F1F;
  --red-200: #F09595;
  --red-50:  #FCEBEB;

  --amber-800: #633806;
  --amber-200: #EF9F27;
  --amber-50:  #FAEEDA;

  --gray-900: #1a1a1a;
  --gray-700: #3a3a3a;
  --gray-500: #5F5E5A;
  --gray-400: #888780;
  --gray-200: #D3D1C7;
  --gray-100: #EEECE6;
  --gray-50:  #F7F5F0;

  --sidebar-w: 240px;
  --topbar-h: 56px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 8px rgba(0,0,0,.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; color: var(--gray-900); background: var(--gray-50); }
a { text-decoration: none; color: var(--blue-600); }
a:hover { color: var(--blue-800); }
input, select, textarea, button { font-family: inherit; }

/* ──────────────────────────────────────────
   Layout
────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--blue-900);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo { max-height: 36px; max-width: 80px; object-fit: contain; border-radius: 4px; }
.sidebar-icon-brand {
  width: 36px; height: 36px;
  background: var(--blue-400);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px; flex-shrink: 0;
}
.sidebar-brand-text { min-width: 0; }
.sidebar-name { display: block; font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-sub { display: block; font-size: 10px; color: rgba(255,255,255,.45); margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 8px 8px; overflow-y: auto; }
.nav-section {
  font-size: 9px;
  font-weight: 600;
  color: rgba(255,255,255,.35);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 10px 8px 3px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: rgba(255,255,255,.65);
  font-size: 12px;
  transition: all .15s;
  margin-bottom: 1px;
}
.nav-item i { font-size: 16px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.08); color: white; }
.nav-item.active { background: var(--blue-400); color: white; font-weight: 500; }

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue-400);
  color: white; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-detail { min-width: 0; }
.user-name { display: block; font-size: 12px; color: white; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 10px; margin-top: 1px; }
.logout-btn { color: rgba(255,255,255,.4); font-size: 16px; padding: 4px; border-radius: 6px; }
.logout-btn:hover { color: white; background: rgba(255,255,255,.1); }

/* Main */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--gray-900); }
.topbar-actions { display: flex; gap: 8px; }

.page-content { padding: 24px; flex: 1; }

/* ──────────────────────────────────────────
   Alerts
────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  border-bottom: 1px solid transparent;
}
.alert i { font-size: 16px; flex-shrink: 0; }
.alert-success { background: var(--green-50); color: var(--green-800); border-color: var(--green-200); }
.alert-error { background: var(--red-50); color: var(--red-800); border-color: var(--red-200); }
.alert-info { background: var(--blue-50); color: var(--blue-800); border-color: var(--blue-100); }

/* ──────────────────────────────────────────
   Buttons
────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
}
.btn i { font-size: 15px; }
.btn-primary { background: var(--blue-800); color: white; border-color: var(--blue-800); }
.btn-primary:hover { background: var(--blue-600); color: white; }
.btn-secondary { background: white; color: var(--gray-700); border-color: var(--gray-200); }
.btn-secondary:hover { background: var(--gray-100); }
.btn-ghost { background: transparent; color: var(--gray-500); border-color: transparent; }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-700); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  background: white;
  color: var(--gray-500);
  cursor: pointer;
  font-size: 15px;
  transition: all .15s;
}
.icon-btn:hover { background: var(--blue-50); color: var(--blue-800); border-color: var(--blue-100); }
.icon-btn-warn:hover { background: var(--amber-50); color: var(--amber-800); border-color: var(--amber-200); }
.icon-btn-ok:hover { background: var(--green-50); color: var(--green-800); }
.action-group { display: flex; gap: 4px; }

/* ──────────────────────────────────────────
   Cards
────────────────────────────────────────── */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-100);
}
.card-header h3 { font-size: 14px; font-weight: 600; }
.card-link { font-size: 12px; color: var(--blue-600); display: flex; align-items: center; gap: 4px; }

/* ──────────────────────────────────────────
   Tables
────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
  white-space: nowrap;
}
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--gray-50); }
.row-inactive td { opacity: .5; }
.empty-row { text-align: center; color: var(--gray-400); padding: 32px; font-size: 13px; }
.table-meta { padding: 10px 16px; font-size: 12px; color: var(--gray-400); border-bottom: 1px solid var(--gray-100); }

/* ──────────────────────────────────────────
   Forms
────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; font-weight: 500; color: var(--gray-500); }
.req { color: var(--red-800); }
.field input, .field select, .field textarea {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--gray-900);
  background: white;
  transition: border-color .15s;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(55,138,221,.12);
}
.field textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.field-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.field-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 12px; }

.form-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.form-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.form-section-title i { font-size: 14px; color: var(--blue-600); }

.form-grid-main { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.form-col { min-width: 0; }
.form-col-side { min-width: 0; position: sticky; top: calc(var(--topbar-h) + 16px); }
.sticky-actions { position: sticky; top: 0; }

/* Severity / Impact selector */
.sev-selector { display: flex; gap: 8px; }
.sev-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 10px 6px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-400);
  background: white;
  transition: all .18s;
  text-align: center;
  user-select: none;
  position: relative;
}
.sev-option i { font-size: 18px; }
.sev-option input { display: none; }
.sev-check { font-size: 13px !important; display: none; position: absolute; top: 4px; right: 5px; }

/* Hover states */
.sev-option:hover { transform: translateY(-1px); }
.sev-option.sev-critica:hover, .sev-option.critica:hover { border-color: #E24B4A; color: var(--red-800);   background: #fff5f5; }
.sev-option.sev-alta:hover,   .sev-option.alta:hover    { border-color: var(--amber-200); color: var(--amber-800); background: #fffaf0; }
.sev-option.sev-media:hover,  .sev-option.media:hover   { border-color: var(--blue-400);  color: var(--blue-800);  background: #f0f7ff; }
.sev-option.sev-baja:hover,   .sev-option.baja:hover    { border-color: var(--green-200); color: var(--green-800); background: #f3fae8; }

/* Active / selected states — is-active class (JS) */
.sev-option.is-active { transform: translateY(-2px); }
.sev-option.is-active .sev-check { display: inline !important; }

.sev-option.sev-critica.is-active, .sev-option.critica.is-active {
  background: var(--red-50); border-color: #E24B4A; color: var(--red-800);
  box-shadow: 0 0 0 3px rgba(226,75,74,.18);
}
.sev-option.sev-alta.is-active, .sev-option.alta.is-active {
  background: var(--amber-50); border-color: var(--amber-200); color: var(--amber-800);
  box-shadow: 0 0 0 3px rgba(239,159,39,.18);
}
.sev-option.sev-media.is-active, .sev-option.media.is-active {
  background: var(--blue-50); border-color: var(--blue-400); color: var(--blue-800);
  box-shadow: 0 0 0 3px rgba(55,138,221,.18);
}
.sev-option.sev-baja.is-active, .sev-option.baja.is-active {
  background: var(--green-50); border-color: var(--green-200); color: var(--green-800);
  box-shadow: 0 0 0 3px rgba(99,153,34,.18);
}

/* Fallback: :has(input:checked) for browsers that support it */
.sev-option.sev-critica:has(input:checked), .sev-option.critica:has(input:checked) {
  background: var(--red-50); border-color: #E24B4A; color: var(--red-800);
  box-shadow: 0 0 0 3px rgba(226,75,74,.18); transform: translateY(-2px);
}
.sev-option.sev-alta:has(input:checked), .sev-option.alta:has(input:checked) {
  background: var(--amber-50); border-color: var(--amber-200); color: var(--amber-800);
  box-shadow: 0 0 0 3px rgba(239,159,39,.18); transform: translateY(-2px);
}
.sev-option.sev-media:has(input:checked), .sev-option.media:has(input:checked) {
  background: var(--blue-50); border-color: var(--blue-400); color: var(--blue-800);
  box-shadow: 0 0 0 3px rgba(55,138,221,.18); transform: translateY(-2px);
}
.sev-option.sev-baja:has(input:checked), .sev-option.baja:has(input:checked) {
  background: var(--green-50); border-color: var(--green-200); color: var(--green-800);
  box-shadow: 0 0 0 3px rgba(99,153,34,.18); transform: translateY(-2px);
}

/* Steps */
.step-list { list-style: none; margin-bottom: 8px; }
.step-item { display: flex; align-items: flex-start; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--gray-100); }
.step-item:last-child { border-bottom: none; }
.step-num {
  min-width: 22px; height: 22px;
  background: var(--blue-800);
  color: white;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.step-text { flex: 1; font-size: 13px; line-height: 1.4; }
.step-del {
  background: none; border: none; cursor: pointer;
  color: var(--gray-400); padding: 2px 4px; border-radius: 4px; font-size: 13px;
}
.step-del:hover { color: var(--red-800); background: var(--red-50); }
.add-step-row { display: flex; gap: 8px; margin-top: 8px; }
.add-step-row input { flex: 1; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 7px 10px; font-size: 13px; }
.add-step-row input:focus { outline: none; border-color: var(--blue-400); }

/* Drop zone */
.drop-zone {
  border: 1.5px dashed var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  text-align: center;
  background: var(--gray-50);
  cursor: pointer;
  transition: all .15s;
}
.drop-zone:hover, .drop-zone.active { border-color: var(--blue-400); background: var(--blue-50); }
.drop-zone i { font-size: 28px; color: var(--gray-400); display: block; margin-bottom: 6px; }
.drop-zone p { font-size: 13px; color: var(--gray-500); margin-bottom: 2px; }
.drop-zone span { font-size: 11px; color: var(--gray-400); }
.file-list { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.file-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  background: white;
  font-size: 12px;
}
.file-item i { color: var(--blue-600); font-size: 14px; }
.file-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { color: var(--gray-400); white-space: nowrap; }

/* Input with icon */
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: 16px; }
.input-icon input { padding-left: 36px; }

/* ──────────────────────────────────────────
   Badges
────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.sev-critica { background: var(--red-50); color: var(--red-800); }
.sev-alta { background: var(--amber-50); color: var(--amber-800); }
.sev-media { background: var(--blue-50); color: var(--blue-800); }
.sev-baja { background: var(--green-50); color: var(--green-800); }
.est-resuelto { background: var(--green-50); color: var(--green-800); }
.est-en-monitoreo { background: var(--blue-50); color: var(--blue-800); }
.est-escalado-a-proveedor { background: var(--amber-50); color: var(--amber-800); }
.est-pendiente-de-repuesto { background: var(--red-50); color: var(--red-800); }
.est-parcialmente-resuelto { background: var(--amber-50); color: var(--amber-800); }
.badge-info { background: var(--blue-50); color: var(--blue-800); }
.badge-success { background: var(--green-50); color: var(--green-800); }
.badge-muted { background: var(--gray-100); color: var(--gray-500); }
.badge-role-admin { background: var(--blue-800); color: white; }
.badge-role-analista { background: var(--gray-100); color: var(--gray-700); }

/* ──────────────────────────────────────────
   Dashboard stats
────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-blue { background: var(--blue-50); color: var(--blue-800); }
.stat-teal { background: #E1F5EE; color: #0F6E56; }
.stat-red { background: var(--red-50); color: var(--red-800); }
.stat-green { background: var(--green-50); color: var(--green-800); }
.stat-value { font-size: 24px; font-weight: 700; color: var(--gray-900); line-height: 1; }
.stat-label { font-size: 12px; color: var(--gray-400); margin-top: 3px; }

.grid-2-1 { display: grid; grid-template-columns: 1fr 320px; gap: 16px; }

/* Chart bars */
.chart-bars { padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; }
.chart-bar-row { display: flex; align-items: center; gap: 10px; }
.chart-bar-label { font-size: 12px; color: var(--gray-500); width: 110px; flex-shrink: 0; }
.chart-bar-track { flex: 1; height: 8px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 4px; transition: width .5s ease; }
.sev-bar-critica { background: #E24B4A; }
.sev-bar-alta { background: var(--amber-200); }
.sev-bar-media { background: var(--blue-400); }
.sev-bar-baja { background: var(--green-200); }
.est-bar { background: var(--blue-400); }
.chart-bar-val { font-size: 12px; font-weight: 600; color: var(--gray-900); width: 24px; text-align: right; }

/* ──────────────────────────────────────────
   Filters
────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
  flex-wrap: wrap;
}
.filter-search {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.filter-search i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: 15px; }
.filter-search input {
  width: 100%; padding: 7px 10px 7px 34px;
  border: 1px solid var(--gray-200); border-radius: var(--radius); font-size: 13px;
}
.filter-search input:focus { outline: none; border-color: var(--blue-400); }
.filter-bar select {
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 7px 10px; font-size: 13px; background: white;
}
.filter-bar select:focus { outline: none; border-color: var(--blue-400); }

/* ──────────────────────────────────────────
   View ticket
────────────────────────────────────────── */
.view-grid { display: grid; grid-template-columns: 1fr 260px; gap: 16px; align-items: start; }
.view-main { min-width: 0; }
.view-side { min-width: 0; position: sticky; top: calc(var(--topbar-h) + 16px); }
.view-header-card {
  background: white; border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  padding: 16px 20px; margin-bottom: 14px; box-shadow: var(--shadow);
  border-left: 4px solid var(--blue-800);
}
.view-num { font-size: 20px; font-weight: 700; color: var(--blue-900); margin-bottom: 6px; }
.view-badges { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.view-meta { font-size: 11px; color: var(--gray-400); }
.view-card {
  background: white; border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  padding: 16px 20px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.view-section-title {
  font-size: 11px; font-weight: 600; color: var(--blue-800);
  text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: 12px; padding-bottom: 6px;
  border-bottom: 1px solid var(--blue-50);
}
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; }
.info-row { display: flex; flex-direction: column; }
.info-lbl { font-size: 11px; color: var(--gray-400); }
.info-val { font-size: 13px; font-weight: 500; color: var(--gray-900); margin-top: 2px; }
.view-field-block { margin-top: 10px; }
.view-text { font-size: 13px; color: var(--gray-900); line-height: 1.6; margin-top: 4px; background: var(--gray-50); border-radius: var(--radius); padding: 10px; }
.view-steps { padding-left: 1.2rem; }
.view-steps li { font-size: 13px; margin-bottom: 4px; }
.attach-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.attach-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 100px; padding: 10px 8px;
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  font-size: 11px; color: var(--gray-700); text-align: center;
}
.attach-item:hover { border-color: var(--blue-400); background: var(--blue-50); }
.attach-thumb { width: 80px; height: 60px; object-fit: cover; border-radius: 4px; }
.attach-icon { width: 80px; height: 60px; display: flex; align-items: center; justify-content: center; background: var(--gray-50); border-radius: 4px; font-size: 26px; color: var(--blue-600); }
.attach-name { width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-size { color: var(--gray-400); }

/* ──────────────────────────────────────────
   Pagination
────────────────────────────────────────── */
.pagination { display: flex; justify-content: center; gap: 4px; padding: 16px; }
.page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  font-size: 13px; color: var(--gray-500); background: white;
}
.page-btn:hover { border-color: var(--blue-400); color: var(--blue-800); background: var(--blue-50); }
.page-btn.active { background: var(--blue-800); color: white; border-color: var(--blue-800); }

/* ──────────────────────────────────────────
   Modals
────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-lg { max-width: 600px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--gray-400); font-size: 18px; padding: 2px; }
.modal-close:hover { color: var(--gray-900); }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; }

/* ──────────────────────────────────────────
   Config page
────────────────────────────────────────── */
.config-tabs { display: flex; gap: 4px; margin-bottom: 20px; }
.ctab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  background: white; font-size: 13px; font-weight: 500;
  color: var(--gray-500); cursor: pointer;
}
.ctab i { font-size: 15px; }
.ctab.active { background: var(--blue-800); color: white; border-color: var(--blue-800); }
.ctab:hover:not(.active) { background: var(--gray-100); }
.config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.color-field { display: flex; align-items: center; gap: 8px; }
.color-field input[type="color"] { width: 36px; height: 36px; padding: 2px; border: 1px solid var(--gray-200); border-radius: var(--radius); cursor: pointer; }
.checkbox-group { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 4px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray-700); cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 15px; height: 15px; }
.pdf-preview {
  margin: 16px 0;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  background: white;
}
.pdf-prev-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-bottom: 3px solid var(--blue-800);
}
.pdf-prev-logo {
  width: 36px; height: 36px;
  background: var(--blue-800);
  color: white; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: bold; flex-shrink: 0;
}
.pdf-prev-title { font-size: 13px; font-weight: 700; color: var(--blue-800); }
.pdf-prev-sub { font-size: 10px; color: var(--gray-400); }
.pdf-prev-body { padding: 12px 14px; }
.pdf-prev-section {
  font-size: 9px; font-weight: 700; color: var(--blue-800);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 4px 8px;
  background: #E6F1FB40;
  border-left: 3px solid var(--blue-800);
  margin-bottom: 8px;
}

/* ──────────────────────────────────────────
   Login
────────────────────────────────────────── */
.login-body { background: var(--gray-50); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
  background: white; border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg); padding: 36px 32px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand-icon {
  width: 56px; height: 56px;
  background: var(--blue-800); border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 26px;
  margin: 0 auto 14px;
}
.login-brand h1 { font-size: 20px; font-weight: 700; color: var(--gray-900); margin-bottom: 6px; }
.login-brand p { font-size: 13px; color: var(--gray-400); line-height: 1.4; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-footer { margin-top: 20px; text-align: center; font-size: 12px; color: var(--gray-400); }

/* ──────────────────────────────────────────
   Utilities
────────────────────────────────────────── */
.fw-500 { font-weight: 500; }
.text-muted { color: var(--gray-400); }
.text-sm { font-size: 12px; }
.text-mono { font-family: 'Consolas', 'Courier New', monospace; }
.link-primary { color: var(--blue-800); font-weight: 500; }
.link-primary:hover { color: var(--blue-600); text-decoration: underline; }

/* ── Step drag handle ───────────────────────────────────── */
.step-drag {
  color: var(--gray-300);
  cursor: grab;
  font-size: 15px;
  padding: 0 2px;
  flex-shrink: 0;
}
.step-drag:active { cursor: grabbing; }
.step-item { align-items: center; }

/* ── kbd ─────────────────────────────────────────────────── */
kbd {
  font-size: 10px; padding: 1px 5px;
  border: 1px solid var(--gray-200);
  border-radius: 3px;
  background: var(--gray-50);
  font-family: monospace;
}

/* ── Preaviso state badges ───────────────────────────────── */
.pre-borrador    { background:#f0f0f0; color:#555; }
.pre-aprobado    { background:#E6F1FB; color:#0C447C; }
.pre-enviado     { background:#EAF3DE; color:#27500A; }
.pre-en-ejecución{ background:#FAEEDA; color:#633806; }
.pre-completado  { background:#EAF3DE; color:#27500A; }
.pre-cancelado   { background:#FCEBEB; color:#791F1F; }

/* ── Step tag (predictive) ───────────────────────────────── */
.step-tag {
  padding:4px 10px; border-radius:20px;
  background:var(--blue-50); color:var(--blue-800);
  border:1px solid var(--blue-100);
  font-size:11px; cursor:pointer; transition:all .12s;
  display:inline-flex; align-items:center; gap:4px;
}
.step-tag:hover { background:var(--blue-100); }

/* ── nc-sev: severity/impact selector (JS-driven, no CSS specificity issues) ── */
.nc-sev { display:flex; gap:8px; }
.nc-sev-btn {
  flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:6px; padding:12px 6px; border:2px solid #D3D1C7; border-radius:8px;
  cursor:pointer; font-size:12px; font-weight:700; color:#888780; background:white;
  transition:border-color .15s, background .15s, color .15s, transform .12s, box-shadow .15s;
  user-select:none; position:relative;
}
.nc-sev-btn .nc-sev-icon { font-size:20px; line-height:1; }
.nc-sev-btn .nc-check { position:absolute; top:5px; right:6px; font-size:14px; display:none; }
.nc-sev-btn:hover { transform:translateY(-2px); }

/* ── NeuralEditor rendered content ── */
.ne-content { font-size:13px; line-height:1.7; color:var(--gray-900); }
.ne-content p { margin:0 0 8px 0; }
.ne-content p:last-child { margin-bottom:0; }
.ne-content ul, .ne-content ol { padding-left:1.4em; margin:4px 0 8px; }
.ne-content li { margin-bottom:3px; }
.ne-content strong, .ne-content b { font-weight:600; }
.ne-content em, .ne-content i { font-style:italic; }
.ne-content u { text-decoration:underline; }
.ne-content br { display:block; margin-bottom:4px; }
