/* =============================================================================
   Conéctate Design System — Linear Dark Edition v1.0
   Plataforma: CRM Ingeniería · v1.2.0
   Un solo archivo: todo módulo usa estas variables y estos componentes.
   Modo oscuro por defecto; el claro es el mismo sistema con otros valores.
   ============================================================================= */

/* ---------- Tipografía local (la CSP no permite CDNs de fuentes) ---------- */
@font-face { font-family: Inter; font-style: normal; font-weight: 400; font-display: swap;
  src: url(assets/fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-style: normal; font-weight: 500; font-display: swap;
  src: url(assets/fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-style: normal; font-weight: 600; font-display: swap;
  src: url(assets/fonts/inter-latin-600-normal.woff2) format('woff2'); }

/* ---------- Variables ---------- */
:root, html[data-theme=dark] {
  color-scheme: dark;
  --bg: #0D1117;            /* fondo principal */
  --side: #10151E;          /* menú lateral */
  --top: #111722;           /* barra superior */
  --card: #161D29;          /* tarjetas */
  --surface: #1C2431;       /* superficie secundaria */
  --field: #131A24;         /* campos de formulario */
  --line: #293241;          /* bordes */
  --line-soft: #202836;
  --hover: #222B39;
  --brand: #0866D9;         /* azul corporativo */
  --brand-hover: #0A74F0;
  --accent: #3B82F6;        /* azul interactivo */
  --pick: #19345F;          /* selección de menú */
  --text: #E6EAF0;          /* texto principal */
  --text2: #A0AAB9;         /* texto secundario */
  --text3: #778397;         /* texto auxiliar */
  --ok: #22C55E;
  --warn: #F59E0B;
  --bad: #EF4444;
  --ok-bg: #22C55E1f; --warn-bg: #F59E0B1f; --bad-bg: #EF44441f; --brand-bg: #3B82F61f;
  --shadow-sm: 0 1px 2px #0006;
  --shadow: 0 8px 24px #00000059;
  --r: 8px;                 /* radio estándar */
  --r-sm: 6px;
  --r-lg: 10px;
  --t: 160ms cubic-bezier(.4,0,.2,1);
  --top-h: 56px;
  --side-w: 240px;
  --side-w-min: 64px;
}
html[data-theme=light] {
  color-scheme: light;
  --bg: #F7F9FC; --side: #FFFFFF; --top: #FFFFFF; --card: #FFFFFF; --surface: #F1F4F9;
  --field: #FFFFFF; --line: #DFE5EE; --line-soft: #E9EEF5; --hover: #EFF3F9;
  --brand: #0866D9; --brand-hover: #0A74F0; --accent: #1D6FE0; --pick: #E4EEFC;
  --text: #0F1B2D; --text2: #4A5A70; --text3: #6B7A90;
  --ok: #16A34A; --warn: #B45309; --bad: #DC2626;
  --ok-bg: #16A34A17; --warn-bg: #B4530917; --bad-bg: #DC262617; --brand-bg: #0866D914;
  --shadow-sm: 0 1px 2px #0f1b2d14; --shadow: 0 10px 28px #0f1b2d1f;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 14px/1.55 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.011em; }
h1 { font-size: 26px; line-height: 1.25; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: 5px; padding: 1px 5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--pick); color: var(--text); }
[hidden] { display: none !important; }

/* Barras de desplazamiento discretas */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); background-clip: content-box; }

/* ---------- Iconos ---------- */
.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ico.lg { width: 20px; height: 20px; stroke-width: 1.6; }
.ico.xl { width: 24px; height: 24px; stroke-width: 1.5; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Botones ---------- */
button, .btn {
  font: inherit; font-weight: 500; font-size: 13.5px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--r-sm); padding: 7px 13px; min-height: 34px;
  background: var(--brand); color: #fff; transition: background var(--t), border-color var(--t), color var(--t), opacity var(--t);
  white-space: nowrap; line-height: 1.2;
}
button:hover { background: var(--brand-hover); }
button.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
button.secondary:hover { background: var(--hover); border-color: var(--text3); }
button.ghost { background: transparent; color: var(--text2); border-color: transparent; padding: 6px 9px; }
button.ghost:hover { background: var(--hover); color: var(--text); }
button.danger { background: transparent; color: var(--bad); border-color: var(--line); }
button.danger:hover { background: var(--bad); border-color: var(--bad); color: #fff; }
button.small { padding: 4px 9px; min-height: 28px; font-size: 12.5px; border-radius: var(--r-sm); }
button.icon { padding: 0; width: 34px; min-height: 34px; }
button:disabled { opacity: .5; pointer-events: none; }
button.loading { position: relative; color: transparent !important; }
button.loading::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #ffffff55; border-top-color: #fff; animation: spin .7s linear infinite; }
button.secondary.loading::after, button.ghost.loading::after { border-color: var(--line); border-top-color: var(--text); }

/* ---------- Campos ---------- */
label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text2); }
input, select, textarea {
  font: inherit; font-size: 13.5px; width: 100%; margin-top: 5px; color: var(--text);
  background: var(--field); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 7px 10px; min-height: 34px; transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--text3); }
