/* ==========================================================================
   Controle DISPA — Central de Segurança (bolha de proteção)
   Linguagem visual nova do sistema: faixa escura de comando com brilho vermelho,
   cartões brancos com respiro, números grandes e cor só onde há atenção.
   ========================================================================== */

.seg-main,
.seg-drawer,
.seg-modal-overlay {
  --seg-ok: #1f9d55;
  --seg-warn: #e0a100;
  --seg-danger: #d61f28;
  --seg-danger-dark: #8c0e14;
  /* Superfícies e linhas seguem o tema (escuro por padrão); os selos usam cor de texto clara no escuro e escura no claro */
  --seg-info: var(--muted);
  --seg-ink: var(--panel-2);
  --seg-line: var(--line);
  --seg-soft: var(--panel-2);
  --seg-ok-fg: #5fd48e;
  --seg-warn-fg: #f2c14e;
  --seg-danger-fg: #ff7a80;
  --seg-info-fg: #a9b4c6}

:root[data-theme="light"] .seg-main,
:root[data-theme="light"] .seg-drawer,
:root[data-theme="light"] .seg-modal-overlay {
  --seg-ok-fg: #16783f;
  --seg-warn-fg: #8a6200;
  --seg-danger-fg: #a30f17;
  --seg-info-fg: #475063}

.seg-main {
  padding: 0 0 56px;
  font-family: var(--cosae-font)}

.seg-main *,
.seg-drawer *,
.seg-modal-overlay * {
  box-sizing: border-box}

/* ------------------------------- Hero ------------------------------- */

.seg-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  color: var(--ink);
  padding: 44px max(28px, calc((100% - var(--cosae-content-max-width)) / 2 + 28px)) 36px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel) 100%);
  border-bottom: 3px solid var(--cosae-red)}

.seg-hero__glow {
  position: absolute;
  inset: -40% -10% auto auto;
  width: 70%;
  height: 160%;
  background: radial-gradient(closest-side, rgba(214, 31, 40, 0.34), rgba(214, 31, 40, 0) 70%);
  z-index: -1;
  pointer-events: none}

.seg-hero__grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(color-mix(in srgb, var(--ink) 5%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--ink) 5%, transparent) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%)}

.seg-hero__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
  flex-wrap: wrap}

.seg-hero__text {
  max-width: 660px}

.seg-eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--seg-danger-fg)}

.seg-eyebrow--dark {
  color: var(--cosae-red)}

.seg-hero__title {
  margin: 10px 0 12px;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1.08}

.seg-hero__subtitle {
  margin: 0 0 20px;
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--cosae-text-inverse-muted)}

.seg-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 12px;
  border-radius: 0;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.1px}

.seg-status__dot {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--seg-ok);
  box-shadow: 0 0 0 0 rgba(47, 189, 107, 0.6);
  animation: seg-pulso 2.2s infinite}

.seg-status.is-alerta .seg-status__dot {
  background: var(--seg-warn);
  box-shadow: 0 0 0 0 rgba(242, 169, 0, 0.6)}

.seg-status.is-erro .seg-status__dot {
  background: var(--seg-danger);
  animation: none}

@keyframes seg-pulso {
  0% { box-shadow: 0 0 0 0 rgba(47, 189, 107, 0.55)}
  70% { box-shadow: 0 0 0 10px rgba(47, 189, 107, 0)}
  100% { box-shadow: 0 0 0 0 rgba(47, 189, 107, 0)}
}

/* Controles do hero */
.seg-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px}

.seg-controls__row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end}

.seg-segmented {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
  border-radius: 0}

.seg-segmented__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--cosae-text-inverse-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 0;
  cursor: pointer;
  transition: background var(--cosae-fast) var(--cosae-ease), color var(--cosae-fast) var(--cosae-ease)}

.seg-segmented__btn:hover {
  color: var(--ink)}

.seg-segmented__btn.is-active {
  background: var(--cosae-red);
  color: #fff}

.seg-atualizado {
  font-size: 0.74rem;
  color: var(--cosae-text-inverse-muted);
  min-height: 1em}

.seg-switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cosae-text-inverse-muted);
  user-select: none}

.seg-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none}

