﻿:root {
  --bg: #eceef1;
  --bg-soft: #f6f7f9;
  --surface: #ffffff;
  --surface-alt: #f3f5f7;
  --surface-hover: #ebeff4;
  --text: #1f2a35;
  --text-secondary: #4f5c68;
  --muted: #7b8794;
  --line: #d4dbe3;
  --line-strong: #c4cdd7;

  --primary: #77c60f;
  --primary-strong: #5da103;
  --primary-soft: #eff9dd;
  --primary-border: #cce7a0;
  --primary-glow: rgba(119, 198, 15, 0.25);

  --ok: #238c45;
  --ok-surface: #eaf7ec;
  --ok-border: #c2e4c8;

  --error: #c94b4b;
  --error-surface: #fbecec;
  --error-border: #efc7c7;

  --warning: #aa7a11;
  --warning-surface: #fcf5e7;
  --warning-border: #f0ddaf;

  --shadow: 0 8px 26px rgba(28, 40, 56, 0.07);
  --shadow-hover: 0 12px 32px rgba(28, 40, 56, 0.13);
  --radius: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100%;
}

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

/* ── Scrollbar ── */

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ── App Layout ── */

.app-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
}

/* ── Sidebar ── */

.sidebar {
  background: linear-gradient(180deg, #f0f2f5 0%, #e4e8ed 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.sidebar-brand {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.menu-toggle {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 2px;
  cursor: default;
  padding: 0;
}

.brand-mark {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  border: 3px solid var(--primary);
  background: radial-gradient(circle at center, #d9f5ab 18%, transparent 20%);
  animation: brandPulse 3s ease-in-out infinite;
}

@keyframes brandPulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.1);
    opacity: 0.85;
  }
}

.brand-name {
  color: var(--primary-strong);
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.sidebar-scroll {
  flex: 1;
  overflow: auto;
  padding: 12px 8px;
}

.menu-group {
  margin-bottom: 18px;
}

.menu-group h2 {
  margin: 10px 8px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.menu-link {
  width: 100%;
  border: 0;
  background: transparent;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  cursor: pointer;
  position: relative;
  transition: background 200ms ease, color 200ms ease, transform 150ms ease;
}

.menu-link .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 200ms ease;
}

.menu-link:hover .nav-icon {
  opacity: 1;
}

.menu-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 60%;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
  transition: transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.menu-link:hover {
  background: var(--surface-hover);
  transform: translateX(2px);
}

.tab-btn.menu-link.active {
  background: var(--primary);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  transform: translateX(0);
}

.tab-btn.menu-link.active::before {
  transform: translateY(-50%) scaleY(1);
  background: #fff;
}

.tab-btn.menu-link.active .nav-icon {
  opacity: 1;
  filter: brightness(10);
}

.sidebar-footer {
  border-top: 1px solid var(--line);
  background: #151d2b;
  color: #fff;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-name {
  font-size: 12px;
  font-weight: 700;
}

.user-id {
  color: #cfd5dd;
  font-size: 11px;
}

/* ── Content Layout ── */

.content-layout {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line);
  min-height: 58px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-secondary);
  font-size: 12px;
}

.breadcrumbs strong {
  color: var(--text);
  font-weight: 700;
}

.breadcrumbs .sep {
  color: #a1acb8;
}

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

