/*
 * Gate portal: styles for the Security pages (Protection, Vulnerabilities, Activity & IOC search, Incidents &
 * response, Policies, Threat review). Shared tokens (kit/tokens.css) only; shared components live in kit/kit.css and console/console.css. Classes are prefixed cx-sec-.
 */

/* ---------- Shared bits ---------- */
.cx-sec-stateline { gap: 12px; margin-bottom: 12px; font-size: 13px; }
.cx-sec-stateline .cx-muted { font-size: var(--t-13); }
.cx-drawer-body .cx-sec-stateline { margin-bottom: 14px; }
.cx-sec-actions { gap: 6px; margin-bottom: 14px; }
.cx-sec-actions .cx-toolbar-sep { margin: 0 2px; }
.cx-sec-push { margin-left: auto; }
.cx-sec-gridnote { margin-top: 8px; }
.cx-sec-clip { overflow: hidden; max-width: 380px; text-overflow: ellipsis; white-space: nowrap; }
.cx-sec-notes { margin: 12px 0 0; font-size: var(--t-13); }
.cx-sec-notes li + li { margin-top: 2px; }
.cx-sec-note-body { color: var(--c-text); white-space: pre-wrap; overflow-wrap: anywhere; }
.cx-sec-tabs-flush { margin-bottom: 0; }
.cx-panel-actions .cx-btn { margin-left: 4px; }
.cx-drawer-foot-link.cx-row { justify-content: flex-end; }
.cx-drawer-body .cx-gridwrap { margin-bottom: 16px; }

/* ---------- Activity: events, filters, process tree ---------- */
.cx-sec-evtype { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.cx-sec-evtype .cx-icon { width: 14px; height: 14px; color: var(--c-text-3); }
.cx-sec-evtype.is-warn { color: var(--c-warn); }
.cx-sec-evtype.is-warn .cx-icon { color: var(--c-warn); }
.cx-sec-event { min-width: 280px; }
.cx-sec-event-summary { font-family: var(--f-mono); font-size: var(--t-13); overflow-wrap: anywhere; }
.cx-sec-event .cx-cell-sub { overflow-wrap: anywhere; }
.cx-sec-filterbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--c-line); }
.cx-panel-body:not(.is-flush) > .cx-sec-filterbar { padding: 0 0 4px; border-bottom: 0; }
.cx-sec-filterbar .cx-field { min-width: 0; }
.cx-sec-filterbar .cx-input[type="datetime-local"] { width: 200px; }
.cx-sec-filterbar .cx-select { min-width: 160px; }
.cx-sec-filterbar .cx-sec-iocvalue { width: 300px; font-family: var(--f-mono); font-size: var(--t-13); }
.cx-sec-filterbar-actions { gap: 6px; padding-bottom: 1px; }
.cx-sec-filterbar + .cx-form-error { padding: 8px 16px 0; }
.cx-panel-body:not(.is-flush) > .cx-sec-filterbar + .cx-form-error { padding: 6px 0 0; }
.cx-sec-innertabs .cx-tabs { margin: 0; padding: 0 8px; }
.cx-sec-more { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 12px; border-top: 1px solid var(--c-line); }
.cx-sec-treehost { padding: 16px; }
.cx-sec-resultline { margin-bottom: 8px; font-size: var(--t-13); }
.cx-sec-sources { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.cx-sec-legend { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--c-line); border-radius: var(--r-sm); background: var(--c-surface-2); font-size: var(--t-13); }
.cx-sec-legend dt { margin: 0; }
.cx-sec-legend dd { margin: 0; color: var(--c-text-2); }
.cx-sec-tree, .cx-sec-tree ul { margin: 0; padding: 0; list-style: none; }
.cx-sec-tree ul { margin-left: 9px; padding-left: 18px; border-left: 1px solid var(--c-line-2); }
.cx-sec-tree li { position: relative; padding: 6px 0 2px; }
.cx-sec-tree ul > li::before { content: ""; position: absolute; left: -18px; top: 16px; width: 12px; border-top: 1px solid var(--c-line-2); }
.cx-sec-tnode { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.cx-sec-tnode strong { font-size: var(--t-13); overflow-wrap: anywhere; }
.cx-sec-tnode .cx-faint, .cx-sec-tnode .cx-muted { font-size: var(--t-13); }
.cx-sec-tnode .cx-status { font-size: var(--t-13); }
.cx-sec-tmeta { margin-top: 2px; color: var(--c-text-3); font-size: var(--t-13); }
.cx-sec-tcmd { margin-top: 4px; padding: 6px 8px; border-radius: var(--r-sm); background: var(--c-surface-2); color: var(--c-text-2); overflow-wrap: anywhere; white-space: pre-wrap; }

/* ---------- Response: device actions, evidence, incident timeline ---------- */
.cx-sec-devicepick { max-width: 420px; margin-bottom: 14px; }
.cx-sec-devicepick .cx-select { width: 100%; }
.cx-sec-isolation .cx-props { margin-bottom: 14px; }
.cx-sec-evidence { max-height: 520px; }
.cx-sec-timeline { margin: 0; padding: 0; list-style: none; }
.cx-sec-timeline li { display: grid; grid-template-columns: 158px 96px minmax(0, 1fr); gap: 4px 12px; align-items: start; padding: 10px 16px; border-bottom: 1px solid var(--c-line); }
.cx-sec-timeline li:last-child { border-bottom: 0; }
.cx-sec-timeline li.is-inferred { background: var(--c-surface-2); }
.cx-sec-timeline time { color: var(--c-text-2); font-size: var(--t-13); }
.cx-sec-timeline .cx-status { font-size: var(--t-13); }
.cx-sec-tl-text { display: grid; gap: 2px; min-width: 0; }
.cx-sec-tl-text .cx-muted { font-size: var(--t-13); overflow-wrap: anywhere; }

/* ---------- Policies: settings, editable tables, preview ---------- */
.cx-sec-settings { padding: 0; }
.cx-sec-setting { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 6px 24px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--c-line); }
.cx-sec-setting:last-child { border-bottom: 0; }
.cx-sec-setting.is-block { grid-template-columns: minmax(0, 1fr); }
.cx-sec-setting-text { display: grid; gap: 2px; min-width: 0; }
.cx-sec-setting-text strong { font-weight: 600; }
.cx-sec-setting-control { min-width: 0; }
.cx-sec-setting-control > .cx-select { width: 100%; }
.cx-sec-list { width: 100%; font-family: var(--f-mono); font-size: var(--t-13); }
.cx-sec-tableeditor { display: grid; gap: 10px; }
.cx-sec-check { align-items: center; }
.cx-sec-check input { margin-top: 0; }
table.cx-sec-edittable td { height: auto; padding: 6px 8px; }
table.cx-sec-edittable th { padding: 0 8px; }
table.cx-sec-edittable .cx-input, table.cx-sec-edittable .cx-select { height: 28px; font-size: var(--t-13); }
table.cx-sec-edittable tbody tr:hover td { background: transparent; }
table.cx-sec-edittable .cx-sec-emptyrow td { padding: 14px 12px; white-space: normal; }
.cx-sec-w-id { width: 140px; font-family: var(--f-mono); }
.cx-sec-w-name { width: 180px; }
.cx-sec-w-ports { width: 96px; }
.cx-sec-w-addr { width: 180px; }
.cx-sec-w-prog { width: 220px; }
.cx-sec-w-wide { width: 100%; min-width: 320px; font-family: var(--f-mono); }
.cx-sec-profiles { display: flex; gap: 10px; }
.cx-sec-profiles .cx-check-row { font-size: var(--t-13); white-space: nowrap; }
.cx-sec-tablefoot { gap: 10px; }
.cx-panel-body.is-flush > .cx-sec-tablefoot { padding: 10px 12px; border-top: 1px solid var(--c-line); }
.cx-sec-stickybar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; padding: 10px 16px; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-surface); box-shadow: 0 -4px 12px rgba(16,24,40,.06); }
.cx-sec-stickybar .cx-muted { font-size: var(--t-13); }
.cx-sec-preview { gap: 12px; }
.cx-sec-previewlist { max-height: 240px; overflow: auto; }

