:root {
  --bg: #07090e;
  --surface: #0f131a;
  --surface-soft: #141a24;
  --surface-strong: #1a2230;
  --ink: #f3f4f6;
  --muted: #9ca3af;
  --line: rgba(255, 255, 255, 0.07);
  --primary: #00f5d4;
  --primary-dark: #00c9ae;
  --blue: #3b82f6;
  --amber: #fbbf24;
  --danger: #ef4444;
  --success: #10b981;
  --sidebar: #040508;
  --sidebar-soft: #0c0f16;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  --radius: 12px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: var(--sidebar);
  color: #f3f4f6;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
  font-family: 'Outfit', sans-serif;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--sidebar-soft) 0%, rgba(255, 255, 255, 0.03) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.brand-mark svg {
  width: 28px;
  height: 28px;
  fill: var(--primary);
  filter: drop-shadow(0 0 4px rgba(0, 245, 212, 0.4));
}

.brand strong {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.brand strong,
.brand small {
  display: block;
}

.nav-tabs {
  display: grid;
  gap: 6px;
}

.nav-tab {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-tab .icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.02);
}

.nav-tab.active {
  background: linear-gradient(135deg, rgba(0, 245, 212, 0.12) 0%, rgba(0, 245, 212, 0.03) 100%);
  color: var(--primary);
  border-color: rgba(0, 245, 212, 0.18);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.nav-tab.active .icon {
  opacity: 1;
  filter: drop-shadow(0 0 3px rgba(0, 245, 212, 0.4));
}

.sidebar-status {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 13px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  font-weight: 600;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #98a2b3;
  flex: 0 0 auto;
  position: relative;
}

.status-dot.active,
.status-dot.ok {
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.status-dot.warning {
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
}

.status-dot.error,
.status-dot.danger {
  background: var(--danger);
  box-shadow: 0 0 10px var(--danger);
}

.main {
  min-width: 0;
  padding: 36px;
  background: var(--bg);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 28px;
}

.topbar-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.state-pill,
.result-count,
.integrations span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  border: 1px solid var(--line);
}

.state-pill.ok,
.state-pill.active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
}

.state-pill.warning {
  background: rgba(251, 191, 36, 0.1);
  color: var(--amber);
  border-color: rgba(251, 191, 36, 0.2);
}

.state-pill.danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.toolbar,
.settings-actions,
.panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.button:hover {
  transform: translateY(-2px);
  background: var(--surface-strong);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.button:active {
  transform: translateY(0);
}

.button.primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #040508;
  border: none;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 245, 212, 0.25);
}

.button.primary:hover {
  background: linear-gradient(135deg, #33ffd8 0%, var(--primary) 100%);
  box-shadow: 0 12px 30px rgba(0, 245, 212, 0.4);
}

.button.ghost {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--line);
}

.button.ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

.button.accent {
  border-color: rgba(0, 245, 212, 0.25);
  color: var(--primary);
  background: rgba(0, 245, 212, 0.03);
}

.button.accent:hover {
  background: rgba(0, 245, 212, 0.08);
  border-color: rgba(0, 245, 212, 0.40);
  color: #ffffff;
}

.button.danger {
  background: rgba(239, 68, 68, 0.05);
  border-color: rgba(239, 68, 68, 0.25);
  color: var(--danger);
}

.button.danger:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.45);
  color: #ffffff;
}

.button.icon-only {
  width: 42px;
  padding: 0;
}

.button.block {
  width: 100%;
}

.button:disabled {
  opacity: 0.5;
  transform: none !important;
  box-shadow: none !important;
  cursor: not-allowed;
}

.button[aria-busy="true"] {
  position: relative;
}

.icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: 0 0 auto;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 20px;
  margin-bottom: 20px;
}

.hero-panel,
.action-panel,
.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.metric:hover,
.panel:hover,
.hero-panel:hover,
.action-panel:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 245, 212, 0.22);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 18px rgba(0, 245, 212, 0.06);
}

.hero-panel {
  min-height: 200px;
  display: grid;
  align-content: space-between;
  gap: 24px;
  padding: 24px;
  border-top: 4px solid var(--primary);
  background: linear-gradient(135deg, var(--surface) 0%, rgba(20, 26, 36, 0.8) 100%);
}

