:root {
  color-scheme: light dark;
  --bg: radial-gradient(circle at top, #ffe1cc 0%, #f6efe8 36%, #ece7df 100%);
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --text: #1f1915;
  --muted: #70655d;
  --accent: #d65a2f;
  --accent-dark: #ab3f1b;
  --accent-soft: #fff0e8;
  --border: rgba(112, 86, 69, 0.18);
  --danger: #b9342f;
  font-family: "Avenir Next", "SF Pro Display", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

button {
  border: 0;
  border-radius: 18px;
  padding: 14px 18px;
  background: var(--accent);
  color: #fff;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

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

button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

button.danger {
  color: var(--danger);
  border-color: rgba(185, 52, 47, 0.2);
}

.app-shell {
  min-height: 100vh;
  padding: 20px 16px 112px;
}

.hero,
.panel,
.metric-grid article,
.tabbar,
.modal-card,
.toast {
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.hero,
.panel,
.metric-grid article,
.modal-card {
  border-radius: 26px;
  box-shadow: 0 18px 52px rgba(89, 52, 20, 0.1);
}

.hero {
  padding: 22px;
}

.hero-topline,
.section-heading,
.status-row,
.queue-row,
.history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

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

.hero h1,
.section-heading h2,
.empty-state h3 {
  margin: 0;
}

.hero-copy,
.modal-copy,
.empty-state p,
.timeline-item p,
.profile-meta,
.history-meta,
.queue-meta,
.status-row span,
.section-caption {
  color: var(--muted);
  line-height: 1.5;
}

.hero-actions,
.button-grid,
.segmented,
.two-col {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.metric-grid article,
.panel {
  padding: 18px;
}

.metric-grid article span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-grid strong {
  font-size: 22px;
}

.screen {
  display: none;
  margin-top: 16px;
}

.screen.active {
  display: grid;
  gap: 16px;
}

.stack {
  display: grid;
  gap: 14px;
}

.status-pill {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.muted {
  background: rgba(93, 84, 77, 0.08);
  color: var(--muted);
}

.status-pill.good {
  background: rgba(35, 140, 91, 0.12);
  color: #1c7f51;
}

.status-pill.warn {
  background: rgba(214, 90, 47, 0.12);
  color: var(--accent-dark);
}

.timeline,
.profile-list,
.history-list,
.queue-items {
  display: grid;
  gap: 10px;
}

.timeline-item,
.profile-card,
.history-row,
.queue-row,
.summary-box,
.empty-state,
.gallery-card {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel-strong);
}

.timeline-item,
.summary-box,
.empty-state,
.history-row,
.queue-row,
.profile-card {
  padding: 16px;
}

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

.field span {
  font-size: 14px;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  padding: 14px;
  color: var(--text);
}

.checkbox-field {
  align-content: end;
}

.checkbox-field input {
  width: 20px;
  height: 20px;
}

.empty-state {
  text-align: center;
}

.profile-card {
  display: grid;
  gap: 12px;
}

.profile-top {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: center;
}

.thumb {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(135deg, #ffc4ab, #f18d61);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.profile-actions,
.history-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.gallery-card {
  overflow: hidden;
  min-height: 150px;
  position: relative;
}

.gallery-preview {
  min-height: 150px;
  background: linear-gradient(145deg, #ffceb6, #ef8455);
}

.gallery-card .gallery-info {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(112, 86, 69, 0.12);
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ef8455, #d65a2f);
  transition: width 0.25s ease;
}

.tabbar {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: 28px;
  background: rgba(255, 249, 245, 0.96);
  box-shadow: 0 18px 48px rgba(73, 48, 30, 0.18);
}

.tab {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 10px 4px;
  display: grid;
  gap: 4px;
  place-items: center;
  font-size: 11px;
}

.tab.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: rgba(214, 90, 47, 0.16);
  font-weight: 700;
}

.tab-icon {
  font-size: 18px;
  line-height: 1;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 14, 10, 0.38);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-card {
  width: min(100%, 420px);
  padding: 20px;
  border-radius: 26px;
}

.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  top: 16px;
  z-index: 30;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(33, 28, 25, 0.88);
  color: #fff;
}

.hidden {
  display: none !important;
}

@media (min-width: 740px) {
  .app-shell {
    max-width: 760px;
    margin: 0 auto;
  }

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