.seg-switch__track {
  width: 38px;
  height: 22px;
  border-radius: 0;
  background: color-mix(in srgb, var(--ink) 18%, transparent);
  padding: 3px;
  transition: background var(--cosae-fast) var(--cosae-ease)}

.seg-switch__thumb {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--panel);
  transition: transform var(--cosae-fast) var(--cosae-ease)}

.seg-switch input:checked + .seg-switch__track {
  background: var(--seg-ok)}

.seg-switch input:checked + .seg-switch__track .seg-switch__thumb {
  transform: translateX(16px)}

.seg-switch input:focus-visible + .seg-switch__track {
  outline: 2px solid var(--line2);
  outline-offset: 2px}

/* ------------------------------- KPIs ------------------------------- */

.seg-kpis {
  margin-top: 34px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px}

@media (max-width: 1000px) {
  .seg-kpis { grid-template-columns: repeat(2, minmax(0, 1fr))}
}

@media (max-width: 420px) {
  .seg-kpis { grid-template-columns: 1fr}
}

.seg-kpi {
  --acc: #9a9aa0;
  position: relative;
  padding: 18px 18px 16px;
  border-radius: 0;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  border: 1px solid color-mix(in srgb, var(--ink) 9%, transparent);
  backdrop-filter: blur(6px);
  overflow: hidden;
  transition: transform var(--cosae-normal) var(--cosae-ease), background var(--cosae-normal) var(--cosae-ease), border-color var(--cosae-normal) var(--cosae-ease)}

.seg-kpi::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--acc)}

.seg-kpi:hover {
  transform: translateY(-2px);
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  border-color: color-mix(in srgb, var(--ink) 18%, transparent)}

.seg-kpi--ok { --acc: #2fbd6b}
.seg-kpi--warn { --acc: #f2a900}
.seg-kpi--danger { --acc: #ff4d56}
.seg-kpi--info { --acc: #8e9bb0}

.seg-kpi__label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cosae-text-inverse-muted);
  margin-bottom: 10px}

.seg-kpi__value {
  display: block;
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
  font-variant-numeric: tabular-nums}

.seg-kpi--danger .seg-kpi__value.is-hot { color: var(--seg-danger-fg)}

.seg-kpi__sub {
  display: block;
  margin-top: 9px;
  font-size: 0.74rem;
  color: var(--cosae-text-inverse-muted);
  line-height: 1.4}

/* ------------------------------ Conteúdo ------------------------------ */

.seg-content {
  max-width: var(--cosae-content-max-width);
  margin: 0 auto;
  padding: 28px 28px 0;
  display: flex;
  flex-direction: column;
  gap: 24px}

.seg-row {
  display: grid;
  gap: 24px;
  align-items: stretch}

.seg-row--2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr)}
.seg-row--1-1 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr)}

.seg-card {
  background: var(--cosae-surface);
  border: 1px solid var(--seg-line);
  border-radius: 0;
  padding: 24px;
  box-shadow: var(--cosae-shadow-sm);
  min-width: 0}

.seg-card--tabs {
  padding: 0;
  overflow: hidden}

.seg-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px}

.seg-card__head--wrap {
  flex-wrap: wrap}

.seg-card__title {
  margin: 0 0 4px;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: var(--cosae-text)}

.seg-card__sub {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--cosae-text-muted);
  max-width: 560px}

/* ------------------------------ Gráfico de barras no tempo ------------------------------ */

.seg-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  justify-content: flex-end}

.seg-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--cosae-text-muted)}

.seg-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 0;
  background: var(--c, #999);
  flex: none}

.seg-chart {
  position: relative;
  width: 100%}

.seg-chart svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--cosae-font);
  overflow: visible}

.seg-chart .seg-col {
  cursor: default}

.seg-chart .seg-col__hit {
  fill: transparent}

.seg-chart .seg-col:hover .seg-col__hit {
  fill: color-mix(in srgb, var(--ink) 6%, transparent)}

.seg-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  min-width: 170px;
  padding: 11px 13px;
  border-radius: 0;
  background: var(--seg-ink);
  border: 1px solid var(--line2);
  color: var(--ink);
  font-size: 0.74rem;
  line-height: 1.55;
  box-shadow: var(--cosae-shadow-md);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--cosae-fast) var(--cosae-ease), transform var(--cosae-fast) var(--cosae-ease)}

