/* DETCREDE — dashboard
 * Tokens de cor em :root (tema escuro por padrão do SO ou escolhido).
 * Regra visual (T-404): uma variável por significado — ícone = classe do
 * equipamento, opacidade/traço = estado, vermelho = risco (a única cor forte).
 */

:root {
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --header-h: 56px;

  /* tema claro */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e6e9ee;
  --border: #dde1e7;
  --border-strong: #c5cbd4;
  --text: #16191f;
  --text-2: #4a525e;
  --text-3: #6b7380;
  --accent: #2f6fed;
  --accent-hover: #255ed0;
  --accent-soft: #e8f0fe;
  --on-accent: #ffffff;
  --bar: #2f6fed;
  --bar-text: #ffffff;
  --bar-hover: rgba(255, 255, 255, .16);
  --link: #3aa757;
  --port-access: #bfe9dd;
  --port-access-text: #146c5a;
  --port-trunk: #fbd3ad;
  --port-trunk-text: #8a4b0f;
  --port-other: #e3e6ea;
  --card: #ffffff;
  --card-border: #e2e6eb;
  --risk: #c62828;
  --risk-soft: #fdecec;
  --risk-border: #f0b8b8;
  --warn: #9a5b00;
  --warn-soft: #fff3dc;
  --ok: #1e7a45;
  --ok-soft: #e4f4ea;
  --canvas: #eef1f5;
  --edge: #8a93a0;
  --edge-inferred: #a3abb6;
  --group-bg: rgba(255, 255, 255, .55);
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
  --focus: 0 0 0 3px rgba(47, 111, 237, .35);
  --sidebar: #fafbfc;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e1116;
  --surface: #161a21;
  --surface-2: #1c212a;
  --surface-3: #252b35;
  --border: #2a303a;
  --border-strong: #3a424f;
  --text: #e8eaee;
  --text-2: #b3bac5;
  --text-3: #8b94a1;
  --accent: #5b9bf0;
  --accent-hover: #7aaef4;
  --accent-soft: #1b2a42;
  --on-accent: #0b1220;
  --risk: #ff6b6b;
  --risk-soft: #3a1a1c;
  --risk-border: #6b2a2d;
  --warn: #f0b458;
  --warn-soft: #33270f;
  --ok: #5fcf8e;
  --ok-soft: #13301f;
  --canvas: #12161c;
  --edge: #7a8391;
  --edge-inferred: #5d6573;
  --group-bg: #181d25;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 12px rgba(0, 0, 0, .3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
  --focus: 0 0 0 3px rgba(91, 155, 240, .45);
  --sidebar: #13171d;
  --bar: #1a2a4a;
  --bar-text: #e8eaee;
  --bar-hover: rgba(255, 255, 255, .1);
  --link: #4fbf6c;
  --port-access: #1d4a40;
  --port-access-text: #9be3cf;
  --port-trunk: #53391d;
  --port-trunk-text: #f7c692;
  --port-other: #2a303a;
  --card: #1c212a;
  --card-border: #2f3642;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
[hidden] { display: none !important; }

.icon { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 2; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }

.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ─── Botões e campos ───────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); }
.btn:focus-visible, .input:focus-visible, .select:focus-visible, .tab:focus-visible,
.icon-btn:focus-visible, .row-link:focus-visible, textarea:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--risk); border-color: var(--risk-border); }
.btn-danger:hover:not(:disabled) { background: var(--risk-soft); border-color: var(--risk); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.ghost { border-color: transparent; background: transparent; }

.input, .select, textarea.input {
  height: 34px; padding: 0 10px; min-width: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; }
.input::placeholder { color: var(--text-3); }
.select { padding-right: 28px; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .field-label { font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }

.search-box { position: relative; display: flex; align-items: center; }
.search-box .icon { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.search-box .input { padding-left: 32px; width: 100%; }

/* ─── Selos ─────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge.risk { background: var(--risk-soft); color: var(--risk); border-color: var(--risk-border); }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: var(--text-3); }
.dot.online { background: var(--ok); }
.dot.offline { background: transparent; border: 1.5px solid var(--text-3); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }

/* ─── Login ─────────────────────────────────────────────────────────── */

.login-view {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: var(--bg);
}
.login-card {
  width: 100%; max-width: 380px; padding: 28px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 18px;
}
.login-card .brand { margin-bottom: 4px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.form-error {
  padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--risk-soft); color: var(--risk); border: 1px solid var(--risk-border);
  font-size: 13px;
}

/* ─── Cabeçalho ─────────────────────────────────────────────────────── */

.app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.app-header {
  flex-shrink: 0; z-index: 30;
  height: var(--header-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px 0 10px;
  background: var(--bar); color: var(--bar-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: .02em; font-size: 15px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent);
}
.app-header .brand-mark { background: rgba(255, 255, 255, .18); color: var(--bar-text); }
.brand-mark .icon { width: 17px; height: 17px; }

.icon-btn.on-bar { background: transparent; border-color: transparent; color: var(--bar-text); }
.icon-btn.on-bar:hover { background: var(--bar-hover); color: var(--bar-text); }
.btn-on-bar { background: rgba(255, 255, 255, .95); border-color: transparent; color: #1b3f8f; }
.btn-on-bar:hover:not(:disabled) { background: #fff; border-color: transparent; }
:root[data-theme="dark"] .btn-on-bar { background: var(--accent); color: var(--on-accent); }

.site-picker {
  display: flex; align-items: center; gap: 6px; margin-left: 10px;
  padding: 0 4px 0 10px; height: 34px; border-radius: var(--radius-sm); background: var(--bar-hover);
}
.site-picker .select {
  max-width: 240px; height: 32px; font-weight: 600; border: 0; background: transparent; color: var(--bar-text);
}
.site-picker .select option { color: var(--text); background: var(--surface); }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.ws-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--bar-text); opacity: .9; padding: 0 4px; }
.ws-dot .dot { background: rgba(255, 255, 255, .6); }
.ws-dot.connected .dot { background: #7ee29a; }
.ws-dot.connecting .dot { background: #ffd27a; }

.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 8px 0 4px;
  border: 0; border-radius: 999px; background: var(--bar-hover); color: var(--bar-text); cursor: pointer;
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: var(--bar); font-weight: 800; font-size: 12px;
}
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: 40;
  padding: 6px; background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.menu-head { padding: 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 0; background: none; border-radius: var(--radius-sm); cursor: pointer; text-align: left;
}
.menu-item:hover { background: var(--surface-2); }

/* ─── Menu lateral ──────────────────────────────────────────────────── */

.shell { flex: 1; min-height: 0; display: flex; }
.sidenav {
  width: 252px; flex-shrink: 0; overflow-y: auto; overflow-x: hidden; padding: 10px 8px;
  background: var(--sidebar, var(--surface)); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidenav:hover {
  scrollbar-color: var(--border) transparent;
}
.sidenav::-webkit-scrollbar {
  width: 4px;
}
.sidenav::-webkit-scrollbar-track {
  background: transparent;
}
.sidenav::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
}
.sidenav:hover::-webkit-scrollbar-thumb {
  background: var(--border);
}
.sidenav::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
}

/* Seções recolhíveis (padrão "sidebar group" moderno). */
.nav-section { display: flex; flex-direction: column; margin-bottom: 2px; }
.nav-items { display: flex; flex-direction: column; gap: 2px; }
.nav-section.closed .nav-items { display: none; }
.nav-group {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  height: 28px; padding: 0 8px; margin-top: 6px; border: 0; border-radius: var(--radius-sm);
  background: none; cursor: pointer; text-align: left;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3);
  transition: color .15s, background .15s;
}
.nav-section:first-child .nav-group { margin-top: 0; }
.nav-group:hover { color: var(--text); background: var(--surface-2); }
.nav-group:focus-visible { outline: none; box-shadow: var(--focus); }
.nav-caret { transition: transform .15s; width: 14px; height: 14px; opacity: 0.6; }
.nav-section.closed .nav-caret { transform: rotate(-90deg); }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px;
  border: 0; border-radius: 8px; background: none; cursor: pointer;
  color: var(--text-2); font-weight: 500; font-size: 13.5px; text-align: left;
  transition: all .15s ease;
}
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.nav-sub-toggle { margin-left: auto; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 4px; color: var(--text-3); }
.nav-sub-toggle:hover { background: var(--surface-3); color: var(--text); }
.nav-sub-toggle .icon { transition: transform .15s; }
.nav-sub-toggle.closed .icon { transform: rotate(-90deg); }
.nav-sub.closed { display: none; }
.nav-item:focus-visible { outline: none; box-shadow: var(--focus); }
.nav-item .count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  display: inline-grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--risk); color: #fff;
}
.nav-sub { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 4px 12px; padding-left: 8px; border-left: 1px solid var(--border); }
.nav-sub:empty { display: none; }
.nav-item-sub { height: 30px; font-size: 12.5px; font-weight: 500; border-radius: 6px; }
.nav-item-sub .icon { width: 14px; height: 14px; }
.nav-item-sub span:not(.nav-num) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.nav-num { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; padding: 1px 6px; background: var(--surface-2); border-radius: 10px; }
.nav-more { color: var(--text-3); }
.inv-cat-note { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.inv-cat-note[hidden] { display: none; }
.shell.collapsed .nav-sub { margin: 0; padding: 0; border: 0; }
.shell.collapsed .nav-num { display: none; }
.shell.collapsed .sidenav { width: 58px; padding: 8px 4px; }
.shell.collapsed .nav-item span:not(.count), .shell.collapsed .nav-group { display: none; }
.shell.collapsed .nav-section.closed .nav-items { display: flex; }
.shell.collapsed .nav-section + .nav-section { border-top: 1px solid var(--border); padding-top: 4px; }
.shell.collapsed .nav-item { justify-content: center; padding: 0; position: relative; }
.shell.collapsed .nav-item .count { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; font-size: 10px; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-y: auto; }
.content:has(> main > .map-view:not([hidden])) { overflow: hidden; }

/* ─── Abas (painel lateral, VLANs) ─────────────────────────────────── */

.tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  height: 42px; padding: 0 12px;
  border: 0; background: none; cursor: pointer;
  color: var(--text-2); font-weight: 600; font-size: 13px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent); }
