:root {
  color-scheme: light;
  --bg: #f4efe5;
  --panel: #fffaf1;
  --panel-alt: #f0e8d8;
  --ink: #182126;
  --muted: #5c646c;
  --line: #d6cdbb;
  --accent: #0d6b61;
  --accent-strong: #0f7f73;
  --accent-alt: #d88a34;
  --soft-blue: #dcefee;
  --soft-green: #e5f4ea;
  --soft-amber: #fff2dd;
  --soft-red: #fbe4df;
  --shadow: 0 16px 32px rgba(24, 33, 38, 0.08);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(13, 107, 97, 0.08), transparent 28%),
    linear-gradient(180deg, #f8f3ea 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

body {
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px 16px 32px;
}

.hero,
.card {
  border: 1px solid var(--line);
  background: rgba(255, 250, 241, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 14px;
  align-items: center;
  border-radius: 28px;
  padding: 18px;
}

.hero-mark {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  background: linear-gradient(180deg, #202933 0%, #11181d 100%);
  display: grid;
  place-items: center;
}

.hero-mark img {
  width: 72px;
  height: 72px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1,
.card h2 {
  margin: 0;
  font-family: "Aptos Display", "Segoe UI", sans-serif;
}

.hero h1 {
  font-size: 1.8rem;
}

.hero-text,
.section-heading p,
#source-status,
.install-note,
.project-meta,
.project-notes,
.log-item,
.empty-state,
.detail-muted,
.admin-status {
  color: var(--muted);
}

.hero-text {
  margin: 8px 0 0;
  line-height: 1.45;
}

.card {
  margin-top: 14px;
  border-radius: var(--radius);
  padding: 16px;
}

.controls-header,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.button-row.compact {
  margin-top: 0;
}

.button {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 10px 14px;
}

.button.primary {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

.button.accent {
  border-color: transparent;
  background: var(--accent-alt);
  color: #1d1408;
}

.button:disabled {
  opacity: 0.45;
}

.admin-grid,
.import-grid,
.edit-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.admin-status {
  margin: 12px 0 0;
  line-height: 1.45;
}

.field {
  display: grid;
  gap: 6px;
}

.field-full {
  grid-column: 1 / -1;
}

.field span {
  font-size: 0.88rem;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

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

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffdf8;
}

.checkbox-row input {
  width: auto;
}

.install-note {
  margin-top: 14px;
  line-height: 1.5;
}

.inline-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel-alt);
  color: var(--ink);
  font-weight: 600;
}

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

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

.local-bridge-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(220, 239, 238, 0.72), rgba(255, 250, 241, 0.96));
}

.local-bridge-actions {
  margin-top: 0;
}

.bambu-stat {
  border-radius: 20px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fffdf8;
}

.bambu-stat strong {
  display: block;
  margin-top: 10px;
  font-family: "Aptos Display", "Segoe UI", sans-serif;
  font-size: 1.5rem;
}

.summary-card {
  border-radius: 24px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255, 250, 241, 0.98), rgba(240, 232, 216, 0.9));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.summary-label {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.summary-card strong {
  display: block;
  margin-top: 10px;
  font-family: "Aptos Display", "Segoe UI", sans-serif;
  font-size: 1.8rem;
}

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

.content-grid {
  display: grid;
  gap: 14px;
}

.project-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.project-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  background: #fffdf8;
}

.project-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 107, 97, 0.12);
}

.project-topline,
.project-footer,
.detail-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-title {
  margin: 10px 0 6px;
  font-size: 1rem;
}

.project-meta,
.project-notes {
  margin: 0;
  line-height: 1.45;
}

.project-notes {
  margin-top: 8px;
}

.project-footer {
  margin-top: 12px;
}

.bambu-job-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.bambu-job {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: #fffdf8;
}

.bambu-job-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.bambu-job-title {
  margin: 0;
  font-size: 1rem;
}

.bambu-job-meta,
.bambu-job-caption {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.alias-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.alias-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel-alt);
  font-size: 0.82rem;
}

.alias-row {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.lane-pill,
.type-pill,
.machine-pill,
.hardware-pill,
.detail-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.8rem;
  font-weight: 700;
}

.lane-pill {
  background: var(--soft-blue);
}

.lane-ready {
  background: var(--soft-green);
}

.lane-active {
  background: var(--soft-blue);
}

.lane-blocked {
  background: var(--soft-red);
}

.lane-completed {
  background: var(--soft-amber);
}

.type-pill,
.machine-pill {
  background: var(--panel-alt);
}

.hardware-pill {
  background: var(--soft-red);
}

.hidden {
  display: none;
}

.project-detail {
  margin-top: 14px;
}

.detail-block + .detail-block {
  margin-top: 18px;
}

.detail-title {
  margin: 0 0 8px;
  font-size: 1rem;
}

.detail-grid {
  margin-bottom: 10px;
}

.meta-list,
.hardware-list,
.materials-list {
  display: grid;
  gap: 8px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.meta-row span:first-child {
  font-weight: 600;
}

.log-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.log-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fffdf8;
  font-size: 0.88rem;
  line-height: 1.45;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(240, 232, 216, 0.45);
}

@media (min-width: 860px) {
  .app-shell {
    padding: 22px 22px 36px;
  }

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

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

  .local-bridge-panel {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .filters-grid,
  .admin-grid,
  .import-grid,
  .edit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .alias-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .content-grid {
    grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
    align-items: start;
  }
}