.seg-tip.is-on {
  opacity: 1;
  transform: translateY(0)}

.seg-tip strong {
  display: block;
  margin-bottom: 5px;
  font-size: 0.78rem}

.seg-tip__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px}

.seg-tip__row span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink)}

/* ------------------------------ Rosca ------------------------------ */

.seg-donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px}

.seg-donut {
  position: relative;
  width: 190px;
  height: 190px}

.seg-donut svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg)}

.seg-donut__centro {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center}

.seg-donut__centro strong {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1;
  font-variant-numeric: tabular-nums}

.seg-donut__centro span {
  margin-top: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cosae-text-muted)}

.seg-donut__legend {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: grid;
  gap: 9px}

.seg-donut__legend li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cosae-text)}

.seg-donut__legend li span:nth-child(2) {
  flex: 1}

.seg-donut__legend li strong {
  font-variant-numeric: tabular-nums}

/* ------------------------------ Tabelas ------------------------------ */

.seg-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--seg-line);
  border-radius: 0}

.seg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem}

.seg-table th {
  position: sticky;
  top: 0;
  text-align: left;
  padding: 12px 14px;
  background: var(--seg-ink);
  color: var(--ink);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap}

.seg-table td {
  padding: 12px 14px;
  border-top: 1px solid var(--seg-line);
  vertical-align: middle;
  color: var(--cosae-text)}

.seg-table tbody tr {
  transition: background var(--cosae-fast) var(--cosae-ease)}

.seg-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--ink) 3%, transparent)}

.seg-table tbody tr:hover {
  background: color-mix(in srgb, var(--ink) 7%, transparent)}

.seg-table tbody tr.is-bloqueado td:first-child {
  box-shadow: inset 3px 0 0 var(--seg-danger)}

.seg-th-acoes {
  text-align: right !important}

.seg-td-acoes {
  text-align: right;
  white-space: nowrap}

.seg-td-acoes .seg-btn + .seg-btn {
  margin-left: 6px}

.seg-mono {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.8rem;
  letter-spacing: -0.2px}

.seg-ip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap}

.seg-ip__num {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--cosae-text);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--cosae-fast) var(--cosae-ease)}

.seg-ip__num:hover {
  text-decoration-color: var(--cosae-red)}

.seg-muted {
  color: var(--cosae-text-muted)}

.seg-small {
  font-size: 0.74rem}

.seg-trunc {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom}

.seg-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px}

.seg-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 8px;
  border-radius: 0;
  background: var(--seg-soft);
  border: 1px solid var(--seg-line);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums}

.seg-count .seg-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%}

.seg-empty {
  padding: 34px 16px;
  text-align: center;
  color: var(--cosae-text-muted);
  font-size: 0.86rem;
  line-height: 1.6}

.seg-empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--cosae-text);
  font-size: 0.95rem}

/* ------------------------------ Selos ------------------------------ */

.seg-badge {
  --bg: color-mix(in srgb, var(--ink) 10%, transparent);
  --fg: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 0;
  background: var(--bg);
  color: var(--fg);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap}

.seg-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85}

.seg-badge--ok { --bg: color-mix(in srgb, var(--seg-ok) 18%, transparent); --fg: var(--seg-ok-fg)}
.seg-badge--warn { --bg: color-mix(in srgb, var(--seg-warn) 20%, transparent); --fg: var(--seg-warn-fg)}
.seg-badge--danger { --bg: color-mix(in srgb, var(--seg-danger) 20%, transparent); --fg: var(--seg-danger-fg)}
.seg-badge--dark { --bg: var(--ink); --fg: var(--panel)}
.seg-badge--info { --bg: color-mix(in srgb, var(--seg-info-fg) 16%, transparent); --fg: var(--seg-info-fg)}
.seg-badge--plain::before { display: none}

/* ------------------------------ Barras horizontais ------------------------------ */

.seg-bars {
  display: grid;
  gap: 14px}

.seg-bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 190px) 1fr auto;
  align-items: center;
  gap: 14px;
  font-size: 0.8rem}