.topbar-api {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-api label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-api input {
  width: 240px;
  max-width: 42vw;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.last-updated {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.countdown-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

.countdown-badge svg {
  width: 14px;
  height: 14px;
  animation: spin 30s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Main Content ── */

.main-content {
  padding: 12px;
}

.subtabs {
  margin: 0 0 10px;
}

.subtabs-track {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: #f1f3f6;
  border: 1px solid var(--line);
  border-radius: 10px;
  gap: 2px;
}

.subtab {
  border: 0;
  background: transparent;
  color: #667380;
  border-radius: 8px;
  min-width: 140px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
}

.subtab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(31, 42, 53, 0.09);
}

.subtab:disabled {
  cursor: default;
}

/* ── Dashboard Sub-Tabs ── */

.dashboard-subtabs {
  margin: 0;
}

.dashboard-subtabs .subtabs-track {
  display: flex;
  width: 100%;
  background: linear-gradient(135deg, #f4f6f9 0%, #edf0f4 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  gap: 3px;
  box-shadow: inset 0 1px 3px rgba(28, 40, 56, 0.04);
}

.dashboard-subtab {
  flex: 1;
  border: 0;
  background: transparent;
  color: #667380;
  border-radius: 9px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 220ms cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}

.dashboard-subtab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 200ms ease;
}

.dashboard-subtab:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
}

.dashboard-subtab:hover svg {
  opacity: 1;
}

.dashboard-subtab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(28, 40, 56, 0.1), 0 1px 2px rgba(28, 40, 56, 0.06);
}

.dashboard-subtab.active svg {
  opacity: 1;
  color: var(--primary);
}

.dashboard-sub-panel {
  display: none;
}

.dashboard-sub-panel.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: subPanelReveal 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes subPanelReveal {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Collapsible Filters ── */

.card-filters {
  border: 1px solid var(--line);
}

.filters-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.filters-summary::-webkit-details-marker {
  display: none;
}

.filters-summary h2 {
  position: relative;
  padding-left: 22px;
}

.filters-summary h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) rotate(0deg);
  width: 0;
  height: 0;
  border-left: 6px solid var(--muted);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transition: transform 200ms ease;
}

details[open]>.filters-summary h2::before {
  transform: translateY(-50%) rotate(90deg);
}

.card-filters .section-note {
  margin-top: 10px;
}

/* ── Section Icons ── */

.section-icon {
  width: 22px;
  height: 22px;
  vertical-align: middle;
  margin-right: 6px;
  opacity: 0.5;
}

.card-header-row h2 {
  display: flex;
  align-items: center;
}

/* ── Tab Panels ── */

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: tabReveal 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes tabReveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Cards ── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  transition: transform 250ms ease, box-shadow 250ms ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.card h2 {
  margin: 0;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

.section-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

/* ── Filters ── */

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

.filters-grid-export {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.filters-grid-export-base {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.export-panel {
  margin-top: 14px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}

.export-panel h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.filters-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Fields & Inputs ── */

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

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

.field-inline {
  flex-direction: row;
  align-items: center;
  gap: 7px;
}

input,
select,
textarea {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: #fff;
  padding: 10px 10px;
  font-size: 13px;
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 150ms ease;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
  transform: scale(1.005);
}

input::placeholder,
textarea::placeholder {
  color: #9ba6b2;
}

/* ── Buttons ── */

.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 180ms ease;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.96);
}

.btn-sm {
  padding: 8px 11px;
  font-size: 12px;
}

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

.btn-primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  box-shadow: 0 4px 14px rgba(119, 198, 15, 0.25);
}

.btn-ghost {
  background: #fff;
  color: var(--text-secondary);
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--muted);
}

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

.btn-danger:hover {
  background: #aa3535;
  border-color: #aa3535;
  box-shadow: 0 4px 14px rgba(201, 75, 75, 0.25);
}

.btn.is-loading {
  color: transparent !important;
  pointer-events: none;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ── Health Badge ── */

.health {
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  transition: all 300ms ease;
}

.health-ok {
  color: var(--ok);
  background: var(--ok-surface);
  border-color: var(--ok-border);
  box-shadow: 0 0 12px rgba(35, 140, 69, 0.15);
  animation: healthGlow 2.5s ease-in-out infinite;
}

@keyframes healthGlow {

  0%,
  100% {
    box-shadow: 0 0 8px rgba(35, 140, 69, 0.12);
  }

  50% {
    box-shadow: 0 0 18px rgba(35, 140, 69, 0.28);
  }
}

.health-error {
  color: var(--error);
  background: var(--error-surface);
  border-color: var(--error-border);
}

.health-pending {
  color: var(--warning);
  background: var(--warning-surface);
  border-color: var(--warning-border);
  animation: pendingPulse 1.2s ease-in-out infinite;
}

@keyframes pendingPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

/* ── Overview Layout ── */

.overview-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 16px;
  align-items: start;
}

.overview-donut-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
}

