:root {
  --bg: #f6f1e7;
  --surface: rgba(255, 252, 246, 0.9);
  --surface-strong: #fffdf9;
  --line: rgba(56, 41, 29, 0.12);
  --text: #221a15;
  --muted: #6c615a;
  --brand: #d45c28;
  --brand-dark: #a24218;
  --accent: #0e6d96;
  --success: #157347;
  --shadow: 0 22px 48px rgba(53, 35, 21, 0.1);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(212, 92, 40, 0.18), transparent 28%),
    radial-gradient(circle at right top, rgba(14, 109, 150, 0.12), transparent 24%),
    linear-gradient(180deg, #f9f5ed 0%, #efe5d6 100%);
}

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

a {
  color: inherit;
  text-decoration: none;
}

.page-shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 28px 18px 48px;
}

.hero,
.panel,
.simple-card,
.port-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 24px;
  margin-bottom: 22px;
}

.hero-copy h1 {
  margin: 0 0 10px;
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.hero-copy p {
  margin: 0;
  max-width: 720px;
  color: var(--muted);
  line-height: 1.6;
}

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

.eyebrow,
.section-kicker,
.port-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: var(--brand-dark);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.85fr);
  gap: 22px;
  align-items: start;
}

.workspace {
  display: grid;
  gap: 22px;
}

.preview-panel {
  position: sticky;
  top: 16px;
}

.panel {
  padding: 22px;
}

.preview-card {
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
}

.panel-header,
.port-card-top,
.action-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.panel-header h2,
.port-card h3 {
  margin: 0;
}

.section-copy {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.hint-pill,
.live-badge {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
}

.hint-pill {
  background: rgba(14, 109, 150, 0.1);
  color: var(--accent);
}

.live-badge {
  background: rgba(21, 115, 71, 0.12);
  color: var(--success);
}

.live-badge.pulse {
  animation: pulse 0.45s ease;
}

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

.form-grid,
.simple-grid,
.toggle-grid,
.preset-row,
.stack {
  display: grid;
  gap: 14px;
}

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

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

.preset-row {
  grid-template-columns: repeat(auto-fit, minmax(160px, max-content));
  margin-top: 16px;
}

.stack {
  margin-top: 16px;
}

label,
.toggle,
.advanced-panel,
.simple-card,
.mode-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
}

label span {
  font-size: 0.92rem;
  color: var(--muted);
}

label small,
.toggle small {
  color: var(--muted);
  line-height: 1.4;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(51, 37, 26, 0.14);
  border-radius: 12px;
  padding: 12px 13px;
  background: #fff;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(14, 109, 150, 0.18);
  border-color: var(--accent);
}

.toggle-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: 14px;
}

.toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
}

.toggle input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--brand);
  flex: 0 0 auto;
}

.primary-btn,
.secondary-btn,
.chip,
.danger-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.primary-btn:hover,
.secondary-btn:hover,
.chip:hover,
.danger-link:hover {
  transform: translateY(-1px);
}

.primary-btn {
  background: linear-gradient(135deg, var(--brand), #eb8248);
  color: #fff;
}

.secondary-btn,
.chip,
.compact-select {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
}

.danger-link {
  background: rgba(162, 66, 24, 0.1);
  color: var(--brand-dark);
}

.link-btn {
  border: 1px solid var(--line);
}

.advanced-panel {
  margin-top: 16px;
  overflow: hidden;
}

.advanced-panel summary {
  cursor: pointer;
  padding: 16px 18px;
  font-weight: 700;
}

.details-body {
  padding: 0 16px 16px;
}

.simple-card,
.port-card {
  padding: 16px;
}

.simple-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
}

.port-card-top {
  margin-bottom: 14px;
}

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

.compact-select {
  width: auto;
  min-width: 190px;
}

.mode-panels {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.mode-panel {
  padding: 14px;
}

.port-security-panel[hidden],
.mode-panel[hidden],
.trunk-only[hidden] {
  display: none;
}

.terminal-shell {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #171b20;
}

.terminal-output {
  min-height: 360px;
  max-height: 60vh;
  margin: 0;
  padding: 16px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #eef6ff;
  background: #171b20;
}

.terminal-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  background: #1d232a;
}

.terminal-input-wrap span {
  color: #dce8f7;
}

.terminal-input-wrap input {
  background: #0f1317;
  color: #eef6ff;
  border-color: rgba(255, 255, 255, 0.08);
}

.live-input-wrap small {
  color: #dce8f7;
}

.note-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(14, 109, 150, 0.16);
  background: rgba(14, 109, 150, 0.08);
  color: var(--text);
  line-height: 1.6;
}

#configOutput {
  flex: 1;
  min-height: 520px;
  margin-top: 14px;
  resize: vertical;
  border: 0;
  background: #1f232a;
  color: #eef6ff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
}

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

  .preview-panel {
    position: static;
  }

  .preview-card {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .hero {
    flex-direction: column;
    align-items: stretch;
  }

  .page-shell {
    padding: 16px 12px 30px;
  }

  .panel,
  .hero {
    padding: 18px;
  }

  .simple-card {
    flex-direction: column;
    align-items: stretch;
  }
}
