.login-panel,
.card,
.metrics article {
  border-color: var(--border-subtle);
  background: var(--surface-card);
  box-shadow: var(--shadow-card);
}

.card {
  padding: 18px;
  border-radius: var(--radius-xl);
}

.card-head {
  margin-bottom: 16px;
}

.card-head h2,
.logs-hero h2 {
  color: var(--text-primary);
  font-family: "Raleway", "Manrope", "Inter", sans-serif;
  font-weight: 750;
}

.metrics {
  gap: 12px;
}

.metrics article {
  position: relative;
  min-height: 108px;
  padding: 19px;
  overflow: hidden;
  border-radius: var(--radius-xl);
}

.metrics article::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -38px;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: var(--brand-soft);
}

.metrics span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.metrics strong {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  color: var(--text-primary);
  font-family: "Raleway", "Manrope", sans-serif;
  font-size: 30px;
}

input,
select,
textarea {
  min-height: 40px;
  padding: 8px 11px;
  border-color: var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  background: var(--surface-raised);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-disabled);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--border-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

button {
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.login-form button,
.topbar-actions > button,
.editor-actions button,
.admin-form button,
.row-action {
  border-radius: var(--radius-sm);
  background: var(--brand-primary);
}

.login-form button:hover,
.topbar-actions > button:hover,
.editor-actions button:hover,
.admin-form button:hover,
.row-action:hover {
  background: var(--brand-hover);
}

.logs-hero > button,
.card-head-actions > button:not(.secondary),
#refresh-won-lots {
  min-height: 38px;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  color: #ffffff;
  background: var(--brand-primary);
  font-weight: 750;
}

.logs-hero > button:hover,
.card-head-actions > button:not(.secondary):hover,
#refresh-won-lots:hover {
  background: var(--brand-hover);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary {
  border: 1px solid var(--border-subtle) !important;
  color: var(--text-secondary) !important;
  background: var(--surface-raised) !important;
}

.secondary:hover {
  color: var(--text-primary) !important;
  background: var(--surface-hover) !important;
}

.pill,
.state {
  border-radius: 999px;
  color: var(--text-secondary);
  background: var(--surface-sunken);
}

.state.ok {
  color: var(--success);
  background: var(--success-soft);
}

.state.warn {
  color: var(--warning);
  background: var(--warning-soft);
}

.state.bad {
  color: var(--danger);
  background: var(--danger-soft);
}

.admin-form {
  margin-bottom: 14px;
  padding: 13px;
  border-color: var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
}

.account-assignment-field,
.account-assignment-option,
.permission-option {
  border-color: var(--border-subtle);
  background: var(--surface-raised);
}

.toolbar {
  gap: 9px;
  margin-bottom: 14px;
}

.table {
  border-color: var(--border-subtle);
  border-radius: var(--radius-lg);
}

.table-row {
  border-color: var(--border-subtle);
  background: var(--surface-raised);
}

.table-row:not(.table-head):hover {
  background: var(--surface-hover);
}

.table-head {
  color: var(--text-muted);
  background: var(--surface-sunken);
  font-size: 11px;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.cards {
  gap: 12px;
}

.mini-card,
.proxy-slot,
.status-item,
.quick-actions button,
.list-item,
.event,
.replay-card,
.replay-thumbs figure,
.permission-option,
.won-lot-row,
.empty,
.replay-empty-video {
  border-color: var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
}

.mini-card {
  padding: 14px;
}

.mini-card:hover,
.proxy-slot:not(.is-empty):hover,
.status-item:hover {
  border-color: color-mix(in srgb, var(--brand-primary) 38%, var(--border-subtle));
}

.quick-actions button {
  min-height: 76px;
  padding: 13px;
}

.quick-actions button:hover {
  border-color: var(--brand-primary);
  background: var(--surface-hover);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.proxy-slot.is-empty,
.account-server-auth,
.entity-editor,
.bound-user,
.replay-evidence,
.event-field-grid div,
.logs-hero,
.replay-controls-seen {
  border-color: var(--border-subtle);
  background: var(--surface-sunken);
}

.proxy-slot.is-empty strong,
.chip,
.event-chips mark,
.replay-title span,
.replay-controls-seen mark,
.dom-controls mark {
  color: var(--text-secondary);
  background: var(--surface-sunken);
}

.logs-shell {
  border-radius: var(--radius-xl);
}

.logs-hero {
  padding: 20px 22px 17px;
}

.log-tabs {
  gap: 7px;
  padding: 11px 18px;
  border-color: var(--border-subtle);
  background: var(--surface-card);
}

.log-tab {
  color: var(--text-muted);
}

.log-tab:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.log-tab.is-active {
  border-color: color-mix(in srgb, var(--brand-primary) 35%, var(--border-subtle));
  color: var(--brand-foreground);
  background: var(--brand-soft);
}

.log-tab span {
  background: var(--surface-raised);
}

.log-event {
  padding: 14px;
  border-radius: var(--radius-lg);
  box-shadow: none;
}

.log-event:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  box-shadow: none;
}

.event-meta time,
.event-heading code,
.event-field-grid dt,
.won-lot-meta,
.won-lots-status {
  color: var(--text-muted);
}

.event-heading code {
  background: var(--surface-sunken);
}

.event-field-grid dd,
.event-main strong,
.replay-title strong,
.replay-player-head strong,
.replay-empty-video strong {
  color: var(--text-primary);
}

.event-meta span {
  color: var(--brand-foreground);
  background: var(--brand-soft);
}

.log-event-auth .event-category {
  color: var(--brand-foreground);
  background: var(--brand-soft);
}

.log-event-action .event-category,
.pool-operations,
.won-lot-row.needs-review,
.won-lot-status.status-internal,
.won-lot-status.status-needs_review,
.won-lot-status.status-failed {
  color: var(--warning);
  background: var(--warning-soft);
}

.log-event-system .event-category {
  color: var(--text-secondary);
  background: var(--surface-sunken);
}

.pool-b2b {
  color: var(--brand-foreground);
  background: var(--brand-soft);
}

.won-lot-status.status-delivered {
  color: var(--success);
  background: var(--success-soft);
}

.won-lot-row.needs-review {
  border-left-color: var(--warning);
}

.replay-evidence-stats span {
  background: var(--surface-raised);
}

.replay-diagnostics {
  border-color: color-mix(in srgb, var(--warning) 34%, var(--border-subtle));
  background: var(--warning-soft);
}

.replay-dom-screen,
.dom-frame-screen {
  color: var(--text-primary);
  background: var(--surface-sunken);
}

.replay-dom-screen p,
.dom-frame-screen p {
  color: var(--text-secondary);
}

.toast {
  right: 22px;
  bottom: 20px;
  padding: 10px 13px;
  border-color: var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  background: var(--surface-raised);
  box-shadow: 0 16px 38px rgba(8, 21, 42, 0.18);
}

.confirmation-dialog {
  color: var(--text-primary);
  background: var(--surface-card);
}

.confirmation-dialog::backdrop {
  background: rgba(3, 10, 22, 0.68);
  backdrop-filter: blur(5px);
}

.confirmation-dialog-warning {
  color: var(--danger);
}

.confirmation-dialog-actions .danger,
.row-action.danger {
  color: #ffffff;
  background: #c53131;
}

:root[data-theme="dark"] .replay-stage,
:root[data-theme="dark"] .replay-scaler .replayer-wrapper > iframe {
  background: #ffffff;
}

:root[data-theme="dark"] .dom-cursor {
  background: var(--surface-raised);
}

@media (max-width: 960px) {
  .card {
    padding: 14px;
  }

  .metrics article {
    min-height: 92px;
  }
}
