:root {
  color-scheme: light;
  --bg: #f8fafc;
  --panel: rgba(255, 255, 255, 0.75);
  --panel-strong: rgba(255, 255, 255, 0.95);
  --text: #0f172a;
  --muted: #64748b;
  --line: rgba(226, 232, 240, 0.8);
  --accent: #0284c7;
  --accent-strong: #0369a1;
  --accent-soft: rgba(2, 132, 199, 0.08);
  --accent-glow: rgba(2, 132, 199, 0.15);
  --danger: #ef4444;
  --shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.02);
  --radius-lg: 20px;
  --radius-md: 12px;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  background:
    radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.12), transparent 45%),
    radial-gradient(circle at 100% 0%, rgba(14, 165, 233, 0.1), transparent 40%),
    var(--bg);
  background-attachment: fixed;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1100px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 40px 0 60px;
}

/* Hero Section */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 40px;
  align-items: center;
  padding: 20px 0 40px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  background: linear-gradient(135deg, #0f172a 30%, #0284c7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.summary {
  max-width: 580px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

/* Cards & Panels */
.status-card,
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.status-card {
  border-radius: var(--radius-lg);
  padding: 20px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(2, 132, 199, 0.1);
}

.status-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.status-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.status-dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  position: relative;
}

.status-dot::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #10b981;
  animation: pulse 2s infinite;
  left: 0;
  top: 0;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2.5); opacity: 0; }
}

.panel {
  margin-top: 24px;
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: border-color 0.2s;
}

.page-hidden {
  display: none !important;
}

.login-panel {
  max-width: 680px;
}

/* Collapsible Advanced Panel */
summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  list-style: none;
  display: flex;
  align-items: center;
  user-select: none;
}

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

summary::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  margin-right: 12px;
  transition: transform 0.2s ease;
}

details[open] summary::before {
  transform: rotate(45deg);
}

details[open] summary {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--line);
}

.advanced-panel .panel-head {
  margin-top: 0;
}

/* Panel Header Elements */
.panel-head {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.panel-head h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.panel-head.compact {
  margin-bottom: 14px;
  align-items: center;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

/* Grid Framework */
.grid {
  display: grid;
  gap: 16px;
}

.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-two { grid-column: span 2; }

/* Form Controls */
label {
  display: flex;
  flex-direction: column;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  outline: none;
  transition: all 0.15s ease;
  font-size: 14px;
}

input::placeholder {
  color: #94a3b8;
}

input:focus,
select:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

/* Custom Toggle Switch Style */
.toggle {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 10px 0 0;
  user-select: none;
}

.toggle input {
  appearance: none;
  width: 36px;
  height: 20px;
  background: #cbd5e1;
  border-radius: 20px;
  position: relative;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}

.toggle input::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
}

.toggle input:checked {
  background: var(--accent);
}

.toggle input:checked::before {
  transform: translateX(16px);
}

.toggle span {
  margin: 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}

.form-note {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 13px;
  line-height: 1.5;
  border: 1px dashed rgba(2, 132, 199, 0.2);
}

/* Buttons */
button {
  height: 38px;
  border: 0;
  border-radius: var(--radius-md);
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

button:active {
  transform: scale(0.98);
}

.primary {
  height: 46px;
  padding: 0 24px;
  color: white;
  background: var(--accent);
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.2);
}

.primary:hover {
  background: var(--accent-strong);
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.3);
}

.secondary {
  color: #475569;
  background: #f1f5f9;
  border: 1px solid var(--line);
}

.secondary:hover {
  background: #e2e8f0;
  color: var(--text);
}

.small {
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 8px;
}

/* Action Rows & Result Display */
.action-row {
  margin-top: 24px;
}

.quick-action {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.quick-action button {
  flex-shrink: 0;
}

.result {
  flex: 1;
  height: 46px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0 16px;
  color: var(--muted);
  background: #fff;
  font-size: 13.5px;
  font-weight: 500;
}

.result.success {
  color: #065f46;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.result.error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

/* Code Log Terminal */
.logs-panel {
  padding-bottom: 20px;
}

pre {
  min-height: 200px;
  max-height: 360px;
  overflow: auto;
  margin: 0;
  border-radius: var(--radius-md);
  padding: 16px;
  color: #e2e8f0;
  background: #0f172a;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
  border: 1px solid #1e293b;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Responsive Adaptive Interface */
@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 10px 0 20px;
  }

  .shell {
    padding: 20px 0;
  }

  .two,
  .three {
    grid-template-columns: 1fr;
  }

  .span-two {
    grid-column: auto;
  }

  .panel {
    padding: 20px;
  }

  .panel-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .button-group {
    justify-content: flex-start;
  }

  .quick-action {
    flex-direction: column;
    align-items: stretch;
  }

  .quick-action button,
  .action-row button {
    width: 100%;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .status-card,
  .panel {
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}