/* =========================================================
   DM CONTROL IT — Identidad visual
   Azul corporativo · Rojo DM Control · Blanco · Gris oscuro
   ========================================================= */
:root {
  --dm-blue: #0b3a82; --dm-blue-2: #1557c0; --dm-blue-soft: #e8effb;
  --dm-red: #d7192a; --dm-red-soft: #fde8ea;
  --dm-ink: #1e2530; --dm-ink-2: #3a4556; --dm-muted: #6b7686;
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #f8f9fc; --line: #e3e7ee; --text: #1e2530;
  --sidebar: #0e1a2e; --sidebar-2: #13223b; --sidebar-text: #b7c3d6;
  --ok: #16a34a; --warn: #d97706; --crit: #dc2626;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
}
[data-bs-theme="dark"] {
  --bg: #0d1219; --surface: #151c26; --surface-2: #1a2330; --line: #263142; --text: #e6ebf2;
  --dm-blue-soft: #14284a; --dm-red-soft: #3a1418; --dm-muted: #8b97a8;
  --sidebar: #0a0f16; --sidebar-2: #111925;
  --bs-body-bg: #0d1219; --bs-body-color: #e6ebf2; --bs-border-color: #263142;
}
html, body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14.5px; }
a { color: var(--dm-blue-2); }
[data-bs-theme="dark"] a { color: #6ea4ff; }
code, .mono, .folio { font-family: var(--mono); }

/* ---------- Shell ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 252px; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; z-index: 1040; transition: transform .2s; border-right: 1px solid rgba(255,255,255,.04); }
.sidebar .brand { display: flex; gap: 10px; align-items: center; padding: 18px 18px 16px; text-decoration: none; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar .brand img { width: 36px; height: 36px; }
.sidebar .brand strong { display: block; letter-spacing: .12em; font-size: 13px; }
.sidebar .brand span { font-size: 11.5px; color: #8fa1bd; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 8px 10px 16px; }
.sidebar .nav-sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; color: #5f7290; padding: 16px 10px 6px; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 7px; color: var(--sidebar-text);
  text-decoration: none; font-weight: 500; margin-bottom: 1px; position: relative; }
.sidebar nav a i { font-size: 16px; opacity: .85; width: 18px; text-align: center; }
.sidebar nav a:hover { background: var(--sidebar-2); color: #fff; }
.sidebar nav a.active { background: linear-gradient(90deg, rgba(21,87,192,.35), rgba(21,87,192,.08)); color: #fff; }
.sidebar nav a.active::before { content: ''; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--dm-red); }
.sidebar-foot { padding: 12px 18px; font-size: 11px; color: #5f7290; border-top: 1px solid rgba(255,255,255,.06); }
.shell { margin-left: 252px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 22px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1030; }
.global-search { flex: 1; max-width: 560px; position: relative; }
.global-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--dm-muted); }
.global-search input { width: 100%; height: 38px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px;
  padding: 0 44px 0 36px; color: var(--text); outline: none; }
.global-search input:focus { border-color: var(--dm-blue-2); box-shadow: 0 0 0 3px rgba(21,87,192,.15); }
.global-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 11px; background: var(--surface); color: var(--dm-muted); border: 1px solid var(--line); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.btn-icon { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 8px; border: 0; background: transparent; color: var(--dm-ink-2); font-size: 18px; }
[data-bs-theme="dark"] .btn-icon { color: #c4cfdd; }
.btn-icon:hover { background: var(--surface-2); }
.notif-dot { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--dm-red);
  color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.notif-panel { width: 380px; max-width: 92vw; overflow: hidden; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--dm-blue-soft); }
.notif-item .ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--surface-2); }
.notif-item.lvl-critica .ico { background: var(--dm-red-soft); color: var(--crit); }
.notif-item.lvl-advertencia .ico { color: var(--warn); }
.notif-item.lvl-exito .ico { color: var(--ok); }
.notif-item .t { font-weight: 600; font-size: 13px; } .notif-item .m { font-size: 12.5px; color: var(--dm-muted); } .notif-item .w { font-size: 11px; color: var(--dm-muted); }
.notif-foot { display: block; text-align: center; padding: 9px; font-size: 13px; text-decoration: none; }
.user-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 20px; padding: 3px 10px 3px 3px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--dm-blue); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.content { padding: 24px 26px 48px; flex: 1; }
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); } .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .shell { margin-left: 0; } .content { padding: 16px; } .global-search kbd { display: none; }
}

/* ---------- Componentes ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--dm-muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 18px; } .panel-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--dm-muted); margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.btn-primary { --bs-btn-bg: var(--dm-blue); --bs-btn-border-color: var(--dm-blue); --bs-btn-hover-bg: var(--dm-blue-2); --bs-btn-hover-border-color: var(--dm-blue-2); --bs-btn-active-bg: #092e68; }
.btn-danger { --bs-btn-bg: var(--dm-red); --bs-btn-border-color: var(--dm-red); }
.btn-remote { background: var(--dm-red); color: #fff; font-weight: 600; letter-spacing: .02em; border: 0; }
.btn-remote:hover { background: #b51322; color: #fff; }
.form-control, .form-select { border-color: var(--line); }
.form-label { font-weight: 500; font-size: 13px; color: var(--dm-ink-2); }
[data-bs-theme="dark"] .form-label { color: #b6c2d2; }
.table { --bs-table-bg: transparent; margin: 0; }
.table thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--dm-muted); font-weight: 600; border-bottom-width: 1px; white-space: nowrap; }
.table td { vertical-align: middle; }
.table-hover tbody tr { cursor: pointer; }
.folio { font-weight: 600; color: var(--dm-blue-2); font-size: 13px; white-space: nowrap; }
[data-bs-theme="dark"] .folio { color: #6ea4ff; }

.badge-status { --c: #64748b; display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 8px; border-radius: 20px; font-size: 12px; font-weight: 600;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); white-space: nowrap; }
.badge-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.badge-prio { display: inline-block; padding: 2px 8px; border-radius: 5px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.prio-critica { background: var(--crit); color: #fff; animation: pulse 2s infinite; }
.prio-alta { background: #fff1e6; color: #c2410c; } .prio-media { background: #e8effb; color: #1d4ed8; } .prio-baja { background: #eef1f5; color: #475569; }
[data-bs-theme="dark"] .prio-alta { background: #3a2210; color: #fdba74; } [data-bs-theme="dark"] .prio-media { background: #14284a; color: #93c5fd; } [data-bs-theme="dark"] .prio-baja { background: #1f2937; color: #cbd5e1; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.45); } 50% { box-shadow: 0 0 0 5px rgba(220,38,38,0); } }
.sla { font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--dm-muted); }
.sla-ok { color: var(--ok); } .sla-riesgo { color: var(--warn); } .sla-vencido { color: var(--crit); } .sla-pausado { color: var(--dm-muted); }
.row-critical { box-shadow: inset 3px 0 0 var(--crit); }

.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.kpi .lbl { font-size: 12px; color: var(--dm-muted); font-weight: 500; }
.kpi .val { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--dm-muted); }
.kpi i.bg-ico { position: absolute; right: 12px; top: 12px; font-size: 22px; opacity: .25; }
.kpi.crit .val { color: var(--crit); } .kpi.warn .val { color: var(--warn); } .kpi.ok .val { color: var(--ok); }
.chart-box { position: relative; height: 260px; }

.empty-state { text-align: center; padding: 56px 20px; color: var(--dm-muted); }
.empty-state i { font-size: 42px; display: block; margin-bottom: 8px; opacity: .6; }

/* Major incident banner */
.major-banner { background: linear-gradient(90deg, var(--crit), #9f1239); color: #fff; border-radius: var(--radius); padding: 12px 16px; display: flex; gap: 12px; align-items: center; margin-bottom: 16px; font-weight: 500; }
.major-banner a { color: #fff; text-decoration: underline; }

/* ---------- Ticket ---------- */
.ticket-head { padding: 18px 20px; }
.ticket-head .folio { font-size: 14px; }
.ticket-head h2 { font-size: 20px; font-weight: 700; margin: 4px 0 10px; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.meta-grid > div { padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.meta-grid > div:nth-child(odd) { color: var(--dm-muted); }
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; margin-bottom: 14px; }
.tl-item .dot { position: absolute; left: -26px; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); display: grid; place-items: center; font-size: 10px; color: var(--dm-muted); }
.tl-item .when { font-family: var(--mono); font-size: 11.5px; color: var(--dm-muted); }
.tl-item .who { font-weight: 600; font-size: 13px; }
.tl-sistema .txt, .tl-accion .txt { font-size: 13px; color: var(--dm-ink-2); }
[data-bs-theme="dark"] .tl-sistema .txt, [data-bs-theme="dark"] .tl-accion .txt { color: #b6c2d2; }
.tl-publico .bubble { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 4px; white-space: pre-wrap; word-wrap: break-word; }
.tl-publico .dot { border-color: var(--dm-blue-2); color: var(--dm-blue-2); }
.tl-interno .bubble { background: #fff8e6; border: 1px solid #f5d98b; border-radius: 10px; padding: 10px 12px; margin-top: 4px; white-space: pre-wrap; }
[data-bs-theme="dark"] .tl-interno .bubble { background: #2b2410; border-color: #5c4a14; }
.tl-interno .dot { border-color: var(--warn); color: var(--warn); }
.tl-remoto .dot { border-color: var(--dm-red); color: var(--dm-red); background: var(--dm-red-soft); }
.tl-remoto .txt { font-weight: 500; }
.tl-evidencia .dot { border-color: var(--ok); color: var(--ok); }
.tag-int { font-size: 10.5px; background: #f5d98b; color: #6b4e00; padding: 1px 6px; border-radius: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.att { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 7px; margin: 6px 6px 0 0; font-size: 12.5px; text-decoration: none; background: var(--surface); }
.att img { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; }
.composer { border-top: 1px solid var(--line); padding: 14px 16px; }
.composer .nav-pills .nav-link { padding: 4px 12px; font-size: 13px; }
.composer .nav-pills .nav-link.active.interno { background: var(--warn); }
.remote-card { border: 1px solid var(--dm-red); border-radius: var(--radius); background: linear-gradient(180deg, var(--dm-red-soft), var(--surface) 60%); padding: 16px; }
.dev-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.dev-status::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: #94a3b8; }
.dev-status.on::before { background: var(--ok); box-shadow: 0 0 0 3px rgba(22,163,74,.2); }
.dev-status.on { color: var(--ok); } .dev-status.off { color: var(--dm-muted); }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(6, minmax(250px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.kcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 200px); }
.kcol-head { padding: 11px 13px; display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--line); }
.kcol-head .count { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; font-size: 12px; }
.kcol-body { padding: 10px; overflow-y: auto; min-height: 120px; flex: 1; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; margin-bottom: 9px; cursor: grab; box-shadow: var(--shadow); }
.kcard:active { cursor: grabbing; }
.kcard.crit { border-left: 3px solid var(--crit); }
.kcard .ttl { font-weight: 600; font-size: 13px; margin: 4px 0 6px; line-height: 1.35; }
.kcard .foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--dm-muted); gap: 6px; }
.kcard.sortable-ghost { opacity: .35; } .kcard.sortable-drag { transform: rotate(1.5deg); }
.kcard .owner { width: 22px; height: 22px; border-radius: 50%; background: var(--dm-blue); color: #fff; font-size: 10.5px; display: grid; place-items: center; font-weight: 600; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: radial-gradient(circle at 20% 20%, #1557c0 0, transparent 45%), radial-gradient(circle at 85% 80%, rgba(215,25,42,.55) 0, transparent 40%), #0b1730;
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::after { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 34px 34px; pointer-events: none; }
.login-art h1 { font-size: 40px; font-weight: 700; letter-spacing: -.02em; max-width: 520px; }
.login-art h1 span { color: #ff5a67; }
.login-art .feat { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: #c6d3ea; position: relative; z-index: 1; }
.login-art .feat div { display: flex; gap: 8px; align-items: center; }
.login-form { display: grid; place-items: center; padding: 32px; background: var(--surface); }
.login-form form { width: 100%; max-width: 380px; }
@media (max-width: 900px) { .login-wrap { grid-template-columns: 1fr; } .login-art { display: none; } }

/* ---------- KB & misc ---------- */
.kb-card { padding: 16px; height: 100%; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.kb-card:hover { border-color: var(--dm-blue-2); transform: translateY(-1px); }
.kb-body h4, .kb-body h5 { margin-top: 18px; font-weight: 600; }
.md-step { display: flex; gap: 10px; margin: 6px 0; } .md-step span { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--dm-blue); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.md-li::before { content: '•'; color: var(--dm-red); margin-right: 8px; font-weight: 700; }
.cat-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cat-pick label { border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; background: var(--surface); font-size: 13px; font-weight: 500; transition: all .12s; }
.cat-pick label i { font-size: 20px; color: var(--dm-blue-2); }
.cat-pick input { display: none; }
.cat-pick input:checked + label { border-color: var(--dm-blue-2); box-shadow: 0 0 0 3px rgba(21,87,192,.15); background: var(--dm-blue-soft); }
.suggest-box { border: 1px solid var(--line); border-left: 3px solid var(--ok); border-radius: 8px; padding: 12px 14px; background: var(--surface-2); }
.stars { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.stars input { display: none; } .stars label { font-size: 28px; color: #cbd5e1; cursor: pointer; }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: #f59e0b; }
.mono-out { font-family: var(--mono); font-size: 12px; background: #0b1220; color: #d6e2f0; padding: 12px; border-radius: 8px; max-height: 420px; overflow: auto; white-space: pre; }
.dataTables_wrapper .dt-search input, .dt-search input { border: 1px solid var(--line); border-radius: 7px; }
.select2-container--bootstrap-5 .select2-selection { border-color: var(--line); }
.swal2-popup { font-family: var(--font); }
