:root {
  --bg: #f6f1ea;
  --panel: #fffaf3;
  --ink: #241d18;
  --muted: #776b60;
  --line: #e2d6c9;
  --accent: #7b3f2f;
  --accent-dark: #552719;
  --soft: #efe4d7;
  --done: #a9a198;
  --shadow: 0 18px 45px rgba(42, 30, 20, .10);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff8ee 0, var(--bg) 42%, #eee3d5 100%);
}
a { color: inherit; text-decoration: none; }
button, .primary, .secondary { font: inherit; }
.app-header {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: flex-end;
  padding: 42px clamp(18px, 5vw, 72px) 26px;
}
h1 { margin: 0; font-size: clamp(2rem, 5vw, 4.8rem); letter-spacing: -0.06em; line-height: .95; }
h2, h3 { margin: 0; }
.subtitle { max-width: 760px; color: var(--muted); font-size: 1.05rem; line-height: 1.55; }
.eyebrow { margin: 0 0 .4rem; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); font-size: .73rem; font-weight: 800; }
.header-actions, .modal-actions { display: flex; gap: .7rem; flex-wrap: wrap; }
.primary, .secondary, button.primary, button.secondary {
  border-radius: 999px;
  padding: .78rem 1.05rem;
  border: 1px solid var(--accent);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
}
.primary { background: var(--accent); color: white; }
.primary:hover { background: var(--accent-dark); }
.secondary { background: transparent; color: var(--accent); }
.secondary:hover { background: var(--soft); }
main { padding: 0 clamp(18px, 5vw, 72px) 70px; }
.summary-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.stat {
  background: rgba(255,250,243,.76);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 18px;
  min-width: 150px;
  box-shadow: 0 8px 24px rgba(42,30,20,.06);
}
.stat strong { display: block; font-size: 1.6rem; }
.stat span { color: var(--muted); font-size: .86rem; }
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 18px;
}
.module-card {
  background: rgba(255,250,243,.92);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Module-specific color themes.
   These use relative/local CSS only and require no external dependencies. */
.module-card {
  --module-accent: var(--accent);
  --module-soft: var(--soft);
}
.module-card .module-head {
  border-top: 8px solid var(--module-accent);
  background: linear-gradient(180deg, var(--module-soft), rgba(255,250,243,.92));
}
.module-card .eyebrow,
.module-card h2 { color: var(--module-accent); }
.module-card .complete-btn { background: var(--module-accent); }
.module-card .complete-btn:hover { filter: brightness(.92); opacity: 1; }
.module-card .pill { border-color: color-mix(in srgb, var(--module-accent) 36%, var(--line)); }

.module-color-space-planning { --module-accent: #2563eb; --module-soft: #eaf1ff; }
.module-color-materials-finishes { --module-accent: #15803d; --module-soft: #eaf8ef; }
.module-color-lighting { --module-accent: #d97706; --module-soft: #fff4db; }
.module-color-ffe { --module-accent: #c2410c; --module-soft: #fff0e7; }
.module-color-codes-clearances { --module-accent: #dc2626; --module-soft: #ffecec; }
.module-color-visual-communication { --module-accent: #7c3aed; --module-soft: #f2eafe; }
.module-color-detailing { --module-accent: #0f766e; --module-soft: #e7f7f5; }
.module-color-concept-story { --module-accent: #475569; --module-soft: #eef2f6; }

.module-head { padding: 22px 22px 14px; border-bottom: 1px solid var(--line); }
.module-head p { color: var(--muted); line-height: 1.45; margin: .55rem 0 0; }
.exercise-list { display: grid; }
.exercise {
  padding: 18px 22px;
  display: grid;
  gap: .75rem;
  border-bottom: 1px solid var(--line);
}
.exercise:last-child { border-bottom: 0; }
.exercise.done { color: var(--done); background: rgba(226,214,201,.38); }
.exercise.done .exercise-title { text-decoration: line-through; }
.exercise-title { font-weight: 800; line-height: 1.25; }
.prompt { color: var(--muted); line-height: 1.46; margin: 0; }
.meta { display: flex; flex-wrap: wrap; gap: .4rem; }
.pill { border: 1px solid var(--line); border-radius: 999px; padding: .22rem .55rem; font-size: .74rem; color: var(--muted); background: rgba(255,255,255,.55); }
.exercise-actions { display: flex; gap: .6rem; align-items: center; justify-content: space-between; }
.complete-btn { border: 0; background: var(--ink); color: white; border-radius: 999px; padding: .62rem .9rem; cursor: pointer; }
.complete-btn:hover { opacity: .86; }
.done-note { font-size: .78rem; color: var(--muted); }
.photo-strip { display: flex; gap: .5rem; flex-wrap: wrap; }
.photo-strip img { width: 54px; height: 54px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.modal { width: min(720px, calc(100vw - 28px)); border: 1px solid var(--line); border-radius: 24px; padding: 0; background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(24,18,14,.42); backdrop-filter: blur(3px); }
.modal form { padding: 24px; display: grid; gap: 14px; }
.modal-header { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.icon-btn { border: 0; background: var(--soft); border-radius: 50%; width: 38px; height: 38px; font-size: 1.35rem; cursor: pointer; }
.modal-prompt { margin: 0; color: var(--muted); line-height: 1.5; }
label { font-weight: 750; }
textarea, input[type="file"] { width: 100%; border: 1px solid var(--line); border-radius: 16px; padding: .9rem; background: white; color: var(--ink); }
textarea { resize: vertical; line-height: 1.45; }
.toast { position: fixed; right: 18px; bottom: 18px; background: var(--ink); color: white; border-radius: 14px; padding: .8rem 1rem; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .2s ease; max-width: 360px; }
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 760px) {
  .app-header { align-items: flex-start; flex-direction: column; }
  .header-actions { width: 100%; }
  .header-actions > * { flex: 1; }
}