.hero-panel::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(0, 245, 212, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.hero-panel h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #a7f3d0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-panel p {
  max-width: 760px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.run-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.run-meta span {
  min-width: 0;
  padding: 14px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.run-meta small,
.metric-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.run-meta strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  color: #ffffff;
  white-space: nowrap;
}

.action-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.metric {
  min-height: 120px;
  padding: 20px;
  display: grid;
  gap: 10px;
  align-content: start;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(135deg, var(--surface) 0%, rgba(255, 255, 255, 0.01) 100%);
  position: relative;
  overflow: hidden;
}

.metric::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
}

.metric:nth-child(1)::after {
  background: linear-gradient(90deg, var(--blue) 0%, #60a5fa 100%);
}

.metric:nth-child(2)::after {
  background: linear-gradient(90deg, var(--primary) 0%, #34d399 100%);
}

.metric:nth-child(3)::after {
  background: linear-gradient(90deg, var(--amber) 0%, #fbbf24 100%);
}

.metric:nth-child(4)::after {
  background: linear-gradient(90deg, var(--success) 0%, #34d399 100%);
}

.metric strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 32px;
  line-height: 1;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: #ffffff;
}

.metric small {
  color: var(--muted);
  min-height: 18px;
  font-size: 12px;
}

.pipeline-panel {
  margin-bottom: 20px;
}

.pipeline-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: rgba(255, 255, 255, 0.01);
}

.pipeline-item {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 20px;
  border-right: 1px solid var(--line);
}

.pipeline-item:last-child {
  border-right: 0;
}

.pipeline-marker {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: 50%;
  background: #4b5563;
  box-shadow: 0 0 0 4px rgba(75, 85, 99, 0.2);
}

.pipeline-item.ok .pipeline-marker {
  background: var(--success);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.pipeline-item.warning .pipeline-marker {
  background: var(--amber);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}

.pipeline-item.danger .pipeline-marker {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.pipeline-copy small,
.pipeline-copy strong,
.pipeline-copy em {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.pipeline-copy small,
.slot-copy small {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.pipeline-copy strong {
  margin: 4px 0 2px;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.pipeline-copy em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 20px;
  margin-bottom: 20px;
}

.panel {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.panel-header {
  min-height: 74px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface) 0%, rgba(255, 255, 255, 0.01) 100%);
}

.panel-header.split {
  align-items: center;
}

.panel-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.health-list,
.compact-events {
  display: grid;
}

.health-item,
.compact-event {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.health-item:last-child,
.compact-event:last-child {
  border-bottom: 0;
}

.health-copy strong,
.compact-event strong {
  display: block;
  overflow-wrap: anywhere;
}

.health-copy small,
.compact-event small {
  color: var(--muted);
  font-size: 12px;
}

.health-value {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.slots-panel,
.chats-panel {
  margin-top: 16px;
}

.table-tools {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px 180px;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

label {
  display: grid;
  gap: 8px;
}

.form-panel > label,
.form-panel > .form-row,
.check-row {
  padding: 16px 20px 0;
}

label span,
.switch-row strong {
  font-weight: 700;
  font-size: 14px;
  color: #ffffff;
}

label small,
.switch-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: #ffffff;
  padding: 10px 14px;
  outline: none;
  font-size: 14px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  background: var(--surface-strong);
  box-shadow: 0 0 0 3px rgba(0, 245, 212, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-soft);
}

td {
  font-size: 14px;
  color: #e5e7eb;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

tr:last-child td {
  border-bottom: 0;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
  padding: 36px !important;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge.warning {
  background: rgba(251, 191, 36, 0.1);
  color: var(--amber);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.badge.danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge.neutral {
  background: var(--surface-soft);
  color: var(--muted);
  border: 1px solid var(--line);
}

.slot-project {
  min-width: 240px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.slot-poster {
  position: relative;
  width: 46px;
  height: 58px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--primary);
  font-weight: 800;
  border: 1px solid var(--line);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.slot-poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slot-poster-fallback {
  font-size: 12px;
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

.slot-copy {
  min-width: 0;
}

.slot-copy strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.35;
  font-size: 15px;
  color: #ffffff;
}

.link-button {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}

.link-button:hover {
  color: #ffffff;
  text-decoration: underline;
  text-shadow: 0 0 8px rgba(0, 245, 212, 0.5);
}

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

.form-panel {
  padding-bottom: 20px;
}

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

.switch-row {
  min-height: 76px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.switch-row input[type="checkbox"] {
  appearance: none;
  width: 48px;
  height: 26px;
  flex: 0 0 48px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  position: relative;
  outline: none;
  cursor: pointer;
  border: 1px solid var(--line);
  transition: background 0.25s ease, border-color 0.25s ease;
}

.switch-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-row input[type="checkbox"]:checked {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-color: transparent;
}

.switch-row input[type="checkbox"]:checked::after {
  transform: translateX(22px);
  background: #040508;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.integrations {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 20px 20px 0;
}

.qr-panel {
  margin: 20px;
  padding: 20px;
  border-radius: var(--radius);
  text-align: center;
  background: rgba(251, 191, 36, 0.05);
  border: 1px solid rgba(251, 191, 36, 0.18);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.qr-panel p {
  margin-bottom: 14px;
  color: var(--amber);
  font-weight: 600;
  font-size: 14px;
}

.qr-panel img {
  width: min(240px, 100%);
  border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  border: 4px solid #ffffff;
}

.settings-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.select-field.compact {
  width: 170px;
}

.events-list {
  display: grid;
}

.event {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  align-items: start;
}

.event:last-child {
  border-bottom: 0;
}

.event-time,
.event-type,
.event-message {
  min-width: 0;
}

.event-time,
.event-type {
  color: var(--muted);
  font-size: 12px;
}

.event-type {
  text-align: right;
  font-weight: 800;
  text-transform: uppercase;
}

.event-message {
  font-size: 14px;
  word-break: break-word;
}

.copy-cell {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.85rem;
  user-select: all;
  cursor: pointer;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--sidebar);
  color: #ffffff;
  box-shadow: 0 18px 48px rgba(20, 32, 51, 0.22);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .overview-grid,
  .insight-grid {
    grid-template-columns: 1fr;
  }

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

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

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

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

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

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

  .nav-tab {
    justify-content: center;
  }

  .sidebar-status {
    margin-top: 0;
  }

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

@media (max-width: 680px) {
  .main {
    padding: 18px;
  }

  h1 {
    font-size: 26px;
  }

  .topbar,
  .panel-header,
  .switch-row {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar,
  .panel-actions,
  .settings-actions {
    width: 100%;
  }

  .toolbar .button.primary,
  .settings-actions .button,
  .panel-actions .button {
    flex: 1 1 auto;
  }

  .action-panel,
  .metric-grid,
  .pipeline-list,
  .run-meta,
  .table-tools,
  .form-row {
    grid-template-columns: 1fr;
  }

  .pipeline-item {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .pipeline-item:last-child {
    border-bottom: 0;
  }

  .select-field.compact {
    width: 100%;
  }

  .health-item,
  .compact-event,
  .event {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .health-value,
  .event-type {
    text-align: left;
  }
}

/* Conta autenticada no painel */
.account-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.account-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(0, 245, 212, 0.1);
  border: 1px solid rgba(0, 245, 212, 0.2);
  color: var(--primary);
  font-family: "Outfit", sans-serif;
  font-weight: 800;
}

.account-copy {
  min-width: 0;
}

.account-copy strong,
.account-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong {
  color: #fff;
  font-size: 13px;
}

.account-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.account-logout {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
}

.account-logout:hover {
  color: #fff;
  background: rgba(239, 68, 68, 0.12);
}

/* Login e cadastro */
.auth-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(0, 245, 212, 0.09), transparent 28rem),
    radial-gradient(circle at 90% 90%, rgba(59, 130, 246, 0.08), transparent 30rem),
    var(--bg);
}

.auth-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

.auth-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(390px, 0.72fr);
  align-items: center;
  gap: clamp(48px, 9vw, 130px);
  padding: 52px 0;
}

.auth-intro {
  min-height: 630px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-brand {
  width: max-content;
}

.auth-copy {
  max-width: 650px;
}

.auth-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-kicker i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 14px rgba(0, 245, 212, 0.75);
}

.auth-copy h1 {
  margin: 20px 0;
  max-width: 620px;
  font-family: "Outfit", sans-serif;
  font-size: clamp(42px, 5.2vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.auth-copy p {
  max-width: 590px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.auth-features {
  display: flex;
  flex-wrap: wrap;
  gap: 22px 28px;
  color: #d1d5db;
  font-size: 12px;
  font-weight: 600;
}

.auth-features span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.auth-features b {
  color: var(--primary);
  font-family: "Outfit", sans-serif;
  font-size: 11px;
}

.auth-card {
  padding: clamp(28px, 4vw, 42px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  background: rgba(15, 19, 26, 0.88);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(18px);
}

.auth-card-head h2 {
  margin: 7px 0 6px;
  font-family: "Outfit", sans-serif;
  font-size: 30px;
}

.auth-card-head > p:last-child {
  color: var(--muted);
  font-size: 13px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin: 28px 0;
  padding: 4px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
}

.auth-tabs.single {
  grid-template-columns: 1fr;
}

.auth-tab {
  min-height: 40px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.auth-tab.active {
  color: #fff;
  background: var(--surface-strong);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

.auth-form {
  display: grid;
  gap: 18px;
}

.auth-form label > span:first-child {
  font-size: 12px;
}

.auth-form input,
.password-control input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: #fff;
  padding: 0 14px;
  outline: none;
  font-size: 14px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.18);
}

.auth-form input:focus,
.password-control input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 245, 212, 0.12);
}

.auth-form input::placeholder {
  color: #667085;
}

.password-control {
  position: relative;
  display: block;
}

.password-control input {
  padding-right: 78px;
}

.password-control button {
  position: absolute;
  top: 50%;
  right: 11px;
  transform: translateY(-50%);
  padding: 6px;
  background: transparent;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
}

.auth-submit {
  min-height: 50px;
  justify-content: space-between;
  margin-top: 2px;
  padding-inline: 18px;
}

.captcha-field {
  min-height: 65px;
  overflow: hidden;
}

.captcha-field[hidden] {
  display: none;
}

.captcha-field > div {
  max-width: 100%;
}

.auth-message {
  padding: 11px 13px;
  border-radius: 9px;
  border: 1px solid rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
  font-size: 12px;
  line-height: 1.5;
}

.auth-message.success {
  border-color: rgba(16, 185, 129, 0.24);
  background: rgba(16, 185, 129, 0.08);
  color: #6ee7b7;
}

.auth-footnote {
  margin-top: 24px;
  color: #6b7280;
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.auth-secondary-actions {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.auth-secondary-actions button {
  padding: 4px 8px;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.auth-secondary-actions button:hover {
  color: #fff;
}

.otp-input {
  font-family: "Outfit", ui-monospace, monospace !important;
  font-size: 20px !important;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-align: center;
}

/* Segurança da conta */
.account-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.security-card {
  align-self: start;
}

.security-card .panel-header {
  min-height: 126px;
  align-items: flex-start;
}

.security-card .panel-header h2 {
  margin: 3px 0 4px;
}

.security-form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.security-step {
  display: grid;
  gap: 18px;
}

.security-step p,
.security-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.security-fields,
.email-confirm-box {
  display: grid;
  gap: 16px;
}

.email-confirm-box {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.security-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

/* Administração */
.admin-panel {
  overflow: hidden;
}

.admin-warning {
  margin: 18px 20px 0;
  padding: 13px 15px;
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.07);
  color: #fcd34d;
  font-size: 12px;
}

.admin-warning code {
  color: #fff;
}

.admin-users-table {
  min-width: 1040px;
}

.admin-user-cell {
  min-width: 230px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.admin-user-cell .account-avatar {
  width: 34px;
  height: 34px;
}

.admin-user-cell strong,
.admin-user-cell small {
  display: block;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-cell small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

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

.button.compact {
  min-height: 32px;
  padding: 0 10px;
  font-size: 11px;
  white-space: nowrap;
}

@media (max-width: 920px) {
  .account-settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .security-actions,
  .security-actions .button {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
    width: min(560px, calc(100% - 36px));
    gap: 36px;
  }

  .auth-intro {
    min-height: auto;
    gap: 44px;
  }

  .auth-copy h1 {
    font-size: clamp(38px, 11vw, 58px);
  }
}

@media (max-width: 520px) {
  .auth-shell {
    width: min(100% - 24px, 480px);
    padding: 24px 0;
  }

  .auth-intro {
    gap: 34px;
  }

  .auth-copy h1 {
    margin: 15px 0;
  }

  .auth-features {
    display: grid;
    gap: 10px;
  }

  .auth-card {
    padding: 24px 20px;
    border-radius: 16px;
  }
}
