:root {
  color-scheme: light;
  --ink: #20211f;
  --muted: #6a6c67;
  --line: #dedfd9;
  --paper: #f6f6f2;
  --panel: #ffffff;
  --accent: #22543d;
  --accent-soft: #e4f0e9;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}

a { color: inherit; }

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

.site-header {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 0.8rem 1.25rem;
}

.wordmark { font-size: 1.3rem; font-weight: 800; text-decoration: none; }
.session-actions { align-items: center; display: flex; gap: 0.8rem; }
.session-actions form { margin: 0; }

.text-button {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.flash {
  border-radius: 0.4rem;
  margin: 1rem auto;
  max-width: 70rem;
  padding: 0.75rem 1rem;
}

.flash.notice { background: var(--accent-soft); }
.flash.alert { background: #f9dfdc; color: #7b231b; }

.office-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(12rem, 0.75fr) minmax(22rem, 2fr) minmax(17rem, 1fr);
  margin: 1rem auto;
  max-width: 90rem;
  padding: 0 1rem;
}

.office-sidebar { display: grid; gap: 1rem; align-content: start; }
.panel, .conversation-panel, .login-card, .assignment-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  padding: 1rem;
}

.panel h2 { font-size: 1rem; margin: 0 0 0.75rem; }
.eyebrow { color: var(--muted); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; margin: 0; text-transform: uppercase; }
.muted { color: var(--muted); }

.roster-entry { align-items: start; display: flex; gap: 0.55rem; margin-bottom: 0.85rem; }
.roster-entry strong, .roster-entry span, .roster-entry small { display: block; }
.roster-entry span, .roster-entry small { color: var(--muted); }
.status-dot { background: #2f855a; border-radius: 50%; height: 0.55rem; margin-top: 0.45rem; width: 0.55rem; }

.conversation-list a { border-radius: 0.35rem; display: block; padding: 0.5rem; text-decoration: none; }
.conversation-list a.current { background: var(--accent-soft); font-weight: 700; }
.conversation-header { border-bottom: 1px solid var(--line); padding-bottom: 0.6rem; }
.conversation-header h1 { font-size: 1.4rem; margin: 0.15rem 0 0; }

.message-list { display: grid; gap: 1rem; min-height: 20rem; padding: 1rem 0; }
.message { border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
.message header { display: flex; justify-content: space-between; }
.message time { color: var(--muted); font-size: 0.8rem; }
.message-body p { margin: 0.4rem 0; white-space: pre-wrap; }
.assignment-badge { background: var(--accent-soft); border-radius: 999px; display: inline-block; font-size: 0.8rem; padding: 0.3rem 0.65rem; }

.message-composer { border-top: 1px solid var(--line); display: grid; gap: 0.6rem; padding-top: 1rem; }
.message-composer textarea, .field input, .field textarea, .field select {
  border: 1px solid #b8bab4;
  border-radius: 0.4rem;
  padding: 0.65rem;
  width: 100%;
}

.primary-button, .secondary-button {
  border-radius: 0.4rem;
  display: inline-block;
  font-weight: 700;
  padding: 0.55rem 0.85rem;
  text-decoration: none;
}

.primary-button { background: var(--accent); border: 1px solid var(--accent); color: white; cursor: pointer; }
.secondary-button { border: 1px solid var(--line); margin-top: 0.5rem; }

.work-panel { align-self: start; }
.work-card { border-top: 1px solid var(--line); padding: 0.8rem 0; }
.work-card h3 { margin: 0.25rem 0; }
.work-card p { color: var(--muted); }
.work-status { color: var(--accent); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; }
.work-card dl div { display: flex; justify-content: space-between; }
.work-card dt { color: var(--muted); }
.work-card dd { margin: 0; }

.work-proof {
  background: var(--paper);
  border-radius: 0.45rem;
  margin-top: 0.9rem;
  padding: 0.75rem;
}

.work-proof > header { align-items: center; display: flex; justify-content: space-between; }
.work-proof h4, .work-proof h5 { margin: 0; }
.proof-state { color: var(--accent); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; }
.attempt-outcome { color: var(--ink) !important; font-size: 0.85rem; }
.previous-attempt-outcome { font-size: 0.75rem; margin-top: -0.25rem; }
.attempt-detail {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.previous-attempt-detail { margin-top: -0.25rem; }
.proof-empty { font-size: 0.82rem; margin: 0.5rem 0 0; }
.proof-record { border-top: 1px solid var(--line); margin-top: 0.7rem; padding-top: 0.7rem; }
.proof-record h5 span { color: var(--muted); font-size: 0.7rem; font-weight: 500; text-transform: uppercase; }
.proof-record pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  margin: 0.5rem 0;
  max-height: 12rem;
  overflow: auto;
  padding: 0.65rem;
  white-space: pre-wrap;
}

.proof-record dl { font-size: 0.68rem; margin: 0; }
.proof-record dl div { display: block; }
.proof-record code { overflow-wrap: anywhere; }

.login-shell, .assignment-shell, .empty-office {
  display: grid;
  gap: 1rem;
  margin: 4rem auto;
  max-width: 44rem;
  padding: 0 1rem;
}

.login-card { margin: auto; max-width: 26rem; width: 100%; }
.assignment-card { padding: 1.5rem; }
.assignment-card blockquote { border-left: 3px solid var(--line); color: var(--muted); margin: 1rem 0 1.5rem; padding-left: 1rem; }
.back-link { color: var(--muted); display: inline-block; margin-bottom: 1rem; }
.stacked-form { display: grid; gap: 1rem; }
.field label { display: block; font-weight: 700; margin-bottom: 0.25rem; }
.visually-hidden { clip: rect(0 0 0 0); clip-path: inset(50%); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; }

@media (max-width: 900px) {
  .office-grid { grid-template-columns: 1fr; }
  .office-sidebar { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .office-sidebar { grid-template-columns: 1fr; }
  .session-actions span { display: none; }
}
