:root {
  --bg: #f4efe7;
  --bg-accent: radial-gradient(circle at top left, rgba(228, 122, 54, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 81, 96, 0.12), transparent 24%), #f4efe7;
  --panel: rgba(255, 252, 247, 0.86);
  --panel-border: rgba(69, 56, 43, 0.12);
  --text: #1f1a16;
  --muted: #6c5d4d;
  --primary: #c55d2d;
  --primary-dark: #9b451c;
  --secondary: #0f5160;
  --secondary-dark: #0b3f4a;
  --success: #2e7d32;
  --warning: #9f6a15;
  --shadow: 0 22px 50px rgba(44, 34, 24, 0.12);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Trebuchet MS", "Noto Sans", sans-serif;
  background: var(--bg-accent);
  color: var(--text);
}

button,
textarea,
input {
  font: inherit;
}

code,
pre,
textarea {
  font-family: "SFMono-Regular", "Cascadia Code", "Consolas", monospace;
}

.shell {
  width: min(1160px, calc(100% - 1.2rem));
  margin: 0 auto;
  padding: 1rem 0 1.5rem;
}

.hero,
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: rise-in 420ms ease both;
}

.hero {
  display: grid;
  gap: 1rem;
  padding: 1.2rem;
  margin-bottom: 1rem;
}

.eyebrow,
.section-kicker {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--secondary);
  font-weight: 700;
}

.hero h1,
.panel h2 {
  margin: 0;
  line-height: 1.08;
}

.hero h1 {
  font-size: clamp(1.9rem, 6vw, 3.3rem);
}

.panel h2 {
  font-size: 1.15rem;
}

.lede,
.muted,
.timestamp {
  color: var(--muted);
}

.hero-status {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.status-pill {
  align-self: flex-start;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(46, 125, 50, 0.12);
  color: var(--success);
  font-weight: 700;
}

.status-pill.is-dirty {
  background: rgba(197, 93, 45, 0.12);
  color: var(--primary);
}

.layout {
  display: grid;
  gap: 1rem;
}

.panel {
  padding: 1rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.path {
  margin-top: 0;
  word-break: break-all;
}

.editor-panel textarea {
  width: 100%;
  min-height: 56vh;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(69, 56, 43, 0.16);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  resize: vertical;
}

.editor-label {
  display: block;
  margin-bottom: 0.55rem;
  font-weight: 700;
}

.editor-actions,
.action-grid,
.metric-grid,
.service-list,
.gpu-list,
.download-form,
.download-list {
  display: grid;
  gap: 0.75rem;
}

.editor-actions {
  margin-top: 0.9rem;
}

.field-group {
  display: grid;
  gap: 0.4rem;
}

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

input,
textarea {
  width: 100%;
  padding: 0.95rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(69, 56, 43, 0.16);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--muted);
}

.checkbox-row input {
  width: auto;
  padding: 0;
}

button {
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.primary-button,
.secondary-button,
.action-button,
.ghost-button {
  font-weight: 700;
}

.primary-button {
  background: linear-gradient(135deg, var(--primary), #d97a2e);
  color: #fffaf4;
}

.secondary-button {
  background: linear-gradient(135deg, var(--secondary), #1f6978);
  color: #effcff;
}

.ghost-button,
.action-button {
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  border: 1px solid rgba(69, 56, 43, 0.14);
}

.metric-card,
.service-card,
.gpu-card,
.empty-card,
.download-card {
  border-radius: var(--radius-md);
  padding: 0.95rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(69, 56, 43, 0.1);
}

.metric-card {
  min-height: 132px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.accent-warm {
  background: linear-gradient(180deg, rgba(255, 234, 215, 0.92), rgba(255, 255, 255, 0.72));
}

.accent-cool {
  background: linear-gradient(180deg, rgba(220, 244, 248, 0.92), rgba(255, 255, 255, 0.72));
}

.metric-label,
.metric-meta,
.service-status,
.gpu-meta {
  color: var(--muted);
}

.metric-value {
  font-size: 2rem;
  line-height: 1;
}

.service-card,
.gpu-card {
  display: grid;
  gap: 0.5rem;
}

.download-card {
  display: grid;
  gap: 0.55rem;
}

.service-row,
.gpu-row,
.download-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.service-name,
.gpu-name,
.download-title {
  font-weight: 700;
}

.download-subtitle,
.download-meta {
  color: var(--muted);
  word-break: break-word;
}

.download-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  color: var(--text);
  font-weight: 700;
}

.download-error {
  color: #a62828;
  background: rgba(184, 45, 45, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}

.download-section + .download-section {
  margin-top: 1rem;
}

.download-section h3 {
  margin: 0 0 0.6rem;
  font-size: 0.96rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
}

.badge.running,
.badge.healthy {
  background: rgba(46, 125, 50, 0.12);
  color: var(--success);
}

.badge.error,
.badge.exited {
  background: rgba(184, 45, 45, 0.12);
  color: #a62828;
}

.badge.unknown {
  background: rgba(15, 81, 96, 0.12);
  color: var(--secondary);
}

.feedback-panel {
  margin-top: 1rem;
}

#feedback {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #2a241f;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero,
  .panel,
  button {
    animation: none;
    transition: none;
  }
}

@media (min-width: 760px) {
  .shell {
    width: min(1280px, calc(100% - 2rem));
    padding-top: 1.2rem;
  }

  .hero {
    grid-template-columns: 1fr auto;
    align-items: end;
    padding: 1.4rem;
  }

  .layout {
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
    align-items: start;
  }

  .sidebar {
    position: sticky;
    top: 1rem;
    display: grid;
    gap: 1rem;
  }

  .editor-actions,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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