@media (max-width: 980px) {
  .overview-layout {
    grid-template-columns: 1fr;
  }
}

/* ── KPI Grid ── */

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

.kpi-grid-mini {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.machine-debug-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.machine-debug-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff 0%, var(--surface-alt) 100%);
  padding: 14px;
}

.machine-debug-card h3 {
  margin: 0 0 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.machine-debug-list {
  display: grid;
  gap: 8px;
}

.machine-debug-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  padding: 10px;
}

.machine-debug-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-weight: 700;
  color: #1d2a19;
}

.machine-debug-meta {
  font-size: 12px;
  color: var(--muted);
}

.machine-debug-reason {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
  color: #2a3a2f;
}

.kpi {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(135deg, var(--surface-alt) 0%, #fff 100%);
  padding: 14px;
  border-left: 4px solid var(--line);
  transition: transform 250ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 250ms ease, border-color 200ms ease;
  position: relative;
  overflow: hidden;
}

.kpi::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(119, 198, 15, 0.04) 0%, transparent 70%);
  transform: translate(20px, -20px);
  pointer-events: none;
}

.kpi:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(28, 40, 56, 0.1);
}

.kpi.kpi-accent-ok {
  border-left-color: var(--ok);
}

.kpi.kpi-accent-ok::after {
  background: radial-gradient(circle, rgba(35, 140, 69, 0.06) 0%, transparent 70%);
}

.kpi.kpi-accent-error {
  border-left-color: var(--error);
}

.kpi.kpi-accent-error::after {
  background: radial-gradient(circle, rgba(201, 75, 75, 0.06) 0%, transparent 70%);
}

.kpi.kpi-accent-primary {
  border-left-color: var(--primary);
}

.kpi.kpi-accent-warning {
  border-left-color: var(--warning);
}

.kpi.kpi-accent-warning::after {
  background: radial-gradient(circle, rgba(170, 122, 17, 0.06) 0%, transparent 70%);
}

.kpi-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
}

.kpi-label svg {
  width: 14px;
  height: 14px;
  opacity: 0.5;
}

.kpi-value {
  margin-top: 5px;
  font-size: 22px;
  line-height: 1.2;
  font-family: "IBM Plex Mono", monospace;
  color: #1d2a19;
  font-weight: 600;
}

.kpi-value-small {
  font-size: 16px;
}

/* ── Tables ── */

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
  background: #fff;
}

th,
td {
  padding: 10px 10px;
  border-bottom: 1px solid #e7edf4;
  text-align: left;
  vertical-align: top;
}

th {
  background: rgba(248, 250, 252, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #6c7986;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 2;
}

td {
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 150ms ease;
}

tr:hover td {
  background: rgba(119, 198, 15, 0.04);
}

tr.run-row {
  cursor: pointer;
}

tr.run-row:hover {
  background: var(--primary-soft);
}

tr.telemetry-machine-row {
  cursor: pointer;
}

tr.telemetry-machine-row:hover td {
  background: rgba(119, 198, 15, 0.06);
}

tr.telemetry-machine-row.telemetry-machine-row-selected td {
  background: #dceec0;
  color: #20310f;
}

tr.selected {
  background: #58820a;
}

tr.selected td {
  background: #8ab33e !important;
  color: #22310f;
}

tr.selected:hover td {
  background: #cde49e !important;
}

/* ── Status Pills ── */

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
  transition: transform 150ms ease;
}

.status-pill:hover {
  transform: scale(1.05);
}

.status-ok {
  color: var(--ok);
  background: var(--ok-surface);
  border-color: var(--ok-border);
}

.status-error {
  color: var(--error);
  background: var(--error-surface);
  border-color: var(--error-border);
}

.status-warning,
.status-placeholder,
.status-info {
  color: var(--warning);
  background: var(--warning-surface);
  border-color: var(--warning-border);
}

.status-processing {
  color: var(--warning);
  background: var(--warning-surface);
  border-color: var(--warning-border);
  animation: processingPulse 1.5s ease-in-out infinite;
}

@keyframes processingPulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.7;
    transform: scale(1.03);
  }
}

