:root {
  --canvas: #f4f3ee;
  --surface: #fffefb;
  --surface-2: #faf9f4;
  --surface-3: #efeee7;
  --ink: #1b1d19;
  --ink-2: #454a42;
  --muted: #63695f;
  --faint: #858b81;
  --line: #dedfd6;
  --line-strong: #c7c9be;
  --accent: #0e6b5b;
  --accent-strong: #0a574a;
  --accent-soft: #e4f2ee;
  --valid: #1c6b3f;
  --valid-soft: #e6f4ea;
  --warn: #805400;
  --warn-soft: #fbf1dc;
  --danger: #9c2b2b;
  --danger-soft: #fbe9e7;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgb(27 29 25 / 0.04), 0 10px 30px rgb(27 29 25 / 0.045);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.has-dialog {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}

code,
pre {
  font-family: var(--font-mono);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.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;
}

.skip-link {
  position: absolute;
  top: -48px;
  left: 12px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--surface);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 28px;
  border-bottom: 1px solid var(--line);
  background: rgb(244 243 238 / 0.94);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 8px;
  background: var(--ink);
  color: var(--canvas);
}

.brand-mark .icon {
  width: 18px;
  height: 18px;
}

.brand-text {
  display: block;
  min-width: 0;
}

.brand-name {
  display: block;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand-sub {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.api-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 11.5px;
  white-space: nowrap;
}

.api-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 3px rgb(133 139 129 / 0.14);
}

.api-status[data-state="loading"] .api-dot {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgb(128 84 0 / 0.12);
  animation: pulse 1.4s ease-in-out infinite;
}

.api-status[data-state="demo"] .api-dot {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgb(128 84 0 / 0.12);
}

.api-status[data-state="api"] .api-dot {
  background: var(--valid);
  box-shadow: 0 0 0 3px rgb(28 107 63 / 0.12);
}

.api-status[data-state="error"] {
  border-color: rgb(156 43 43 / 0.25);
  background: var(--danger-soft);
  color: var(--danger);
}

.api-status[data-state="error"] .api-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgb(156 43 43 / 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-strong);
}

.btn-ghost {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--ink-2);
  color: var(--ink);
}

.btn-quiet {
  background: transparent;
  color: var(--muted);
}

.btn-quiet:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--ink);
}

.btn-sm {
  height: 29px;
  padding: 0 9px;
  font-size: 11.5px;
}

.btn.is-copied {
  background: var(--valid-soft);
  border-color: transparent;
  color: var(--valid);
}

.btn-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.refresh-icon.is-spinning {
  animation: spin 0.9s linear infinite;
}

/* Summary strip */

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 26px 28px 34px;
}