.tab[aria-selected="true"]::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px;
  background: var(--accent); border-radius: 2px 2px 0 0;
}
.seg { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.seg button {
  height: 30px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 12.5px; cursor: pointer;
}
.btn[aria-pressed="true"],
.seg button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ─── Painel (dashboard) ───────────────────────────────────────────── */

.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.dash-grid > .span-3 { grid-column: span 3; }
.dash-grid > .span-4 { grid-column: span 4; }
.dash-grid > .span-5 { grid-column: span 5; }
.dash-grid > .span-6 { grid-column: span 6; }
.dash-grid > .span-7 { grid-column: span 7; }
.dash-grid > .span-8 { grid-column: span 8; }
.dash-grid > .span-12 { grid-column: span 12; }
.widget { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.widget-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.widget-head h3 { font-size: 14px; }
.stat-tile { padding: 16px; display: flex; gap: 14px; align-items: center; }
.stat-tile .tile-icon {
  width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.stat-tile .tile-icon.risk { background: var(--risk-soft); color: var(--risk); }
.stat-tile .label { font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.stat-tile .value { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-tile .value.risk { color: var(--risk); }
.stat-tile .sub { font-size: 12px; color: var(--text-3); }
.bar-list { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--accent); border-radius: 4px; }
.bar-row .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.legend-list { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.legend-list span.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ─── Barra de varredura ────────────────────────────────────────────── */

.scan-bar {
  display: flex; align-items: center; gap: 14px; padding: 8px 16px;
  background: var(--accent-soft); border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.scan-bar .progress { flex: 1; max-width: 420px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.scan-bar .progress > span { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.scan-bar .scan-text { display: flex; flex-direction: column; min-width: 0; }
.scan-bar .scan-detail { color: var(--text-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Páginas ───────────────────────────────────────────────────────── */

main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* Páginas ocupam a largura toda (antes: 1440px centralizado, com faixas vazias). */
.page { padding: 20px 28px 32px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; font-weight: 700; }
.page-head p { color: var(--text-2); margin-top: 3px; max-width: 760px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 16px; }
.card h3 { font-size: 15px; }

.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
}
.notice.warn { background: var(--warn-soft); border-color: transparent; color: var(--text); }
.notice.risk { background: var(--risk-soft); border-color: var(--risk-border); color: var(--text); }
.notice.ok { background: var(--ok-soft); border-color: transparent; color: var(--text); }
.notice.info { background: var(--accent-soft); border-color: transparent; color: var(--text); }

/* Identificação: barra de confiança e tabelas compactas de evidência. */
.conf-bar { display: inline-block; width: 90px; height: 6px; border-radius: 3px; background: var(--border); vertical-align: middle; margin: 0 6px; overflow: hidden; }
.conf-bar > span { display: block; height: 100%; border-radius: 3px; }
.conf-bar.conf-ok > span { background: var(--ok); }
.conf-bar.conf-info > span { background: var(--accent); }
.conf-bar.conf-warn > span { background: var(--warn); }
.table.compact th, .table.compact td { padding: 6px 8px; font-size: 12.5px; vertical-align: top; }
details.section > summary { cursor: pointer; list-style: revert; }
.notice .icon { margin-top: 1px; }
.notice strong { color: var(--text); }

.empty {
  padding: 40px 20px; text-align: center; color: var(--text-2);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty h3 { color: var(--text); font-size: 15px; }
.empty p { max-width: 520px; }
.empty .icon { width: 28px; height: 28px; color: var(--text-3); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 12px 14px; }
.kpi .label { font-size: 12px; color: var(--text-3); font-weight: 600; }
.kpi .value { font-size: 22px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .value.risk { color: var(--risk); }

/* ─── Tabelas ───────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; font-size: 12px; font-weight: 700; color: var(--text-3);
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
  background: var(--surface); position: sticky; top: 0;
}
table.data th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
table.data th button:focus-visible { box-shadow: var(--focus); border-radius: 4px; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover td { background: var(--surface-2); }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--text-3); }
.type-cell { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); }
.table-foot { padding: 10px 12px; font-size: 12.5px; color: var(--text-3); border-top: 1px solid var(--border); }

/* ─── Mapa ──────────────────────────────────────────────────────────── */

.map-view { position: relative; flex: 1; min-height: 480px; display: flex; flex-direction: column; }
.map-top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.map-summary { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.map-summary b { color: var(--text); font-variant-numeric: tabular-nums; }
.map-summary .risk b { color: var(--risk); }
.map-top .search-box { width: 280px; }
.map-top .toolbar { margin-left: auto; }

.map-body { flex: 1; min-height: 0; display: flex; }
.map-canvas-wrap { position: relative; flex: 1; min-width: 0; min-height: 0; }
#cy { position: absolute; inset: 0; background: var(--canvas); }
/* Menu de contexto por classe de equipamento (T-514 / SPEC-04) */
.node-menu {
  position: absolute; z-index: 20; min-width: 220px; max-width: 280px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.node-menu-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px 6px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  border-bottom: 1px solid var(--border); margin-bottom: 4px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.node-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text);
  font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.node-menu-item:hover, .node-menu-item:focus-visible { background: var(--surface-2); outline: none; }
.node-menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.node-menu-item.danger { color: var(--risk); }
.node-menu-note { padding: 6px 10px; font-size: 12px; color: var(--text-2); }
/* Propriedade declarada no perfil e ainda não coletada (T-515) */
.fact.missing .fact-val { color: var(--text-2); font-style: italic; }
.map-dock {
  width: 580px; max-width: 48%; min-width: 380px; flex-shrink: 0; min-height: 0;
  border-left: 1px solid var(--border); background: var(--surface);
  display: flex; flex-direction: column;
}
.map-dock[hidden] { display: none; }
.drawer.docked {
  position: relative; inset: auto; z-index: auto; width: 100%; height: 100%;
  border-left: 0; box-shadow: none;
}

.map-cats {
  display: flex; gap: 6px; flex-wrap: wrap; flex-basis: 100%; order: 3; min-width: 0;
}
.map-cats[hidden] { display: none; }
.map-cat {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 10px; cursor: pointer;
  font: inherit; font-size: 12px; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
}
.map-cat b { color: var(--text); font-size: 13px; }
.map-cat-total { color: var(--text-3); margin-left: -5px; }
.map-cat:hover { border-color: var(--accent); }
.map-cat.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.map-cat.active b, .map-cat.active .map-cat-total { color: #fff; }
.map-legend {
  position: absolute; left: 16px; bottom: 16px; z-index: 5;
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
  padding: 8px 12px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  font-size: 12px; color: var(--text-2);
}
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-line { width: 26px; height: 0; border-top: 2px solid var(--link); }
.legend-pill {
  display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 9px;
  border: 1px solid var(--link); color: var(--link); background: var(--surface); font-size: 11px; font-weight: 600;
}
.legend-line.dashed { border-top-style: dashed; border-top-color: var(--edge-inferred); }
.legend-risk { width: 12px; height: 12px; border-radius: 3px; border: 2px solid var(--risk); background: var(--risk-soft); }

.map-empty { position: absolute; inset: 0; display: grid; place-items: center; z-index: 4; pointer-events: none; }
.map-empty .card { pointer-events: auto; max-width: 440px; }

/* ─── Painel lateral (drawer) ───────────────────────────────────────── */

.drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .25); z-index: 49; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(640px, 100vw); display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.drawer-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.drawer-head h3 { font-size: 18px; word-break: normal; overflow-wrap: anywhere; }
/* O bloco do título nunca encolhe abaixo de 260px: quando falta espaço, são os
   botões que descem para a linha de baixo (antes o título quebrava letra a letra). */
.drawer-head > div:first-child { min-width: min(260px, 100%) !important; }
.drawer-head .sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.drawer-head .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.drawer-head .actions { margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
/* Abas do painel lateral: quebram linha quando não cabem (drawer docked de
   500px tem 7 abas) em vez de criar scroll horizontal. */
.drawer-tabs { display: flex; flex-wrap: wrap; gap: 0 2px; padding: 0 10px; border-bottom: 1px solid var(--border); }
.drawer-tabs .tab { height: 40px; font-size: 13px; padding: 0 9px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px 28px; display: flex; flex-direction: column; gap: 18px; }

/* Editor de notas EasyMDE (T-625): integra com os tokens de tema. */
.EasyMDEContainer .CodeMirror {
  background: var(--surface); color: var(--text); border-color: var(--border);
  border-radius: 0 0 var(--radius) var(--radius); min-height: 280px;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13.5px;
}
.EasyMDEContainer .CodeMirror-cursor { border-color: var(--text); }
.EasyMDEContainer .editor-toolbar {
  background: var(--surface-2); border-color: var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}
.EasyMDEContainer .editor-toolbar button { color: var(--text-2) !important; }
.EasyMDEContainer .editor-toolbar button:hover,
.EasyMDEContainer .editor-toolbar button.active { background: var(--surface-3); border-color: var(--border); }
.EasyMDEContainer .editor-toolbar i.separator { border-color: var(--border); }
.EasyMDEContainer .CodeMirror-selected { background: var(--accent-soft) !important; }

/* Histórico de mudanças do ativo (T-310) */
.timeline { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline-item:last-child { border-bottom: 0; }
.timeline-icon { flex: 0 0 26px; height: 26px; width: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--text-2); }
.timeline-body { flex: 1; min-width: 0; }
.timeline-text { font-size: 13.5px; line-height: 1.45; word-break: break-word; }
.timeline-text .mono { font-size: 12.5px; }
.timeline-item.change-ok .timeline-icon { background: var(--ok-soft); color: var(--ok); }
.timeline-item.change-warn .timeline-icon { background: var(--warn-soft); color: var(--warn); }
.timeline-item.change-info .timeline-icon { background: var(--accent-soft); color: var(--accent); }

.section h4 { font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: minmax(92px, 150px) 1fr; gap: 7px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; word-break: break-word; }
.not-informed { color: var(--text-3); font-style: italic; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; height: 24px; padding: 0 8px;
  border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12px; font-family: var(--font-mono);
}

.fact-group { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.fact-group + .fact-group { margin-top: 10px; }
.fact-group-head { padding: 8px 12px; background: var(--surface-2); font-weight: 700; font-size: 13px; display: flex; justify-content: space-between; }
.fact { padding: 9px 12px; border-top: 1px solid var(--border); }
.fact-key { font-size: 12px; color: var(--text-3); display: flex; justify-content: space-between; gap: 8px; }
.fact-val { font-family: var(--font-mono); font-size: 12.5px; margin-top: 3px; word-break: break-word; white-space: pre-wrap; }
pre.raw {
  margin: 0; padding: 12px; max-height: 300px; overflow: auto;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 12px; white-space: pre-wrap; word-break: break-word;
}
details.collapsible summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-2); padding: 4px 0; }

/* Painel de portas: cor = tipo (access/trunk), LED = link, contorno = selecionada */
.port-strip {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 12px;
  border: 1px solid var(--card-border); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow);
}
.port {
  width: 40px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px 0 5px; border: 1.5px solid transparent; border-radius: 6px; cursor: pointer;
  background: var(--port-other); color: var(--text-2);
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
}
.port.access { background: var(--port-access); color: var(--port-access-text); }
.port.trunk { background: var(--port-trunk); color: var(--port-trunk-text); }
.port .jack { width: 22px; height: 16px; border-radius: 2px; background: #59626d; position: relative; }
.port .jack::after { content: ''; position: absolute; left: 6px; right: 6px; top: 0; height: 4px; background: rgba(255, 255, 255, .35); border-radius: 0 0 2px 2px; }
.port.up .jack { background: #2e3a45; box-shadow: 0 0 0 2px var(--link) inset; }
.port .poe { font-size: 8.5px; line-height: 1; opacity: .8; }
.port.selected { border-color: var(--accent); box-shadow: var(--focus); }
.port-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.port-legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.port-legend .l-access::before { background: var(--port-access); }
.port-legend .l-trunk::before { background: var(--port-trunk); }
.port-legend .l-other::before { background: var(--port-other); }
.port-legend .l-up::before { background: #2e3a45; box-shadow: 0 0 0 2px var(--link) inset; }

.dev-head { display: grid; grid-template-columns: 96px 1fr; gap: 6px 12px; font-size: 13px; }
.dev-head dt { color: var(--text-3); }
.dev-head dd { margin: 0; overflow-wrap: anywhere; }
.dev-art { width: 96px; height: 60px; flex-shrink: 0; background-size: contain; background-repeat: no-repeat; background-position: center; }


.member-fdb { cursor: default; background: var(--surface-2); }
.member-fdb .cell-main { color: var(--text-2); }
.member-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.member {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
  padding: 9px 12px; border-top: 1px solid var(--border); cursor: pointer; background: var(--surface);
  text-align: left; border-left: 0; border-right: 0; border-bottom: 0; width: 100%;
}
.member:first-child { border-top: 0; }
.member:hover { background: var(--surface-2); }

.cred-result { padding: 10px 12px; border-radius: var(--radius); font-size: 13px; }
.cred-result.ok { background: var(--ok-soft); }
.cred-result.fail { background: var(--risk-soft); }

/* ─── Riscos / CFTV / Sites / Perfis ────────────────────────────────── */

.list { display: flex; flex-direction: column; gap: 10px; }
.alert-card { padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; }
.alert-card.risky { border-left: 3px solid var(--risk); }
.alert-card .title { font-weight: 700; }
.alert-card .desc { color: var(--text-2); grid-column: 1 / 2; }
.alert-card .meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); grid-column: 1 / 2; }
.alert-card .side { grid-row: 1 / span 3; grid-column: 2; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.alert-card.resolved { opacity: .7; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.cam-card { overflow: hidden; display: flex; flex-direction: column; }
.cam-shot {
  aspect-ratio: 16 / 9; background: var(--surface-3); display: grid; place-items: center;
  color: var(--text-3); font-size: 12.5px; border: 0; padding: 0; width: 100%; cursor: zoom-in;
}
.cam-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-shot.none { cursor: default; flex-direction: column; gap: 6px; display: flex; align-items: center; justify-content: center; }
.cam-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.cam-actions { display: flex; gap: 6px; margin-top: auto; }

.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.site-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.site-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.site-card h3 { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.optin-box { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.optin-state { display: flex; gap: 8px; flex-wrap: wrap; }

.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }

/* ─── Modais ────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .4);
  display: grid; place-items: center; padding: 20px;
}
.modal {
  width: 100%; max-width: 520px; max-height: calc(100vh - 40px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
}
.modal.lg { max-width: 820px; }
.modal-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 12px; }
.modal-head h3 { font-size: 16px; }
.modal-head p { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.chips-select { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  height: 28px; padding: 0 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); font-family: var(--font-mono); font-size: 12px;
}
.chip-btn:hover { border-color: var(--accent); }
.chip-btn .muted { font-family: var(--font-sans); }
.code-area { font-family: var(--font-mono); font-size: 12.5px; min-height: 240px; }

.lightbox { max-width: 1000px; }
.lightbox img { width: 100%; display: block; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.print-choice-card {
  transition: border-color .18s ease, box-shadow .18s ease, transform .12s ease;
}
.print-choice-card:hover {
  border-color: var(--accent) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}
.print-choice-card:active {
  transform: scale(0.995);
}

/* ─── Toasts ────────────────────────────────────────────────────────── */

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 70; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; gap: 10px; align-items: flex-start; width: 340px; max-width: calc(100vw - 32px);
  padding: 11px 13px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  font-size: 13px; animation: toast-in .18s ease-out;
}
.toast.risk { border-left: 3px solid var(--risk); }
.toast.ok { border-left: 3px solid var(--ok); }
.toast .t-title { font-weight: 700; }
.toast .t-msg { color: var(--text-2); }
@keyframes toast-in { from { transform: translateY(6px); opacity: 0; } }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 1100px) {
  .site-picker .select { max-width: 150px; }
  .ws-dot span:not(.dot) { display: none; }
  .map-top .search-box { width: 200px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app-header { flex-wrap: wrap; height: auto; padding: 8px 12px; }
  .tabs { order: 3; width: 100%; }
  .tab { height: 40px; }
  .page { padding: 16px; }
  .field-row { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
}

/* ── Notas (Épico D / RF-34) ─────────────────────────────────────────── */
.notes-layout { display: grid; grid-template-columns: 220px minmax(240px, 320px) 1fr; gap: 12px; min-height: calc(100vh - 190px); }
.notes-books, .notes-list, .notes-editor { padding: 10px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.notes-book-row { display: flex; align-items: center; gap: 2px; }
.notes-book { flex: 1; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; min-width: 0; }
.notes-book span:first-of-type { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-book:hover, .notes-book.active { background: var(--surface-2); }
.notes-book.active { box-shadow: inset 3px 0 0 var(--accent); }
.notes-new-book { margin-top: auto; }
.notes-items { display: flex; flex-direction: column; gap: 4px; overflow: auto; }
.notes-item { display: flex; flex-direction: column; gap: 3px; width: 100%; padding: 9px 10px; border: 1px solid transparent;
  border-radius: var(--radius-sm); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer;
  box-shadow: inset 3px 0 0 var(--border); }
.notes-item:hover { background: var(--surface-2); }
.notes-item.active { border-color: var(--accent); background: var(--surface-2); }
.notes-item.kind-warning { box-shadow: inset 3px 0 0 #d4a106; }
.notes-item.kind-danger { box-shadow: inset 3px 0 0 var(--risk); }
.notes-item.kind-success { box-shadow: inset 3px 0 0 #2e9d5b; }
.notes-snippet { font-size: 12px; color: var(--text-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notes-snippet mark { background: var(--accent-soft); color: var(--text); border-radius: 3px; padding: 0 2px; }
.notes-empty { padding: 12px 4px; }
.notes-active-filters { margin: 2px 0; }
.notes-title { font-size: 18px; font-weight: 600; width: 100%; border: 0; border-bottom: 1px solid var(--border); background: transparent;
  color: var(--text); padding: 6px 2px; }
.notes-title:focus { outline: none; border-bottom-color: var(--accent); }
.notes-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.notes-meta label { display: flex; flex-direction: column; gap: 3px; }
.notes-meta .grow { flex: 1; min-width: 180px; }
.notes-meta select, .notes-meta input { font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.notes-link { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--text-2); }
.notes-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.notes-toolbar .grow { flex: 1; }
.btn.danger { color: var(--risk); }
.notes-conflict { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; padding: 10px; border-radius: var(--radius-sm);
  background: var(--risk-soft); color: var(--text); font-size: 13px; }
.notes-body { flex: 1; min-height: 320px; width: 100%; resize: vertical; padding: 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font: 13px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
.notes-body:focus { outline: none; border-color: var(--accent); }
.notes-preview { flex: 1; min-height: 320px; padding: 4px 6px; overflow: auto; }
.md h1, .md h2, .md h3 { margin: 14px 0 6px; } .md h1 { font-size: 20px; } .md h2 { font-size: 17px; } .md h3 { font-size: 15px; }
.md p, .md ul, .md ol, .md pre, .md table, .md blockquote { margin: 0 0 10px; }
.md ul, .md ol { padding-left: 22px; }
.md code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.md pre { background: var(--surface-2); padding: 10px; border-radius: var(--radius-sm); overflow: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { border-left: 3px solid var(--border); padding-left: 10px; color: var(--text-2); }
.md table { border-collapse: collapse; } .md th, .md td { border: 1px solid var(--border); padding: 4px 8px; }
.md img { max-width: 100%; border-radius: var(--radius-sm); }
.md-fallback { white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.notes-attachments h4 { display: flex; align-items: center; gap: 6px; margin: 12px 0 6px; font-size: 13px; }
.notes-att { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-top: 1px solid var(--border); font-size: 13px; }
.notes-att .grow { flex: 1; }
.notes-foot { margin-top: 6px; }
.notes-version { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.linklike { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
@media (max-width: 1100px) { .notes-layout { grid-template-columns: 1fr; } .notes-books { flex-direction: row; flex-wrap: wrap; } }
/* Imprimir a nota como PDF: só o texto renderizado */
@media print {
  body.printing-note * { visibility: hidden; }
  body.printing-note .notes-editor .notes-title, body.printing-note #note-preview, body.printing-note #note-preview * { visibility: visible; }
  body.printing-note #note-preview { position: absolute; left: 0; top: 40px; width: 100%; }
  body.printing-note .notes-editor .notes-title { position: absolute; left: 0; top: 0; border: 0; }
}

/* Formulário de host manual (T-540) */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ─── Formulários em grade (modais) ─────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .field { font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.form-grid .field.full { grid-column: 1 / -1; }
.form-grid .field.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.form-grid .field[hidden] { display: none; }
.select-sm { height: 30px; font-size: 12.5px; padding-top: 0; padding-bottom: 0; }

/* ─── Administração (T-602..T-604) ─────────────────────────────────── */
.admin-tabs { display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.admin-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.admin-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.admin-head p { margin: 0; max-width: 820px; font-size: 13px; line-height: 1.5; }
.admin-head .btn { flex-shrink: 0; }
.admin-sub { margin: 6px 0 0; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.row-actions { white-space: nowrap; text-align: right; }
.empty-inline { display: flex; gap: 12px; align-items: center; padding: 18px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-2); }
.empty-inline p { margin: 0; font-size: 13px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-pick label { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; color: var(--text-2); }
.icon-pick input { position: absolute; opacity: 0; pointer-events: none; }
.icon-pick label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.icon-pick label:has(input:focus-visible) { box-shadow: var(--focus); }
@media (max-width: 760px) {
  .form-grid { grid-template-columns: 1fr; }
  .admin-head { flex-direction: column; }
}

/* ─── Painel frontal de portas (etapa 1 / A3) ─────────────────────── */
.faceplate {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px; overflow-x: auto;
  border: 1px solid var(--card-border); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow);
}
.fp-block { display: flex; flex-direction: column; gap: 5px; }
.fp-side { padding-left: 10px; border-left: 2px solid var(--border); }
.fp-row { display: flex; gap: 3px; }
/* Portas compactas: um switch de 24–28 portas cabe em 2 fileiras mesmo no
   painel encaixado no mapa (500px), sem precisar rolar na horizontal. */
.faceplate .port { width: 28px; flex-shrink: 0; font-size: 10px; padding: 3px 0 4px; }
.faceplate .port .jack { width: 18px; height: 13px; }
.port.sfp .jack { width: 22px; height: 10px; border-radius: 1px; background: #8a939d; }
.port.mgmt .jack { background: #b07a2a; }
.port.unread { background: var(--surface-2); color: var(--text-3); border: 1.5px dashed var(--border-strong); }
.port.unread .jack { background: #9aa3ae; opacity: .7; }
.model-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.model-pick {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; cursor: pointer;
  text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.model-pick:hover { border-color: var(--accent); }
.model-pick:disabled { opacity: .6; cursor: progress; }

.ports-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.ports-head h4 { margin: 0; }

.cam-shot { border-radius: var(--radius); overflow: hidden; background: #0f1419; min-height: 120px; display: grid; place-items: center; }
.cam-shot img { display: block; width: 100%; height: auto; }

.stat-tile.clickable, .bar-row.clickable { cursor: pointer; }
.stat-tile.clickable:hover { border-color: var(--accent); }
.bar-row.clickable:hover .type-cell { color: var(--accent); }
.stat-tile.clickable:focus-visible, .bar-row.clickable:focus-visible { outline: none; box-shadow: var(--focus); }

.local-nets { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.local-net { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.local-net .select-sm { width: auto; }

.probe-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }
.probe-opt { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.probe-opt > span { display: flex; flex-direction: column; gap: 1px; }
.probe-opt input { margin-top: 3px; }
@media (max-width: 760px) { .probe-grid { grid-template-columns: 1fr; } }

.local-net { flex-wrap: nowrap; }
.local-net .iface { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.local-net .badge { flex-shrink: 0; }

.optin-box-edit { display: flex; flex-direction: column; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }

.row-off { opacity: .55; }
.switch-sm { position: relative; display: inline-block; width: 34px; height: 18px; }
.switch-sm input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-sm span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: background .15s; cursor: pointer; }
.switch-sm span::before { content: ''; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch-sm input:checked + span { background: var(--accent); }
.switch-sm input:checked + span::before { transform: translateX(16px); }

.admin-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); }
.admin-foot strong { color: var(--text-2); font-variant-numeric: tabular-nums; }

.input-with-btn { display: flex; gap: 6px; }
.input-with-btn .input { flex: 1; min-width: 0; }
.input-with-btn .btn { flex-shrink: 0; }

/* T-609: papel só-leitura (Auditor/Leitura) esconde as ações de escrita. */
body[data-role="readonly"] [data-write] { display: none !important; }

/* T-609: abas dentro de modais (formulário do site). */
.modal-tabs { border-bottom: 1px solid var(--border); margin-bottom: 14px; gap: 2px; }
.modal-tabs .tab { height: 38px; font-size: 13px; }
.tab-panel { display: flex; flex-direction: column; gap: 12px; }
.tab-panel[hidden] { display: none; }

/* Inspetor de porta: hosts vistos atrás de um uplink. */
.port-hosts { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; max-height: 220px; overflow: auto; }
.port-hosts li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 12.5px; }

/* Etiquetas que podem ter texto longo (evidências): quebram, sem rolagem lateral. */
.tags-wrap { flex-wrap: wrap; }
.tags-wrap .tag { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }

/* Endereços IP (T-904) */
.ipam-subnets { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.ipam-card { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; display: grid; gap: 8px; color: var(--text); }
.ipam-card:hover { border-color: var(--accent); }
.ipam-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.ipam-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ipam-card-counts { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.ipam-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--border); }
.ipam-bar .in-use { background: var(--ok); }
.ipam-bar .seen { background: var(--warn); opacity: .6; }
table.data tbody tr.ipam-free td { color: var(--text-3); padding-top: 4px; padding-bottom: 4px; }

/* Impressões por período (T-908) */
.data th.num, .data td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.prn-table tfoot td { border-top: 2px solid var(--border); padding-top: 10px; }
.prn-table td .icon-btn { vertical-align: middle; }
.prn-table td { vertical-align: top; }
.prn-table td:nth-child(2) { max-width: 240px; }
.prn-sup { max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prn-sup .icon { vertical-align: -2px; margin-right: 3px; }
.prn-table td:last-child { white-space: nowrap; }

/* Ligados há mais de N horas (T-913) */
.uptime-grid { display: grid; grid-template-columns: minmax(220px, 280px) 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .uptime-grid { grid-template-columns: 1fr; } }
.uptime-kpis { display: grid; gap: 12px; }
.uptime-kpis .value { font-size: 28px; font-weight: 800; }
.uptime-kpis .value.warn { color: var(--warn); }
.uptime-days { display: flex; align-items: flex-end; gap: 2px; height: 40px; }
.uptime-day { flex: 1; background: var(--warn); opacity: .7; border-radius: 2px 2px 0 0; min-width: 3px; }
.uptime-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Suprimentos da impressora (T-908) */
.supply-list { display: grid; gap: 10px; }
.supply-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.supply-track { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.supply-fill { height: 100%; border-radius: 5px; }
.supply-fill.unknown { width: 100%; opacity: .18; background-image: repeating-linear-gradient(45deg, transparent 0 6px, rgba(255,255,255,.5) 6px 12px); }

/* Prévia da etiqueta (T-912) */
.lbl-preview { display: grid; justify-items: center; gap: 10px; padding: 18px 0 6px; overflow: hidden; }
.lbl-sample { background: #fff; color: #000; outline: 1px dashed var(--border-strong); transform-origin: top left; font-family: Arial, Helvetica, sans-serif; }
.lbl-sample .lbl { width: 100%; height: 100%; padding: 1.6mm; display: flex; gap: 1.5mm; align-items: center; overflow: hidden; }
.lbl-sample .lbl-text { flex: 1; min-width: 0; font-size: var(--f); line-height: 1.18; }
.lbl-sample .ln { overflow-wrap: anywhere; }
.lbl-sample .lbl-qr { width: var(--q); height: var(--q); flex: none; }
.lbl-sample .lbl-qr svg { width: 100%; height: 100%; }

/* Manual de operação (T-909) */
.man-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .man-layout { grid-template-columns: 1fr; } }
.man-side { position: sticky; top: 12px; padding: 12px; display: grid; gap: 10px; max-height: calc(100vh - 120px); overflow: auto; }
.man-toc { display: grid; gap: 2px; }
.man-toc a { padding: 6px 8px; border-radius: 6px; color: var(--text-2); text-decoration: none; font-size: 13px; }
.man-toc a:hover, .man-toc a.active { background: var(--accent-soft); color: var(--text); }
.man-body { padding: 18px 24px; line-height: 1.6; max-width: 900px; }
.man-body h1 { font-size: 22px; margin-top: 0; }
.man-body h2 { font-size: 18px; margin-top: 26px; padding-top: 8px; border-top: 1px solid var(--border); }
.man-sec:first-of-type h2 { border-top: 0; }
.man-body table { width: 100%; margin-bottom: 12px; }
@media print {
  .sidenav, .topbar, header, .man-side, #man-print, .page-head p { display: none !important; }
  .man-layout { display: block; }
  .man-body { box-shadow: none; border: 0; max-width: none; padding: 0; }
}

/* Estatística de impressões (T-908) */
.prn-stats { padding: 14px 16px; }
.prn-stats-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg-btn { background: var(--surface); border: 0; padding: 6px 12px; font: inherit; font-size: 13px; color: var(--text-2); cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.prn-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
@media (max-width: 860px) { .prn-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.prn-kpis .value { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.prn-chart { width: 100%; overflow: hidden; }
.usage-chart { width: 100%; height: auto; display: block; }
.usage-chart .g { stroke: var(--border); stroke-width: 1; }
.usage-chart .ax { fill: var(--text-3); font-size: 11px; }
.usage-chart .mono { fill: #475569; }
.usage-chart .color { fill: #d946ef; }
.usage-chart .rest { fill: var(--link); }
.usage-chart .none { stroke: var(--border-strong); stroke-width: 2; stroke-dasharray: 3 3; }
.usage-chart g:hover rect { opacity: .8; }
.prn-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 6px; }
.prn-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.prn-legend .sw.mono { background: #475569; } .prn-legend .sw.color { background: #d946ef; } .prn-legend .sw.rest { background: var(--link); }
.prn-legend .sw.none { background: none; border-top: 2px dashed var(--border-strong); height: 0; width: 14px; }

/* Porta com erro novo (T-917) */
.port.err { box-shadow: 0 0 0 2px var(--warn); }

/* Tabelas curtas de fatos por extenso (Fase 10) */
.fact-val { white-space: pre-line; }

/* Chatwoot por caixa de entrada (000051) e Integrações. */
.cw-conn-card {
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.cw-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.cw-meta-item { display: flex; flex-direction: column; gap: 2px; }
.cw-meta-item .muted { font-size: 11.5px; }

.cw-section-header {
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.cw-section-header:first-of-type { margin-top: 8px; }
.cw-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cw-section-title .icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
  flex-shrink: 0;
}
.cw-section-title h4 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}
.cw-section-title .muted {
  font-size: 12px;
  color: var(--text-3);
}

.cw-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}
.cw-grid > .card {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.cw-grid > .card .table-wrap {
  flex: 1;
}
@media (max-width: 1100px) {
  .cw-grid {
    grid-template-columns: 1fr;
  }
}

.cw-grid h3 { font-size: 15px; font-weight: 600; margin: 0; }
#cw-kind button { display: inline-flex; align-items: center; gap: 6px; }
#cw-pick-person option { padding: 4px 8px; }
.cw-sync-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.cw-sync-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.cw-sync-stat { display: flex; align-items: center; gap: 6px; font-size: 13px; }

.cw-inbox-table th, .cw-inbox-table td { vertical-align: middle; }

/* Estrutura da organização (T-1100). */
.struct-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: 14px; align-items: start; }
.struct-side { display: flex; flex-direction: column; gap: 14px; }
.struct-grid h3 { font-size: 14.5px; }
.tree-name { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tree-elbow { color: var(--text-3); font-family: var(--font-mono); }
.levels-grid { display: grid; grid-template-columns: auto 1fr 1fr; gap: 6px 8px; align-items: center; }
.ea-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow: auto; margin-top: 8px; }
.ea-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--border); }
@media (max-width: 1100px) { .struct-grid { grid-template-columns: 1fr; } }

/* Expediente (T-1104). */
.cal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.cal-card-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.cal-card h3 { font-size: 15px; }
.cal-summary { margin: 6px 0 10px; color: var(--text-2); font-family: var(--font-mono); font-size: 12.5px; }
.cal-week { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 12px; }
.cal-day { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; font-size: 13px; }
.cal-ents { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow: auto; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.cal-preview { grid-template-columns: 2fr 1.4fr 1fr auto; align-items: end; }
@media (max-width: 900px) { .cal-preview { grid-template-columns: 1fr; } }

/* Locais (T-1101). */
.kind-list { display: flex; flex-direction: column; }
.kind-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.kind-row .row-actions { margin-left: auto; }
.legacy-list { display: flex; flex-direction: column; gap: 8px; }
.legacy-row { display: grid; grid-template-columns: 1fr minmax(180px, 46%); gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }

/* Solicitante (T-1102): sem painel técnico. */
.requester-notice { padding: 40px 28px; max-width: 720px; }
.requester-notice h2 { margin-bottom: 8px; }
body.requester main, body.requester .sidenav .nav-section, body.requester #btn-scan, body.requester #entity-picker { display: none !important; }

/* Ligados fora do expediente (T-1103). */
.oh-days { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 6px; }
.oh-day { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.oh-bar { width: 100%; max-width: 26px; background: var(--accent); border-radius: 3px 3px 0 0; }
.oh-lbl { font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ── Chamados (Fase 12) ─────────────────────────────────────────────── */
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.prio { font-size: 12px; font-weight: 600; white-space: nowrap; }
.prio-5 { color: var(--risk); }
.prio-4 { color: var(--warn); }
.prio-3 { color: var(--text-2); }
.prio-2, .prio-1 { color: var(--text-3, var(--text-2)); font-weight: 500; }
.tk-table td { vertical-align: top; }
.tk-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.tk-main, .tk-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.tk-main h3, .tk-side h3 { font-size: 14px; margin-bottom: 8px; }
@media (max-width: 1000px) { .tk-layout { grid-template-columns: 1fr; } }
.tk-timeline { display: flex; flex-direction: column; gap: 8px; }
.tk-msg { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--surface); }
.tk-msg.requester { background: var(--surface-2); }
.tk-msg.private { border-style: dashed; background: var(--warn-soft); }
.tk-msg-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.tk-event { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-2); padding: 0 4px; }
.tk-event > span:first-of-type { flex: 1; min-width: 0; }
.tk-reply { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.tk-reply .toolbar { justify-content: flex-end; flex-wrap: wrap; }
.tk-tasks { display: flex; flex-direction: column; gap: 4px; }
.tk-task { display: flex; gap: 8px; align-items: center; }
.tk-task .check { flex: 1; min-width: 0; }
.tk-task.done .check { text-decoration: line-through; color: var(--text-2); }
.tk-line { display: flex; gap: 6px; align-items: center; padding: 3px 0; }
.tk-line > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tk-x { margin-left: auto; padding: 2px; }
.tk-asset { position: relative; }
.tk-asset .tk-x { position: absolute; top: 6px; right: 0; }
/* Pré-cadastro sugerido (suggest.js) */
.sg-list { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; }
.sg-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.sg-item:hover { background: var(--surface-2); }
.sg-item input { margin-top: 3px; }
.sg-item > span { min-width: 0; overflow-wrap: anywhere; }
.sg-detail { display: block; font-size: .85em; color: var(--text-2); margin-top: 2px; }
.sg-needs { display: flex; gap: 4px; align-items: center; font-size: .85em; color: var(--warn); margin-top: 4px; }
.tk-asset { padding: 8px 0; border-top: 1px solid var(--border); }
.tk-asset:first-of-type { border-top: 0; }
.tk-asset-results { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.tk-asset-hit { display: block; width: 100%; text-align: left; padding: 6px 8px; border-radius: var(--radius-sm); border: 1px solid transparent; background: none; color: inherit; cursor: pointer; text-decoration: none; }
.tk-asset-hit:hover, .tk-asset-hit:focus-visible { background: var(--surface-2); border-color: var(--border); }
.tk-dash-h { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin: 6px 0 8px; }
.tk-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.field.inline { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; }
.tk-chart { width: 100%; height: 180px; display: block; background: var(--surface-2); border-radius: var(--radius-sm); }
.tk-bar-open { fill: var(--accent); background: var(--accent); }
.tk-bar-solved { fill: var(--ok); background: var(--ok); }
.tk-chart-axis { display: flex; justify-content: space-between; margin-top: 4px; }
.tk-legend { display: flex; gap: 14px; align-items: center; margin-top: 6px; }
.tk-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.tk-ranks { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 14px; }
.tk-ranks h3 { font-size: 14px; margin-bottom: 8px; }
@media print {
  .sidenav, .topbar, header, #tk-dash-page .toolbar { display: none !important; }
}

/* Sino de avisos (T-1207) */
.bell-wrap #bell-btn { position: relative; }
.bell-count { position: absolute; top: 1px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--risk); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
.bell-menu { width: min(380px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; }
.bell-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bell-item { flex-direction: column; align-items: stretch; gap: 2px; }
.bell-item.unread { background: var(--accent-soft); }
.bell-item .bell-title { font-weight: 600; font-size: 13px; }
.bell-item .bell-body { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bell-item .bell-when { font-size: 11.5px; color: var(--text-3, var(--text-2)); }

/* Código para o chat (T-1210) */
.chat-code { font-size: 40px; font-weight: 800; letter-spacing: .3em; text-align: center; margin: 14px 0; color: var(--accent); }

/* Base de conhecimento (Fase 13) */
.kb-layout { display: grid; grid-template-columns: minmax(260px, 380px) minmax(0, 1fr); border-top: 1px solid var(--border); min-height: 420px; }
.kb-list { border-right: 1px solid var(--border); overflow-y: auto; max-height: 72vh; }
.kb-item { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--border);
  background: none; color: inherit; cursor: pointer; }
.kb-item:hover, .kb-item.active { background: var(--surface-2); }
.kb-snip { font-size: 13px; color: var(--text-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.kb-snip mark { background: var(--warn-soft); color: inherit; }
.kb-view { padding: 16px 20px; min-width: 0; }
.kb-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.kb-body { margin-top: 12px; }
.kb-help { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 10px; }
.kb-preview { border: 1px dashed var(--border); border-radius: var(--radius); padding: 12px; margin-top: 10px; }
.kb-suggest { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 8px 10px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
@media (max-width: 900px) { .kb-layout { grid-template-columns: 1fr; } .kb-list { border-right: 0; max-height: 40vh; } }

/* ── Visão KANBAN & Hover Card de Chamados ── */
.tk-kanban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(260px, 1fr));
  gap: 14px;
  padding: 14px;
  overflow-x: auto;
  min-height: 560px;
  align-items: start;
}
.tk-kanban-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.tk-kanban-col-head {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--border);
  font-weight: 700;
  font-size: 13px;
  border-top-left-radius: var(--radius, 10px);
  border-top-right-radius: var(--radius, 10px);
  background: var(--surface);
}
.tk-kanban-col-head.col-stage { border-top: 3px solid #6366f1; }
.tk-kanban-col-head.col-n1 { border-top: 3px solid #0284c7; }
.tk-kanban-col-head.col-n2 { border-top: 3px solid #f59e0b; }
.tk-kanban-col-head.col-pending { border-top: 3px solid #ec4899; }
.tk-kanban-col-head.col-solved { border-top: 3px solid #10b981; }

.tk-kanban-col-title {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tk-kanban-badge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
}
.tk-kanban-cards {
  padding: 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
  transition: background 0.15s ease;
}
.tk-kanban-cards.dragover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  outline: 2px dashed var(--accent);
  border-radius: 8px;
}
.tk-kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: grab;
  user-select: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.tk-kanban-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.tk-kanban-card:active {
  cursor: grabbing;
  opacity: 0.8;
}
.tk-kanban-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11.5px;
}
.tk-kanban-card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tk-kanban-card-sub {
  font-size: 11.5px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tk-kanban-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  font-size: 11.5px;
}

/* ── Hover Popover Flutuante com Resumo e Botão Atender ── */
.tk-hover-popover {
  position: fixed;
  z-index: 9999;
  width: 330px;
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
  opacity: 0;
  transform: scale(0.97) translateY(4px);
  transition: opacity 0.16s cubic-bezier(0.16, 1, 0.3, 1), transform 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* Ponte invisível contínua para o mouse não perder o foco ao cruzar o vão de 10px */
.tk-hover-popover::before {
  content: '';
  position: absolute;
  top: -14px;
  bottom: -14px;
  left: -20px;
  right: -20px;
  z-index: -1;
  pointer-events: auto;
}
.tk-hover-popover.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}
.tk-pop-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.tk-pop-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}
.tk-pop-desc {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-2);
  background: var(--surface-2);
  padding: 8px 10px;
  border-radius: 6px;
  max-height: 110px;
  overflow-y: auto;
  white-space: pre-wrap;
}
.tk-pop-meta {
  font-size: 11.5px;
  color: var(--text-2);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tk-pop-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  position: relative;
  z-index: 2;
}
.tk-pop-actions .btn {
  flex: 1;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
}

/* ── Chips de Seleção de Faixas no Scan ── */
.chips-select {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.chip-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.chip-btn:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}
.chip-btn.chip-fast {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.chip-btn.chip-fast:hover {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
}

/* ══════════════════════════════════════════════════════════════════════════
   MÓDULO DE RESERVAS & AGENDA (GLPI-STYLE)
   ══════════════════════════════════════════════════════════════════════════ */
.reservations-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* KPIs Globais e Módulos (Reservas, Ouvidoria, etc.) */
.kpi-bar,
.res-kpi-bar,
.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.kpi-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kpi-icon.kpi-warn { background: var(--warn-soft); color: var(--warn); }
.kpi-icon.kpi-ok { background: var(--ok-soft); color: var(--ok); }
.kpi-icon.kpi-risk { background: var(--risk-soft); color: var(--risk); }
.kpi-icon.kpi-accent,
.kpi-icon.kpi-info-accent { background: var(--accent-soft); color: var(--accent); }
.kpi-icon.kpi-muted { background: var(--surface-2); color: var(--text-3); }

.kpi-info { display: flex; flex-direction: column; min-width: 0; }
.kpi-value { font-size: 22px; font-weight: 800; line-height: 1.1; color: var(--text); }
.kpi-label { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* Barra de Ferramentas / Filtros */
.res-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border-radius: 10px;
}
.res-nav-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}
.res-current-period {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.res-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* Grade do Calendário */
.calendar-grid {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.calendar-header-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-2);
}
.calendar-header-day {
  padding: 10px 4px;
}
.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(115px, auto);
}
.calendar-day {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 8px;
  min-height: 115px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
}
.calendar-day:nth-child(7n) {
  border-right: none;
}
.calendar-day:hover {
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}
.calendar-day.other-month {
  background: color-mix(in srgb, var(--surface) 92%, black);
  opacity: 0.55;
  cursor: default;
}
.calendar-day.is-today {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.calendar-day.is-today .day-number {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.day-number {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}
.day-badge-count {
  font-size: 10.5px;
  background: var(--surface-3);
  color: var(--text-2);
  padding: 1px 6px;
  border-radius: 10px;
}

/* Eventos / Pílulas no Calendário */
.day-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  max-height: 120px;
}
.res-pill {
  font-size: 11px;
  padding: 4px 7px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
  border-left: 3px solid;
}
.res-pill:hover {
  transform: scale(1.02);
  filter: brightness(1.15);
}
.pill-time {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: 0.85;
}
.pill-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.pill-title {
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

/* Cores de status das pílulas */
.pill-pending {
  background: color-mix(in srgb, var(--warn) 18%, var(--surface-2));
  color: var(--warn);
  border-left-color: var(--warn);
}
.pill-approved {
  background: color-mix(in srgb, var(--ok) 18%, var(--surface-2));
  color: var(--ok);
  border-left-color: var(--ok);
}
.pill-in-use {
  background: color-mix(in srgb, var(--accent) 20%, var(--surface-2));
  color: var(--accent);
  border-left-color: var(--accent);
}
.pill-completed {
  background: color-mix(in srgb, var(--text-3) 15%, var(--surface-2));
  color: var(--text-2);
  border-left-color: var(--text-3);
}
.pill-cancelled {
  background: color-mix(in srgb, var(--risk) 18%, var(--surface-2));
  color: var(--risk);
  border-left-color: var(--risk);
}

/* Modal e Formulário de Reserva */
.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
.field.full { grid-column: span 12; }
.field.col-6 { grid-column: span 6; }
.field.col-4 { grid-column: span 4; }

.conflict-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}
.conflict-alert.alert-danger {
  background: var(--risk-soft);
  color: var(--risk);
  border: 1px solid var(--risk-border);
}
.conflict-alert.alert-success {
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
}

.res-equipment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}
.res-equip-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.res-equip-card:hover {
  background: var(--surface-3);
  border-color: var(--accent);
}
.res-equip-card input[type="checkbox"] {
  margin-top: 3px;
}
.equip-name { font-weight: 600; font-size: 13px; color: var(--text); }
.equip-cat { font-size: 11px; margin-top: 2px; }

/* Detalhes da Reserva */
.res-detail-view {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.res-detail-banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.res-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  background: var(--surface-2);
  padding: 14px;
  border-radius: 8px;
}
.meta-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.meta-label { font-size: 11.5px; color: var(--text-3); text-transform: uppercase; font-weight: 600; letter-spacing: 0.03em; }
.meta-value { font-size: 13.5px; font-weight: 500; color: var(--text); }

.res-section h4 {
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 600;
}
.checklist-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: var(--surface-2);
  border-radius: 6px;
  margin-bottom: 8px;
}

