/* ============================================================
   NEXO CRM · ERP — Hoja de estilos
   ============================================================ */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e6eaf2;
  --line-strong: #d7ddea;
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-soft: #eef2ff;
  --teal: #0d9488;
  --green: #059669;
  --green-soft: #ecfdf5;
  --amber: #b45309;
  --amber-bright: #f59e0b;
  --amber-soft: #fffbeb;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --purple: #7c3aed;
  --purple-soft: #f5f3ff;
  --slate: #475569;
  --slate-soft: #f1f5f9;
  --navy: #0b1220;
  --navy-2: #111c33;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 10px 30px -18px rgba(15, 23, 42, 0.22);
  --shadow-lg: 0 30px 70px -30px rgba(15, 23, 42, 0.4);
  --sidebar-w: 268px;
  --font: "Segoe UI", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 105% -12%, rgba(99, 102, 241, 0.08), transparent 60%),
    radial-gradient(900px 480px at -10% 0%, rgba(14, 165, 233, 0.06), transparent 55%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
::selection { background: rgba(99, 102, 241, 0.2); }

/* ---------------- Scrollbar ---------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; border: 2px solid transparent; background-clip: content-box; }

/* ---------------- Utilidades ---------------- */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.text-danger { color: var(--red); }
.text-warning { color: var(--amber); }
.text-success { color: var(--green); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.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;
}

/* ---------------- Botones ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 39px; padding: 0 15px; border-radius: 10px;
  border: 1px solid transparent; background: transparent;
  font-size: 13.5px; font-weight: 650; line-height: 1; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .1s ease, color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .icon-btn:focus-visible, .nav-link:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible, .chip:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.25); outline-offset: 1px;
}
.btn svg { flex: 0 0 auto; }
.btn-primary {
  background: linear-gradient(180deg, #5b52ea, #4f46e5);
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(79, 70, 229, 0.85), inset 0 1px 0 rgba(255,255,255,.16);
}
.btn-primary:hover { background: linear-gradient(180deg, #4f46e5, #4338ca); }
.btn-secondary { background: #fff; border-color: var(--line-strong); color: var(--ink-2); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { border-color: #c3cbdc; background: var(--surface-2); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { background: var(--slate-soft); color: var(--ink-2); }
.btn-danger { background: var(--red); color: #fff; box-shadow: 0 8px 18px -12px rgba(220, 38, 38, .9); }
.btn-danger:hover { background: #b91c1c; }
.btn-danger-soft { background: var(--red-soft); color: var(--red); border-color: #fecaca; }
.btn-danger-soft:hover { background: #fee2e2; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; gap: 6px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 14.5px; border-radius: 12px; }
.btn[disabled] { opacity: .6; cursor: not-allowed; transform: none; }
.icon-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; background: transparent; border-radius: 9px; color: var(--muted);
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--slate-soft); color: var(--ink); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }
.icon-btn.bordered { border-color: var(--line); background: #fff; }

/* ---------------- Badges / chips ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 650; line-height: 1.55;
  white-space: nowrap; border: 1px solid transparent;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge--plain::before { display: none; }
.badge--green { background: var(--green-soft); color: #047857; border-color: #d1fae5; }
.badge--amber { background: var(--amber-soft); color: #b45309; border-color: #fde68a; }
.badge--red { background: var(--red-soft); color: var(--red); border-color: #fecaca; }
.badge--blue { background: var(--blue-soft); color: var(--blue); border-color: #dbeafe; }
.badge--indigo { background: var(--brand-soft); color: #4338ca; border-color: #e0e7ff; }
.badge--purple { background: var(--purple-soft); color: var(--purple); border-color: #ede9fe; }
.badge--slate { background: var(--slate-soft); color: var(--slate); border-color: #e2e8f0; }
.badge--teal { background: #f0fdfa; color: #0f766e; border-color: #ccfbf1; }
.badge--dark { background: #0f172a; color: #e2e8f0; border-color: #0f172a; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px;
  border-radius: 9px; border: 1px solid var(--line-strong); background: #fff;
  color: var(--muted); font-size: 12.5px; font-weight: 600; transition: all .15s;
}
.chip:hover { border-color: #c3cbdc; color: var(--ink-2); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.active svg { opacity: .9; }
.chip .chip-count { font-size: 11px; background: rgba(148, 163, 184, .2); padding: 1px 6px; border-radius: 20px; }
.chip.active .chip-count { background: rgba(255, 255, 255, .18); }

/* ---------------- Formularios ---------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.span-2 { grid-column: span 2; }
.field > label { font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.field > label .req { color: var(--red); margin-left: 2px; }
.field .hint { font-size: 11.5px; color: var(--muted-2); }
input, select, textarea {
  width: 100%; border: 1px solid var(--line-strong); background: #fff;
  border-radius: 9px; padding: 9px 11px; font-size: 13.5px; color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input, select { height: 39px; }
textarea { min-height: 92px; resize: vertical; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: #a3aebe; }
input:hover, select:hover, textarea:hover { border-color: #c3cbdc; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: #818cf8; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14);
}
input[disabled], select[disabled], textarea[disabled] { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px;
}
.check {
  display: flex; align-items: flex-start; gap: 9px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2);
  font-size: 13px; color: var(--ink-2); cursor: pointer;
}
.check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); margin: 1px 0 0; flex: 0 0 auto; }
.form-section { margin-top: 4px; padding-top: 16px; border-top: 1px dashed var(--line); }
.form-section-title { font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 12px; }
.form-error {
  margin: 0 24px 4px; padding: 10px 12px; border-radius: 9px;
  background: var(--red-soft); border: 1px solid #fecaca; color: #b91c1c; font-size: 12.5px; font-weight: 550;
}

/* ---------------- Login ---------------- */
.login-screen { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.login-visual {
  position: relative; overflow: hidden; padding: 54px 60px;
  color: #e2e8f0; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(700px 420px at 85% 12%, rgba(99, 102, 241, .38), transparent 60%),
    radial-gradient(600px 400px at 10% 90%, rgba(14, 165, 233, .22), transparent 60%),
    linear-gradient(155deg, #0a1020 0%, #101b33 58%, #0b1426 100%);
}
.login-visual::before {
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(rgba(148, 163, 184, .18) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(160deg, #000 10%, transparent 75%);
}
.login-visual::after {
  content: ""; position: absolute; width: 560px; height: 560px; border-radius: 50%;
  right: -220px; bottom: -260px; border: 1px solid rgba(129, 140, 248, .22);
  box-shadow: 0 0 0 70px rgba(99, 102, 241, .045), 0 0 0 140px rgba(99, 102, 241, .03);
}
.login-visual > * { position: relative; z-index: 1; }
.login-brand { display: flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 700; letter-spacing: -.01em; color: #fff; }
.login-brand .mark { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 19px; font-weight: 800; background: linear-gradient(135deg, #6366f1, #0ea5e9); box-shadow: 0 10px 30px -10px rgba(79, 70, 229, .8); }
.login-brand span small { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: #94a3b8; margin-top: 2px; }
.login-copy { max-width: 520px; margin: 40px 0; }
.login-copy .eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #a5b4fc; background: rgba(99, 102, 241, .14); border: 1px solid rgba(129, 140, 248, .25); padding: 5px 11px; border-radius: 999px; }
.login-copy h1 { font-size: clamp(32px, 4vw, 46px); line-height: 1.08; letter-spacing: -.03em; margin: 20px 0 16px; color: #f8fafc; }
.login-copy h1 em { font-style: normal; background: linear-gradient(90deg, #a5b4fc, #67e8f9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-copy p { font-size: 15px; line-height: 1.65; color: #94a3b8; max-width: 440px; }
.login-features { display: grid; gap: 14px; margin-top: 30px; }
.login-feature { display: flex; gap: 12px; align-items: center; font-size: 13.5px; color: #cbd5e1; }
.login-feature .ico { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 9px; background: rgba(148, 163, 184, .1); border: 1px solid rgba(148, 163, 184, .14); display: grid; place-items: center; color: #a5b4fc; }
.login-cards { display: flex; gap: 12px; flex-wrap: wrap; }
.login-mini-card { flex: 1 1 180px; padding: 14px 16px; border-radius: 13px; background: rgba(148, 163, 184, .08); border: 1px solid rgba(148, 163, 184, .14); backdrop-filter: blur(8px); }
.login-mini-card .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #94a3b8; font-weight: 700; }
.login-mini-card .value { font-size: 20px; font-weight: 750; color: #f1f5f9; margin-top: 5px; letter-spacing: -.02em; }
.login-mini-card .meta { font-size: 11.5px; color: #818cf8; margin-top: 2px; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 44px 28px; }
.login-card { width: 100%; max-width: 408px; }
.login-card .mobile-brand { display: none; }
.login-card h2 { font-size: 27px; letter-spacing: -.025em; margin-bottom: 7px; }
.login-card > p { color: var(--muted); font-size: 13.5px; margin-bottom: 28px; }
.login-form { display: flex; flex-direction: column; gap: 15px; }
.login-form .field > label { font-size: 12.5px; }
.login-form .input-wrap { position: relative; }
.login-form .input-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.login-form .input-wrap input { padding-left: 38px; height: 44px; }
.login-form .btn { height: 46px; margin-top: 4px; }
.login-error { background: var(--red-soft); border: 1px solid #fecaca; color: #b91c1c; border-radius: 9px; padding: 10px 12px; font-size: 12.5px; font-weight: 550; }
.demo-box { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.demo-box .demo-title { display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted-2); font-weight: 750; margin-bottom: 10px; }
.demo-accounts { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.demo-account {
  text-align: left; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
  padding: 10px 12px; transition: border-color .15s, background .15s, transform .1s;
}
.demo-account:hover { border-color: #c7d2fe; background: var(--brand-soft); }
.demo-account .role { font-size: 11.5px; font-weight: 700; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.demo-account .creds { font-size: 11px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.login-foot { margin-top: 26px; font-size: 11.5px; color: var(--muted-2); text-align: center; }

/* ---------------- Estructura ---------------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 22px 16px 16px; gap: 8px; overflow-y: auto;
  background:
    radial-gradient(520px 300px at 50% -8%, rgba(99, 102, 241, .18), transparent 65%),
    linear-gradient(180deg, #0b1220 0%, #0d1729 100%);
  color: #94a3b8; z-index: 40;
}
.sidebar::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, .35); }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 18px; color: #fff; }
.brand .mark { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 18px; background: linear-gradient(135deg, #6366f1, #0ea5e9); box-shadow: 0 10px 25px -10px rgba(79, 70, 229, .9); flex: 0 0 auto; }
.brand .name { font-size: 15.5px; font-weight: 750; letter-spacing: -.01em; line-height: 1.15; }
.brand .name small { display: block; font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase; color: #64748b; font-weight: 700; margin-top: 3px; }
.nav-section { padding: 14px 10px 6px; font-size: 9.5px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; color: #52617a; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px;
  color: #94a3b8; font-size: 13.2px; font-weight: 550; text-decoration: none;
  border: 1px solid transparent; transition: background .15s, color .15s, border-color .15s;
  position: relative;
}
.nav-link:hover { background: rgba(148, 163, 184, .09); color: #e2e8f0; text-decoration: none; }
.nav-link.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, .22), rgba(99, 102, 241, .08));
  color: #fff; border-color: rgba(129, 140, 248, .2);
  box-shadow: inset 2.5px 0 0 #818cf8;
}
.nav-link svg { color: #7b8aa5; transition: color .15s; flex: 0 0 auto; }
.nav-link.active svg, .nav-link:hover svg { color: #a5b4fc; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 750; background: rgba(99, 102, 241, .25); color: #c7d2fe;
}
.nav-badge.danger { background: rgba(248, 113, 113, .18); color: #fca5a5; }
.sidebar-spacer { flex: 1; }
.sidebar-note {
  margin: 10px 4px; padding: 12px 13px; border-radius: 11px;
  background: rgba(148, 163, 184, .07); border: 1px solid rgba(148, 163, 184, .12);
  font-size: 11.5px; color: #8b9bb4; line-height: 1.5;
}
.sidebar-note strong { display: flex; gap: 7px; align-items: center; color: #cbd5e1; font-size: 12px; margin-bottom: 3px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 11px; background: rgba(148, 163, 184, .07); border: 1px solid rgba(148, 163, 184, .1); }
.sidebar-user .meta { min-width: 0; flex: 1; }
.sidebar-user .meta strong { display: block; font-size: 12.5px; color: #e2e8f0; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .meta span { display: block; font-size: 10.5px; color: #7b8aa5; margin-top: 1px; }
.sidebar-user .logout { color: #7b8aa5; }
.sidebar-user .logout:hover { color: #fca5a5; background: rgba(239, 68, 68, .12); }
.avatar {
  --av-bg: #e0e7ff; --av-fg: #4338ca;
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 750;
  background: var(--av-bg); color: var(--av-fg); letter-spacing: .01em;
  border: 1px solid rgba(15, 23, 42, .04);
}
.avatar.sm { width: 30px; height: 30px; font-size: 10.5px; }
.avatar.lg { width: 52px; height: 52px; font-size: 16px; }
.avatar.xxl { width: 64px; height: 64px; font-size: 20px; border-radius: 18px; }

.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: 68px; flex: 0 0 auto; display: flex; align-items: center; gap: 16px;
  padding: 0 30px; background: rgba(255, 255, 255, .82); backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(226, 232, 240, .85); position: sticky; top: 0; z-index: 30;
}
.crumbs { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted-2); white-space: nowrap; }
.crumbs strong { color: var(--ink-2); font-weight: 650; }
.topbar-search { margin-left: auto; position: relative; width: min(300px, 30vw); }
.topbar-search form { position: relative; }
.topbar-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.topbar-search input {
  height: 36px; padding-left: 35px; background: var(--surface-2); border-color: transparent;
  font-size: 12.5px; border-radius: 9px;
}
.topbar-search input:focus { background: #fff; border-color: #818cf8; }
.topbar-date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.topbar-user { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); background: #fff;
  border-radius: 999px; padding: 4px 10px 4px 4px; transition: border-color .15s, box-shadow .15s;
}
.user-chip:hover { border-color: #c7d2fe; box-shadow: 0 4px 14px -8px rgba(79, 70, 229, .5); }
.user-chip .name { font-size: 12.5px; font-weight: 650; line-height: 1.2; white-space: nowrap; }
.user-chip .name small { display: block; font-size: 10px; color: var(--muted-2); font-weight: 600; }
.user-chip .chevron { color: var(--muted-2); transition: transform .15s; }
.topbar-user.open .chevron { transform: rotate(180deg); }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 10px); width: 228px; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; opacity: 0; transform: translateY(-5px) scale(.98); pointer-events: none;
  transition: opacity .15s, transform .15s; z-index: 50;
}
.topbar-user.open .user-menu { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.user-menu .menu-head { padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.user-menu .menu-head strong { display: block; font-size: 13px; }
.user-menu .menu-head span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 0;
  background: transparent; border-radius: 8px; text-align: left; font-size: 12.5px; color: var(--ink-2);
}
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--red); }
.menu-item.danger:hover { background: var(--red-soft); }
.mobile-menu { display: none; }
.sidebar-backdrop { display: none; }

/* ---------------- Alertas ---------------- */
.topbar-alerts { position: relative; }
.alerts-btn {
  position: relative; width: 38px; height: 38px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink-2);
  transition: background .15s, border-color .15s, color .15s;
}
.alerts-btn:hover { border-color: #c7d2fe; color: var(--brand); background: var(--brand-soft); }
.alerts-btn.has-alerts { color: var(--red); border-color: #fecaca; background: var(--red-soft); }
.alerts-btn.has-alerts svg { animation: bellRing 2.8s ease-in-out infinite; transform-origin: 50% 12%; }
@keyframes bellRing {
  0%, 58%, 100% { transform: rotate(0); }
  64% { transform: rotate(10deg); }
  70% { transform: rotate(-9deg); }
  76% { transform: rotate(6deg); }
  82% { transform: rotate(-4deg); }
  88% { transform: rotate(2deg); }
}
.alerts-badge {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--red); color: #fff; border: 2px solid #fff;
  font-size: 10px; font-weight: 750; line-height: 1; display: grid; place-items: center;
}
.alerts-badge[hidden] { display: none; }
.alerts-panel {
  position: absolute; right: -6px; top: calc(100% + 16px); width: min(392px, calc(100vw - 24px));
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-6px) scale(.985); pointer-events: none; overflow: hidden;
  transition: opacity .15s, transform .15s; z-index: 60;
}
.topbar-alerts.open .alerts-panel { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.alerts-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px 16px 12px; border-bottom: 1px solid var(--line);
}
.alerts-head h3 { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.alerts-head p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.alerts-head .mark-read {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; border: 0;
  border-radius: 6px; background: transparent; color: var(--brand); font-size: 11.5px; font-weight: 650;
}
.alerts-head .mark-read:hover:not(:disabled) { background: var(--brand-soft); }
.alerts-head .mark-read:disabled { color: var(--muted-2); cursor: default; }
.alerts-list { max-height: min(430px, 60vh); overflow: auto; padding: 6px; }
.alert-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-radius: 10px;
  border: 1px solid transparent; color: inherit; text-decoration: none; position: relative;
  transition: background .12s, border-color .12s;
}
.alert-item:hover { background: var(--surface-2); text-decoration: none; }
.alert-item.unread { background: #f8faff; border-color: #e6e9ff; }
.alert-item.unread:hover { background: #f1f4ff; }
.alert-item .alert-ic { width: 31px; height: 31px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; }
.alert-item.sev-critica .alert-ic { background: var(--red-soft); color: var(--red); }
.alert-item.sev-alta .alert-ic { background: var(--amber-soft); color: var(--amber); }
.alert-item.sev-media .alert-ic { background: var(--blue-soft); color: var(--blue); }
.alert-item.sev-baja .alert-ic { background: var(--slate-soft); color: var(--slate); }
.alert-item.sev-info .alert-ic { background: var(--brand-soft); color: var(--brand); }
.alert-item .alert-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.alert-title {
  display: block; font-size: 12.5px; font-weight: 650; color: var(--ink); line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.alert-msg { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.alert-item.compact .alert-msg {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.alert-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  font-size: 10.5px; color: var(--muted-2); margin-top: 3px;
}
.alert-meta .code-tag { font-size: 9.5px; padding: 1px 5px; }
.alert-meta .badge { font-size: 9.5px; padding: 1px 6px; }
.alert-tag {
  font-size: 9.5px; font-weight: 700; color: var(--brand);
  background: var(--brand-soft); border-radius: 4px; padding: 1px 5px;
}
.alert-item .alert-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); margin-top: 7px; flex: 0 0 auto; }
.alert-item:not(.unread) .alert-dot { visibility: hidden; }
.alerts-empty { padding: 32px 22px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.6; }
.alerts-empty .empty-icon {
  width: 44px; height: 44px; border-radius: 13px; margin: 0 auto 10px;
  background: var(--green-soft); color: var(--green); display: grid; place-items: center;
}
.alerts-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; border-top: 1px solid var(--line); flex-wrap: wrap;
}
.alerts-foot a { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650; }
.alerts-notify { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; justify-content: flex-end; }
.alerts-notify button, .alerts-notify .notif-state {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted);
  font-size: 11px; font-weight: 650;
}
.alerts-notify button:hover { background: var(--slate-soft); color: var(--ink); }
.alerts-notify .notif-toggle.on { color: var(--brand); }
.alerts-notify .notif-state.ok { color: var(--green); }
.alerts-notify .notif-state.muted { color: var(--muted-2); }
.nav-count {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 750; display: grid; place-items: center;
}
.nav-count[hidden] { display: none; }
.nav-link.active .nav-count { background: #fff; color: var(--ink); }

.alert-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; margin-bottom: 17px; }
.alert-stat {
  display: flex; align-items: center; gap: 11px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.alert-stat-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; }
.alert-stat strong { display: block; font-size: 21px; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; }
.alert-stat span:not(.alert-stat-icon) { font-size: 11.5px; color: var(--muted); }
.alert-stat.tone-indigo .alert-stat-icon { background: var(--brand-soft); color: var(--brand); }
.alert-stat.tone-red .alert-stat-icon { background: var(--red-soft); color: var(--red); }
.alert-stat.tone-amber .alert-stat-icon { background: var(--amber-soft); color: var(--amber); }
.alert-stat.tone-blue .alert-stat-icon { background: var(--blue-soft); color: var(--blue); }
.alert-stat.tone-purple .alert-stat-icon { background: var(--purple-soft); color: var(--purple); }

.alert-notify-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 16px; margin-bottom: 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.alert-notify-copy { display: flex; align-items: flex-start; gap: 11px; min-width: 0; }
.alert-notify-ic {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  background: var(--brand-soft); color: var(--brand); display: grid; place-items: center;
}
.alert-notify-copy strong { display: block; font-size: 12.5px; color: var(--ink); }
.alert-notify-copy span { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.45; margin-top: 1px; }
.alert-notify-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.notif-action {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  color: var(--muted); font-size: 11.5px; font-weight: 650;
  transition: border-color .15s, color .15s, background .15s;
}
.notif-action:hover { border-color: #c7d2fe; color: var(--brand); background: var(--brand-soft); }
.notif-action.on { color: var(--brand); border-color: #c7d2fe; background: var(--brand-soft); }
.notif-state { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 650; color: var(--muted); }
.notif-state.ok { color: var(--green); }
.notif-state.muted { color: var(--muted-2); }
.alert-page-list .alert-item { padding: 14px 16px; border-radius: 0; border-bottom: 1px solid var(--line); }
.alert-page-list .alert-item:last-child { border-bottom: 0; }
.alert-page-list .alert-item.lg .alert-title { font-size: 13.5px; }
.alert-page-list .alert-item.lg .alert-msg { font-size: 12.5px; }
.alert-page-list .alert-item .alert-dot { margin-top: 9px; }
.dash-alerts .alert-item { border-radius: 9px; }
.dash-alerts .alert-item { padding: 9px 8px; }
.dash-alerts .alert-item + .alert-item { border-top: 1px solid var(--line); }

/* ---------------- Modo técnico (móvil) ---------------- */
.tech-shell { max-width: 920px; margin: 0 auto; }
.tech-hero {
  background: linear-gradient(135deg, #0b1220, #1e293b 58%, #312e81);
  color: #eef2ff; border-radius: 20px; padding: 20px 22px; box-shadow: var(--shadow);
}
.tech-hero-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.tech-eyebrow {
  display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px;
  font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #a5b4fc;
}
.tech-hero h1 { font-size: 26px; font-weight: 750; margin: 4px 0 2px; letter-spacing: -.02em; color: #fff; }
.tech-hero p { font-size: 12.5px; color: #c7d2fe; }
.tech-hero-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.tech-icon-btn {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08); color: #e0e7ff; display: grid; place-items: center;
  transition: background .15s;
}
.tech-icon-btn:hover { background: rgba(255,255,255,.16); }
.tech-hero-stats { display: flex; gap: 8px; margin-top: 16px; }
.tech-hero-stat {
  flex: 1; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px; padding: 9px 12px;
}
.tech-hero-stat strong { display: block; font-size: 20px; font-weight: 750; color: #fff; line-height: 1.1; }
.tech-hero-stat span { font-size: 10.5px; color: #c7d2fe; }
.tech-hero-stat.alert strong { color: #fca5a5; }
.tech-tabs { display: flex; gap: 6px; margin: 14px 0 16px; }
.tech-tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 8px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--muted); font-size: 12px; font-weight: 650;
  transition: border-color .15s, color .15s, background .15s;
}
.tech-tab:hover { border-color: #c7d2fe; color: var(--brand); }
.tech-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 8px 20px -12px rgba(79,70,229,.8); }
.tech-tab b {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--slate-soft); color: var(--ink-2); font-size: 10px; display: grid; place-items: center;
}
.tech-tab.active b { background: rgba(255,255,255,.22); color: #fff; }
.tech-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.tech-card {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 14px 16px 14px 19px; background: #fff; border: 1px solid var(--line);
  border-radius: 15px; box-shadow: var(--shadow-sm); cursor: pointer; overflow: hidden;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.tech-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--stripe, var(--slate)); }
.tech-card.sev-critica { --stripe: var(--red); }
.tech-card.sev-alta { --stripe: var(--amber-bright); }
.tech-card.sev-media { --stripe: var(--blue); }
.tech-card.sev-baja { --stripe: var(--slate); }
.tech-card:hover { border-color: #c7d2fe; box-shadow: 0 14px 28px -20px rgba(15,23,42,.35); transform: translateY(-1px); }
.tech-card.is-overdue { background: #fffafa; }
.tech-card-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.tech-card h2 { font-size: 14.5px; font-weight: 700; color: var(--ink); line-height: 1.35; margin: 1px 0; }
.tech-sla {
  margin-left: auto; font-size: 10.5px; font-weight: 700; padding: 2px 7px;
  border-radius: 999px; border: 1px solid var(--line); white-space: nowrap;
}
.tech-sla.sla--danger { background: var(--red-soft); color: var(--red); border-color: #fecaca; }
.tech-sla.sla--warn { background: var(--amber-soft); color: #b45309; border-color: #fde68a; }
.tech-sla.sla--ok { background: var(--green-soft); color: #047857; border-color: #d1fae5; }
.tech-sla.sla--muted { background: var(--slate-soft); color: var(--muted); }
.tech-card-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--muted); }
.tech-card-meta span { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.tech-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 2px; padding-top: 9px; border-top: 1px dashed var(--line);
}
.tech-time { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--muted-2); }
.tech-card-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tech-action {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  color: var(--ink-2); font-size: 11.5px; font-weight: 650;
  transition: border-color .15s, color .15s, background .15s;
}
.tech-action:hover { border-color: #c7d2fe; color: var(--brand); background: var(--brand-soft); }
.tech-action.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.tech-action.primary:hover { background: var(--brand-600); color: #fff; }
.tech-muted { font-size: 11px; color: var(--muted-2); }
.tech-empty {
  padding: 44px 20px; text-align: center; color: var(--muted);
  background: #fff; border: 1px dashed var(--line-strong); border-radius: 15px;
}
.tech-empty-icon {
  width: 48px; height: 48px; border-radius: 14px; background: var(--green-soft);
  color: var(--green); display: grid; place-items: center; margin: 0 auto 10px;
}
.tech-empty strong { display: block; color: var(--ink); font-size: 13.5px; }
.tech-empty span:last-child { display: block; font-size: 12px; margin-top: 3px; }
.tech-alert-list { background: #fff; border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.tech-link-more {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  margin-top: 10px; padding: 10px; border-radius: 11px;
  background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 700;
}
.tech-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 18px; padding: 10px 4px; font-size: 10.5px; color: var(--muted-2);
}
.tech-foot button {
  display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent;
  color: var(--brand); font-size: 10.5px; font-weight: 650;
}
.tech-bottom-space { height: 12px; }

.tech-back { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 12px; font-size: 12px; font-weight: 650; color: var(--muted); }
.tech-back:hover { color: var(--brand); }
.tech-detail { max-width: 760px; }
.tech-detail-hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 20px 22px;
  background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.tech-detail-hero::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--stripe, var(--slate)); }
.tech-detail-hero.sev-critica { --stripe: var(--red); }
.tech-detail-hero.sev-alta { --stripe: var(--amber-bright); }
.tech-detail-hero.sev-media { --stripe: var(--blue); }
.tech-detail-hero.sev-baja { --stripe: var(--slate); }
.tech-detail-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tech-detail-hero h1 { font-size: 22px; line-height: 1.25; margin: 8px 0; letter-spacing: -.02em; color: var(--ink); }
.tech-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.tech-detail-sub { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.tech-deadline { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted-2); margin-top: 4px; }
.tech-warning {
  display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; padding: 11px 13px;
  border-radius: 12px; background: var(--red-soft); border: 1px solid #fecaca;
  color: #991b1b; font-size: 12px;
}
.tech-block {
  margin-top: 13px; padding: 16px 18px; background: #fff; border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-sm);
}
.tech-block h2 { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--ink); margin-bottom: 9px; }
.tech-count { font-size: 10px; font-weight: 700; background: var(--slate-soft); color: var(--muted); border-radius: 20px; padding: 1px 6px; }
.tech-description { font-size: 13px; line-height: 1.65; color: var(--ink-2); white-space: pre-line; }
.tech-solution {
  display: flex; gap: 8px; margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  background: var(--green-soft); border: 1px solid #d1fae5; color: #047857; font-size: 12px;
}
.tech-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tech-big-action {
  flex: 1 1 150px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink-2); font-size: 13px; font-weight: 700;
  transition: border-color .15s, color .15s, background .15s;
}
.tech-big-action:hover { border-color: #c7d2fe; background: var(--brand-soft); color: var(--brand); }
.tech-big-action.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.tech-big-action.primary:hover { background: var(--brand-600); color: #fff; }
.tech-closed {
  display: flex; align-items: center; gap: 6px; padding: 11px 13px; border-radius: 10px;
  background: var(--green-soft); color: #047857; font-size: 12px; font-weight: 650;
}
.tech-contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tech-contact {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
  color: var(--ink); min-width: 0;
}
.tech-contact:hover { border-color: #c7d2fe; }
.tech-contact-ic {
  width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft);
  color: var(--brand); display: grid; place-items: center; flex: 0 0 auto;
}
.tech-contact strong { display: block; font-size: 12px; }
.tech-contact small { display: block; font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tech-comment { padding: 10px 0; border-top: 1px solid var(--line); }
.tech-comment:first-child { border-top: 0; padding-top: 0; }
.tech-comment.internal {
  background: var(--amber-soft); border: 1px solid #fde68a; border-radius: 10px;
  padding: 10px 12px; margin: 8px 0;
}
.tech-comment-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 10.5px; color: var(--muted-2); }
.tech-comment-head strong { color: var(--ink-2); font-size: 11.5px; }
.tech-comment-head em {
  font-style: normal; font-size: 9.5px; font-weight: 700; color: #b45309;
  background: #fef3c7; border-radius: 4px; padding: 1px 5px;
}
.tech-comment p { font-size: 12.5px; line-height: 1.6; color: var(--ink-2); margin-top: 4px; white-space: pre-line; }
.tech-comment-form { margin-top: 12px; }
.tech-comment-form textarea {
  width: 100%; min-height: 84px; resize: vertical; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 13px;
}
.tech-comment-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 7px; }
.tech-comment-foot label { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.tech-detail-links { margin-top: 13px; }

@media (max-width: 720px) {
  .tech-shell { max-width: none; }
  .tech-hero { border-radius: 16px; padding: 16px; }
  .tech-hero h1 { font-size: 22px; }
  .tech-hero-stats { gap: 6px; }
  .tech-hero-stat { padding: 8px 10px; }
  .tech-list { grid-template-columns: 1fr; }
  .tech-tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 32; margin: 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.96); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); gap: 4px;
  }
  .tech-tabs .tech-tab {
    position: relative; flex-direction: column; gap: 2px; padding: 6px 4px;
    border: 0; background: transparent; border-radius: 10px; font-size: 10px;
  }
  .tech-tabs .tech-tab.active { background: var(--brand-soft); color: var(--brand); box-shadow: none; }
  .tech-tabs .tech-tab b {
    position: absolute; top: 3px; left: 50%; margin-left: 10px;
    background: var(--red); color: #fff;
  }
  .tech-bottom-space { height: calc(76px + env(safe-area-inset-bottom)); }
  .tech-contact-grid { grid-template-columns: 1fr; }
  .tech-card { padding: 13px 14px 13px 17px; }
  .tech-detail-hero { border-radius: 16px; padding: 16px; }
  .tech-detail-hero h1 { font-size: 19px; }
  .tech-block { padding: 14px; border-radius: 14px; }
  .tech-big-action { flex: 1 1 100%; min-height: 50px; }
}

/* ---------------- Página ---------------- */
.page { padding: 27px 30px 56px; width: 100%; max-width: 1480px; margin: 0 auto; animation: pageIn .25s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 23px; flex-wrap: wrap; }
.page-title-group { min-width: 0; }
.page-eyebrow { display: flex; align-items: center; gap: 7px; font-size: 10.5px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); margin-bottom: 6px; }
.page-header h1 { font-size: 25px; letter-spacing: -.025em; line-height: 1.2; font-weight: 750; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-header .subtitle { margin-top: 6px; color: var(--muted); font-size: 13px; line-height: 1.5; max-width: 720px; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 9px; font-weight: 550; }
.back-link:hover { color: var(--brand); text-decoration: none; }

/* ---------------- Cards / paneles ---------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px 14px; }
.panel-head h2, .panel-head h3 { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.panel-head p { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.panel-head .panel-action { font-size: 12px; font-weight: 650; color: var(--brand); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.panel-head .panel-action:hover { text-decoration: none; color: var(--brand-600); }
.panel-body { padding: 0 20px 20px; }
.panel-body.pad { padding: 20px; }
.panel-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 650; color: var(--muted); }
.panel-link:hover { color: var(--brand); text-decoration: none; }

/* ---------------- KPIs ---------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; margin-bottom: 18px; }
.kpi {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 16px 15px; box-shadow: var(--shadow-sm); overflow: hidden;
  transition: transform .15s, box-shadow .15s, border-color .15s; display: block; color: inherit;
}
a.kpi:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: #d9def0; }
.kpi::after { content: ""; position: absolute; right: -24px; top: -30px; width: 92px; height: 92px; border-radius: 50%; background: var(--kpi-glow, rgba(99, 102, 241, .07)); }
.kpi .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: relative; z-index: 1; }
.kpi .icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--kpi-bg, var(--brand-soft)); color: var(--kpi-fg, var(--brand)); }
.kpi .trend { font-size: 10.5px; font-weight: 700; color: var(--muted-2); display: flex; align-items: center; gap: 4px; }
.kpi .value { font-size: 27px; font-weight: 750; letter-spacing: -.035em; margin-top: 12px; line-height: 1; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.kpi .label { font-size: 11.5px; color: var(--muted); font-weight: 550; margin-top: 5px; position: relative; z-index: 1; }
.kpi .foot { margin-top: 9px; font-size: 11px; display: flex; align-items: center; gap: 5px; position: relative; z-index: 1; }
.kpi .foot.danger { color: var(--red); }
.kpi .foot.ok { color: var(--green); }
.kpi .foot.warn { color: var(--amber); }
.kpi.danger { --kpi-bg: var(--red-soft); --kpi-fg: var(--red); --kpi-glow: rgba(239, 68, 68, .06); }
.kpi.green { --kpi-bg: var(--green-soft); --kpi-fg: var(--green); --kpi-glow: rgba(16, 185, 129, .06); }
.kpi.blue { --kpi-bg: var(--blue-soft); --kpi-fg: var(--blue); --kpi-glow: rgba(59, 130, 246, .06); }
.kpi.amber { --kpi-bg: var(--amber-soft); --kpi-fg: var(--amber-bright); --kpi-glow: rgba(245, 158, 11, .07); }
.kpi.purple { --kpi-bg: var(--purple-soft); --kpi-fg: var(--purple); --kpi-glow: rgba(139, 92, 246, .06); }

/* ---------------- Avisos ---------------- */
.notice-strip { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 18px; }
.notice {
  display: inline-flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: 9px;
  font-size: 12px; font-weight: 600; border: 1px solid; background: #fff;
}
.notice--danger { color: #b91c1c; border-color: #fecaca; background: #fff7f7; }
.notice--warning { color: #92400e; border-color: #fde68a; background: #fffdf5; }
.notice--info { color: #3730a3; border-color: #e0e7ff; background: #fafaff; }
.notice a { color: inherit; margin-left: 2px; text-decoration: underline; text-underline-offset: 2px; }

/* ---------------- Dashboard ---------------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .9fr); gap: 15px; margin-bottom: 15px; }
.dash-grid.equal { grid-template-columns: 1fr 1fr; }
.dash-grid.three { grid-template-columns: 1.1fr 1fr 1fr; }
.donut-wrap { display: flex; align-items: center; gap: 26px; padding: 5px 4px 2px; flex-wrap: wrap; }
.donut {
  --size: 142px; width: var(--size); height: var(--size); border-radius: 50%; position: relative; flex: 0 0 auto;
  background: conic-gradient(#e2e8f0 0 100%);
}
.donut::before {
  content: ""; position: absolute; inset: 17px; border-radius: 50%; background: #fff;
  box-shadow: inset 0 0 0 1px rgba(226, 232, 240, .7);
}
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1; }
.donut-center strong { font-size: 25px; letter-spacing: -.04em; line-height: 1; }
.donut-center span { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); font-weight: 700; margin-top: 4px; }
.legend { display: grid; gap: 9px; flex: 1; min-width: 160px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend-dot { width: 8px; height: 8px; border-radius: 3px; flex: 0 0 auto; }
.legend-row .name { color: var(--muted); flex: 1; }
.legend-row .count { font-weight: 700; font-variant-numeric: tabular-nums; }
.legend-row .pct { font-size: 10.5px; color: var(--muted-2); width: 34px; text-align: right; }
.trend-chart { display: flex; align-items: flex-end; gap: 7px; height: 150px; padding: 8px 2px 0; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; min-width: 0; }
.trend-bar { width: 100%; max-width: 26px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, #818cf8, #4f46e5); min-height: 3px; position: relative; transition: opacity .15s; }
.trend-col:hover .trend-bar { opacity: .8; }
.trend-col.zero .trend-bar { background: #e2e8f0; }
.trend-label { font-size: 9px; color: var(--muted-2); white-space: nowrap; }
.trend-value { font-size: 9.5px; font-weight: 700; color: var(--muted); }
.workload { display: grid; gap: 14px; }
.workload-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.workload-info { min-width: 0; }
.workload-info .name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workload-info .role { font-size: 10.5px; color: var(--muted-2); }
.workload-track { height: 6px; border-radius: 999px; background: var(--slate-soft); overflow: hidden; margin-top: 5px; }
.workload-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6366f1, #0ea5e9); }
.workload-count { font-size: 12px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 20px; text-align: right; }
.list-clean { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { text-decoration: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .sub { font-size: 11px; color: var(--muted-2); margin-top: 2px; display: flex; gap: 6px; align-items: center; white-space: nowrap; overflow: hidden; }
.list-row .sub .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
.priority-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.priority-dot.critica { background: var(--red); box-shadow: 0 0 0 3px rgba(220, 38, 38, .1); }
.priority-dot.alta { background: #f97316; }
.priority-dot.media { background: #eab308; }
.priority-dot.baja { background: #94a3b8; }
.mini-empty { padding: 26px 10px; text-align: center; color: var(--muted-2); font-size: 12px; }
.stock-row { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.stock-row:last-child { border-bottom: 0; }
.stock-row .grow { flex: 1; min-width: 0; }
.stock-row .name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stock-row .ref { font-size: 10.5px; color: var(--muted-2); margin-top: 1px; }
.stock-pill { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.stock-pill.low { background: var(--red-soft); color: var(--red); }
.stock-pill.ok { background: var(--green-soft); color: #047857; }
.contract-mini { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.contract-mini:last-child { border-bottom: 0; }
.contract-mini .days { width: 44px; height: 44px; border-radius: 9px; background: var(--amber-soft); color: var(--amber); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 13px; font-weight: 750; line-height: 1; flex: 0 0 auto; }
.contract-mini .days span { font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.contract-mini .grow { flex: 1; min-width: 0; }
.contract-mini .name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contract-mini .sub { font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }

/* ---------------- Toolbar / filtros ---------------- */
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { position: relative; flex: 1 1 240px; max-width: 360px; }
.toolbar .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.toolbar .search input { padding-left: 35px; height: 37px; font-size: 12.5px; }
.toolbar select { width: auto; min-width: 140px; height: 37px; font-size: 12.5px; padding-top: 0; padding-bottom: 0; }
.toolbar .spacer { flex: 1; }
.toolbar .result-count { font-size: 12px; color: var(--muted-2); white-space: nowrap; }
.chip-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }

/* ---------------- Tablas ---------------- */
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; min-width: 720px; }
/* Las tablas dentro de fichas con columna lateral disponen de menos ancho. */
.detail-grid .table-scroll table.data { min-width: 540px; }
.detail-grid .table-scroll table.data thead th { padding-left: 8px; padding-right: 8px; white-space: normal; }
.detail-grid .table-scroll table.data tbody td { padding: 11px 10px; }
.detail-grid .table-scroll table.data thead th:first-child,
.detail-grid .table-scroll table.data tbody td:first-child { padding-left: 16px; }
.detail-grid .table-scroll table.data thead th:last-child,
.detail-grid .table-scroll table.data tbody td:last-child { padding-right: 16px; }
.detail-grid .table-scroll table.data td.nowrap,
.detail-grid .table-scroll table.data .sla { white-space: normal; }
table.data thead th {
  text-align: left; font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted-2); background: #fbfcfe; padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data thead th:first-child { padding-left: 20px; }
table.data thead th:last-child { padding-right: 20px; text-align: right; }
table.data tbody td { padding: 12px 16px; border-bottom: 1px solid #eef1f7; vertical-align: middle; font-size: 12.8px; color: var(--ink-2); }
table.data tbody td:first-child { padding-left: 20px; }
table.data tbody td:last-child { padding-right: 20px; text-align: right; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; transition: background .12s; }
table.data tbody tr.clickable:hover { background: #fafbff; }
table.data tbody tr.is-overdue { background: #fffafa; }
table.data tbody tr.is-overdue:hover { background: #fff5f5; }
.cell-primary { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--slate-soft); color: var(--slate); display: grid; place-items: center; flex: 0 0 auto; }
.cell-icon.indigo { background: var(--brand-soft); color: var(--brand); }
.cell-icon.green { background: var(--green-soft); color: var(--green); }
.cell-icon.amber { background: var(--amber-soft); color: var(--amber-bright); }
.cell-icon.red { background: var(--red-soft); color: var(--red); }
.cell-icon.blue { background: var(--blue-soft); color: var(--blue); }
.cell-title { font-weight: 650; color: var(--ink); font-size: 12.9px; line-height: 1.3; }
.cell-sub { font-size: 11px; color: var(--muted-2); margin-top: 2px; line-height: 1.4; }
.cell-sub.mono { font-variant-numeric: tabular-nums; }
.cell-stack { display: flex; flex-direction: column; gap: 2px; }
.cell-stack strong { font-weight: 600; color: var(--ink-2); font-size: 12.5px; }
.cell-stack span { font-size: 11px; color: var(--muted-2); }
.user-cell { display: flex; align-items: center; gap: 8px; }
.user-cell .name { font-size: 12.3px; font-weight: 550; white-space: nowrap; }
.user-cell .unassigned { font-size: 11.5px; color: var(--muted-2); font-style: italic; }
.row-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 2px; }
.code-tag { font-size: 11px; font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; white-space: nowrap; }
.sla { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.sla--ok { color: var(--green); }
.sla--warn { color: var(--amber); }
.sla--danger { color: var(--red); }
.sla--muted { color: var(--muted-2); }
.stock-bar { width: 74px; height: 5px; border-radius: 999px; background: #eef2f7; overflow: hidden; margin-top: 4px; }
.stock-bar span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.stock-bar.low span { background: var(--red); }
.stock-num { display: flex; align-items: baseline; gap: 4px; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stock-num small { font-size: 10px; color: var(--muted-2); font-weight: 600; }

/* ---------------- Vacío / carga ---------------- */
.empty { padding: 52px 24px; text-align: center; }
.empty .empty-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--slate-soft); color: var(--muted-2); display: grid; place-items: center; margin: 0 auto 14px; }
.empty h3 { font-size: 14.5px; font-weight: 700; margin-bottom: 5px; }
.empty p { font-size: 12.5px; color: var(--muted); max-width: 380px; margin: 0 auto 16px; line-height: 1.55; }
.skeleton { background: linear-gradient(90deg, #eef1f7 25%, #f6f8fc 37%, #eef1f7 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.loading-block { padding: 40px 20px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #dfe5f0; border-top-color: var(--brand); animation: spin .7s linear infinite; }
.spinner.lg { width: 28px; height: 28px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--muted); font-size: 13px; }
.boot-logo { width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center; color: #fff; font-size: 25px; font-weight: 800; background: linear-gradient(135deg, #6366f1, #0ea5e9); box-shadow: 0 18px 40px -16px rgba(79, 70, 229, .8); }
.error-screen { min-height: 100vh; display: grid; place-items: center; padding: 30px; }
.error-card { max-width: 440px; text-align: center; padding: 34px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.error-card h1 { font-size: 19px; margin-bottom: 8px; }
.error-card p { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 18px; }

/* ---------------- Detalles ---------------- */
.detail-hero {
  position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px 24px; margin-bottom: 15px;
}
.detail-hero::after {
  content: ""; position: absolute; inset: 0 0 auto auto; width: 340px; height: 100%;
  background: radial-gradient(280px 150px at 90% 0%, rgba(99, 102, 241, .08), transparent 70%);
  pointer-events: none;
}
.detail-hero-inner { display: flex; align-items: flex-start; gap: 16px; position: relative; z-index: 1; flex-wrap: wrap; }
.detail-hero .grow { flex: 1; min-width: 260px; }
.detail-hero h1 { font-size: 22px; letter-spacing: -.02em; line-height: 1.3; margin: 6px 0 8px; font-weight: 750; }
.detail-hero .meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-hero .meta-row .sep { color: #cbd5e1; }
.detail-hero .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .8fr); gap: 15px; align-items: start; }
.detail-col { display: flex; flex-direction: column; gap: 15px; min-width: 0; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 20px; }
.info-item { min-width: 0; }
.info-item .k { font-size: 10.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); margin-bottom: 3px; }
.info-item .v { font-size: 12.8px; color: var(--ink-2); line-height: 1.5; word-break: break-word; }
.info-item.wide { grid-column: span 2; }
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 15px; }
.stat-strip .stat { background: #fff; padding: 13px 16px; }
.stat-strip .stat .val { font-size: 19px; font-weight: 750; letter-spacing: -.03em; line-height: 1; }
.stat-strip .stat .lbl { font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.contact-card { display: flex; align-items: flex-start; gap: 12px; padding: 4px 0; }
.contact-card .avatar { border-radius: 12px; }
.contact-card .grow { min-width: 0; }
.contact-card .name { font-size: 13.5px; font-weight: 650; }
.contact-card .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.contact-lines { display: grid; gap: 8px; margin-top: 14px; }
.contact-line { display: flex; align-items: center; gap: 9px; font-size: 12.3px; color: var(--ink-2); min-width: 0; }
.contact-line svg { color: var(--muted-2); flex: 0 0 auto; }
.contact-line span { overflow: hidden; text-overflow: ellipsis; }
.contact-line a { color: var(--ink-2); }
.detail-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.detail-actions-grid .btn { justify-content: flex-start; font-size: 12.2px; }
.notes-box { margin-top: 16px; padding: 11px 13px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; line-height: 1.6; color: var(--muted); white-space: pre-line; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.section-head h2 { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.section-head .count-badge { font-size: 10.5px; font-weight: 700; background: var(--slate-soft); color: var(--muted); border-radius: 20px; padding: 2px 7px; }
.section-body { padding: 0 20px 20px; }
.section-body.pad { padding: 20px; }
.section-foot { padding: 12px 20px; border-top: 1px solid var(--line); background: #fbfcfe; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 20px; overflow-x: auto; }
.tab {
  position: relative; border: 0; background: transparent; padding: 12px 13px 11px;
  font-size: 12.5px; font-weight: 650; color: var(--muted); white-space: nowrap;
}
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--brand); }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand); }
.tab .count { font-size: 10px; margin-left: 3px; color: var(--muted-2); }
/* ---------------- Timeline / comentarios ---------------- */
.comment-list { display: flex; flex-direction: column; gap: 16px; }
.comment { display: flex; gap: 10px; }
.comment .body { flex: 1; min-width: 0; }
.comment .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.comment .head strong { font-size: 12.3px; font-weight: 650; }
.comment .head .time { font-size: 10.5px; color: var(--muted-2); }
.comment .head .internal { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--amber-soft); color: #b45309; padding: 1px 6px; border-radius: 4px; }
.comment .text { font-size: 12.7px; line-height: 1.6; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 3px 10px 10px 10px; padding: 9px 12px; white-space: pre-line; }
.comment-form { display: flex; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--line); }
.comment-form .grow { flex: 1; min-width: 0; }
.comment-form textarea { min-height: 70px; font-size: 12.5px; }
.comment-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.check-inline input { width: 14px; height: 14px; accent-color: var(--brand); }
.timeline { position: relative; padding-left: 18px; display: flex; flex-direction: column; gap: 15px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 5px; bottom: 5px; width: 1px; background: var(--line); }
.timeline-item { position: relative; font-size: 11.8px; color: var(--muted); line-height: 1.5; }
.timeline-item::before { content: ""; position: absolute; left: -18px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 2px solid #cbd5e1; }
.timeline-item.strong::before { border-color: var(--brand); background: var(--brand-soft); }
.timeline-item .what { color: var(--ink-2); }
.timeline-item .what strong { font-weight: 650; }
.timeline-item .when { font-size: 10px; color: var(--muted-2); margin-top: 1px; }
.parts-table { width: 100%; border-collapse: collapse; }
.parts-table td { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12.3px; vertical-align: middle; }
.parts-table tr:last-child td { border-bottom: 0; }
.parts-table .part-name { font-weight: 600; color: var(--ink-2); }
.parts-table .part-ref { font-size: 10.5px; color: var(--muted-2); margin-top: 1px; }
.parts-table .qty { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.parts-table .price { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.parts-total { display: flex; justify-content: space-between; padding: 12px 0 0; margin-top: 6px; border-top: 1px solid var(--line); font-size: 12.5px; font-weight: 700; }
.parts-total span:last-child { font-variant-numeric: tabular-nums; }
.quick-select { display: grid; gap: 5px; }
.quick-select label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-2); }
.quick-select select { height: 36px; font-size: 12.5px; }
.kv-list { display: grid; gap: 11px; }
.kv { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; font-size: 12.3px; }
.kv .k { color: var(--muted-2); }
.kv .v { color: var(--ink-2); text-align: right; font-weight: 550; }
.phase-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.phase-actions .btn { font-size: 12px; height: 34px; }
.phase-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted-2); }
.alert-box { display: flex; gap: 10px; padding: 11px 12px; border-radius: 9px; font-size: 12px; line-height: 1.5; }
.alert-box svg { flex: 0 0 auto; margin-top: 1px; }
.alert-box--danger { background: var(--red-soft); border: 1px solid #fecaca; color: #991b1b; }
.alert-box--warning { background: var(--amber-soft); border: 1px solid #fde68a; color: #92400e; }

/* ---------------- Modales ---------------- */
#modal-root { position: relative; z-index: 100; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8, 15, 30, .52); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 18px 30px;
  overflow-y: auto; z-index: 100; animation: fadeIn .16s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 620px; background: #fff; border-radius: 16px;
  box-shadow: 0 40px 90px -30px rgba(2, 8, 23, .5); border: 1px solid rgba(255, 255, 255, .5);
  animation: modalIn .2s cubic-bezier(.2, .8, .2, 1); margin: auto;
}
.modal.wide { max-width: 860px; }
.modal.narrow { max-width: 440px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; gap: 16px; padding: 20px 22px 15px; border-bottom: 1px solid var(--line); }
.modal-head .grow { flex: 1; min-width: 0; }
.modal-head h2 { font-size: 17px; font-weight: 750; letter-spacing: -.015em; }
.modal-head p { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.modal-form { display: flex; flex-direction: column; }
.modal-body { padding: 20px 22px 22px; max-height: 66vh; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fbfcfe; border-radius: 0 0 16px 16px; }
.modal-foot .left { margin-right: auto; }
.modal-close { margin: -3px -5px 0 0; }
.modal-confirm-text { font-size: 13px; color: var(--muted); line-height: 1.65; padding: 4px 2px 8px; }
.modal-confirm-text strong { color: var(--ink); }

/* ---------------- Toasts ---------------- */
.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 9px; width: min(370px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: 11px; align-items: flex-start;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 13px; box-shadow: 0 20px 40px -18px rgba(15, 23, 42, .35);
  animation: toastIn .22s cubic-bezier(.2, .8, .2, 1); position: relative; overflow: hidden;
}
.toast.out { animation: toastOut .2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(16px); } }
.toast .t-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto; }
.toast.success .t-icon { background: var(--green-soft); color: var(--green); }
.toast.error .t-icon { background: var(--red-soft); color: var(--red); }
.toast.info .t-icon { background: var(--blue-soft); color: var(--blue); }
.toast.warning .t-icon { background: var(--amber-soft); color: var(--amber-bright); }
.toast .grow { flex: 1; min-width: 0; }
.toast .t-title { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.toast .t-msg { font-size: 11.8px; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.toast .t-close { color: var(--muted-2); width: 22px; height: 22px; border-radius: 5px; border: 0; background: transparent; display: grid; place-items: center; }
.toast .t-close:hover { background: var(--slate-soft); color: var(--ink); }
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--toast-line, var(--brand)); transform-origin: left; animation: toastTimer var(--toast-life, 4.5s) linear forwards; }
.toast.success { --toast-line: var(--green); }
.toast.error { --toast-line: var(--red); }
.toast.info { --toast-line: var(--blue); }
.toast.warning { --toast-line: var(--amber-bright); }
@keyframes toastTimer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------------- Responsive ---------------- */
@media (max-width: 1250px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: minmax(0, 1.3fr) minmax(300px, .9fr); }
  .dash-grid.three { grid-template-columns: 1fr 1fr; }
  .dash-grid.three > :last-child { grid-column: span 2; }
}
@media (max-width: 1080px) {
  .dash-grid, .dash-grid.equal, .dash-grid.three { grid-template-columns: 1fr; }
  .dash-grid.three > :last-child { grid-column: auto; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; }
  .login-card .mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 34px; font-weight: 750; }
  .login-card .mobile-brand .mark { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #6366f1, #0ea5e9); }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 280px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; height: 100vh; width: var(--sidebar-w); transform: translateX(-102%); transition: transform .22s ease; box-shadow: 20px 0 60px -30px rgba(0, 0, 0, .6); }
  .sidebar.open { transform: none; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(8, 15, 30, .45); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .mobile-menu { display: inline-flex; }
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar-search { display: none; }
  .topbar-date { display: none; }
  .page { padding: 20px 16px 42px; }
  .page-header h1 { font-size: 22px; }
  .detail-hero { padding: 18px; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .alert-stats { grid-template-columns: 1fr 1fr; }
  .alert-notify-bar { flex-direction: column; align-items: stretch; }
  .alert-notify-actions { justify-content: flex-start; }
  .alerts-panel { position: fixed; left: 12px; right: 12px; top: 78px; width: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: auto; }
  .info-grid { grid-template-columns: 1fr; }
  .info-item.wide { grid-column: auto; }
  .toolbar .search { max-width: none; }
  .toolbar select { min-width: 0; flex: 1 1 130px; }
  .topbar-user .name { display: none; }
  .user-chip { padding: 3px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; max-width: none; max-height: 94vh; display: flex; flex-direction: column; }
  .modal-body { max-height: none; flex: 1; overflow-y: auto; }
  .modal-foot { border-radius: 0; }
  .detail-actions-grid { grid-template-columns: 1fr; }
  .donut-wrap { gap: 18px; }
  .stat-strip .stat { padding: 11px 13px; }
  .login-panel { padding: 32px 20px; }
  .demo-accounts { grid-template-columns: 1fr; }
  .toast-root { right: 12px; bottom: 12px; }
  .tech-mode .toast-root { bottom: calc(86px + env(safe-area-inset-bottom)); }
  .modal-head, .modal-body { padding-left: 18px; padding-right: 18px; }
  .modal-foot { padding-left: 18px; padding-right: 18px; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .alert-stats { grid-template-columns: 1fr 1fr; }
  .alerts-panel { top: 70px; }
  .alert-page-list .alert-item { padding: 12px; }
  .crumbs { display: none; }
  .page-header h1 { font-size: 20px; }
  .topbar { height: 62px; }
}