.seg-bar-row__label {
  font-weight: 600;
  color: var(--cosae-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap}

.seg-bar-row__track {
  height: 10px;
  border-radius: 0;
  background: var(--seg-soft);
  overflow: hidden}

.seg-bar-row__fill {
  display: block;
  height: 100%;
  border-radius: 0;
  background: linear-gradient(90deg, var(--seg-danger-dark), var(--seg-danger));
  width: 0;
  transition: width var(--cosae-slow) var(--cosae-ease)}

.seg-bar-row__value {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: right}

/* ------------------------------ Feed ------------------------------ */

.seg-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--seg-ok)}

.seg-live__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--seg-ok);
  animation: seg-pulso 2.2s infinite}

.seg-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px}

.seg-feed__item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 0;
  transition: background var(--cosae-fast) var(--cosae-ease)}

.seg-feed__item:hover {
  background: var(--seg-soft)}

.seg-feed__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c, #999)}

.seg-feed__main {
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35}

.seg-feed__main small {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--cosae-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap}

.seg-feed__quando {
  font-size: 0.72rem;
  color: var(--cosae-text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums}

/* ------------------------------ Controles ------------------------------ */

.seg-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 0;
  padding: 10px 18px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--cosae-fast) var(--cosae-ease), border-color var(--cosae-fast) var(--cosae-ease), transform var(--cosae-fast) var(--cosae-ease), box-shadow var(--cosae-fast) var(--cosae-ease)}

.seg-btn:active { transform: translateY(1px)}
.seg-btn:focus-visible { outline: 2px solid var(--cosae-red); outline-offset: 2px}
.seg-btn[disabled] { opacity: 0.5; cursor: not-allowed}

.seg-btn--sm { padding: 6px 12px; font-size: 0.74rem; border-radius: 0}

.seg-btn--primary { background: var(--cosae-red); color: #fff}
.seg-btn--primary:hover { background: var(--cosae-red-dark)}

.seg-btn--danger { background: var(--cosae-red); color: #fff}
.seg-btn--danger:hover { background: var(--cosae-red-dark); box-shadow: var(--cosae-shadow-red)}

.seg-btn--ghost { background: transparent; border-color: var(--seg-line); color: var(--cosae-text)}
.seg-btn--ghost:hover { background: var(--seg-soft); border-color: var(--line2)}

.seg-hero .seg-btn--ghost { border-color: color-mix(in srgb, var(--ink) 20%, transparent); color: var(--ink)}
.seg-hero .seg-btn--ghost:hover { background: color-mix(in srgb, var(--ink) 10%, transparent); border-color: color-mix(in srgb, var(--ink) 35%, transparent)}

.seg-btn--ok { background: color-mix(in srgb, var(--seg-ok) 14%, transparent); color: var(--seg-ok-fg)}
.seg-btn--ok:hover { background: color-mix(in srgb, var(--seg-ok) 26%, transparent)}

.seg-input {
  font: inherit;
  font-size: 0.82rem;
  color: var(--cosae-text);
  background: var(--panel);
  border: 1px solid var(--seg-line);
  border-radius: 0;
  padding: 10px 12px;
  min-width: 0;
  transition: border-color var(--cosae-fast) var(--cosae-ease), box-shadow var(--cosae-fast) var(--cosae-ease)}

.seg-input:focus {
  outline: none;
  border-color: var(--cosae-red);
  box-shadow: 0 0 0 3px rgba(179, 18, 26, 0.12)}

.seg-input--busca { min-width: 230px}

.seg-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap}

.seg-chips {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap}

.seg-chip {
  appearance: none;
  border: 1px solid var(--seg-line);
  background: var(--panel);
  color: var(--cosae-text-muted);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 7px 13px;
  border-radius: 0;
  cursor: pointer;
  transition: all var(--cosae-fast) var(--cosae-ease)}

.seg-chip:hover { border-color: var(--line2); color: var(--cosae-text)}
.seg-chip.is-active { background: var(--cosae-red); border-color: var(--cosae-red); color: #fff}

/* ------------------------------ Abas ------------------------------ */

.seg-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--seg-line);
  background: var(--panel);
  overflow-x: auto}

