:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f5;
  color: #202520;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #f6f7f5;
}

button, input, select, textarea { font: inherit; }
a { color: inherit; }
.page-shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 36px 0 56px; }
.narrow-page { width: min(480px, 100%); margin: 7vh auto 0; }
.page-heading { margin: 2rem 0 1.4rem; }
.page-heading h1, .narrow-page h1 { margin: 0; font-size: 1.9rem; line-height: 1.2; }
.page-intro { max-width: 760px; margin: 0.55rem 0 0; color: #5c625c; line-height: 1.55; }
.eyebrow { display: block; margin: 0 0 0.45rem; color: #657167; font-size: 0.78rem; font-weight: 750; text-transform: uppercase; }
.muted { display: block; margin-top: 0.2rem; color: #69716a; font-size: 0.93rem; }

.top-actions, .actions-inline { display: flex; align-items: center; justify-content: space-between; gap: 0.7rem; flex-wrap: wrap; }
.actions-inline { justify-content: flex-end; }
.top-actions form, .actions-inline form { margin: 0; }
.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.62rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid #9ec8e9;
  outline-offset: 2px;
}
.button-primary { background: #245b45; border-color: #245b45; color: #fff; }
.button-primary:hover { background: #1c4d39; }
.button-secondary { background: #fff; border-color: #cbd2cc; color: #303b33; }
.button-secondary:hover, .button-quiet:hover { background: #edf1ed; }
.button-quiet { background: transparent; border-color: transparent; color: #536057; }

.workbook-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.6rem;
  padding: 1rem 1.1rem;
  border: 1px solid #cbd7cc;
  border-left: 4px solid #245b45;
  border-radius: 7px;
  background: #fff;
}
.workbook-mark {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 6px;
  background: #e7f0e8;
  color: #245b45;
  font-size: 0.75rem;
  font-weight: 850;
}
.workbook-details { display: grid; gap: 0.1rem; min-width: 0; }
.workbook-details .eyebrow { margin-bottom: 0.05rem; }
.workbook-name { overflow-wrap: anywhere; font-size: 1.08rem; }
.workbook-size { color: #626b63; font-size: 0.92rem; }

.stack-form { display: grid; gap: 0.6rem; margin-top: 1.5rem; }
.field-label { display: block; color: #313a33; font-size: 0.94rem; font-weight: 700; }
.text-input {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.75rem;
  border: 1px solid #c8d0c9;
  border-radius: 6px;
  background: #fff;
  color: #202520;
}
.file-input { padding: 0.55rem; }
.upload-section { margin-top: 1.8rem; padding: 1.3rem; border-top: 1px solid #d8ded8; border-bottom: 1px solid #d8ded8; }
.upload-form { display: grid; max-width: 600px; gap: 0.65rem; }
.upload-form .button { margin-top: 0.35rem; justify-self: start; }
.last-upload {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: 1.8rem;
  padding: 1rem;
  border: 1px solid #d5ddd5;
  border-radius: 7px;
  background: #fff;
}
.last-upload > div { display: grid; flex: 1; min-width: 0; }
.last-upload-name { overflow-wrap: anywhere; }
.status-dot { width: 11px; height: 11px; flex: 0 0 auto; border-radius: 50%; background: #4f8d64; box-shadow: 0 0 0 4px #e7f1e9; }
.page-footer-actions { margin-top: 1.3rem; }
.alert { margin: 1rem 0 0; padding: 0.8rem; border: 1px solid #ddb5ac; border-radius: 6px; background: #fff1ed; color: #76291e; }
.status-error { color: #9a3024 !important; }
.empty-state { margin: 0; padding: 1.3rem; color: #626b63; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 640px) {
  .page-shell { width: calc(100% - 24px); padding-top: 22px; }
  .narrow-page { margin-top: 6vh; }
  .page-heading h1, .narrow-page h1 { font-size: 1.65rem; }
  .top-actions { align-items: stretch; }
  .last-upload { align-items: flex-start; flex-wrap: wrap; }
  .last-upload .button { width: 100%; }
  .actions-inline { width: 100%; }
  .actions-inline .button, .actions-inline form, .actions-inline form .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