.summary {
  display: flex;
  align-items: stretch;
  margin-bottom: 20px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.summary-item {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 0 22px;
  min-width: 0;
}

.summary-item:first-child {
  padding-left: 0;
}

.summary-sep {
  width: 1px;
  flex: none;
  background: var(--line);
}

.summary-value {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.summary-value--sm {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.summary-label {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

/* Workspace and filters */

.workspace {
  min-width: 0;
}

.workspace-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 15px;
}

h1 {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.workspace-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.updated {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field-search {
  flex: 1 1 270px;
  min-width: 210px;
}

.field-label {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.input-wrap {
  position: relative;
}

.field-icon {
  position: absolute;
  top: 50%;
  left: 10px;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

input[type="search"],
select {
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

input[type="search"] {
  width: 100%;
  padding: 0 12px 0 33px;
}

input[type="search"]::placeholder {
  color: var(--muted);
  opacity: 1;
}

input[type="search"]:hover,
select:hover {
  border-color: var(--faint);
}

select {
  min-width: 148px;
  padding: 0 30px 0 10px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2363695f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.clear-btn {
  margin-left: 2px;
}

/* Alert */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgb(156 43 43 / 0.2);
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
}

.alert-icon {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.alert-copy {
  min-width: 0;
  flex: 1;
}

.alert-copy strong {
  display: block;
  font-size: 12.5px;
}

.alert-copy p {
  margin-top: 1px;
  color: var(--ink-2);
  font-size: 12px;
}

.alert .btn {
  margin-left: auto;
  flex: none;
}

.text-preview.is-empty,
.card-text.is-empty,
.detail-text.is-empty {
  color: var(--muted);
  font-style: italic;
}

/* Results and table */

.results {
  position: relative;
}

.results.is-refreshing::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  z-index: 6;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: progress 1.25s ease-in-out infinite;
}

.table-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.table-shell::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 1px;
  left: 1px;
  height: 16px;
  background: linear-gradient(180deg, rgb(255 254 251 / 0), var(--surface));
  pointer-events: none;
}

.table-scroll {
  max-height: clamp(320px, calc(100dvh - 380px), 720px);
  overflow: auto;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.sessions-table {
  width: 100%;
  min-width: 1310px;
  border-collapse: collapse;
  table-layout: fixed;
}

.sessions-table .col-select {
  width: 42px;
}

.sessions-table .col-site {
  width: 216px;
}

.sessions-table .col-session {
  width: 168px;
}

.sessions-table .col-text {
  width: auto;
}

.sessions-table .col-capture {
  width: 96px;
}

.sessions-table .col-status {
  width: 128px;
}

.sessions-table .col-actions {
  width: 440px;
}

.sessions-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 9px 14px;
  background: var(--surface-2);
  box-shadow: inset 0 -1px 0 var(--line);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.col-actions-head {
  text-align: right !important;
}

/* --- selecao em lote --------------------------------------------------- */

.col-select-head {
  text-align: center !important;
}

.col-select-cell {
  text-align: center;
}

.row-select {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
  vertical-align: middle;
}

.row-select:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.sessions-table tbody tr.is-selected td {
  background: var(--accent-soft);
}

.sessions-table tbody tr.is-selected td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.bulk-count {
  margin-right: auto;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.btn-danger-solid {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.btn-danger-solid:hover:not(:disabled) {
  background: #862424;
  border-color: #862424;
}

.btn-danger-quiet {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  color: var(--danger);
}

.btn-danger-quiet:hover:not(:disabled) {
  border-color: var(--danger);
  background: var(--danger-soft);
}

@media (max-width: 720px) {
  .bulk-bar {
    gap: 6px;
  }

  .bulk-count {
    width: 100%;
  }
}

/* --- paginacao --------------------------------------------------------- */

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.pager-nums {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pager-num {
  min-width: 28px;
  height: 26px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.pager-num:hover {
  border-color: var(--line-strong);
  background: var(--surface-3);
}

.pager-num.is-current {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: default;
}

.pager-gap {
  color: var(--faint);
  font-size: 12px;
  padding: 0 2px;
}

.pager-info {
  margin-left: auto;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.pager-jump {
  width: 62px;
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}

.pager-jump:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

@media (max-width: 720px) {
  .pager-info {
    margin-left: 0;
    width: 100%;
  }
}

.sessions-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.sessions-table tbody tr:last-child td {
  border-bottom: 0;
}

.session-row {
  transition: background-color 0.12s ease;
}

.session-row:hover,
.session-row:focus-within {
  background: var(--surface-2);
}

.site-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.monogram {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.monogram--0 {
  background: #e2f0ec;
  color: #0e6b5b;
}

.monogram--1 {
  background: #f3ecd9;
  color: #7a5a12;
}

.monogram--2 {
  background: #e8ebf3;
  color: #3f527d;
}

.monogram--3 {
  background: #ece8f0;
  color: #6a4c7a;
}

.site-text {
  min-width: 0;
}

.site-domain {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sinaliza que o card soma hosts da mesma organizacao (www + pj + raiz). */
.site-hosts {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 500;
  vertical-align: middle;
}

.site-url {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-cell {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.session-key {
  overflow: hidden;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.text-preview {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.time-relative {
  display: block;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.time-absolute {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.35;
  white-space: nowrap;
}

.status-pill .dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}

.status-valid {
  background: var(--valid-soft);
  color: var(--valid);
}

.status-expired {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-unknown {
  background: var(--warn-soft);
  color: var(--warn);
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.icon-btn:hover:not(:disabled) {
  border-color: var(--line);
  background: var(--surface-3);
  color: var(--ink);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.icon-btn.is-copied {
  background: var(--valid-soft);
  color: var(--valid);
}

.open-btn {
  height: 30px;
  padding: 0 7px;
  font-size: 11.5px;
}

.open-btn .icon {
  width: 13px;
  height: 13px;
}

/* Empty and loading states */

.empty-row td {
  padding: 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 46px 24px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
}

.empty-icon .icon {
  width: 19px;
  height: 19px;
}

.empty-title {
  font-size: 13.5px;
  font-weight: 650;
}

.empty-text {
  max-width: 370px;
  margin: 3px 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.skeleton-row td {
  padding: 14px;
}

.skeleton {
  display: block;
  height: 9px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-3), #e8e7df, var(--surface-3));
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-avatar {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 7px;
}

.skeleton-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.skeleton-line--xs {
  width: 28px;
}

.skeleton-line--sm {
  width: 68%;
}

.skeleton-line--md {
  width: 84%;
}

.skeleton-line--lg {
  width: 95%;
}

.skeleton-pill {
  width: 64px;
  height: 20px;
  border-radius: 999px;
}

.table-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 11px;
}

.foot-note {
  text-align: right;
}

/* Mobile session cards */

.mobile-list {
  display: none;
}

.mobile-list .empty-state {
  padding: 30px 12px;
}

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

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-site {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.card-site .monogram {
  width: 30px;
  height: 30px;
}

.card-site-text {
  min-width: 0;
}

.card-domain {
  display: block;
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-url {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-text {
  display: -webkit-box;
  margin-top: 11px;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.card-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.card-meta-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.card-meta-value {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  color: var(--ink-2);
  font-size: 11.5px;
}

.card-meta-value .session-key {
  font-size: 10.5px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.card-actions .btn {
  height: 32px;
}

.skeleton-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.skeleton-card .skeleton + .skeleton {
  margin-top: 8px;
}

/* Detail dialog */

.detail-dialog {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(560px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: -24px 0 70px rgb(27 29 25 / 0.14);
}

.detail-dialog[open] {
  display: flex;
  flex-direction: column;
  animation: panel-in 0.18s ease-out;
}

.detail-dialog::backdrop {
  background: rgb(20 22 19 / 0.36);
  animation: fade-in 0.18s ease-out;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}

.detail-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.detail-heading .monogram {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 12px;
}

.detail-heading-text {
  min-width: 0;
}

.detail-head h2 {
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.detail-sub {
  margin-top: 1px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.4;
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 17px 20px 26px;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.detail-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.detail-expires {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.detail-meta {
  margin-bottom: 18px;
  border-top: 1px solid var(--line);
}

.detail-meta > div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.detail-meta dt {
  padding-top: 1px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.detail-meta dd {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink-2);
  font-size: 11.5px;
}

.detail-meta code {
  font-size: 10.5px;
  line-height: 1.5;
}

.detail-key-row dd {
  display: flex;
  align-items: center;
  gap: 1px;
  flex-wrap: wrap;
}

.detail-key-row .icon-btn {
  width: 27px;
  height: 27px;
}

.detail-section + .detail-section {
  margin-top: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.section-head h3 {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.detail-text {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.detail-snapshot {
  max-height: 290px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: #1c1f1b;
  color: #e8e9e2;
  font-size: 10.5px;
  line-height: 1.55;
  tab-size: 2;
}

.detail-snapshot code {
  font-family: inherit;
}

.detail-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding: 11px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.detail-feedback {
  margin-left: auto;
  color: var(--valid);
  font-size: 11px;
  font-weight: 600;
}

/* Toast */

.toast {
  position: fixed;
  top: auto;
  right: auto;
  bottom: 22px;
  left: 50%;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(92vw, 460px);
  margin: 0;
  padding: 9px 13px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  box-shadow: 0 8px 28px rgb(27 29 25 / 0.22);
  font-family: var(--font-sans);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@supports selector(:popover-open) {
  .toast[popover]:not(:popover-open) {
    display: none;
  }
}

.toast[data-tone="warn"] .toast-icon {
  color: #e9c46a;
}

.toast[data-tone="error"] .toast-icon {
  color: #f0a9a2;
}

.toast-icon {
  width: 14px;
  height: 14px;
  color: #9dd9c8;
}

.noscript {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 70;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  box-shadow: var(--shadow);
}

.clipboard-fallback {
  position: fixed;
  top: 0;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* Motion */

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@keyframes progress {
  0% {
    opacity: 0;
    transform: translateX(-100%);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(100%);
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Responsive */

@media (max-width: 1000px) {
  .topbar {
    padding-right: 20px;
    padding-left: 20px;
  }

  main {
    padding-right: 20px;
    padding-left: 20px;
  }

  .summary-item {
    padding: 0 16px;
  }
}

@media (max-width: 800px) {
  .table-shell {
    display: none;
  }

  .mobile-list {
    display: grid;
    gap: 9px;
  }

  .table-foot {
    margin-top: 11px;
  }
}

@media (max-width: 700px) {
  .topbar {
    flex-wrap: wrap;
    gap: 9px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 13px 18px;
    padding: 13px 0;
  }

  .summary-sep {
    display: none;
  }

  .summary-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0;
  }

  .summary-value {
    font-size: 20px;
  }

  .workspace-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .field-search {
    flex-basis: 100%;
  }

  .field {
    flex: 1 1 calc(50% - 5px);
  }

  .field select {
    width: 100%;
  }

  .clear-btn {
    flex: 1 1 100%;
    justify-content: flex-start;
    padding-left: 0;
  }

  .table-foot {
    flex-direction: column;
    gap: 3px;
  }

  .foot-note {
    text-align: left;
  }

  .detail-dialog {
    border-left: 0;
  }

  .detail-head,
  .detail-body,
  .detail-foot {
    padding-right: 16px;
    padding-left: 16px;
  }
}

@media (max-width: 520px) {
  main {
    padding: 18px 14px 28px;
  }

  .topbar {
    padding-right: 14px;
    padding-left: 14px;
  }

  .brand-sub {
    display: none;
  }

  .topbar-actions {
    gap: 6px;
    display: contents;
  }

  .topbar::after {
    content: "";
    order: 1;
    flex: 0 0 100%;
    height: 0;
  }

  .api-status {
    order: 0;
    flex: 0 0 auto;
    margin-left: auto;
  }

  .topbar-actions .btn {
    order: 2;
    flex: 1 1 0;
  }

  .field {
    flex-basis: 100%;
  }

  .alert {
    flex-wrap: wrap;
  }

  .alert .btn {
    margin-left: 26px;
  }

  .detail-meta > div {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .detail-foot .btn {
    flex: 1 1 auto;
  }

  .detail-feedback {
    flex-basis: 100%;
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .refresh-icon.is-spinning,
  .api-status[data-state="loading"] .api-dot,
  .skeleton,
  .results.is-refreshing::before,
  .detail-dialog[open],
  .detail-dialog::backdrop {
    animation: none;
  }

  .results.is-refreshing::before {
    opacity: 0.5;
    transform: none;
  }

  .toast,
  .session-row,
  .btn,
  .icon-btn,
  input[type="search"],
  select {
    transition: none;
  }
}

/* abas de categoria (financas / internos / comunicacao / infra / generico) */
.cat-tabs{display:flex;flex-wrap:wrap;gap:.5rem;margin:0 0 .85rem}
.cat-tab{font:inherit;font-size:.8125rem;line-height:1;padding:.5rem .8rem;border-radius:999px;border:1px solid rgba(127,127,127,.35);background:rgba(127,127,127,.08);color:inherit;cursor:pointer;opacity:.8}
.cat-tab:hover{opacity:1}
.cat-tab.is-active{border-color:currentColor;background:rgba(127,127,127,.22);font-weight:600;opacity:1}
.cat-tab:focus-visible{outline:2px solid currentColor;outline-offset:2px}
/* coluna e badge de categoria */
.col-cat{width:128px}
.col-cat-cell{white-space:nowrap}
.cat-badge{display:inline-block;font-size:.6875rem;line-height:1;letter-spacing:.02em;text-transform:uppercase;padding:.32rem .5rem;border-radius:999px;border:1px solid rgba(127,127,127,.35);background:rgba(127,127,127,.1);opacity:.9;margin-top:.25rem}
.cat-badge[data-grupo="financas"]{border-color:rgba(90,200,140,.55);background:rgba(90,200,140,.14);color:#8ee0b0}
.cat-badge[data-grupo="internos"]{border-color:rgba(240,170,90,.55);background:rgba(240,170,90,.14);color:#f3c78a}
.cat-badge[data-grupo="comunicacao"]{border-color:rgba(110,168,254,.55);background:rgba(110,168,254,.14);color:#a9c8ff}
.cat-badge[data-grupo="infra"]{border-color:rgba(180,140,240,.55);background:rgba(180,140,240,.14);color:#cbb2ff}
.cat-badge[data-grupo="generico"]{opacity:.75}
/* ---- alerta de captura (sino + contador) ---- */
.alerta-sino {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.alerta-sino:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.alerta-sino:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.alerta-sino[data-mudo="1"] {
  color: var(--faint);
}

.alerta-sino[data-mudo="1"] .icon {
  opacity: 0.55;
}

.alerta-contador {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.alerta-contador[hidden] {
  display: none;
}

/* ---- identidade da maquina na linha da sessao ---- */
.site-maquina {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 34ch;
}

/* ==========================================================================
   Botoes de acao — icone, cor funcional, tooltip
   tone-info (cinza/azul) | tone-open (verde) | tone-export (ambar) | tone-danger
   ========================================================================== */

.btn-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease, transform 0.1s ease;
}

.btn-icon .icon {
  width: 17px;
  height: 17px;
  stroke-width: 1.85;
}

.btn-icon:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-icon:active:not(:disabled) {
  transform: translateY(0);
}

.btn-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn-icon:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

/* --- tons --- */
.btn-icon.tone-info {
  color: #4a5a6a;
  background: #eef1f4;
}
.btn-icon.tone-info:hover:not(:disabled) {
  color: #1f3346;
  background: #dde4ea;
}

.btn-icon.tone-open {
  color: var(--valid);
  background: var(--valid-soft);
}
.btn-icon.tone-open:hover:not(:disabled) {
  color: #0f4d2c;
  background: #d3ecdb;
}

.btn-icon.tone-export {
  color: var(--warn);
  background: var(--warn-soft);
}
.btn-icon.tone-export:hover:not(:disabled) {
  color: #5f3e00;
  background: #f7e6c4;
}

.btn-icon.tone-danger {
  color: var(--danger);
  background: var(--danger-soft);
}
.btn-icon.tone-danger:hover:not(:disabled) {
  color: #7a1d1d;
  background: #f8d9d5;
}

/* --- tooltip em camada propria: nao sofre o overflow do .table-scroll --- */
.tip {
  position: fixed;
  z-index: 90;
  max-width: 260px;
  padding: 6px 9px;
  border-radius: 7px;
  background: #1b1d19;
  color: #fff;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  box-shadow: 0 8px 22px rgb(27 29 25 / 0.24);
}

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

.tip::after {
  content: '';
  position: absolute;
  left: var(--seta, 50%);
  bottom: -5px;
  border: 5px solid transparent;
  border-top-color: #1b1d19;
  transform: translateX(-50%);
}

.tip[data-lado='baixo']::after {
  bottom: auto;
  top: -5px;
  border-top-color: transparent;
  border-bottom-color: #1b1d19;
}

@media (prefers-reduced-motion: reduce) {
  .tip {
    transition: none;
  }
}

/* ==========================================================================
   Pilula de acao — icone + rotulo (tabela e card)
   ========================================================================== */

.pilula {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.005em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease,
    transform 0.1s ease;
}

.pilula .icon {
  width: 14px;
  height: 14px;
  flex: none;
  stroke-width: 1.9;
}

.pilula-rotulo {
  display: inline-block;
}

.pilula:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgb(27 29 25 / 0.1);
}

.pilula:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

.pilula:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pilula:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  box-shadow: none;
}

/* --- tons: fundo cheio, texto de alto contraste --- */
.pilula.tone-info {
  background: #eef1f4;
  color: #33465a;
}
.pilula.tone-info:hover:not(:disabled) {
  background: #dde4ea;
  color: #1f3346;
}

.pilula.tone-ghost {
  background: transparent;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
}
.pilula.tone-ghost:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--ink);
}

.pilula.tone-open {
  background: var(--valid);
  color: #fff;
}
.pilula.tone-open:hover:not(:disabled) {
  background: #14572f;
}

.pilula.tone-export {
  background: #a8690a;
  color: #fff;
}
.pilula.tone-export:hover:not(:disabled) {
  background: #8a5407;
}

.pilula.tone-danger {
  background: var(--danger);
  color: #fff;
}
.pilula.tone-danger:hover:not(:disabled) {
  background: #7d2020;
}

/* credenciais: roxo, distinto do resto — e o dado mais sensivel da linha */
.pilula.tone-cred {
  background: #6b3fa0;
  color: #fff;
}
.pilula.tone-cred:hover:not(:disabled) {
  background: #55307f;
}

/* OPERAR: e o botao principal da linha — verde cheio, nao outline */
.pilula.tone-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.pilula.tone-primary:hover:not(:disabled) {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

/* --- credenciais identificadas (triagem) ------------------------------- */

.section-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.triagem-perfil {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-strong);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}

.triagem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
}

.triagem-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 8px 10px;
  min-width: 0;
}

/* dado sensivel (senha, otp, cartao) fica com a borda marcada: e o que o
   operador copia primeiro, e nao pode se confundir com agencia/conta */
.triagem-card.is-sensivel {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-2));
}

.triagem-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.triagem-card-tipo {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.triagem-card-formato {
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.triagem-card-linha {
  display: flex;
  align-items: center;
  gap: 6px;
}

.triagem-card-valor {
  flex: 1;
  min-width: 0;
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.triagem-card-linha .btn {
  flex: 0 0 auto;
}

.triagem-vazio {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

/* --- painel de credenciais -------------------------------------------- */

.creds-box {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  width: min(560px, calc(100vw - 36px));
  max-height: min(70vh, 620px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.creds-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.creds-title {
  font-size: 13px;
  color: var(--ink);
}

.creds-body {
  overflow: auto;
  padding: 8px 14px;
}

.creds-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}

.creds-row:last-child {
  border-bottom: 0;
}

.creds-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.creds-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.creds-value {
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 12.5px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--ink);
  user-select: all;
}

.creds-url {
  width: 100%;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creds-acoes {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 14px 12px;
  border-top: 1px solid var(--line);
}

@media (max-width: 640px) {
  .creds-box {
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
  }
}

/* linha de acoes: 6 pilulas lado a lado sem quebrar */
.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 6px;
}

/* quando a coluna aperta, quebra em 2 linhas alinhadas a direita
   em vez de transbordar por cima da coluna vizinha (table-layout: fixed) */
@container (max-width: 519px) {
  .row-actions {
    flex-wrap: wrap;
  }
}

.col-actions-cell {
  padding-right: 10px !important;
  container-type: inline-size;
}

.col-actions-cell .row-actions {
  min-width: 0;
}

/* card mobile: pilulas quebram em linhas com largura igual, sem transbordar */
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-actions .pilula {
  flex: 1 1 auto;
  min-width: 0;
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
}

.card-actions .pilula-rotulo {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .pilula,
  .pilula:hover:not(:disabled) {
    transition: none;
    transform: none;
  }
}

/* ═══════════════════════════════════════════════════════════════
   CONTROLE REMOTO — barra do tunel, selo ao vivo, menu de comandos
   ═══════════════════════════════════════════════════════════════ */

/* barra do tunel: linha unica, alinhada ao resumo */
.tunel-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--ink-2);
}

.tunel-rotulo {
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.tunel-estado {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  color: var(--muted);
}

.tunel-estado[data-state="on"] {
  border-color: var(--valid);
  background: var(--valid-soft);
  color: var(--valid);
}

.tunel-meta {
  color: var(--faint);
  font-size: 12px;
}

.tunel-bar .btn {
  margin-left: auto;
}

/* selo de estado por vitima: substitui o campo vazio quando nao ha socket */
.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid var(--line-strong);
  color: var(--faint);
  background: var(--surface-2);
}

.live-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}

.live-dot[data-state="on"] {
  border-color: var(--valid);
  background: var(--valid-soft);
  color: var(--valid);
}

.live-dot[data-state="on"]::before {
  opacity: 1;
}

/* menu de comandos: ancora no botao, abre para baixo */
.cmd-menu {
  position: relative;
  display: inline-flex;
}

.cmd-toggle {
  min-width: 30px;
  padding: 3px 7px;
}

.cmd-list {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 40;
  min-width: 190px;
  display: grid;
  gap: 1px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.cmd-item {
  appearance: none;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink-2);
  padding: 7px 9px;
  border-radius: 5px;
  cursor: pointer;
}

.cmd-item:hover,
.cmd-item:focus-visible {
  background: var(--accent-soft);
  color: var(--accent-strong);
  outline: none;
}

.cmd-nav {
  display: flex;
  gap: 4px;
  padding: 5px 4px 2px;
  border-top: 1px solid var(--line);
  margin-top: 3px;
}

.cmd-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 12px;
  padding: 5px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink);
}

.cmd-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.cmd-go {
  flex: 0 0 auto;
  font-weight: 600;
  color: var(--accent);
}

@media (max-width: 768px) {
  .tunel-bar {
    font-size: 12px;
  }

  .tunel-bar .btn {
    margin-left: 0;
  }

  .cmd-list {
    right: auto;
    left: 0;
  }
}

/* console de retorno: resposta de comando, linha a linha (SSE) */
.console-retorno {
  margin: 0 0 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.console-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.console-rotulo {
  font-weight: 600;
  color: var(--ink);
}

.console-estado {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--faint);
}

.console-estado[data-state="on"] {
  color: #15803d;
  border-color: rgba(21, 128, 61, 0.35);
}

.console-meta {
  color: var(--faint);
  font-size: 12px;
  margin-left: auto;
}

/* seletor alvo do "Sincronizar Inputs" */
.sync-seletor-linha {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.sync-seletor-label {
  color: var(--faint);
  white-space: nowrap;
}

.sync-seletor-campo {
  flex: 1 1 auto;
  min-width: 0;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg, #fff);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.sync-seletor-campo:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.sync-seletor-status {
  color: var(--faint);
  font-size: 11px;
  white-space: nowrap;
}

/* editores do console: clique/digitar e roteiro */
.clique-editor,
.roteiro-editor {
  display: grid;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.clique-linha {
  display: flex;
  align-items: center;
  gap: 8px;
}

.clique-linha .sync-seletor-campo {
  flex: 1 1 auto;
}

.clique-opcoes {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--faint);
}

.clique-opcoes label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.console-linhas {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  max-height: 220px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.console-linhas:empty::after {
  content: "nenhuma resposta ainda";
  display: block;
  padding: 8px 14px;
  color: var(--faint);
  font-family: inherit;
}

.console-linha {
  display: grid;
  grid-template-columns: 62px 92px 110px 1fr;
  gap: 8px;
  padding: 3px 14px;
  white-space: nowrap;
  overflow: hidden;
}

.console-linha[data-ok="0"] {
  color: #b91c1c;
}

.console-hora {
  color: var(--faint);
}

.console-vid {
  overflow: hidden;
  text-overflow: ellipsis;
}

.console-saida {
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 720px) {
  .console-linha {
    grid-template-columns: 54px 1fr;
  }
  .console-vid,
  .console-acao {
    display: none;
  }
}

.console-alvo {
  font-size: 11px;
  color: var(--ink-2);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px dashed var(--line);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* PAINEL DE OPERACAO: comando da vitima selecionada */
.operacao {
  margin: 0 0 18px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  overflow: hidden;
}

.operacao-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.operacao-titulo {
  font-weight: 700;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
}

.operacao-alvo {
  font-weight: 600;
  color: var(--ink);
}

.operacao-vid {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--faint);
}

.operacao-head .btn {
  margin-left: auto;
}

.operacao-corpo {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.operacao-grupo {
  display: grid;
  gap: 7px;
}

.operacao-rotulo {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--faint);
}

.operacao-botoes {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.operacao-nav {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 1 1 260px;
}

.operacao-nav .sync-seletor-campo {
  flex: 1 1 auto;
  min-width: 140px;
}

/* alvo do console: destaque na linha/card selecionado */
.session-row.is-alvo {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.session-row.is-alvo td {
  font-weight: 600;
}

.session-row[role="button"] {
  cursor: pointer;
}

.session-row[role="button"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.session-card.is-alvo {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent), 0 0 0 1px var(--accent-soft);
}

.console-alvo[data-ativo="1"] {
  color: var(--accent-strong);
  border-style: solid;
  font-weight: 600;
}

.console-head .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* editor do escopo de captura */
.escopo-editor {
  display: grid;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-2, var(--surface));
}

.escopo-label {
  font-size: 12px;
  color: var(--ink-2);
}

.escopo-lista {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg, #fff);
  color: var(--ink);
  resize: vertical;
}

.escopo-acoes {
  display: flex;
  align-items: center;
  gap: 8px;
}

.escopo-status {
  font-size: 12px;
  color: var(--faint);
}