.seg-tab {
  appearance: none;
  position: relative;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--cosae-text-muted);
  padding: 12px 18px;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--cosae-fast) var(--cosae-ease)}

.seg-tab::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 3px;
  border-radius: 0;
  background: var(--cosae-red);
  transform: scaleX(0);
  transition: transform var(--cosae-normal) var(--cosae-ease)}

.seg-tab:hover { color: var(--cosae-text)}
.seg-tab.is-active { color: var(--cosae-text)}
.seg-tab.is-active::after { transform: scaleX(1)}
.seg-tab:focus-visible { outline: 2px solid var(--cosae-red); outline-offset: -2px; border-radius: 0}

.seg-pane {
  padding: 22px 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 16px}

.seg-pane[hidden] { display: none}

.seg-filtros {
  display: flex;
  gap: 10px;
  flex-wrap: wrap}

.seg-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px;
  border: 1px dashed var(--line2);
  border-radius: 0;
  background: var(--panel)}

.seg-form[hidden] { display: none}

.seg-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cosae-text-muted)}

.seg-field--grow { flex: 1; min-width: 200px}

.seg-field .seg-input { text-transform: none; letter-spacing: 0; font-weight: 500}

.seg-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cosae-text-muted);
  cursor: pointer}

.seg-check--inline { padding-bottom: 10px}

.seg-check input { accent-color: var(--cosae-red); width: 16px; height: 16px}

.seg-note {
  margin: 0;
  padding: 14px 16px;
  border-radius: 0;
  background: var(--seg-soft);
  border-left: 3px solid var(--cosae-red);
  font-size: 0.84rem;
  line-height: 1.65;
  color: var(--cosae-text)}

.seg-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap}

.seg-pager__info {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--cosae-text-muted)}

.seg-pager__btns { display: inline-flex; gap: 8px}

/* Como funciona */
.seg-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px}

.seg-info__card {
  padding: 18px;
  border: 1px solid var(--seg-line);
  border-radius: 0;
  background: var(--panel)}

.seg-info__card h3 {
  margin: 0 0 10px;
  font-size: 0.92rem;
  font-weight: 800}

.seg-info__card p,
.seg-info__card li {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--cosae-text-muted)}

.seg-info__card ul {
  margin: 0;
  padding: 0 0 0 18px;
  display: grid;
  gap: 5px}

.seg-info__card code {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.74rem;
  background: var(--seg-soft);
  padding: 1px 6px;
  border-radius: 0;
  color: var(--cosae-text)}

.seg-info__num {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: var(--cosae-text);
  margin-bottom: 4px}

/* ------------------------------ Gaveta (ficha do IP) ------------------------------ */

.seg-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: color-mix(in srgb, var(--panel) 55%, transparent);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--cosae-normal) var(--cosae-ease)}

.seg-overlay.is-on { opacity: 1}
.seg-overlay[hidden] { display: none}

.seg-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  width: min(560px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  box-shadow: var(--cosae-shadow-lg);
  transform: translateX(105%);
  transition: transform var(--cosae-slow) var(--cosae-ease);
  font-family: var(--cosae-font)}

.seg-drawer.is-on { transform: translateX(0)}

.seg-drawer__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 26px 26px 20px;
  border-bottom: 1px solid var(--seg-line);
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel) 100%)}

.seg-drawer__ip {
  margin: 6px 0 12px;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  word-break: break-all}

.seg-drawer__badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap}

.seg-drawer__close {
  appearance: none;
  border: 0;
  background: var(--seg-soft);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--cosae-text);
  cursor: pointer;
  flex: none;
  transition: background var(--cosae-fast) var(--cosae-ease)}

.seg-drawer__close:hover { background: var(--panel-2)}

.seg-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 26px 26px;
  display: flex;
  flex-direction: column;
  gap: 22px}

.seg-drawer__foot {
  padding: 16px 26px;
  border-top: 1px solid var(--seg-line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: var(--panel)}

.seg-section-title {
  margin: 0 0 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cosae-text-muted)}

.seg-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px}

.seg-stat {
  padding: 12px 14px;
  border-radius: 0;
  background: var(--seg-soft);
  border: 1px solid var(--seg-line)}