/* ── Pagination ── */

.pager {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

#pageInfo,
#queuePageInfo,
.mono {
  font-family: "IBM Plex Mono", monospace;
}

/* ── Queue ── */

.queue-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.queue-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── CSV Drop Zone ── */

.csv-drop-zone {
  border: 2px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--surface-alt);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color 250ms ease, background 250ms ease, transform 200ms ease;
  position: relative;
  text-align: center;
}

.csv-drop-zone svg {
  width: 32px;
  height: 32px;
  color: var(--muted);
  transition: color 250ms ease, transform 300ms ease;
}

.csv-drop-zone span {
  font-size: 13px;
  color: var(--text-secondary);
}

.csv-drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.csv-drop-zone:hover {
  border-color: var(--primary);
  background: rgba(112, 186, 17, 0.04);
}

.csv-drop-zone:hover svg {
  color: var(--primary);
  transform: translateY(-2px);
}

.csv-drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(112, 186, 17, 0.08);
  transform: scale(1.01);
}

.csv-drop-zone.drag-over svg {
  color: var(--primary);
  transform: translateY(-4px);
}

.csv-drop-filename {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  min-height: 16px;
}

#cpfRegCpfsInput {
  min-height: 112px;
  font-family: "IBM Plex Mono", monospace;
}

.telemetry-top-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

#telemetryTopProcessesContext {
  margin-top: 0;
  flex: 1;
}

tr.telemetry-top-date-row td {
  background: #f4f8ea;
  color: #3e6014;
  font-size: 12px;
  font-weight: 700;
}

.queue-alert-cell .status-pill {
  white-space: nowrap;
}

/* ── Logins ── */

.login-register-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.login-controls {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
}

#loginsSearchInput {
  min-width: 220px;
}

.login-import-file {
  max-width: 290px;
}

.login-import-overwrite {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.login-import-overwrite input {
  margin: 0;
}

.login-import-file-name {
  max-width: 340px;
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.login-modal-import-wrap {
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
}

.login-modal-import-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#loginModalImportFeedback {
  margin-top: 10px;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field-full {
  grid-column: span 2;
}

.queue-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
  margin-bottom: 12px;
}

.queue-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.queue-meta-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #708193;
}

.queue-meta-value {
  font-size: 13px;
  color: var(--text-secondary);
}

.modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Feedback ── */

.feedback-msg {
  margin-top: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-alt);
  font-size: 13px;
  transition: all 300ms ease;
}

.feedback-msg.feedback-success {
  background: var(--ok-surface);
  border-color: var(--ok-border);
  color: var(--ok);
}

.feedback-msg.feedback-error {
  background: var(--error-surface);
  border-color: var(--error-border);
  color: var(--error);
}

.feedback-msg.feedback-warning {
  background: var(--warning-surface);
  border-color: var(--warning-border);
  color: var(--warning);
}

.dashboard-alerts {
  display: grid;
  gap: 8px;
}

.dashboard-alerts .feedback-msg {
  margin-top: 0;
}

/* ── Errors List ── */

.errors-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.errors-list li {
  border: 1px solid var(--error-border);
  border-radius: 10px;
  background: var(--error-surface);
  color: #9a4444;
  margin-bottom: 8px;
  padding: 10px 12px;
  font-size: 13px;
  transition: transform 200ms ease, box-shadow 200ms ease;
  position: relative;
  overflow: hidden;
}

.errors-list li:hover {
  transform: translateX(3px);
  box-shadow: 0 3px 10px rgba(201, 75, 75, 0.1);
}

.error-count {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  color: #b03c3c;
}