input:hover, select:hover, textarea:hover { border-color: var(--text3); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--brand-bg); }
input:disabled, select:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
input[type=checkbox] { width: 16px; height: 16px; min-height: 0; margin: 0 6px 0 0; accent-color: var(--brand); vertical-align: -2px; }
select { appearance: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text3) 50%), linear-gradient(135deg, var(--text3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
label.inline { display: flex; align-items: center; gap: 2px; font-weight: 400; color: var(--text); font-size: 13.5px; }
label.inline input { width: auto; margin-top: 0; }
.hint { display: block; margin-top: 5px; font-size: 12px; color: var(--text3); font-weight: 400; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin: 16px 0; }
fieldset legend { padding: 0 6px; font-size: 12.5px; font-weight: 600; color: var(--text2); }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: end; }
.fields.two { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.fields .full { grid-column: 1 / -1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
.actions .sep { flex: 1; }
.error { color: var(--bad); font-size: 13px; margin: 8px 0 0; }
.error:empty { display: none; }
.ok-text { color: var(--ok); }

/* ---------- Armazón ---------- */
#shell { display: grid; grid-template-columns: var(--side-w) 1fr; grid-template-rows: var(--top-h) 1fr;
  grid-template-areas: "brand top" "side main"; min-height: 100vh; transition: grid-template-columns var(--t); }
#shell.min { --side-w: var(--side-w-min); }

/* Barra superior */
.brand { grid-area: brand; display: flex; align-items: center; gap: 9px; padding: 0 14px;
  background: var(--side); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; }
.brand img { height: 28px; width: auto; border-radius: 6px; flex: none; }
.brand b { font-size: 14px; font-weight: 600; white-space: nowrap; letter-spacing: -.01em; }
#shell.min .brand b { display: none; }
#shell.min .brand { justify-content: center; padding: 0; }

header { grid-area: top; display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--top); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
header .spacer { flex: 1; }
.menu-btn { display: none; }

/* Buscador global */
.search { position: relative; width: min(420px, 42vw); }
.search .ico { position: absolute; left: 10px; top: 9px; color: var(--text3); }
.search input { padding-left: 32px; padding-right: 54px; background: var(--field); margin: 0; }
.kbd { position: absolute; right: 8px; top: 7px; display: flex; gap: 3px; pointer-events: none; }
.kbd span { font-size: 10.5px; font-weight: 500; color: var(--text3); background: var(--surface);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; line-height: 1.5; }

/* Menú de cuenta y notificaciones */
.pop { position: relative; }
.pop > .sheet { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  min-width: 260px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 6px; animation: pop var(--t); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.sheet .who { display: flex; gap: 10px; align-items: center; padding: 8px 10px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
.sheet .who div { min-width: 0; }
.sheet .who b { display: block; font-size: 13.5px; font-weight: 600; }
.sheet .who small { color: var(--text3); font-size: 12px; }
.sheet button { width: 100%; justify-content: flex-start; background: transparent; color: var(--text);
  border: 0; padding: 7px 10px; font-weight: 400; min-height: 32px; border-radius: var(--r-sm); }
.sheet button:hover { background: var(--hover); }
.sheet .head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; }
.sheet .head b { font-size: 13px; font-weight: 600; }
.sheet .list { max-height: 340px; overflow: auto; }
.sheet .item { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: var(--r-sm); }
.sheet .item:hover { background: var(--hover); }
.sheet .item b { display: block; font-size: 13px; font-weight: 500; }
.sheet .item small { color: var(--text3); font-size: 11.5px; }
.sheet .empty { padding: 20px 12px; text-align: center; color: var(--text3); font-size: 13px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--pick); color: var(--text); font-size: 11.5px; font-weight: 600; letter-spacing: .02em; }
.ndot { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--bad); border: 2px solid var(--top); }

/* Menú lateral */
#sidebar { grid-area: side; background: var(--side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden; position: sticky; top: var(--top-h);
  height: calc(100vh - var(--top-h)); z-index: 25; }
#nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 8px 4px; }
#nav::-webkit-scrollbar { width: 6px; }
.nav-group { margin-bottom: 2px; }
/* Categorías: se ven como un botón propio, más claras que sus opciones, para no perderse con todo abierto */
.nav-group { margin-bottom: 6px; }
.nav-cat { display: flex; align-items: center; gap: 7px; width: 100%; background: var(--surface); border: 1px solid var(--line);
  color: var(--text); font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: 7px 9px; min-height: 30px; justify-content: flex-start; border-radius: var(--r-sm); margin: 6px 0 3px; }
