:root {
  --bg: #f4efe5;
  --bg-strong: #ebe0cf;
  --panel: rgba(255, 251, 245, 0.9);
  --panel-strong: #fffaf2;
  --ink: #142218;
  --muted: #5d6b60;
  --line: rgba(20, 34, 24, 0.12);
  --accent: #10b981;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --neutral-soft: rgba(20, 34, 24, 0.08);
  --shadow: 0 24px 60px rgba(43, 35, 22, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --mono: "Cascadia Mono", "Consolas", "Courier New", monospace;
  --sans: "Segoe UI Variable Text", "Aptos", "Trebuchet MS", sans-serif;
}

[data-theme="dark"] {
  --bg: #0f1419;
  --bg-strong: #1a2027;
  --panel: rgba(26, 32, 39, 0.92);
  --panel-strong: #1e2630;
  --ink: #d4dce4;
  --muted: #7e8f9e;
  --line: rgba(212, 220, 228, 0.1);
  --accent: #10b981;
  --accent-soft: rgba(16, 185, 129, 0.16);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.16);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.16);
  --neutral-soft: rgba(212, 220, 228, 0.08);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] body {
  background:
    radial-gradient(circle at top left, rgba(45, 185, 164, 0.1), transparent 30%),
    radial-gradient(circle at top right, rgba(232, 152, 58, 0.08), transparent 26%),
    linear-gradient(180deg, #0f1419 0%, #141c24 100%);
}

[data-theme="dark"] .card {
  border-color: rgba(212, 220, 228, 0.06);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: rgba(15, 20, 25, 0.7);
  border-color: rgba(212, 220, 228, 0.1);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  border-color: rgba(45, 185, 164, 0.45);
  box-shadow: 0 0 0 4px rgba(45, 185, 164, 0.1);
}

[data-theme="dark"] .highlight-card,
[data-theme="dark"] .mini-panel {
  background: rgba(15, 20, 25, 0.5);
  border-color: rgba(212, 220, 228, 0.06);
}

[data-theme="dark"] .auth-card {
  background:
    linear-gradient(180deg, rgba(26, 32, 39, 0.8), rgba(26, 32, 39, 0.5)),
    linear-gradient(130deg, rgba(45, 185, 164, 0.06), transparent 38%),
    linear-gradient(220deg, rgba(232, 152, 58, 0.06), transparent 34%),
    var(--panel-strong);
}

[data-theme="dark"] .topbar {
  background:
    linear-gradient(180deg, rgba(26, 32, 39, 0.7), rgba(26, 32, 39, 0.4)),
    var(--panel);
}

[data-theme="dark"] .hero-card {
  background:
    linear-gradient(135deg, rgba(45, 185, 164, 0.08), transparent 55%),
    linear-gradient(215deg, rgba(232, 152, 58, 0.06), transparent 45%),
    var(--panel-strong);
}

[data-theme="dark"] .dashboard-card {
  background:
    linear-gradient(180deg, rgba(26, 32, 39, 0.7), rgba(26, 32, 39, 0.3)),
    linear-gradient(130deg, rgba(45, 185, 164, 0.06), transparent 38%),
    var(--panel-strong);
}

[data-theme="dark"] .nav-link {
  background: rgba(26, 32, 39, 0.6);
  color: var(--ink);
}

[data-theme="dark"] .btn-secondary {
  background: rgba(212, 220, 228, 0.08);
  color: var(--ink);
}

[data-theme="dark"] .btn-ghost {
  border-color: rgba(212, 220, 228, 0.1);
  color: var(--ink);
}

[data-theme="dark"] thead th {
  background: rgba(15, 20, 25, 0.95);
}

[data-theme="dark"] .table-wrap {
  background: rgba(15, 20, 25, 0.5);
  border-color: rgba(212, 220, 228, 0.06);
}

[data-theme="dark"] tbody tr:hover {
  background: rgba(45, 185, 164, 0.06);
}

[data-theme="dark"] tbody tr.active-row {
  background: rgba(45, 185, 164, 0.1);
}

[data-theme="dark"] tbody tr.level-error {
  background: rgba(224, 84, 69, 0.08);
}

[data-theme="dark"] tbody tr.level-error:hover {
  background: rgba(224, 84, 69, 0.14);
}

[data-theme="dark"] tbody tr.level-warning {
  background: rgba(232, 152, 58, 0.07);
}

[data-theme="dark"] tbody tr.level-warning:hover {
  background: rgba(232, 152, 58, 0.12);
}

[data-theme="dark"] tbody tr.level-critical {
  background: rgba(224, 84, 69, 0.14);
}

[data-theme="dark"] tbody tr.level-critical:hover {
  background: rgba(224, 84, 69, 0.2);
}

[data-theme="dark"] .stat-card {
  background: rgba(15, 20, 25, 0.72);
  border-color: rgba(212, 220, 228, 0.08);
}

[data-theme="dark"] .stat-card.soft-accent {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.16), rgba(15, 20, 25, 0.76));
}