.seg-stat strong {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums}

.seg-stat span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cosae-text-muted)}

.seg-kv {
  margin: 0;
  display: grid;
  gap: 8px}

.seg-kv div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.82rem;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--seg-line)}

.seg-kv dt { color: var(--cosae-text-muted); font-weight: 600}
.seg-kv dd { margin: 0; font-weight: 700; text-align: right; word-break: break-word}

.seg-timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 4px;
  position: relative}

.seg-timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--seg-line)}

.seg-timeline li {
  position: relative;
  padding: 0 0 14px 26px;
  font-size: 0.8rem;
  line-height: 1.45}

.seg-timeline li::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c, #999);
  border: 2px solid var(--line2);
  box-shadow: 0 0 0 1px var(--seg-line)}

.seg-timeline li strong { display: block; font-weight: 700}
.seg-timeline li small { display: block; color: var(--cosae-text-muted); font-size: 0.72rem; word-break: break-all}

/* ------------------------------ Modal ------------------------------ */

.seg-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: color-mix(in srgb, var(--panel) 60%, transparent);
  backdrop-filter: blur(3px);
  font-family: var(--cosae-font)}

.seg-modal-overlay[hidden] { display: none}

.seg-modal {
  width: min(480px, 100%);
  padding: 28px;
  border-radius: 0;
  background: var(--panel);
  box-shadow: var(--cosae-shadow-lg);
  animation: seg-entrada var(--cosae-normal) var(--cosae-ease)}

@keyframes seg-entrada {
  from { opacity: 0; transform: translateY(10px) scale(0.98)}
  to { opacity: 1; transform: none}
}

.seg-modal__title { margin: 0 0 8px; font-size: 1.2rem; font-weight: 800; letter-spacing: -0.3px}
.seg-modal__text { margin: 0 0 16px; font-size: 0.88rem; line-height: 1.65; color: var(--cosae-text-muted)}
.seg-modal__fields { display: grid; gap: 12px; margin-bottom: 20px}
.seg-modal__fields:empty { display: none}
.seg-modal__fields .seg-input { width: 100%}
.seg-modal__actions { display: flex; justify-content: flex-end; gap: 10px}

/* ------------------------------ Avisos ------------------------------ */

.seg-toasts {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 140;
  display: grid;
  gap: 10px;
  pointer-events: none}

.seg-toast {
  min-width: 240px;
  max-width: 380px;
  padding: 13px 18px;
  border-radius: 0;
  background: var(--seg-ink);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.45;
  box-shadow: var(--cosae-shadow-md);
  border-left: 4px solid var(--seg-ok);
  animation: seg-entrada var(--cosae-normal) var(--cosae-ease)}

.seg-toast--erro { border-left-color: var(--seg-danger)}

/* ------------------------------ Carregando / responsivo ------------------------------ */

.seg-skeleton {
  display: block;
  height: 1em;
  border-radius: 0;
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--panel) 37%, var(--panel-2) 63%);
  background-size: 400% 100%;
  animation: seg-brilho 1.4s ease infinite}

@keyframes seg-brilho {
  0% { background-position: 100% 50%}
  100% { background-position: 0 50%}
}

@media (max-width: 1000px) {
  .seg-row--2-1,
  .seg-row--1-1 { grid-template-columns: 1fr}
  .seg-controls { align-items: flex-start}
  .seg-controls__row { justify-content: flex-start}
}

@media (max-width: 640px) {
  .seg-hero { padding: 30px 18px 26px}
  .seg-hero__title { font-size: 1.9rem}
  .seg-content { padding: 20px 14px 0}
  .seg-card { padding: 18px}
  .seg-pane { padding: 18px 14px 22px}
  .seg-bar-row { grid-template-columns: 1fr auto}
  .seg-bar-row__track { grid-column: 1 / -1; order: 3}
  .seg-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr))}
  .seg-input--busca { min-width: 0; width: 100%}
}

@media (prefers-reduced-motion: reduce) {
  .seg-status__dot,
  .seg-live__dot,
  .seg-skeleton { animation: none}
  .seg-drawer,
  .seg-kpi,
  .seg-bar-row__fill,
  .seg-tab::after { transition: none}
}