.nav-cat:hover { background: var(--hover); color: var(--text); border-color: var(--accent); }
.nav-cat[aria-expanded=true] { border-left: 3px solid var(--accent); padding-left: 7px; }
.nav-cat .ico { width: 13px; height: 13px; transition: transform var(--t); color: var(--accent); }
.nav-cat[aria-expanded=false] .ico { transform: rotate(-90deg); color: var(--text2); }
.nav-cat em { flex: 1; text-align: left; font-style: normal; }
.nav-group .nav-item { margin-left: 8px; width: calc(100% - 8px); }
#shell.min .nav-group .nav-item { margin-left: 0; width: 100%; }
#shell.min .nav-group { border-top: 1px solid var(--line); padding-top: 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; justify-content: flex-start;
  background: transparent; border: 0; color: var(--text2); font-size: 13.5px; font-weight: 400;
  padding: 7px 8px; min-height: 32px; border-radius: var(--r-sm); margin-bottom: 1px; position: relative; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.on { background: var(--pick); color: var(--text); font-weight: 500; }
.nav-item.on .ico { color: var(--accent); }
.nav-item .ico { color: var(--text3); }
.nav-item:hover .ico { color: var(--text2); }
.nav-item em { font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .pill { margin-left: auto; font-size: 10.5px; font-weight: 600; background: var(--bad);
  color: #fff; border-radius: 9px; padding: 0 6px; line-height: 16px; }
.nav-foot { border-top: 1px solid var(--line); padding: 8px; }
.ver { font-size: 11.5px; color: var(--text3); background: transparent; border: 0; padding: 6px 8px;
  justify-content: flex-start; min-height: 28px; width: 100%; font-weight: 400; }
.ver:hover { background: var(--hover); color: var(--text2); }
#shell.min .nav-cat, #shell.min .nav-item em, #shell.min .ver em { display: none; }
#shell.min .nav-item { justify-content: center; padding: 7px 0; }
#shell.min .nav-item .pill { position: absolute; top: 2px; right: 6px; margin: 0; }
#shell.min .nav-foot button { justify-content: center; }
/* Tooltips cuando el menú está contraído */
#shell.min .nav-item::after, #shell.min .nav-foot button::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 5px 9px; font-size: 12.5px; white-space: nowrap; box-shadow: var(--shadow); opacity: 0;
  pointer-events: none; transition: opacity var(--t); z-index: 70; }
#shell.min .nav-item:hover::after, #shell.min .nav-foot button:hover::after { opacity: 1; }

/* Área de trabajo */
main { grid-area: main; padding: 22px 24px 48px; min-width: 0; }
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .t { min-width: 0; flex: 1; }
.page-head p { color: var(--text2); font-size: 13.5px; margin-top: 4px; max-width: 78ch; }
.page-head .actions { margin: 0; }

/* ---------- Tarjetas y paneles ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.panel > h2 { font-size: 15px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel > h2 .sep { flex: 1; }
.panel.flat { background: transparent; border: 0; box-shadow: none; padding: 0; }
.grid { display: grid; gap: 14px; }
.grid.k3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.k4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid.k2 { grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); }

/* Indicadores */
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; }
.kpi .k { display: flex; align-items: center; gap: 7px; color: var(--text3); font-size: 12px; font-weight: 500; }
.kpi .v { font-size: 23px; font-weight: 600; letter-spacing: -.02em; margin-top: 6px; line-height: 1.2; }
.kpi .d { font-size: 12px; color: var(--text3); margin-top: 3px; }
.kpi .d.up { color: var(--ok); } .kpi .d.down { color: var(--bad); }

/* Estados */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500;
  border-radius: 999px; padding: 2px 9px; background: var(--surface); color: var(--text2); border: 1px solid var(--line); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text3); }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.ok::before { background: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.warn::before { background: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.badge.bad::before { background: var(--bad); }
.badge.info { background: var(--brand-bg); color: var(--accent); border-color: transparent; }
.badge.info::before { background: var(--accent); }
.badge.plain::before { display: none; }

/* Avisos en bloque */
.notice { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--text3);
  border-radius: var(--r); padding: 11px 14px; margin: 12px 0; font-size: 13.5px; color: var(--text2); }
.notice strong { color: var(--text); font-weight: 600; }
.notice.bad { border-left-color: var(--bad); background: var(--bad-bg); }
.notice.warn { border-left-color: var(--warn); background: var(--warn-bg); }
.notice.ok { border-left-color: var(--ok); background: var(--ok-bg); }
.notice.info { border-left-color: var(--accent); background: var(--brand-bg); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice li { margin: 3px 0; }

/* ---------- Tablas ---------- */
.tablewrap { border: 1px solid var(--line); border-radius: var(--r); overflow: auto; background: var(--card); max-height: 70vh; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); color: var(--text3);
  font-size: 11.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; text-align: left;
  padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--text); }
thead th .ico { width: 12px; height: 12px; opacity: .5; vertical-align: -2px; margin-left: 3px; }
thead th.sorted { color: var(--text); }
thead th.sorted .ico { opacity: 1; color: var(--accent); }
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle;
  white-space: nowrap; color: var(--text2); }