[data-theme="dark"] .stat-card.soft-warn {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.14), rgba(15, 20, 25, 0.76));
}

[data-theme="dark"] .stat-card.soft-danger {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.14), rgba(15, 20, 25, 0.76));
}

[data-theme="dark"] .dashboard-panel {
  background: rgba(15, 20, 25, 0.68);
  border-color: rgba(212, 220, 228, 0.08);
}

[data-theme="dark"] .detail-block {
  border-color: rgba(212, 220, 228, 0.08);
}

[data-theme="dark"] .detail-block header {
  background: rgba(15, 20, 25, 0.5);
}

[data-theme="dark"] .detail-block pre {
  background: rgba(15, 20, 25, 0.6);
}

[data-theme="dark"] .json-tree {
  background: rgba(15, 20, 25, 0.5);
}

[data-theme="dark"] .flow-summary,
[data-theme="dark"] .flow-panel {
  background: rgba(15, 20, 25, 0.46);
  border-color: rgba(212, 220, 228, 0.08);
}

[data-theme="dark"] .flow-empty {
  background: rgba(15, 20, 25, 0.5);
}

[data-theme="dark"] .flow-payload-block .json-code {
  background:
    linear-gradient(180deg, rgba(10, 15, 20, 0.78), rgba(10, 15, 20, 0.62));
  scrollbar-color: rgba(126, 143, 158, 0.48) transparent;
}

[data-theme="dark"] .json-code::-webkit-scrollbar-thumb {
  background: rgba(126, 143, 158, 0.34);
}

[data-theme="dark"] .json-code::-webkit-scrollbar-thumb:hover {
  background: rgba(45, 185, 164, 0.5);
}

[data-theme="dark"] .timeline-details > summary {
  background: rgba(15, 20, 25, 0.46);
  border-color: rgba(212, 220, 228, 0.08);
}

[data-theme="dark"] .json-syntax-key {
  color: #e8b35f;
}

[data-theme="dark"] .json-syntax-string {
  color: #58d5bd;
}

[data-theme="dark"] .json-syntax-number {
  color: #ff8b7e;
}

[data-theme="dark"] .json-syntax-boolean,
[data-theme="dark"] .json-syntax-null {
  color: #b9a8ff;
}

[data-theme="dark"] .json-key {
  color: #e8983a;
}

[data-theme="dark"] .json-value-string {
  color: #2db9a4;
}

[data-theme="dark"] .json-value-number {
  color: #e05445;
}

[data-theme="dark"] .json-value-boolean,
[data-theme="dark"] .json-value-null {
  color: #9b8aff;
}

[data-theme="dark"] .timeline-item {
  background: rgba(15, 20, 25, 0.5);
  border-color: rgba(212, 220, 228, 0.06);
}