.error-bar-bg {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, #e88, #c94b4b);
  border-radius: 0 3px 3px 0;
  opacity: 0.5;
  transition: width 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

.error-monitor-table {
  min-width: 1320px;
}

.error-monitor-machine {
  display: grid;
  gap: 2px;
  min-width: 170px;
}

.error-monitor-print,
.error-monitor-error {
  max-width: 340px;
  word-break: break-word;
}

/* ── Timeline Bars ── */

.timeline-bars {
  min-height: 220px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 8px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #fbfcfe 0%, #f1f4f8 100%);
  padding: 8px;
  overflow-x: auto;
}

.timeline-bars-campaign {
  min-height: 200px;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  margin-top: 12px;
}

.timeline-bars .canvas-chart-wrap {
  min-width: 100%;
}

.timeline-bars-campaign .bar {
  background: linear-gradient(180deg, #ffd366 0%, #f5c04d 40%, #d98f00 100%);
  box-shadow: 0 2px 6px rgba(217, 143, 0, 0.15);
}

.timeline-bars-campaign .bar:hover {
  box-shadow: 0 6px 16px rgba(217, 143, 0, 0.25);
}

.bar-item {
  height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: end;
  animation: barSlideUp 400ms cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.bar-item:nth-child(1) {
  animation-delay: 0ms;
}

.bar-item:nth-child(2) {
  animation-delay: 30ms;
}

.bar-item:nth-child(3) {
  animation-delay: 60ms;
}

.bar-item:nth-child(4) {
  animation-delay: 90ms;
}

.bar-item:nth-child(5) {
  animation-delay: 120ms;
}

.bar-item:nth-child(6) {
  animation-delay: 150ms;
}

.bar-item:nth-child(7) {
  animation-delay: 180ms;
}

.bar-item:nth-child(8) {
  animation-delay: 210ms;
}

.bar-item:nth-child(9) {
  animation-delay: 240ms;
}

.bar-item:nth-child(10) {
  animation-delay: 270ms;
}

.bar-item:nth-child(11) {
  animation-delay: 300ms;
}

.bar-item:nth-child(12) {
  animation-delay: 330ms;
}

.bar-item:nth-child(n+13) {
  animation-delay: 360ms;
}

@keyframes barSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scaleY(0.6);
  }

  to {
    opacity: 1;
    transform: translateY(0) scaleY(1);
  }
}

.bar {
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #b4e652 0%, #70ba11 50%, #5a9e0a 100%);
  min-height: 4px;
  transition: transform 250ms cubic-bezier(0.22, 1, 0.36, 1), filter 200ms ease, box-shadow 200ms ease;
  cursor: default;
  position: relative;
  box-shadow: 0 2px 6px rgba(112, 186, 17, 0.15);
}

.bar:hover {
  transform: scaleY(1.08) translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 6px 16px rgba(112, 186, 17, 0.25);
}

.bar-value {
  text-align: center;
  margin-top: 4px;
  font-size: 11px;
  color: #5f6d7a;
  font-family: "IBM Plex Mono", monospace;
}

.bar-label {
  text-align: center;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

/* ── Detail Header ── */

.detail-header {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  padding: 10px;
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

.detail-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  margin-bottom: 10px;
}

.cpf-important-wrap {
  margin-bottom: 10px;
}

.cpf-important-head {
  margin-bottom: 8px;
}

.cpf-important-head h3 {
  margin: 0;
  font-size: 14px;
}

.cpf-important-group {
  margin-bottom: 10px;
}

.cpf-important-group:last-child {
  margin-bottom: 0;
}

.cpf-important-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.cpf-important-table {
  min-width: 1880px;
}

.cpf-important-table td:first-child {
  font-family: "IBM Plex Mono", monospace;
}

/* ── Categories ── */

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.category-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
  padding: 10px;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.category-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(28, 40, 56, 0.08);
}

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

.category-head strong {
  font-size: 14px;
}

.category-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.category-mapped {
  margin: 0;
  padding-left: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

.category-mapped li {
  margin-bottom: 3px;
}

.category-empty {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

/* ── Raw Toggle ── */

.raw-toggle {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: #fff;
}

.raw-toggle summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.json-box {
  border: 1px solid var(--line);
  border-radius: 9px;
  margin: 8px 0 0;
  padding: 8px;
  background: #f9fbfd;
  max-height: 250px;
  overflow: auto;
  font-size: 12px;
  color: #43505f;
  font-family: "IBM Plex Mono", monospace;
}

.payload-preview {
  max-width: 340px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

/* ── Modals ── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.48);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  z-index: 1000;
  overflow-y: auto;
  animation: overlayFadeIn 200ms ease;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

@keyframes overlayFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-panel {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 20px 44px rgba(13, 24, 38, 0.2);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-lg {
  max-width: 1120px;
}

.modal-md {
  max-width: 740px;
}

.modal-header {
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  width: 32px;
  height: 32px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 180ms ease;
}

.modal-close:hover {
  background: var(--error-surface);
  color: var(--error);
  border-color: var(--error-border);
  transform: rotate(90deg);
}

.modal-body {
  padding: 12px 14px;
  overflow: auto;
}

.modal-tabs {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
  display: flex;
  overflow: hidden;
  margin-bottom: 10px;
}

.modal-tab-btn {
  flex: 1;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}

.modal-tab-btn:last-child {
  border-right: 0;
}

.modal-tab-btn:hover {
  background: rgba(255, 255, 255, 0.6);
}

.modal-tab-btn.active {
  background: #fff;
  color: var(--text);
}

.modal-tab-panel {
  display: none;
}

.modal-tab-panel.active {
  display: block;
  animation: tabReveal 250ms ease;
}

/* ── Toast Notifications ── */

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 400px;
}

.toast {
  pointer-events: all;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(13, 24, 38, 0.18);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toastIn 350ms cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  overflow: hidden;
}

.toast.toast-exit {
  animation: toastOut 250ms ease forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.toast-message {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.4;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 10px 10px;
  background: var(--primary);
  animation: toastProgress linear forwards;
}

.toast-success .toast-progress {
  background: var(--ok);
}

.toast-error .toast-progress {
  background: var(--error);
}

.toast-success .toast-icon {
  color: var(--ok);
}

.toast-error .toast-icon {
  color: var(--error);
}

.toast-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 2px;
  font-size: 14px;
  line-height: 1;
  transition: color 150ms ease;
}

.toast-close:hover {
  color: var(--text);
}

/* ── Loading Skeleton ── */

.skeleton {
  background: linear-gradient(90deg, var(--surface-alt) 25%, #e8ecf1 50%, var(--surface-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
  min-height: 18px;
}

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

  100% {
    background-position: -200% 0;
  }
}

.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-line:last-child {
  width: 60%;
}

.skeleton-kpi {
  height: 68px;
  border-radius: 10px;
}

/* ── Loading Overlay ── */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 3000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms ease;
}

.loading-overlay.active {
  opacity: 1;
}

.loading-overlay .loading-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #9ed93c, var(--primary));
  background-size: 200% 100%;
  animation: loadingSlide 1s ease-in-out infinite;
  border-radius: 0 2px 2px 0;
}

@keyframes loadingSlide {
  0% {
    background-position: 200% 0;
    width: 10%;
  }

  50% {
    width: 70%;
  }

  100% {
    background-position: -200% 0;
    width: 100%;
  }
}

/* ── Stagger Reveal ── */

.stagger-item {
  animation: staggerIn 350ms cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

@keyframes staggerIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Utilities ── */

.muted {
  color: var(--muted);
}

.reveal {
  animation: reveal 220ms ease;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive ── */

@media (max-width: 1260px) {
  .filters-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filters-grid-export {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters-grid-export-base {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: 0;
  }

  .sidebar-scroll {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .main-content {
    padding: 10px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .topbar-api {
    width: 100%;
  }

  .topbar-api input {
    width: 100%;
    max-width: none;
  }

  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters-grid-export {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters-grid-export-base {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .queue-register-grid {
    grid-template-columns: 1fr;
  }

  .toast-container {
    right: 8px;
    left: 8px;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .filters-grid {
    grid-template-columns: 1fr;
  }

  .filters-grid-export {
    grid-template-columns: 1fr;
  }

  .filters-grid-export-base {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .subtab {
    min-width: 112px;
    padding: 8px 12px;
  }

  .card {
    padding: 11px;
  }

  .card h2 {
    font-size: 19px;
  }

  .table-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-form-grid {
    grid-template-columns: 1fr;
  }

  .field-full {
    grid-column: span 1;
  }

  .queue-meta-grid {
    grid-template-columns: 1fr;
  }
}