tbody td:first-child { color: var(--text); font-weight: 500; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--hover); }
tbody tr.on td { background: var(--pick); }
td.ops { text-align: right; white-space: nowrap; }
td.ops button { margin-left: 4px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.wrap td { white-space: normal; min-width: 140px; vertical-align: top; }
table.props th { position: static; background: transparent; text-transform: none; letter-spacing: 0;
  font-size: 12.5px; color: var(--text3); font-weight: 500; width: 1%; padding-right: 20px; border-bottom: 1px solid var(--line-soft); }
.empty-state { padding: 40px 20px; text-align: center; color: var(--text3); }
.empty-state .ico { width: 28px; height: 28px; opacity: .4; display: block; margin: 0 auto 10px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; max-width: 100%; }
.toolbar .sep { flex: 1; }
.toolbar label { display: flex; flex-direction: column; gap: 0; min-width: 0; max-width: 100%; }
.toolbar input, .toolbar select { margin-top: 0; min-width: 0; max-width: 100%; }
.toolbar .find { position: relative; min-width: 180px; }
.toolbar .find .ico { position: absolute; left: 9px; top: 9px; color: var(--text3); }
.toolbar .find input { padding-left: 30px; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 12px;
  color: var(--text3); font-size: 12.5px; }

/* ---------- Ventanas y paneles laterales ---------- */
.modal { position: fixed; inset: 0; z-index: 100; background: #05080dcc; backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 20px; animation: fade var(--t); }
@keyframes fade { from { opacity: 0; } }
.modal-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); width: min(680px, 100%); max-height: 88vh; overflow: auto; padding: 20px 22px;
  animation: rise var(--t); }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.modal-card h2 { font-size: 17px; margin-bottom: 4px; }