[data-theme="dark"] .modal-shell {
  background: rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .preset-bar {
  background: rgba(15, 20, 25, 0.4);
  border-color: rgba(212, 220, 228, 0.06);
}

[data-theme="dark"] .preset-chip {
  background: rgba(45, 185, 164, 0.08);
  border-color: rgba(45, 185, 164, 0.14);
}

[data-theme="dark"] .stack-item {
  background: rgba(15, 20, 25, 0.4);
}

[data-theme="dark"] .tiny-btn {
  background: rgba(26, 32, 39, 0.8);
  border-color: rgba(212, 220, 228, 0.1);
  color: var(--ink);
}

[data-theme="dark"] .tiny-btn:hover {
  background: rgba(45, 185, 164, 0.12);
}

[data-theme="dark"] .mini-action {
  background: rgba(26, 32, 39, 0.8);
  border-color: rgba(212, 220, 228, 0.1);
  color: var(--ink);
}

[data-theme="dark"] .mini-action:hover {
  background: rgba(45, 185, 164, 0.1);
}

[data-theme="dark"] .notice {
  background: rgba(232, 152, 58, 0.1);
  border-color: rgba(232, 152, 58, 0.18);
}

[data-theme="dark"] .toast {
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.2rem;
}

.theme-icon {
  display: inline-flex;
  transition: transform 300ms ease;
}

[data-theme="dark"] .theme-icon {
  transform: rotate(180deg);
}

html {
  overflow-x: hidden;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  overflow-x: clip;
  background:
    radial-gradient(circle at top left, rgba(15, 123, 108, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(191, 106, 2, 0.18), transparent 26%),
    linear-gradient(180deg, #f8f3eb 0%, #f0e7db 100%);
}

body.modal-open {
  overflow: hidden;
  height: 100dvh;
}

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

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

h1,
h2,
h3 {
  font-weight: 800;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2rem, 3vw, 2.8rem);
}

h2 {
  font-size: clamp(1.3rem, 2vw, 1.8rem);
}

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

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.subtitle,
.muted,
.notice span,
.empty-cell,
.placeholder {
  color: var(--muted);
}

.eyebrow,
.meta-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 700;
}

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

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

.field span {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.compact-field {
  min-width: 120px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.78);
  padding: 13px 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(15, 123, 108, 0.45);
  box-shadow: 0 0 0 4px rgba(15, 123, 108, 0.12);
}

.card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  padding: 22px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease, background 140ms ease;
}

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

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

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 24px rgba(15, 123, 108, 0.24);
}

.btn-secondary {
  background: rgba(20, 34, 24, 0.08);
  color: var(--ink);
}

.btn-accent {
  background: #d46d25;
  color: white;
  box-shadow: 0 12px 24px rgba(212, 109, 37, 0.24);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stack-form,
.stack-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.checkbox input {
  width: auto;
}

.inline-checkbox {
  align-self: end;
  padding-bottom: 10px;
}

.badge,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.badge-neutral,
.chip-neutral {
  background: var(--neutral-soft);
  color: var(--ink);
}

.badge-ok,
.chip-ok {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-warn,
.chip-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge-danger,
.chip-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

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

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.hidden {
  display: none !important;
}

.auth-view,
.app-shell {
  width: min(100%, 1880px);
  margin: 0 auto;
  padding: 24px;
}

.auth-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.auth-shell {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 470px);
  gap: 28px;
  align-items: center;
}

.auth-copy,
.page-shell,
.page-view {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

.auth-subtitle {
  max-width: 640px;
  font-size: 1.08rem;
  line-height: 1.7;
}

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

.highlight-card,
.mini-panel {
  border: 1px solid rgba(20, 34, 24, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.56);
  padding: 16px;
}

.highlight-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.54), rgba(255, 255, 255, 0.2)),
    linear-gradient(130deg, rgba(15, 123, 108, 0.08), transparent 38%),
    linear-gradient(220deg, rgba(212, 109, 37, 0.1), transparent 34%),
    var(--panel-strong);
}

.auth-controls,
.topbar-meta {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.auth-note {
  margin-bottom: 16px;
}

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

.mini-panel {
  min-width: 0;
}

.mini-panel strong,
.mini-panel code {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 280px) auto minmax(340px, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.24)),
    var(--panel);
}

