/* NODO Soporte - UI v2 (diseño según design-ui: paleta NODO, grid 8 px, 1 primario por pantalla) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --primary: #2c64a8; --primary-hover: #3b76bf; --primary-active: #1a3a6c; --primary-soft: #e8f0fa; --primary-ring: rgba(44,100,168,.22);
  --navy: #14325f; --navy-2: #1d4a86;
  --accent: #ffe79a;
  --text: #1b2330; --muted: #5b6676; --muted-2: #8591a3;
  --border: #d9dfe8; --border-strong: #b9c3d1;
  --bg: #f3f5f9; --panel: #e9edf3; --canvas: #ffffff;
  --ok: #1f8a4c; --warn: #c7870a; --danger: #c22c2c; --purple: #6a3fb5;
  --ok-bg: #e4f5ea; --warn-bg: #fff3d6; --danger-bg: #fde7e7; --info-bg: #e8f0fa; --purple-bg: #efe8fb;
  --radius: 10px; --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow: 0 4px 14px rgba(16,24,40,.08);
  --shadow-lg: 0 16px 40px rgba(16,24,40,.18);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 14px/1.5 Inter, "Segoe UI", system-ui, sans-serif; color: var(--text); background: var(--bg); min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: "JetBrains Mono", Consolas, monospace; }
pre { background: #0f172a; color: #e2e8f0; border-radius: var(--radius-sm); padding: 12px 14px; overflow: auto; font-size: 12.5px; line-height: 1.55; }
code { background: var(--panel); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
pre code { background: none; padding: 0; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; color: var(--text); }
h2 { font-size: 15px; }
h3 { font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.muted { color: var(--muted-2); }
.small { font-size: 12px; }
.hidden { display: none !important; }
::selection { background: var(--accent); }

/* ---------- Topbar ---------- */
.topbar { height: 60px; background: linear-gradient(90deg, var(--navy) 0%, var(--navy-2) 60%, #2c64a8 100%); color: #fff; display: flex; align-items: center; padding: 0 24px; gap: 20px; position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 12px rgba(20,50,95,.25); }
.topbar .brand { font-weight: 700; font-size: 16px; color: #fff; display: flex; align-items: center; gap: 10px; letter-spacing: -.01em; }
.topbar .brand:hover { text-decoration: none; }
.topbar .brand::before { content: ''; width: 28px; height: 28px; border-radius: 8px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232c64a8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2 3 7v10l9 5 9-5V7z'/%3E%3Cpath d='M12 22V12M3 7l9 5 9-5'/%3E%3C/svg%3E") center/18px no-repeat; box-shadow: inset 0 0 0 1px rgba(44,100,168,.15); }
.topbar .brand small { font-weight: 500; opacity: .75; font-size: 12px; margin-left: 2px; }
.topbar nav { display: flex; gap: 2px; margin-left: 8px; }
.topbar nav a { color: rgba(255,255,255,.82); padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: 13.5px; }
.topbar nav a:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.topbar nav a.active { background: rgba(255,255,255,.18); color: #fff; }
.topbar .spacer { flex: 1; }
.topbar .user { font-size: 13px; display: flex; align-items: center; gap: 10px; }
.topbar .user .company { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22); padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.topbar button.link { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.28); color: #fff; padding: 6px 12px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 500; }
.topbar button.link:hover { background: rgba(255,255,255,.2); }
.topbar #pwBtn { background: none; border: none; font-weight: 600; padding: 6px 4px; }
.topbar #pwBtn::before { content: ''; display: inline-block; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); vertical-align: middle; margin-right: 8px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.5); }
.topbar select { height: 34px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.12); color: #fff; border-radius: 8px; padding: 0 10px; font: inherit; font-size: 13px; font-weight: 500; }
.topbar select option { color: var(--text); }

.page { max-width: 1200px; margin: 0 auto; padding: 28px 24px 48px; }
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.page-head .spacer { flex: 1; }

/* ---------- Cards / KPIs ---------- */
.card { background: var(--canvas); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 16px; }
.card h2 { margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi { position: relative; background: var(--canvas); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px 14px; cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s; overflow: hidden; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary); }
.kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.kpi .label { font-size: 11px; text-transform: uppercase; color: var(--muted-2); letter-spacing: .08em; font-weight: 600; }
.kpi .value { font: 600 30px/1.15 Inter, sans-serif; margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi.warn::before { background: var(--warn); }
.kpi.ok::before { background: var(--ok); }
.kpi.info::before { background: var(--primary); }
.kpi.active { box-shadow: 0 0 0 3px var(--primary-ring); border-color: var(--primary); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 11.5px; text-transform: uppercase; color: var(--muted); letter-spacing: .06em; font-weight: 600; margin-bottom: 6px; }
.field label .req { color: var(--danger); }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=datetime-local], .field select, .field textarea {
  width: 100%; height: 40px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 12px; font: inherit; background: var(--canvas); color: var(--text); transition: border-color .12s, box-shadow .12s;
}
.field select { appearance: none; background: var(--canvas) 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='%235b6676' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 12px center no-repeat; padding-right: 32px; }
.field textarea { height: auto; min-height: 104px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: #a3adbd; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.field .hint { font-size: 12px; color: var(--muted-2); margin-top: 6px; }
.field .error { font-size: 12px; color: var(--danger); margin-top: 6px; font-weight: 500; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(194,44,44,.15); }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-row label { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 9px 14px; cursor: pointer; font-size: 13.5px; text-transform: none; letter-spacing: 0; color: var(--text); margin: 0; background: var(--canvas); font-weight: 500; transition: all .12s; }
.radio-row label:hover { border-color: var(--primary); }
.radio-row label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary) inset; }
.radio-row label small { color: var(--muted-2); font-weight: 400; }
.radio-row input { accent-color: var(--primary); }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px 18px; margin-top: 20px; background: #fafbfd; }
.fieldset legend { font-size: 11.5px; font-weight: 600; color: var(--primary); padding: 0 8px; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Buttons ---------- */
.btn { height: 40px; padding: 0 18px; border-radius: var(--radius-sm); border: 1px solid var(--primary); background: linear-gradient(180deg, #3570b8, var(--primary)); color: #fff; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 1px 2px rgba(26,58,108,.25), inset 0 1px 0 rgba(255,255,255,.15); transition: all .12s; white-space: nowrap; }
.btn:hover { background: linear-gradient(180deg, #4381c9, var(--primary-hover)); box-shadow: 0 3px 8px rgba(26,58,108,.3); text-decoration: none; }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.secondary { background: var(--canvas); color: var(--primary); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { background: var(--primary-soft); border-color: var(--primary); }
.btn.ghost { background: none; border-color: transparent; color: var(--primary); font-weight: 500; box-shadow: none; }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.danger { background: var(--canvas); color: var(--danger); border-color: #e7b3b3; box-shadow: none; }
.btn.danger:hover { background: var(--danger-bg); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; align-items: center; }
.actions .left { margin-right: auto; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { text-align: left; background: #f6f8fb; border-bottom: 1px solid var(--border); border-top: 1px solid var(--border); padding: 10px 12px; font-size: 11px; text-transform: uppercase; color: var(--muted-2); letter-spacing: .08em; font-weight: 600; white-space: nowrap; }
.table th:first-child { border-left: 1px solid var(--border); border-radius: var(--radius-sm) 0 0 0; }
.table th:last-child { border-right: 1px solid var(--border); border-radius: 0 var(--radius-sm) 0 0; }
.table td { padding: 12px; border-bottom: 1px solid #edf0f4; vertical-align: middle; }
.table td:first-child { border-left: 1px solid var(--border); }
.table td:last-child { border-right: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 1px solid var(--border); }
.table tr:last-child td:first-child { border-radius: 0 0 0 var(--radius-sm); }
.table tr:last-child td:last-child { border-radius: 0 0 var(--radius-sm) 0; }
.table tr.row { cursor: pointer; transition: background .1s; }
.table tr.row:hover td { background: #f6f9fe; }
.table .num { text-align: right; font-family: "JetBrains Mono", monospace; font-variant-numeric: tabular-nums; }
.table .mono { font-family: "JetBrains Mono", monospace; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.table .nowrap { white-space: nowrap; }
.empty { padding: 40px; text-align: center; color: var(--muted-2); }
.empty::before { content: ''; display: block; width: 48px; height: 48px; margin: 0 auto 10px; border-radius: 50%; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238591a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h7'/%3E%3Cpath d='m3 7 9 6 9-6'/%3E%3C/svg%3E") center/22px no-repeat; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .field { min-width: 150px; }
.filters .field.grow { flex: 1; min-width: 220px; }
.filters .field input, .filters .field select { height: 36px; }
.filters .btn { height: 36px; }

/* ---------- Chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 16px; white-space: nowrap; border: 1px solid transparent; }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.chip.type::before, .chip.company::before { display: none; }
.chip.sev-blocker { background: var(--danger-bg); color: var(--danger); }
.chip.sev-major { background: var(--warn-bg); color: #8a5a00; }
.chip.sev-minor { background: var(--panel); color: var(--muted); }
.chip.st-new { background: var(--info-bg); color: var(--primary); }
.chip.st-analysis, .chip.st-bug_confirmed, .chip.st-qa, .chip.st-ready_for_release { background: var(--purple-bg); color: var(--purple); }
.chip.st-info_requested { background: var(--warn-bg); color: #8a5a00; border-color: #efd28a; }
.chip.st-resolved_by_user, .chip.st-closed { background: var(--ok-bg); color: var(--ok); }
.chip.type { background: var(--panel); color: var(--muted); font-weight: 500; }
.chip.company { background: #fff; color: var(--text); font-weight: 500; border-color: var(--border-strong); }
.chip.sla-ok { background: var(--ok-bg); color: var(--ok); }
.chip.sla-breached { background: var(--danger-bg); color: var(--danger); }
.chip.sla-paused { background: var(--panel); color: var(--muted); }

/* ---------- Alerts ---------- */
.alert { padding: 12px 14px 12px 42px; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 14px; font-size: 13.5px; position: relative; }
.alert::before { content: ''; position: absolute; left: 14px; top: 13px; width: 18px; height: 18px; border-radius: 50%; background: currentColor; opacity: .18; }
.alert::after { content: ''; position: absolute; left: 20px; top: 17px; width: 6px; height: 10px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); opacity: .9; }
.alert.danger { background: var(--danger-bg); border-color: #efb8b8; color: #8f1d1d; }
.alert.danger::after { border: none; width: 2px; height: 10px; background: currentColor; left: 22px; top: 15px; transform: none; border-radius: 1px; }
.alert.warn { background: var(--warn-bg); border-color: #efd28a; color: #7a4f00; }
.alert.warn::after { border: none; width: 2px; height: 10px; background: currentColor; left: 22px; top: 15px; transform: none; border-radius: 1px; }
.alert.ok { background: var(--ok-bg); border-color: #b4e2c4; color: #155f35; }
.alert.info { background: var(--info-bg); border-color: #bcd1ec; color: var(--primary-active); }
.alert.info::after { border: none; width: 2px; height: 10px; background: currentColor; left: 22px; top: 15px; transform: none; border-radius: 1px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-brand { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 55%, #2c64a8 100%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.login-brand::before { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle, rgba(255,231,154,.22), transparent 65%); top: -160px; right: -160px; }
.login-brand::after { content: ''; position: absolute; width: 400px; height: 400px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.12), transparent 65%); bottom: -180px; left: -120px; }
.login-brand .logo { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 20px; margin-bottom: 40px; position: relative; }
.login-brand .logo::before { content: ''; width: 40px; height: 40px; border-radius: 12px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232c64a8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2 3 7v10l9 5 9-5V7z'/%3E%3Cpath d='M12 22V12M3 7l9 5 9-5'/%3E%3C/svg%3E") center/24px no-repeat; }
.login-brand h2 { font-size: 34px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; margin-bottom: 16px; position: relative; max-width: 480px; }
.login-brand p { font-size: 15px; line-height: 1.6; opacity: .85; max-width: 460px; margin: 0 0 32px; position: relative; }
.login-brand ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; position: relative; }
.login-brand li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; opacity: .92; }
.login-brand li::before { content: ''; flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2314325f' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 13 4 4L19 7'/%3E%3C/svg%3E") center/12px no-repeat; margin-top: 1px; }
.login-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.login { width: 420px; background: var(--canvas); border: 1px solid var(--border); border-radius: 16px; padding: 40px; box-shadow: var(--shadow-lg); }
.login h1 { font-size: 24px; margin-bottom: 6px; }
.login .sub { color: var(--muted-2); font-size: 13.5px; margin-bottom: 28px; }
.login .field { margin-bottom: 18px; }
.login .field input { height: 44px; }
.login .btn { width: 100%; justify-content: center; height: 44px; font-size: 14px; margin-top: 4px; }
.login .foot { margin-top: 20px; font-size: 12.5px; color: var(--muted-2); text-align: center; }

/* ---------- Ticket detail ---------- */
.detail { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
.detail .main > .card + .card { margin-top: 16px; }
.ticket-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ticket-head .num { font-family: "JetBrains Mono", monospace; color: var(--muted); font-size: 13px; font-weight: 600; background: var(--panel); padding: 3px 8px; border-radius: 6px; margin-right: 4px; }
.ticket-head h1 { font-size: 22px; flex-basis: 100%; margin-top: 8px; line-height: 1.3; }
.meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; font-size: 13.5px; margin: 0; }
.meta dt { font-size: 10.5px; text-transform: uppercase; color: var(--muted-2); letter-spacing: .08em; font-weight: 600; margin-bottom: 3px; }
.meta dd { margin: 0; font-weight: 500; }
.md p { margin: 0 0 10px; }
.md p:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 0 0 10px 22px; padding: 0; }
.md li { margin-bottom: 2px; }
.kv { width: 100%; font-size: 13.5px; border-collapse: collapse; }
.kv td { padding: 7px 10px 7px 0; border-bottom: 1px solid #edf0f4; }
.kv td:first-child { color: var(--muted); width: 180px; font-weight: 500; }
.kv .mono { font-size: 12.5px; font-weight: 600; }
.kv .copy { background: var(--panel); border: none; color: var(--primary); cursor: pointer; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; margin-left: 6px; }
.kv .copy:hover { background: var(--primary-soft); }

/* ---------- Attachments ---------- */
.att-list { display: flex; flex-wrap: wrap; gap: 8px; }
.att { position: relative; display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; background: var(--canvas); font-size: 12.5px; max-width: 100%; color: var(--text); transition: all .12s; overflow: hidden; }
a.att:hover { border-color: var(--primary); background: var(--primary-soft); text-decoration: none; }
.att .ico { width: 30px; height: 30px; border-radius: 8px; background: var(--info-bg); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-size: 9.5px; font-weight: 700; text-transform: uppercase; flex-shrink: 0; letter-spacing: .02em; }
.att .ico.image { background: var(--ok-bg); color: var(--ok); }
.att .ico.video { background: var(--purple-bg); color: var(--purple); }
.att .ico.log { background: var(--panel); color: var(--muted); }
.att .ico.json { background: var(--warn-bg); color: #8a5a00; }
.att .name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.att .size { color: var(--muted-2); font-size: 11.5px; }
.att .rm { background: none; border: none; color: var(--muted-2); cursor: pointer; padding: 0 4px; font-size: 14px; line-height: 1; }
.att .rm:hover { color: var(--danger); }
.att.pending { opacity: .75; }
.att .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--primary); width: 0; transition: width .2s; }
.att img.thumb { width: 52px; height: 38px; object-fit: cover; border-radius: 6px; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 22px 16px; text-align: center; color: var(--muted); font-size: 13.5px; cursor: pointer; background: #fafbfd; transition: all .12s; }
.dropzone::before { content: ''; display: block; width: 36px; height: 36px; margin: 0 auto 8px; border-radius: 10px; background: var(--primary-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232c64a8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4M6 10l6-6 6 6'/%3E%3Cpath d='M4 20h16'/%3E%3C/svg%3E") center/20px no-repeat; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid #edf0f4; }
.timeline li:last-child { border-bottom: none; }
.timeline .avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(145deg, #4a8bd6, var(--primary)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; box-shadow: var(--shadow-sm); }
.timeline .avatar.dev { background: linear-gradient(145deg, var(--navy-2), var(--navy)); }
.timeline .avatar.sys { width: 28px; height: 28px; margin: 4px; background: var(--panel); color: var(--muted-2); font-size: 11px; box-shadow: none; }
.timeline .body { flex: 1; min-width: 0; }
.timeline .who { font-size: 13.5px; margin-bottom: 4px; }
.timeline .who b { font-weight: 600; }
.timeline .when { color: var(--muted-2); font-size: 12px; margin-left: 8px; }
.timeline .md { background: #f6f8fb; border-radius: 0 12px 12px 12px; padding: 10px 14px; display: inline-block; max-width: 100%; }
.timeline .event { color: var(--muted); font-size: 13px; padding-top: 6px; }
.timeline li.internal .md { background: #fff6dc; }
.timeline li.internal { background: linear-gradient(90deg, rgba(255,231,154,.25), transparent 60%); border-left: 3px solid var(--warn); padding-left: 12px; margin-left: -12px; border-radius: 0 8px 8px 0; }
.timeline .tag { font-size: 10px; text-transform: uppercase; color: #8a5a00; font-weight: 700; margin-left: 8px; letter-spacing: .06em; background: var(--warn-bg); padding: 2px 6px; border-radius: 4px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs button { background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 10px 14px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; transition: color .12s; border-radius: 6px 6px 0 0; }
.tabs button:hover { color: var(--text); background: #f6f8fb; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs button .count { font-weight: 500; color: var(--muted-2); margin-left: 4px; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 50; animation: fade .12s; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal { background: var(--canvas); width: 580px; max-width: calc(100vw - 32px); border-radius: 14px; box-shadow: var(--shadow-lg); max-height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden; animation: pop .14s; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }
.modal header { background: linear-gradient(90deg, var(--navy), var(--navy-2)); color: #fff; padding: 14px 20px; font-weight: 600; font-size: 15px; }
.modal .content { padding: 20px; overflow: auto; }
.modal .content .field + .field { margin-top: 14px; }
.modal footer { background: #f6f8fb; border-top: 1px solid var(--border); padding: 14px 20px; display: flex; justify-content: flex-end; gap: 10px; }
.modal footer .left { margin-right: auto; }

/* ---------- Kanban ---------- */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; align-items: stretch; }
.col { background: var(--panel); border-radius: var(--radius); padding: 10px; min-height: 280px; }
.col h3 { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; color: var(--muted); }
.col h3 span { background: #fff; border-radius: 999px; padding: 1px 8px; font-size: 11px; color: var(--muted-2); }
.col.over { outline: 2px dashed var(--primary); outline-offset: -2px; background: var(--primary-soft); }
.tcard { position: relative; background: var(--canvas); border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px; cursor: grab; font-size: 12.5px; box-shadow: var(--shadow-sm); transition: box-shadow .12s, transform .12s; }
.tcard:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.tcard:has(.sev-blocker) { border-left-color: var(--danger); }
.tcard:has(.sev-major) { border-left-color: var(--warn); }
.tcard:has(.sev-minor) { border-left-color: var(--border-strong); }
.tcard .num { font-family: "JetBrains Mono", monospace; color: var(--muted-2); font-size: 11px; font-weight: 600; }
.tcard .subject { font-weight: 600; margin: 4px 0 6px; line-height: 1.35; font-size: 13px; }
.tcard .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tcard .company { color: var(--text); font-weight: 500; }
.tcard .slabar { height: 4px; background: #e3e7ee; border-radius: 2px; margin-top: 8px; overflow: hidden; }
.tcard .slabar i { display: block; height: 100%; background: var(--ok); border-radius: 2px; }
.tcard .slabar.warn i { background: var(--warn); }
.tcard .slabar.breached i { background: var(--danger); width: 100% !important; }
.tcard.dragging { opacity: .5; }

/* ---------- Log / JSON viewers ---------- */
.logview { background: #0f172a; color: #cbd5e1; font: 12.5px/1.6 "JetBrains Mono", Consolas, monospace; padding: 10px 0; border-radius: var(--radius-sm); max-height: 480px; overflow: auto; counter-reset: ln; }
.logview div { padding: 0 12px 0 60px; position: relative; white-space: pre-wrap; word-break: break-all; }
.logview div::before { counter-increment: ln; content: counter(ln); position: absolute; left: 0; width: 44px; text-align: right; color: #475569; }
.logview div.err { background: rgba(239,68,68,.22); color: #fecaca; }
.logview div.warn { background: rgba(245,158,11,.18); color: #fde68a; }
.json-tree { font: 12.5px/1.6 "JetBrains Mono", Consolas, monospace; background: #f6f8fb; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; max-height: 480px; overflow: auto; }
.json-tree details { margin-left: 16px; }
.json-tree summary { cursor: pointer; color: var(--muted); }
.json-tree .k { color: var(--primary-active); }
.json-tree .s { color: var(--ok); }
.json-tree .n { color: var(--danger); }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 500; z-index: 60; box-shadow: var(--shadow-lg); animation: pop .14s; }
.toast.danger { background: var(--danger); }

@media (max-width: 960px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login { width: 100%; max-width: 420px; padding: 28px; }
}
@media (max-width: 860px) {
  .page { padding: 20px 16px 40px; }
  .topbar { padding: 0 16px; gap: 12px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .value { font-size: 24px; }
  .form-grid { grid-template-columns: 1fr; }
  .detail { grid-template-columns: 1fr !important; }
  .topbar nav { display: none; }
  .table .hide-sm { display: none; }
  .topbar .user .company { display: none; }
}

/* ---------- Ajustes finos ---------- */
.cgrid > .card { margin-top: 0; }
.tcard .row:first-child { flex-wrap: nowrap; }
.tcard .row:first-child .muted { white-space: nowrap; font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.filters .field { min-width: 132px; }
.filters .field.grow { min-width: 200px; }
.tcard .num { white-space: nowrap; }

/* ======================= Móvil (≤ 760 px) ======================= */
@media (max-width: 760px) {
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .page { padding: 16px 12px 24px; }
  .page-head { flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
  .page-head h1 { font-size: 20px; }
  .page-head > .btn, .page-head > a.btn { flex-basis: 100%; justify-content: center; order: 9; }
  .page-head .btn.ghost { flex-basis: auto; order: -1; padding: 0 8px; }

  /* Topbar compacta + nav como barra inferior */
  .topbar { height: 56px; padding: 0 12px; gap: 10px; padding-top: env(safe-area-inset-top); }
  .topbar .brand { font-size: 15px; }
  .topbar .brand small { display: none; }
  .topbar select { max-width: 150px; height: 32px; font-size: 12.5px; }
  .topbar #pwBtn { font-size: 0; padding: 4px; }
  .topbar #pwBtn::before { margin: 0; width: 30px; height: 30px; }
  .topbar .user .company { display: none; }
  .topbar nav { display: flex !important; position: fixed; left: 0; right: 0; bottom: 0; margin: 0; background: #fff; border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(16,24,40,.08); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); z-index: 20; justify-content: space-around; }
  .topbar nav a { color: var(--muted); font-size: 12px; font-weight: 600; padding: 8px 10px; border-radius: 10px; flex: 1; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 44px; justify-content: center; }
  .topbar nav a::before { content: ''; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--nav-ico) center/20px no-repeat; mask: var(--nav-ico) center/20px no-repeat; }
  .topbar nav a:nth-child(1) { --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 15h5'/%3E%3C/svg%3E"); }
  .topbar nav a:nth-child(2) { --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v8M8 12h8'/%3E%3C/svg%3E"); }
  .topbar nav a:nth-child(3) { --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 7h-9M14 17H5'/%3E%3Ccircle cx='17' cy='17' r='3'/%3E%3Ccircle cx='7' cy='7' r='3'/%3E%3C/svg%3E"); }
  .topbar nav a.active { background: var(--primary-soft); color: var(--primary); }
  .topbar nav a:hover { background: var(--primary-soft); }

  /* KPIs */
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .kpi { padding: 12px 12px 10px 14px; }
  .kpi .label { font-size: 10px; letter-spacing: .05em; }
  .kpi .value { font-size: 24px; }

  /* Cards y filtros */
  .card { padding: 14px; border-radius: var(--radius); }
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .filters .field, .filters .field.grow { min-width: 0; }
  .filters .field.grow { grid-column: 1 / -1; }
  .filters .btn { grid-column: 1 / -1; justify-content: center; height: 44px; }
  .filters .tabs { grid-column: 1 / -1; margin: 4px 0 0 !important; justify-content: center; }
  .filters .field input, .filters .field select { height: 44px; }

  /* Formularios: 16 px evita el zoom en iOS, 44 px de alto para el dedo */
  .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=datetime-local], .field select, .field textarea { font-size: 16px; height: 44px; }
  .field textarea { height: auto; }
  .radio-row label { flex: 1 1 100%; min-height: 44px; }
  .btn { height: 44px; }
  .btn.sm { height: 36px; }
  .actions { flex-wrap: wrap; }
  .actions .btn { flex: 1 1 auto; justify-content: center; }
  .actions .left { flex-basis: 100%; }
  .fieldset { padding: 12px 12px 14px; }

  /* Tablas → tarjetas apiladas */
  .table thead { display: none; }
  .table, .table tbody { display: block; }
  .table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; background: var(--canvas); border: 1px solid var(--border) !important; border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; }
  .table tr.row:hover td { background: transparent; }
  .table td { display: inline-flex; align-items: center; border: none !important; padding: 0 !important; border-radius: 0 !important; font-size: 13px; }
  .table td:nth-child(2) { flex-basis: 100%; font-size: 14px; line-height: 1.35; margin: 2px 0 4px; }
  .table td:nth-child(2) > b { font-weight: 600; }
  .table td .btn { margin-left: auto; }
  .table .mono { font-size: 11.5px; }
  .table .num { margin-left: auto; }
  .table .empty { flex-basis: 100%; justify-content: center; display: block; text-align: center; }
  .empty { padding: 28px 12px; }

  /* Detalle de ticket */
  .detail { grid-template-columns: 1fr !important; gap: 12px; }
  .ticket-head h1 { font-size: 18px; }
  .ticket-head .chip { font-size: 11px; }
  .meta { grid-template-columns: 1fr 1fr; gap: 10px 12px; }
  .kv td:first-child { width: 120px; font-size: 12px; }
  .kv .mono { font-size: 12px; word-break: break-all; }
  .att .name { max-width: 140px; }
  .dropzone { padding: 14px 12px; font-size: 13px; }
  .timeline .md { max-width: 100%; }
  .timeline .avatar { width: 32px; height: 32px; font-size: 12px; }
  .tabs { overflow-x: auto; white-space: nowrap; scrollbar-width: none; margin: 0 -14px 14px; padding: 0 14px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { padding: 10px 12px; font-size: 13px; }
  .logview { font-size: 11.5px; }
  .logview div { padding-left: 44px; }
  .logview div::before { width: 32px; }

  /* Kanban deslizable con snap */
  .board { display: grid; grid-auto-flow: column; grid-auto-columns: 84vw; grid-template-columns: none; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -14px; padding: 0 14px 12px; align-items: start; }
  .col { scroll-snap-align: start; min-height: 160px; }
  .tcard { cursor: pointer; }

  /* Empresas */
  .cgrid { grid-template-columns: 1fr; gap: 10px; }

  /* Modal como hoja inferior */
  .modal-bg { align-items: flex-end; }
  .modal { width: 100%; max-width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; animation: slideup .18s; }
  @keyframes slideup { from { transform: translateY(40px); opacity: 0 } to { transform: none; opacity: 1 } }
  .modal footer { flex-wrap: wrap; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal footer .btn { flex: 1 1 auto; justify-content: center; }
  .modal footer .left { flex-basis: 100%; order: 2; }

  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); width: calc(100% - 32px); text-align: center; }

  /* Login */
  .login-side { padding: 24px 16px; min-height: 100vh; }
  .login { padding: 28px 22px; }
  .login h1 { font-size: 22px; }
}
@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); }
}

/* Móvil: ajustes finos */
@media (max-width: 760px) {
  .page { overflow-x: hidden; }
  .detail { grid-template-columns: minmax(0, 1fr) !important; }
  .detail > *, .card, .main { min-width: 0; }
  pre, .logview, .json-tree { max-width: 100%; }
  .topbar .brand { white-space: nowrap; }
  .topbar select { max-width: 118px; }
  .topbar .user { gap: 6px; }
  .login-side { flex-direction: column; justify-content: center; gap: 20px; }
  .login-side::before { content: 'NODO Soporte'; display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; color: var(--navy); padding-left: 44px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232c64a8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2 3 7v10l9 5 9-5V7z'/%3E%3Cpath d='M12 22V12M3 7l9 5 9-5'/%3E%3C/svg%3E") left center/34px no-repeat; }
  .login-side::after { content: ''; display: none; }
}
@media (max-width: 760px) {
  .topbar:has(select) .brand { font-size: 0; gap: 0; }
  .topbar:has(select) select { max-width: 160px; }
}

@media (max-width: 760px) {
  .topbar nav a:nth-child(4) { --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20V10M10 20V4M16 20v-7M22 20H2'/%3E%3C/svg%3E"); }
  .topbar nav a { padding: 8px 4px; font-size: 11px; }
}
.kpi[style*='--c'] { }

.att .ico.document { background: #fdecec; color: #b42318; font-size: 9px; }
.att .ico.archive { background: var(--panel); color: var(--muted); }

/* ---------- Notificaciones ---------- */
.topbar button.link.bell { position: relative; width: 36px; height: 34px; padding: 0 !important; background: rgba(255,255,255,.1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9'/%3E%3Cpath d='M10 21a2 2 0 0 0 4 0'/%3E%3C/svg%3E") center/18px no-repeat; }
.topbar .bell .badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--navy-2); }
.push-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #f6f8fb; }
.notif-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; }
.notif-list li { padding: 10px 8px; border-bottom: 1px solid #edf0f4; cursor: pointer; font-size: 13.5px; }
.notif-list li:hover { background: #f6f9fe; }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); margin-right: 6px; vertical-align: middle; box-shadow: 0 0 0 2px #fff; }
.tcard.unread { box-shadow: 0 0 0 2px var(--danger-bg), var(--shadow-sm); }
.table tr.unread td:first-child { font-weight: 700; color: var(--text); }
.live-pill { font-size: 11px; color: var(--muted-2); display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; }
.live-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); animation: blink 2s infinite; }
@keyframes blink { 50% { opacity: .3 } }
@media (max-width: 760px) { .topbar .bell { width: 34px; } }