/* ---------- Phone ---------- */
@media (max-width: 960px) {
  .cx-sec-setting { grid-template-columns: minmax(0, 1fr); }
  .cx-sec-timeline li { grid-template-columns: minmax(0, 1fr) auto; }
  .cx-sec-timeline .cx-sec-tl-text { grid-column: 1 / -1; }
  .cx-sec-clip { max-width: 220px; }
}
@media (max-width: 560px) {
  .cx-sec-filterbar .cx-field, .cx-sec-filterbar .cx-input[type="datetime-local"], .cx-sec-filterbar .cx-select, .cx-sec-filterbar .cx-sec-iocvalue { width: 100%; }
  .cx-sec-filterbar { gap: 10px; }
  .cx-sec-push { margin-left: 0; }
  .cx-sec-legend { grid-template-columns: minmax(0, 1fr); }
  .cx-sec-event { min-width: 220px; }
}

/* ---------- Layout fixes ---------- */
/* Single-column stacks and device-tab columns must not grow to a wide table's content width. */
.cx-stack { grid-template-columns: minmax(0, 1fr); }
.cx-device-tab .cx-device-cols > div { grid-template-columns: minmax(0, 1fr); }
.cx-table td.cx-wrap .cx-mono { overflow-wrap: anywhere; }
.cx-sec-stopnotes { margin: 4px 0 0; }
.cx-sec-stopnotes .cx-sec-notes { margin-top: 0; }
.cx-sec-isolation { margin-bottom: 14px; }
.cx-panel-body > .cx-alert { margin-bottom: 12px; }
@media (max-width: 560px) {
  .cx-sec-page .cx-panel-head { flex-wrap: wrap; row-gap: 2px; padding-top: 8px; padding-bottom: 8px; }
  .cx-sec-page .cx-panel-head .cx-panel-sub { order: 3; flex-basis: 100%; }
}

.cx-sec-timeline .cx-chip, .cx-sec-timeline .cx-status { justify-self: start; }