.topbar-brand,
.topbar-side {
  min-width: 0;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-link {
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
  padding: 11px 16px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.connection-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  transition: background 300ms ease, box-shadow 300ms ease;
}

.connection-ok {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.connection-fail {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
  animation: pulse-dot 1.5s infinite;
}

.connection-unknown {
  background: var(--muted);
  opacity: 0.4;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.nav-link.is-active {
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 24px rgba(15, 123, 108, 0.2);
}

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

.wide-panel {
  grid-column: 1 / -1;
}

.topbar-actions {
  justify-content: flex-end;
  align-items: center;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.82rem;
}

.session-collapsible {
  animation: slideDown 200ms ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-card,
.dashboard-card {
  background:
    linear-gradient(135deg, rgba(15, 123, 108, 0.12), transparent 55%),
    linear-gradient(215deg, rgba(191, 106, 2, 0.12), transparent 45%),
    var(--panel-strong);
}

.dashboard-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.54), rgba(255, 255, 255, 0.2)),
    linear-gradient(130deg, rgba(15, 123, 108, 0.08), transparent 38%),
    linear-gradient(220deg, rgba(212, 109, 37, 0.1), transparent 34%),
    var(--panel-strong);
}

.dashboard-welcome-bar {
  padding: 14px 18px;
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.12), transparent 55%),
    linear-gradient(215deg, rgba(245, 158, 11, 0.08), transparent 45%),
    var(--panel-strong);
}

.welcome-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.welcome-bar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.welcome-bar-title {
  font-size: 1.05rem;
  line-height: 1.2;
}

.welcome-bar-meta {
  font-size: 0.82rem;
  margin-top: 2px;
}

.welcome-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.time-pills {
  display: flex;
  gap: 4px;
  background: var(--neutral-soft);
  border-radius: 999px;
  padding: 3px;
}

.time-pill {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.time-pill:hover {
  color: var(--ink);
  transform: translateY(-1px);
}

.time-pill.is-active {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.24);
}

.health-dot {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(20, 34, 24, 0.08);
  flex-shrink: 0;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  transition: background 300ms ease, box-shadow 300ms ease, color 300ms ease;
}

.health-dot::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

.health-ok {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.health-warn {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  animation: pulse-dot 2s infinite;
}

.health-danger {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  animation: pulse-dot 1.2s infinite;
}

.health-unknown {
  color: var(--muted);
  background: rgba(20, 34, 24, 0.05);
  opacity: 0.9;
}

.last-updated {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  font-size: 0.78rem;
  margin-top: 10px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .dashboard-welcome-bar {
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.1), transparent 55%),
    linear-gradient(215deg, rgba(245, 158, 11, 0.08), transparent 45%),
    var(--panel-strong);
}

[data-theme="dark"] .time-pills {
  background: rgba(15, 20, 25, 0.6);
}

[data-theme="dark"] .time-pill.is-active {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.28);
}

[data-theme="dark"] .health-dot {
  border-color: rgba(212, 220, 228, 0.1);
}

[data-theme="dark"] .last-updated {
  background: rgba(15, 20, 25, 0.68);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 420px);
  gap: 24px;
  align-items: center;
}

.logs-hero-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 460px);
}

.hero-side {
  min-width: 0;
}

.dashboard-toolbar {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.filters-card {
  position: static;
}

.preset-hint {
  margin-top: 6px;
}

.preset-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.46);
}

.preset-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(15, 123, 108, 0.14);
  background: rgba(15, 123, 108, 0.08);
  color: var(--ink);
  cursor: pointer;
}

.preset-chip:hover {
  background: rgba(15, 123, 108, 0.14);
}

.preset-chip.is-active {
  background: rgba(15, 123, 108, 0.2);
  border-color: rgba(15, 123, 108, 0.32);
  box-shadow: inset 0 0 0 1px rgba(15, 123, 108, 0.12);
}

.preset-chip-label {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(20, 34, 24, 0.08);
  cursor: pointer;
}

.preset-empty {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(20, 34, 24, 0.06);
  color: var(--muted);
}

.dashboard-meta {
  margin-bottom: 18px;
}

.dashboard-layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  appearance: none;
  width: 100%;
  text-align: left;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(20, 34, 24, 0.12);
  background: rgba(255, 255, 255, 0.76);
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.stat-card.soft-accent {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.18), rgba(255, 255, 255, 0.8));
}

.stat-card.soft-warn {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.16), rgba(255, 255, 255, 0.8));
}

.stat-card.soft-danger {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.16), rgba(255, 255, 255, 0.8));
}

