:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f5ef;
  color: #20201d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

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

button {
  border: 0;
  border-radius: 8px;
  background: #285e5d;
  color: #fff;
  cursor: pointer;
  padding: 0.75rem 1rem;
}

button:hover {
  background: #1f4c4b;
}

button:disabled {
  background: #b7b0a4;
  cursor: not-allowed;
}

.secondary-button {
  background: #e8d9b7;
  color: #544016;
}

.secondary-button:hover {
  background: #ddc994;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d8d1c3;
  border-radius: 8px;
  background: #fff;
  color: #20201d;
  padding: 0.7rem 0.75rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: #4c4a44;
}

progress {
  width: 100%;
  height: 0.8rem;
  accent-color: #c35c3d;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.topbar h1,
.setup-panel h1,
.auth-panel h1 {
  margin: 0.2rem 0 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
}

.account {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.role,
.status {
  border-radius: 999px;
  background: #e8d9b7;
  color: #544016;
  padding: 0.3rem 0.65rem;
  white-space: nowrap;
}

.eyebrow {
  margin: 0;
  color: #7e3f29;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.setup-panel,
.auth-panel,
.panel {
  border: 1px solid #e4dccd;
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 16px 40px rgb(40 34 22 / 8%);
}

.setup-panel,
.auth-panel {
  margin: 12vh auto 0;
  max-width: 680px;
  padding: 2rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.module-card {
  background: #f8f1df;
}

.module-card.active {
  background: #fffdf8;
}

.rule-guide {
  margin-bottom: 1rem;
}

.rule-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.rule-card {
  border: 1px solid #eee5d4;
  border-radius: 10px;
  background: #fff8e8;
  padding: 0.85rem;
}

.rule-card h3 {
  margin: 0 0 0.55rem;
  color: #7e3f29;
  font-size: 1rem;
}

.rule-card ul {
  margin: 0;
  padding-left: 1.1rem;
}

.rule-card li + li {
  margin-top: 0.4rem;
}

.panel {
  padding: 1rem;
}

.panel h2 {
  margin: 0 0 0.8rem;
  font-size: 1.15rem;
}

.panel h2 + p,
.panel p:last-child {
  margin-bottom: 0;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.section-heading h2,
.section-heading p {
  margin: 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.workspace + .workspace {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.member-workspace {
  grid-template-columns: minmax(280px, 0.8fr) minmax(320px, 1.2fr);
}

.reading-workspace {
  grid-template-columns: minmax(420px, 1.2fr) minmax(320px, 0.8fr);
}

.compact-label {
  min-width: 150px;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
  margin-top: 1.2rem;
}

.stack {
  display: grid;
  gap: 0.9rem;
}

.inline-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.activity-composer {
  align-content: start;
}

.add-button {
  min-height: 4.4rem;
  border-radius: 14px;
  font-size: 1.1rem;
  font-weight: 800;
}

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

.type-card {
  display: grid;
  gap: 0.25rem;
  min-height: 6.2rem;
  align-content: start;
  border: 1px solid #e4dccd;
  background: #fff8e8;
  color: #2f2d29;
  text-align: left;
}

.type-card:hover,
.type-card.selected {
  background: #285e5d;
  color: #fff;
}

.type-card strong {
  font-size: 1.05rem;
}

.type-card span {
  font-size: 0.86rem;
  line-height: 1.35;
}

.activity-detail-form {
  border-top: 1px solid #eee5d4;
  padding-top: 0.9rem;
}

.reading-pre,
.reading-question-list {
  display: grid;
  gap: 0.75rem;
}

.reading-pre {
  margin: 0;
  padding-left: 1.2rem;
}

.reading-question {
  border-top: 1px solid #eee5d4;
  padding-top: 0.75rem;
}

.reading-record {
  border-top: 1px solid #eee5d4;
  padding-top: 0.75rem;
}

.reading-record:first-child {
  border-top: 0;
  padding-top: 0;
}

.reading-record summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
}

.reading-record summary span:first-child {
  display: grid;
  gap: 0.25rem;
}

.reading-record small {
  color: #686158;
  line-height: 1.45;
}

.reading-record-detail {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.reading-record-detail article {
  border-radius: 8px;
  background: #fff8e8;
  padding: 0.75rem;
}

.reading-record-detail h3 {
  margin: 0 0 0.4rem;
  color: #7e3f29;
  font-size: 0.95rem;
}

.reading-record-detail p {
  margin: 0 0 0.45rem;
  color: #4c4a44;
}

.reading-record-detail blockquote {
  margin: 0;
  border-left: 3px solid #d8c392;
  color: #20201d;
  padding-left: 0.7rem;
  white-space: pre-wrap;
}

.llm-placeholder {
  border: 1px dashed #d8c392;
}

.list {
  display: grid;
  gap: 0.75rem;
}

.list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid #eee5d4;
  padding-top: 0.75rem;
}

.list-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.list-item p {
  color: #686158;
  margin: 0.25rem 0 0;
}

.media-panel {
  margin-bottom: 1rem;
}

.media-strip {
  display: grid;
  grid-auto-columns: minmax(180px, 240px);
  grid-auto-flow: column;
  gap: 0.8rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scroll-snap-type: x mandatory;
}

.media-card {
  border: 1px solid #eee5d4;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  scroll-snap-align: start;
}

.media-card img,
.media-card video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #ece6d9;
}

.media-card p {
  margin: 0;
  overflow: hidden;
  color: #686158;
  padding: 0.55rem 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.actions button:last-child {
  background: #8a3a34;
}

.notice {
  border-radius: 8px;
  background: #e4f0dc;
  color: #244a1e;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
}

.notice.error {
  background: #f3ded8;
  color: #713229;
}

.muted {
  color: #756f66;
}

code {
  border-radius: 6px;
  background: #f1eadc;
  padding: 0.1rem 0.25rem;
}

@media (max-width: 900px) {
  .topbar,
  .list-item {
    display: grid;
  }

  .dashboard-grid,
  .module-grid,
  .rule-grid,
  .workspace,
  .workspace + .workspace,
  .auth-grid,
  .inline-fields {
    grid-template-columns: 1fr;
  }
}