.modal-card > p:first-of-type { color: var(--text2); font-size: 13.5px; }
.modal-card .fields { margin-top: 16px; }
.modal.wide .modal-card { width: min(980px, 100%); }
/* Panel lateral para editar registros */
.modal.drawer { display: flex; justify-content: flex-end; align-items: stretch; padding: 0; background: #05080d99; }
.modal.drawer .modal-card { width: min(560px, 100%); max-height: 100vh; height: 100vh; border-radius: 0;
  border-right: 0; border-top: 0; border-bottom: 0; animation: slide var(--t); display: flex; flex-direction: column; }
@keyframes slide { from { transform: translateX(24px); } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.drawer-head h2 { flex: 1; }

/* Notificaciones flotantes */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: flex-start; gap: 9px; background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 11px 14px; font-size: 13.5px; max-width: 380px; animation: rise var(--t); }
.toast.ok { border-left-color: var(--ok); } .toast.ok .ico { color: var(--ok); }
.toast.bad { border-left-color: var(--bad); } .toast.bad .ico { color: var(--bad); }
.toast.warn { border-left-color: var(--warn); } .toast.warn .ico { color: var(--warn); }
.toast .ico { color: var(--accent); margin-top: 1px; }
.toast button { margin-left: 4px; }

/* ---------- Pestañas ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 16px; overflow-x: auto; }
.tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  color: var(--text2); font-weight: 500; padding: 9px 13px; min-height: 36px; }
.tabs button:hover { background: var(--hover); color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); background: transparent; }

/* ---------- Varios ---------- */
.issues { list-style: none; margin: 10px 0 0; padding: 0; }
.issues li { display: flex; gap: 8px; align-items: flex-start; padding: 7px 0 7px 11px;
  border-left: 2px solid var(--line); font-size: 13.5px; color: var(--text2); }
.issues li.ok { border-left-color: var(--ok); }
.issues li.error { border-left-color: var(--bad); color: var(--text); }
pre.script { background: #090E16; color: #CBD9E8; border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow: auto; max-height: 520px; white-space: pre; margin: 12px 0; }
html[data-theme=light] pre.script { background: #0F1B2D; color: #D9E6F5; }
pre.script.small { max-height: 190px; padding: 11px 13px; }
pre.sample { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 14px; font: 13px/1.6 Inter, system-ui, sans-serif; white-space: pre-wrap; word-break: break-word; margin: 10px 0; }
.bar { height: 6px; border-radius: 4px; background: var(--surface); overflow: hidden; margin: 10px 0; border: 1px solid var(--line-soft); }
.bar span { display: block; height: 100%; background: var(--brand); transition: width .35s var(--t); }
.qr { width: 220px; height: 220px; background: #fff; border-radius: var(--r); padding: 10px; border: 1px solid var(--line); }
label.check { display: flex; gap: 8px; align-items: baseline; padding: 5px 0; font-weight: 400; color: var(--text); font-size: 13.5px; }
label.check input { width: auto; margin: 0; }
label.check small { color: var(--text3); }
.scroll { overflow-x: auto; }
small { font-size: 12px; color: var(--text3); }
.muted { color: var(--text3); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; }
.chart { width: 100%; display: block; }
.chart text { fill: var(--text3); font-size: 11px; font-family: Inter, sans-serif; }
.chart .grid-line { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text2); margin-top: 10px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: 0; }


/* ---------- Componentes de los módulos (mismo sistema, mismas variables) ---------- */
/* Tarjetas de resumen */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 0 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; min-width: 0; }
.card span { display: block; color: var(--text3); font-size: 12px; font-weight: 500; }
.card strong { display: block; font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin-top: 6px; color: var(--text); }
.card.muted strong { font-size: 13.5px; font-weight: 400; color: var(--text2); letter-spacing: 0; }
.card small { display: block; margin-top: 3px; }

/* Puesta en marcha */
.point { display: grid; grid-template-columns: 26px 1fr auto; gap: 12px; align-items: start;
  padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.point:last-child { border-bottom: 0; }
.point ol { margin: 8px 0 0; padding-left: 18px; color: var(--text2); font-size: 13px; }
.point ol li { margin: 4px 0; }
.point details summary { cursor: pointer; color: var(--accent); font-size: 12.5px; margin-top: 4px; }
.dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px;
  font-weight: 600; background: var(--surface); border: 1px solid var(--line); color: var(--text3); }
.dot.done { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.tag { font-size: 11px; font-weight: 500; border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 8px; color: var(--text3); margin-left: 6px; }
progress { appearance: none; width: 100%; height: 6px; border: 0; border-radius: 4px; overflow: hidden;
  background: var(--surface); margin: 10px 0 6px; }
progress::-webkit-progress-bar { background: var(--surface); }
progress::-webkit-progress-value { background: var(--brand); border-radius: 4px; }
progress::-moz-progress-bar { background: var(--brand); }

/* Segundo factor */
.mfa { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; }
.mfa ol, .steps { margin: 0 0 12px; padding-left: 18px; color: var(--text2); font-size: 13.5px; }
.mfa li, .steps li { margin-bottom: 9px; }
.codes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.codes code { text-align: center; padding: 8px; font-size: 13px; }

/* Analizador */
.finding h2 { font-size: 15px; }
.finding ul { margin: 4px 0 10px; padding-left: 18px; color: var(--text2); }
.cmds > div { padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.cmds > div:last-child { border-bottom: 0; }
.cmds > div.risky code { border-color: var(--bad); color: var(--bad); }
.flag { display: block; margin-top: 3px; font-size: 12.5px; }
.flag.danger, .flag.error { color: var(--bad); }
.flag.warning { color: var(--warn); }
.badge.sev-critica { background: var(--bad); border-color: var(--bad); color: #fff; }
.badge.sev-critica::before { background: #fff; }
.badge.sev-alta { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.badge.sev-alta::before { background: var(--bad); }
.badge.sev-media { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.sev-media::before { background: var(--warn); }
.badge.sev-baja, .badge.sev-info { background: var(--surface); color: var(--text2); }
.issues li.warning { border-left-color: var(--warn); }
.issues li.warning strong { color: var(--warn); }
.issues li.error strong { color: var(--bad); }

/* Tablas editables (VLAN, PON) */
.grid-edit td { padding: 4px 6px; }
.grid-edit input, .grid-edit select { margin: 0; padding: 5px 8px; min-height: 30px; min-width: 92px; }
.grid-edit input[type=number] { min-width: 74px; width: 88px; }
.grid-edit input[type=checkbox] { min-width: 0; }

/* Varios */
.filebtn { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; color: var(--text2); cursor: pointer; }
.filebtn input { width: auto; margin: 0; }
.soon { color: var(--text3); }
.toolbar .spacer { flex: 1; }
.modal-card .scroll, .modal-card .tablewrap { margin: 12px 0; }
.who { color: var(--text2); font-size: 13px; }

/* ---------- Acceso ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.login-card { width: min(380px, 100%); background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 30px 28px; box-shadow: var(--shadow); }
.login-card img { height: 56px; width: auto; border-radius: 10px; }
.login-card h1 { font-size: 20px; margin: 14px 0 4px; }
.login-card > p { color: var(--text2); font-size: 13.5px; margin-bottom: 22px; }
.login-card label { margin-bottom: 14px; }
.login-card button { width: 100%; margin-top: 6px; }

/* Barra de versión nueva */
.banner { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 300;
  display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; box-shadow: var(--shadow); padding: 8px 10px 8px 18px; font-size: 13.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .search { width: 240px; } }
@media (max-width: 900px) {
  #shell { grid-template-columns: 1fr; grid-template-areas: "top" "main"; }
  .brand { display: none; }
  .menu-btn { display: inline-flex; }
  header { padding: 0 10px; }
  .search { position: absolute; left: 10px; right: 10px; top: calc(var(--top-h) + 8px); width: auto;
    z-index: 40; display: none; }
  .search.open { display: block; }
  .search input { box-shadow: var(--shadow); }
  #sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 262px; height: 100vh;
    transform: translateX(-100%); transition: transform var(--t); z-index: 90; box-shadow: var(--shadow); }
  #sidebar.open { transform: none; }
  #sidebar .brand-m { display: flex; align-items: center; gap: 9px; padding: 14px; border-bottom: 1px solid var(--line); }
  #sidebar .brand-m img { height: 28px; width: auto; border-radius: 6px; }
  main { padding: 16px 14px 40px; }
  h1 { font-size: 21px; }
  .modal { padding: 0; place-items: end stretch; }
  .modal-card { width: 100%; max-height: 92vh; border-radius: 14px 14px 0 0; border-bottom: 0; }
  .modal.drawer { align-items: flex-end; }
  .modal.drawer .modal-card { width: 100%; height: 92vh; border-radius: 14px 14px 0 0; }
  #toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
  .tablewrap { max-height: none; }
}
@media (max-width: 560px) {
  .mfa { grid-template-columns: 1fr; }
  .codes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .point { grid-template-columns: 26px 1fr; }
  .point > :last-child { grid-column: 2; justify-self: start; }
  .page-head { gap: 10px; }
  .fields, .fields.two { grid-template-columns: 1fr; }
  .grid.k3, .grid.k4, .grid.k2 { grid-template-columns: 1fr 1fr; }
  .kpi .v { font-size: 19px; }
}
@media (min-width: 1700px) { main { padding: 26px 34px 56px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- Gráficos: los colores viven aquí para que cambien con el tema ---------- */
.chart .s1, .legend i.s1 { fill: var(--brand); background: var(--brand); }
.chart .s2, .legend i.s2 { fill: var(--text3); background: var(--text3); }
.chart .s3, .legend i.s3 { fill: var(--ok); background: var(--ok); }
.chart .s4, .legend i.s4 { fill: var(--warn); background: var(--warn); }
.chart .s-bad { fill: var(--bad); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.s1 { stroke: var(--accent); } .chart .line.s2 { stroke: var(--text3); } .chart .line.s3 { stroke: var(--ok); }
.chart .area { opacity: .1; stroke: none; }
.chart .pt { stroke: var(--card); stroke-width: 2; }
.chart text.val { fill: var(--text2); font-weight: 500; }
.chart rect { transition: opacity var(--t); }
.chart rect:hover, .chart .pt:hover { opacity: .78; }
th.chk, td.chk { width: 1%; padding-right: 0; }
th.chk input, td.chk input { margin: 0; }
#confirm .modal-card { width: min(440px, 100%); }
#confirm p { color: var(--text2); margin-top: 6px; font-size: 13.5px; white-space: pre-line; }
/* Tablas que los módulos envuelven por su cuenta */
.scroll:has(> table) { border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
.scroll > table + p { padding: 14px; color: var(--text3); }

/* ---------- Buscador global (Ctrl + K) ---------- */
.modal.palette { place-items: start center; padding-top: 12vh; }
.palette .modal-card { width: min(640px, 100%); padding: 0; overflow: hidden; display: flex; flex-direction: column; max-height: 68vh; }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--text3); }
.pal-in input { border: 0; background: transparent; margin: 0; padding: 4px 0; font-size: 15px; min-height: 0; box-shadow: none; }
.pal-in input:focus { box-shadow: none; }
.kbd-static { font-size: 10.5px; color: var(--text3); background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.pal-list { overflow: auto; padding: 6px; }
.pal-group { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text3); padding: 10px 10px 4px; }
.pal-item { display: flex; align-items: center; gap: 11px; width: 100%; justify-content: flex-start; text-align: left;
  background: transparent; border: 0; color: var(--text); padding: 8px 10px; border-radius: var(--r-sm); font-weight: 400; min-height: 38px; }
.pal-item:hover { background: transparent; }
.pal-item.on { background: var(--pick); }
.pal-item .ico { color: var(--text3); }
.pal-item.on .ico { color: var(--accent); }
.pal-item span { display: flex; flex-direction: column; min-width: 0; }
.pal-item b { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet .pal-group { padding: 8px 10px 2px; }

/* Novedades */
h3.cl { margin-top: 18px; font-size: 14px; }
h3.cl small { font-weight: 400; margin-left: 6px; }
.cl-t { color: var(--text2); font-size: 13.5px; margin-top: 2px; }
.cl-list { margin: 8px 0 0; padding-left: 18px; color: var(--text2); font-size: 13.5px; }
.cl-list li { margin: 5px 0; }

/* Marca del menú en móvil y buscador como botón */
.brand-m { display: none; }
#me .who { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
#me { padding: 4px 8px 4px 4px; gap: 8px; }
@media (max-width: 900px) {
  .brand-m { display: flex; }
  header .search { display: none; }
  #search-m { display: inline-flex !important; }
  #me .who { display: none; }
  #full { display: none; }
  .modal.palette { padding: 0; place-items: start stretch; }
  .palette .modal-card { max-height: 100vh; height: 100vh; border-radius: 0; }
  .pal-in input { font-size: 16px; }
}
@media (max-width: 560px) { input, select, textarea { font-size: 16px; } }   /* evita el zoom de iOS al enfocar */
.mt { margin-top: 16px; }
.grid .panel { margin-bottom: 0; min-width: 0; }
.grid + .panel, .grid + .grid { margin-top: 16px; }
.cap { color: var(--text3); font-size: 12px; margin-top: 10px; }
.kpi .k .ico { color: var(--text3); }

/* ---------- Integraciones ---------- */
.ig-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.ig-head > div { flex: 1; min-width: 0; }
.ig-head h2 { font-size: 15.5px; }
.ig-head p { color: var(--text2); font-size: 13px; margin-top: 3px; }
.ig-ico { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); color: var(--accent); }
.chip { background: transparent; border: 1px solid var(--line); color: var(--text2); border-radius: 999px;
  padding: 4px 11px; min-height: 30px; font-size: 12.5px; font-weight: 500; }
.chip:hover { background: var(--hover); color: var(--text); }
.chip.on { background: var(--pick); border-color: transparent; color: var(--text); }
.chip b { font-weight: 600; color: var(--text3); margin-left: 2px; }
.chip.on b { color: var(--accent); }
/* Interruptor */
label.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 400; color: var(--text); font-size: 13.5px; align-self: end; min-height: 34px; }
label.switch input { position: absolute; opacity: 0; width: 0; height: 0; min-height: 0; margin: 0; }
.track { width: 34px; height: 20px; flex: none; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  position: relative; transition: background var(--t), border-color var(--t); }
.track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--text3); transition: transform var(--t), background var(--t); }
label.switch input:checked + .track { background: var(--brand); border-color: var(--brand); }
label.switch input:checked + .track::after { transform: translateX(14px); background: #fff; }
label.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.secret { display: flex; gap: 6px; align-items: center; }
.secret input { flex: 1; }
.secret button { margin-top: 5px; }

.ver em, .nav-item em, .nav-cat em { font-style: normal; }
#sidebar .brand-m b { font-size: 14px; font-weight: 600; }
/* En pantallas angostas el gráfico se encoge: el texto se agranda en unidades del dibujo para seguir siendo legible */
@media (max-width: 560px) { .chart text { font-size: 16px; } .grid.k3, .grid.k4 { grid-template-columns: 1fr 1fr; } }

td.ops .ghost.icon { width: 28px; }
td.ops [data-del]:hover, td.ops [data-delpay]:hover, td.ops [data-delfile]:hover { color: var(--bad); background: var(--bad-bg); }
.fields label.inline, .fields label.switch { align-self: end; min-height: 34px; }
.toolbar select, .toolbar input { width: auto; }
.toolbar select { min-width: 170px; }
.toolbar .find input { width: 240px; }
.toolbar label select, .toolbar label input { width: auto; min-width: 150px; }
@media (max-width: 560px) { .toolbar .find, .toolbar .find input, .toolbar select, .toolbar label, .toolbar label select, .toolbar label input { width: 100%; } }

.panel > p { color: var(--text2); margin: 0 0 12px; }
.panel > p:last-child { margin-bottom: 0; }
.panel > h3 { margin: 16px 0 8px; }
.tablewrap + .toolbar, .scroll + .toolbar, .tablewrap + .actions { margin-top: 12px; }
.tablewrap + p, .scroll + p { margin-top: 12px; }
.modal-card > p { color: var(--text2); margin: 6px 0 10px; }
.modal-card h3 { margin: 16px 0 6px; }
input[type=file] { padding: 5px 8px; }
input[type=file]::file-selector-button { font: inherit; font-size: 12.5px; font-weight: 500; margin-right: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); border-radius: 5px; padding: 3px 10px; cursor: pointer; }
/* Tablas de propiedades (clave → valor) que usan los módulos */
tbody th { text-align: left; font-weight: 500; color: var(--text3); font-size: 12.5px; padding: 9px 16px 9px 12px;
  width: 1%; white-space: nowrap; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:last-child th { border-bottom: 0; }
tbody tr:hover th { background: var(--hover); }
.issues + .scroll, .issues + .tablewrap, .issues + p { margin-top: 12px; }

/* ---------- Formulario público de registro ---------- */
.reg { max-width: 760px; margin: 0 auto; padding: 28px 18px 48px; }
.reg-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.reg-head img { height: 44px; width: auto; border-radius: 8px; }
.reg-head p { color: var(--text2); font-size: 13.5px; margin-top: 2px; }
.reg-foot { text-align: center; margin-top: 22px; }
.reg .panel > h2 { margin-bottom: 14px; }
.trap { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
label.mt { margin-top: 14px; }
/* En el panel lateral nada se encoge: si el contenido no cabe, se desplaza el panel entero, no cada tabla. */
.modal.drawer .modal-card > * { flex-shrink: 0; }
.modal.drawer .tablewrap { max-height: none; overflow: visible; }

/* v1.4.0 · logos, comprobantes */
.logo-prev { max-width: 240px; max-height: 120px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px; }
.small-file { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--text2);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px 9px; min-height: 28px; cursor: pointer; margin: 0; }
.small-file:hover { background: var(--hover); color: var(--text); }
.small-file input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.small-file:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=file] { padding: 7px; font-size: 13px; }

/* v1.5.0 · Integraciones en tarjetas */
.ig-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.ig-tile { display: flex; flex-direction: column; align-items: stretch; gap: 4px; text-align: left; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; min-height: 172px; font-weight: 400; color: var(--text);
  white-space: normal; transition: border-color var(--t), box-shadow var(--t), transform var(--t); }
.ig-tile:hover { background: var(--card); border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.ig-tile:disabled { opacity: .6; }
.ig-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.ig-ico.violet { color: #A78BFA; background: #A78BFA1f; border-color: transparent; }
.ig-ico.amber { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.ig-ico.green { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.ig-ico.blue { color: var(--accent); background: var(--brand-bg); border-color: transparent; }
.ig-cat { font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text3); }
.ig-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.ig-ok { display: inline-grid; color: var(--ok); }
.ig-ok .ico { width: 15px; height: 15px; }
.ig-desc { font-size: 13px; color: var(--text2); line-height: 1.45; flex: 1; }
.ig-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text3); margin-top: 10px; }
.ig-cfg { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-weight: 500; opacity: 0; transition: opacity var(--t); }
.ig-cfg .ico { width: 14px; height: 14px; }
.ig-tile:hover .ig-cfg, .ig-tile:focus-visible .ig-cfg { opacity: 1; }
@media (hover: none) { .ig-cfg { opacity: 1; } }
.ig-dsub { color: var(--text2); font-size: 13px; margin-bottom: 14px; }

/* v1.5.0 · Portal del cliente y tickets */
.pt-hero { display: flex; align-items: center; gap: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; margin-bottom: 14px; }
.pt-hero img { max-height: 56px; max-width: 160px; background: #fff; border-radius: var(--r-sm); padding: 6px; }
.pt-hero h2 { font-size: 18px; }
.pt-hero p { color: var(--text2); font-size: 13px; margin-top: 2px; }
.pt-tile { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px; min-height: 128px; font-weight: 400; color: var(--text); white-space: normal; }
.pt-tile:hover { background: var(--card); border-color: var(--accent); }
.pt-tile b { font-size: 15px; font-weight: 600; }
.pt-tile small { color: var(--text2); font-size: 13px; line-height: 1.4; }
.pt-tile .n { font-size: 17px; font-weight: 600; margin-top: auto; }
.pt-tile.plus { border-style: dashed; }
.pt-tile.plus .n { font-size: 12.5px; font-weight: 500; color: var(--accent); }
.tk-thread { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.tk-msg { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; background: var(--surface); max-width: 92%; }
.tk-msg.staff { align-self: flex-end; background: var(--brand-bg); border-color: transparent; }
.tk-msg.internal { align-self: flex-end; background: var(--warn-bg); border: 1px dashed var(--warn); }
.tk-msg header { font-size: 11.5px; color: var(--text3); margin-bottom: 4px; display: flex; gap: 8px; justify-content: space-between; }
.tk-msg p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.5; }
.tk-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12.5px; color: var(--text2); }
.tk-row { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line-soft);
  padding: 9px 2px; font-weight: 400; color: var(--text); border-radius: 0; white-space: normal; }
.tk-row:hover { background: var(--hover); }
.tk-row b { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-row small { color: var(--text3); font-size: 12px; flex: none; }
label.check.consent { align-items: flex-start; gap: 10px; line-height: 1.5; color: var(--text2); font-size: 13px; }
label.check.consent input { width: 18px; height: 18px; flex: none; margin-top: 2px; }

/* v1.6.0 · Terminal */
.tr-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 16px; margin-bottom: 12px; }
.tr-head small { color: var(--text3); font-size: 12px; }
.tr-open { max-width: 360px; display: grid; gap: 12px; }
.tr-quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 8px; }
.tr-quick .chip { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.tr-out { background: #0A0E14; color: #D9E6F5; border: 1px solid var(--line); border-radius: var(--r) var(--r) 0 0; height: min(52vh, 520px); overflow: auto; padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.55; }
.tr-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.tr-line.cmd { color: #7DB4FF; margin-top: 6px; }
.tr-line.dim { color: #7A8799; }
.tr-line.ok { color: #4ADE80; }
.tr-line.warn { color: #FBBF24; }
.tr-line.bad { color: #F87171; }
.tr-in { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r) var(--r); padding: 8px 10px; }
.tr-in input { flex: 1; min-width: 180px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.tr-prompt { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--accent); white-space: nowrap; }
@media (max-width: 640px) { .tr-prompt { display: none; } .tr-head { flex-direction: column; align-items: flex-start; } }
#ask-msg { white-space: pre-wrap; overflow-wrap: anywhere; }