.stat-card.is-interactive {
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.stat-card.is-interactive:hover {
  transform: translateY(-2px);
  border-color: rgba(16, 185, 129, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 12px 28px rgba(20, 34, 24, 0.08);
}

.stat-kicker {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 700;
}

.stat-value {
  font-size: clamp(1.55rem, 2.2vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
}

.stat-value-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-secondary {
  font-size: 0.92rem;
  color: var(--muted);
  font-weight: 700;
}

.stat-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.stat-note {
  color: var(--muted);
  font-size: 0.82rem;
}

.stat-action {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.dashboard-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  padding: 16px;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h3 {
  font-size: 1rem;
}

.level-list,
.stack-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.level-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.level-label {
  font-weight: 700;
}

.level-bar {
  height: 11px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(20, 34, 24, 0.08);
}

.level-bar-fill {
  height: 100%;
  border-radius: inherit;
}

.level-count {
  min-width: 3ch;
  text-align: right;
}

.pulse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(34px, 1fr));
  gap: 8px;
  align-items: end;
  min-height: 178px;
}

.pulse-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pulse-stack {
  display: flex;
  align-items: end;
  justify-content: center;
  width: 100%;
  min-height: 118px;
}

.pulse-track {
  width: 16px;
  min-height: 8px;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse;
  background: rgba(20, 34, 24, 0.08);
  box-shadow: inset 0 0 0 1px rgba(20, 34, 24, 0.06);
}

.pulse-segment {
  display: block;
  width: 100%;
}

.pulse-segment.total {
  background: rgba(16, 185, 129, 0.34);
}

.pulse-segment.warn {
  background: rgba(245, 158, 11, 0.72);
}

.pulse-segment.error {
  background: rgba(239, 68, 68, 0.82);
}

.pulse-label {
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
}

.pulse-value {
  font-size: 0.78rem;
  font-weight: 700;
}

.stack-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 13px;
  border-radius: 18px;
  background: rgba(20, 34, 24, 0.05);
  border: 1px solid rgba(20, 34, 24, 0.08);
}

.stack-item-main,
.stack-item-side {
  min-width: 0;
}

.stack-item-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stack-item-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.stack-item-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.mini-action {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

.mini-action:hover {
  background: rgba(16, 185, 129, 0.08);
}

.trace-form,
.filters-grid,
.meta-grid {
  display: grid;
  gap: 14px;
}

.trace-form {
  grid-template-columns: 1fr auto;
  align-items: end;
}

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

.filter-actions {
  align-self: end;
  justify-content: flex-end;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, var(--logs-table-width, 62%)) 12px minmax(320px, 1fr);
  gap: 20px;
  align-items: start;
}

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

.detail-stack {
  display: grid;
  grid-template-rows: minmax(280px, var(--detail-panel-height, 360px)) 12px minmax(220px, 1fr);
  gap: 20px;
  min-width: 0;
  min-height: 0;
}

.table-card,
.log-detail-card,
.trace-card {
  min-width: 0;
  min-height: 0;
}

.log-detail-card,
.trace-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#logDetailPanel,
#tracePanel {
  min-height: 0;
  overflow: visible;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 80;
  padding: 20px;
  background: rgba(20, 34, 24, 0.22);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-card {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-section {
  min-width: 0;
}

.modal-section + .modal-section {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.modal-body #logDetailPanel,
.modal-body #tracePanel {
  overflow: visible;
}

.resize-handle {
  position: relative;
  border-radius: 999px;
  background: rgba(20, 34, 24, 0.08);
  user-select: none;
}

.resize-handle::after {
  content: "";
  position: absolute;
  inset: 50%;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(15, 123, 108, 0.28);
}

.resize-handle-horizontal {
  width: 12px;
  min-height: 100%;
  cursor: col-resize;
}

.resize-handle-horizontal::after {
  width: 4px;
  height: 62px;
}

.resize-handle-vertical {
  width: 100%;
  height: 12px;
  cursor: row-resize;
}

.resize-handle-vertical::after {
  width: 62px;
  height: 4px;
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
}

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

thead th {
  position: sticky;
  top: 0;
  background: rgba(255, 250, 242, 0.96);
  z-index: 1;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.94rem;
}

tbody tr {
  cursor: pointer;
  transition: background 120ms ease;
}

tbody tr:hover {
  background: rgba(15, 123, 108, 0.07);
}

tbody tr.active-row {
  background: rgba(15, 123, 108, 0.12);
}

tbody tr.level-error {
  background: rgba(178, 59, 42, 0.07);
}

tbody tr.level-error:hover {
  background: rgba(178, 59, 42, 0.13);
}

tbody tr.level-warning {
  background: rgba(191, 106, 2, 0.06);
}

tbody tr.level-warning:hover {
  background: rgba(191, 106, 2, 0.11);
}

tbody tr.level-critical {
  background: rgba(178, 59, 42, 0.13);
}

tbody tr.level-critical:hover {
  background: rgba(178, 59, 42, 0.19);
}

.trace-id {
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.path-cell,
.message-cell {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kind-cell {
  min-width: 118px;
}

.status-cell {
  min-width: 78px;
}

.empty-cell,
.placeholder {
  padding: 24px;
  text-align: center;
}

.notice {
  border: 1px solid rgba(212, 109, 37, 0.22);
  background: rgba(212, 109, 37, 0.1);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-meta,
.trace-meta,
.session-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.meta-item {
  min-width: 0;
}

.meta-value {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.meta-value code {
  white-space: pre-wrap;
}

.detail-block {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.detail-block header {
  padding: 11px 14px;
  background: rgba(20, 34, 24, 0.05);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-block pre {
  margin: 0;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(255, 255, 255, 0.52);
}

.json-code {
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.55;
  max-height: 360px;
  scrollbar-width: thin;
  scrollbar-color: rgba(93, 107, 96, 0.44) transparent;
}

.json-code::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.json-code::-webkit-scrollbar-track {
  background: transparent;
}

.json-code::-webkit-scrollbar-thumb {
  background: rgba(93, 107, 96, 0.34);
  border-radius: 999px;
}

.json-code::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 123, 108, 0.48);
}

.json-syntax-key {
  color: #835300;
  font-weight: 800;
}

.json-syntax-string {
  color: #0d7f71;
}

.json-syntax-number {
  color: #b23b2a;
}

.json-syntax-boolean,
.json-syntax-null {
  color: #6b5df0;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tiny-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.tiny-btn:hover {
  background: rgba(15, 123, 108, 0.1);
}

.json-tree {
  padding: 10px 14px 14px;
  background: rgba(255, 255, 255, 0.52);
}

.json-node {
  margin-left: 12px;
}

.json-node summary {
  cursor: pointer;
  list-style: none;
  padding: 4px 0;
}

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

.json-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  line-height: 1.55;
}

.json-toggle {
  color: var(--muted);
  width: 12px;
  display: inline-flex;
  justify-content: center;
  transition: transform 120ms ease;
}

.json-node[open] > summary .json-toggle {
  transform: rotate(90deg);
}

.json-key {
  color: #835300;
  font-weight: 700;
}

.json-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.json-children {
  margin-left: 18px;
  border-left: 1px dashed rgba(20, 34, 24, 0.12);
  padding-left: 12px;
}

.json-leaf {
  margin-left: 12px;
  padding: 4px 0;
}

.json-value-string {
  color: #0d7f71;
}

.json-value-number {
  color: #b23b2a;
}

.json-value-boolean,
.json-value-null {
  color: #6b5df0;
}

.flow-summary {
  margin: 18px 0 22px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.42);
}

.flow-summary-head,
.flow-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.flow-summary-head {
  margin-bottom: 14px;
}

.flow-summary h3,
.flow-panel h4,
.flow-exchange h5 {
  margin: 0;
  font-size: 1rem;
}

.flow-summary p,
.flow-panel p,
.flow-exchange p {
  margin: 5px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.flow-route {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.flow-route span:not(.flow-route-arrow) {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--neutral-soft);
  color: var(--ink);
}

.flow-route-arrow {
  color: var(--accent);
}

.flow-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.flow-grid-no-provider {
  grid-template-columns: minmax(0, 1fr);
}

.flow-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.5);
}

.flow-panel-api {
  border-left: 5px solid rgba(15, 123, 108, 0.48);
}

.flow-panel-provider {
  border-left: 5px solid rgba(191, 106, 2, 0.52);
}

.flow-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.flow-payload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.flow-payload-block {
  margin-top: 0;
  min-width: 0;
}

.flow-payload-block header {
  padding: 9px 11px;
}

.flow-payload-block .json-code {
  min-height: 112px;
  max-height: min(54vh, 540px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.42));
}

.flow-empty {
  padding: 18px 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.42);
}

.flow-provider-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.flow-exchange {
  min-width: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.flow-exchange:first-child {
  padding-top: 0;
  border-top: 0;
}

.timeline-details {
  margin-top: 18px;
}

.timeline-details > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--ink);
  font-weight: 800;
}

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

