:root {
  --bg: #05060a;
  --bg-elevated: #0b0d14;
  --bg-soft: #111522;
  --border: #252b3a;
  --border-strong: #3b4357;
  --text: #f7f8fb;
  --text-muted: #9aa3b8;
  --text-faint: #687187;
  --brand: #f43f5e;
  --brand-strong: #fb7185;
  --accent: #7c3aed;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #fb7185;
  --info: #60a5fa;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --shadow-panel: 0 18px 60px rgba(0, 0, 0, .32);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body.webui {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, rgba(124, 58, 237, .18), transparent 36rem), var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

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

.side-nav {
  border-right: 1px solid var(--border);
  padding: 24px;
  background: rgba(5, 6, 10, .72);
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  font-weight: 800;
  letter-spacing: .04em;
  margin-bottom: 28px;
}

.nav-link {
  display: block;
  color: var(--text-muted);
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 12px;
  margin-bottom: 6px;
}

.nav-link:hover,
.nav-link.active {
  background: var(--bg-soft);
  color: var(--text);
}

.main {
  padding: 32px;
  max-width: 1180px;
  width: 100%;
}

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

.eyebrow {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: 12px;
}

h1 {
  margin: 6px 0 8px;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.1;
}

p {
  color: var(--text-muted);
  line-height: 1.55;
}

.panel {
  background: rgba(11, 13, 20, .86);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-panel);
}

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

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.label {
  color: var(--text);
  font-weight: 650;
}

.hint {
  color: var(--text-muted);
  font-size: 14px;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font: inherit;
}

.textarea {
  min-height: 180px;
  resize: vertical;
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--info);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, .24);
}

.btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 11px 16px;
  color: var(--text);
  background: var(--bg-soft);
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 12px 40px rgba(244, 63, 94, .22);
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.status {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.status.ready {
  color: var(--success);
  border-color: rgba(52, 211, 153, .4);
}

.status.missing {
  color: var(--warning);
  border-color: rgba(251, 191, 36, .4);
}

.mobile-nav { display: none; }

@media (max-width: 760px) {
  .app-shell {
    display: block;
    padding-bottom: 72px;
  }

  .side-nav { display: none; }
  .main { padding: 20px; }
  .grid { grid-template-columns: 1fr; }
  .page-head { display: block; }

  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    z-index: 10;
  }

  .mobile-nav a {
    color: var(--text-muted);
    text-align: center;
    text-decoration: none;
    padding: 12px 4px;
    font-size: 12px;
  }
}
