:root {
  color-scheme: light;
  --bg: #f4efe7;
  --bg-accent: radial-gradient(circle at top, rgba(213, 146, 78, 0.24), transparent 36%);
  --surface: rgba(255, 250, 244, 0.78);
  --surface-strong: #fffaf4;
  --surface-border: rgba(57, 44, 35, 0.1);
  --text: #201914;
  --text-muted: #665a52;
  --accent: #af5b2d;
  --accent-strong: #8c451e;
  --shadow: 0 24px 60px rgba(49, 34, 23, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-display: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171411;
  --bg-accent: radial-gradient(circle at top, rgba(233, 136, 73, 0.2), transparent 34%);
  --surface: rgba(33, 28, 24, 0.86);
  --surface-strong: #231d19;
  --surface-border: rgba(255, 232, 216, 0.1);
  --text: #f4ede6;
  --text-muted: #c3b7ad;
  --accent: #f19b64;
  --accent-strong: #ffbb8e;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg-accent), var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
}

button,
select {
  font: inherit;
}

code {
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: rgba(122, 84, 55, 0.12);
}

.app-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
  gap: 1.5rem;
  align-items: stretch;
  margin-bottom: 1.5rem;
}

.hero__copy,
.hero__panel,
.toolbar,
.template-card,
.empty-state {
  border: 1px solid var(--surface-border);
  background: var(--surface);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.hero__copy,
.hero__panel {
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}

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

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 5vw, 4.5rem);
  line-height: 0.95;
}

.hero__text {
  max-width: 38rem;
  margin: 1rem 0 0;
  color: var(--text-muted);
  font-size: 1.02rem;
}

.hero__panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
}

.hero__stat span,
.toolbar__group span,
.toolbar__note,
.template-card__meta,
.template-card__category,
.template-card__status {
  color: var(--text-muted);
}

.hero__stat strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 3rem;
  line-height: 1;
}

.theme-toggle,
.template-card__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff8f1;
  cursor: pointer;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease;
}

.theme-toggle:hover,
.template-card__link:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.dashboard {
  display: grid;
  gap: 1.5rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-md);
}

.toolbar__group {
  display: grid;
  gap: 0.45rem;
}

.toolbar select {
  min-width: 220px;
  min-height: 46px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text);
}

.toolbar__note {
  margin: 0;
  font-size: 0.95rem;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.template-card {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius-md);
}

.template-card__preview,
.template-card__placeholder {
  aspect-ratio: 4 / 3;
  width: 100%;
  border-radius: var(--radius-sm);
}

.template-card__preview {
  border: 1px solid var(--surface-border);
  object-fit: cover;
  background: #d9d2cb;
}

.template-card__placeholder {
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(175, 91, 45, 0.24), transparent),
    linear-gradient(135deg, rgba(32, 25, 20, 0.1), rgba(255, 255, 255, 0.08));
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.template-card__body {
  display: grid;
  gap: 0.45rem;
}

.template-card__category {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.template-card h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.15;
}

.template-card__description {
  margin: 0;
  color: var(--text-muted);
}

.template-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.92rem;
}

.template-card__status {
  display: inline-flex;
  width: fit-content;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  font-size: 0.84rem;
  text-transform: capitalize;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 2rem;
  border-radius: var(--radius-lg);
  text-align: center;
}

.empty-state h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.empty-state p {
  margin: 0;
  color: var(--text-muted);
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 1.2rem, 100%);
    padding-top: 1.2rem;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar__note {
    width: 100%;
  }
}