.timeline-details > summary::before {
  content: "+";
  display: inline-block;
  width: 18px;
  color: var(--accent);
}

.timeline-details[open] > summary {
  margin-bottom: 14px;
}

.timeline-details[open] > summary::before {
  content: "-";
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.timeline-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-group-label {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.timeline-group-label.front {
  background: rgba(15, 123, 108, 0.12);
  color: var(--accent);
}

.timeline-group-label.app {
  background: rgba(20, 34, 24, 0.08);
  color: var(--ink);
}

.timeline-group-label.provider {
  background: rgba(191, 106, 2, 0.14);
  color: var(--warn);
}

.timeline-item {
  border: 1px solid var(--line);
  border-left-width: 6px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
  padding: 16px;
}

.timeline-item.timeline-item-front {
  border-left-color: rgba(15, 123, 108, 0.5);
}

.timeline-item.timeline-item-app {
  border-left-color: rgba(20, 34, 24, 0.28);
}

.timeline-item.timeline-item-provider {
  border-left-color: rgba(191, 106, 2, 0.54);
}

.timeline-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.timeline-head h3 {
  font-size: 1rem;
}

.timeline-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 18px;
  color: white;
  box-shadow: 0 18px 40px rgba(20, 34, 24, 0.28);
  z-index: 60;
}

.toast.ok {
  background: #0f7b6c;
}

.toast.warn {
  background: #d46d25;
}

.toast.error {
  background: #b23b2a;
}

@media (max-width: 1280px) {
  .topbar,
  .auth-shell,
  .hero-grid,
  .logs-hero-grid {
    grid-template-columns: 1fr;
  }

  .main-nav {
    justify-content: flex-start;
  }

  .session-grid,
  .stats-strip,
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .detail-stack {
    grid-template-rows: minmax(260px, 340px) 12px minmax(220px, 1fr);
  }

  .resize-handle-horizontal {
    display: none;
  }

  .filters-card {
    position: static;
  }
}

@media (max-width: 960px) {
  .auth-view,
  .app-shell {
    padding: 16px;
  }

  .auth-highlights,
  .auth-footer-grid,
  .session-grid,
  .stats-strip,
  .dashboard-grid,
  .filters-grid {
    grid-template-columns: 1fr;
  }

  .preset-bar {
    flex-direction: column;
    align-items: stretch;
  }

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

  .section-head,
  .timeline-head,
  .panel-head,
  .topbar-actions,
  .dashboard-toolbar,
  .detail-block header,
  .flow-summary-head,
  .flow-panel-head {
    align-items: stretch;
  }

  .section-head,
  .timeline-head,
  .panel-head,
  .topbar-actions,
  .detail-block header,
  .flow-summary-head,
  .flow-panel-head {
    flex-direction: column;
  }

  .flow-grid,
  .flow-payload-grid {
    grid-template-columns: 1fr;
  }

  .level-row {
    grid-template-columns: 1fr;
  }

  .stack-item,
  .stack-item-side {
    flex-direction: column;
    align-items: stretch;
  }

  .resize-handle-vertical {
    display: none;
  }

  .detail-stack {
    grid-template-rows: auto;
  }
}

@media (max-width: 760px) {
  .card {
    padding: 16px;
    border-radius: 22px;
  }

  table {
    min-width: 920px;
  }

  th,
  td {
    padding: 10px 12px;
    font-size: 0.88rem;
  }

  .pulse-grid {
    grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));
  }
}
