:root {
  color-scheme: light;
  --bg: #f5f7f3;
  --surface: #ffffff;
  --surface-soft: #f9fbf7;
  --surface-tint: #eef5ee;
  --line: #d8e1d4;
  --line-strong: #b8c8b2;
  --text: #1d2c24;
  --muted: #68766d;
  --heading: #123624;
  --green: #1f6b45;
  --green-strong: #155334;
  --green-soft: #e6f1e9;
  --gold: #a67c4f;
  --gold-strong: #8f693f;
  --gold-soft: #f3eadf;
  --danger: #a94442;
  --danger-soft: #fae8e6;
  --warn: #9b671a;
  --warn-soft: #f8ecd6;
  --ok: #207454;
  --ok-soft: #e4f2eb;
  --shadow: 0 18px 42px rgba(24, 54, 36, 0.08);
  --radius-lg: 8px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --font-body: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  background:
    linear-gradient(90deg, rgba(31, 107, 69, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(31, 107, 69, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, #fbfcf9 0%, var(--bg) 100%);
  background-size: 28px 28px, 28px 28px, auto;
  overflow-x: hidden;
}

body[data-view="teacher-auth"],
body[data-view="teacher-dashboard"] {
  --accent: var(--green);
  --accent-strong: var(--green-strong);
  --accent-soft: var(--green-soft);
}

body[data-view="admin-auth"],
body[data-view="admin-dashboard"] {
  --accent: #225f43;
  --accent-strong: #17452f;
  --accent-soft: #e5f0e9;
}

body:not([data-view="teacher-auth"]):not([data-view="teacher-dashboard"]):not([data-view="admin-auth"]):not([data-view="admin-dashboard"]) {
  --accent: var(--green);
  --accent-strong: var(--green-strong);
  --accent-soft: var(--green-soft);
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(1360px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  overflow: hidden;
}

.brand-mark img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.brand-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.brand-copy strong {
  color: var(--heading);
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
}

.brand-copy span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.topbar-actions,
.inline-actions,
.chip-row,
.auth-links,
.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.topbar-actions {
  justify-content: flex-end;
}

.button,
.button-secondary,
.button-ghost,
.button-danger,
.nav-link,
.ghost-button,
.segmented-link,
.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  gap: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 700;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.button {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 10px 20px rgba(31, 107, 69, 0.18);
}

.button-secondary,
.nav-link,
.ghost-button,
.segmented-link,
.mini-button {
  color: var(--heading);
  background: #fff;
  border-color: var(--line);
}

.button-ghost {
  color: var(--accent-strong);
  background: transparent;
  border-color: var(--line-strong);
}

.button-danger {
  color: #8f2521;
  background: var(--danger-soft);
  border-color: #edc8c5;
}

.button:hover,
.button-secondary:hover,
.button-ghost:hover,
.button-danger:hover,
.nav-link:hover,
.ghost-button:hover,
.mini-button:hover {
  transform: translateY(-1px);
  border-color: var(--gold);
}

.button:disabled,
.button-secondary:disabled,
.button-ghost:disabled,
.button-danger:disabled,
.mini-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  transform: none;
}

.home-stage {
  min-height: calc(100vh - 126px);
  display: grid;
  grid-template-columns: minmax(360px, 0.94fr) minmax(440px, 1.06fr);
  gap: 34px;
  align-items: center;
  padding: 32px 0;
}

.home-identity {
  display: grid;
  gap: 24px;
  align-content: center;
  justify-items: start;
  padding: 32px;
}

.home-emblem {
  width: 190px;
  height: 190px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.home-wordmark {
  width: min(100%, 520px);
  max-height: 148px;
  object-fit: contain;
  object-position: left center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  box-shadow: var(--shadow);
}

.home-card {
  display: grid;
  gap: 28px;
  padding: 34px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(31, 107, 69, 0.94), rgba(22, 83, 52, 0.96)),
    var(--green);
  color: #fff;
  box-shadow: 0 24px 54px rgba(20, 65, 40, 0.22);
}

.home-card h1 {
  margin: 8px 0 0;
  color: #fff;
  font-size: 40px;
  line-height: 1.18;
}

.home-card .panel-kicker {
  color: #f5dfbf;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.entry-card {
  display: grid;
  gap: 8px;
  min-height: 126px;
  padding: 20px;
  align-content: end;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.95);
  color: var(--heading);
  border: 1px solid rgba(255, 255, 255, 0.52);
}

.entry-card span {
  color: var(--gold-strong);
  font-size: 13px;
  font-weight: 700;
}

.entry-card strong {
  font-size: 24px;
}

.entry-card:hover {
  transform: translateY(-2px);
}

.muted-entry {
  grid-column: span 2;
  min-height: 88px;
  background: rgba(245, 234, 218, 0.96);
}

.experience-entry {
  grid-column: span 2;
  min-height: 96px;
  background: #fff7ea;
  border-color: rgba(245, 223, 191, 0.92);
}

.experience-stage {
  display: grid;
  gap: 22px;
  padding-top: 22px;
}

.experience-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.experience-card {
  display: grid;
  gap: 16px;
  padding: 26px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 251, 247, 0.98)),
    #fff;
  box-shadow: var(--shadow);
}

.experience-card h2 {
  margin: 0;
  color: var(--heading);
  font-size: 26px;
}

.experience-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.step-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
  color: var(--heading);
  line-height: 1.65;
}

.experience-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.experience-flow div {
  display: grid;
  gap: 8px;
  min-height: 130px;
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.experience-flow strong {
  color: var(--heading);
}

.experience-flow span {
  color: var(--muted);
  line-height: 1.6;
}

.auth-shell {
  min-height: calc(100vh - 100px);
  display: grid;
  align-items: center;
  padding: 28px 0;
}

.auth-layout,
.dashboard-grid,
.review-grid,
.field-grid,
.filter-grid,
.admin-export-grid,
.summary-grid,
.feature-grid,
.panel-grid,
.info-grid {
  display: grid;
  gap: 18px;
}

.auth-layout.single {
  max-width: 700px;
  width: 100%;
  margin: 0 auto;
}

.auth-card,
.panel,
.metric-card,
.strip-card,
.story-card,
.role-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.auth-card {
  display: grid;
  gap: 22px;
  padding: 30px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.auth-brand img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
}

.auth-brand div {
  display: grid;
  gap: 4px;
}

.auth-brand strong {
  color: var(--heading);
  font-size: 20px;
}

.auth-brand span {
  color: var(--muted);
  font-size: 13px;
}

.auth-heading h2,
.panel-head h2,
.section-head h2,
.role-card h3,
.story-card h3 {
  margin: 6px 0 0;
  color: var(--heading);
  font-size: 26px;
  line-height: 1.28;
}

.dashboard-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(239, 246, 238, 0.97));
  box-shadow: var(--shadow);
}

.intro-title {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.intro-title img {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
}

.dashboard-intro h1 {
  margin: 6px 0 0;
  color: var(--heading);
  font-size: 30px;
  line-height: 1.25;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.14fr) minmax(330px, 0.86fr);
  margin-top: 18px;
  align-items: start;
}

.review-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.9fr);
  margin-top: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 24px;
}

.panel-head,
.section-head,
.helper-row,
.formula-value,
.legend-row,
.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.panel-head {
  align-items: flex-start;
  margin-bottom: 18px;
}

.panel-kicker,
.eyebrow,
.metric-label,
.field-label,
.badge-label,
.tiny-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.panel-subtitle,
.muted,
.meta,
.formula-note,
.helper-text,
.table-note,
.empty-state p {
  color: var(--muted);
  line-height: 1.65;
}

.field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-stack,
.field-grid > label,
.filter-grid label,
.admin-export-grid label {
  display: grid;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  padding: 11px 13px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

textarea {
  min-height: 118px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 107, 69, 0.12);
}

.filter-grid,
.admin-export-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.export-panel {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.notice {
  margin-top: 14px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: #fff;
  box-shadow: var(--shadow);
}

.notice.info {
  border-color: var(--line);
  color: var(--green-strong);
}

.notice.success {
  background: var(--ok-soft);
  border-color: #c4dfd2;
  color: #185c40;
}

.notice.error {
  background: var(--danger-soft);
  border-color: #edc8c5;
  color: #85231f;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 27, 18, 0.58);
  backdrop-filter: blur(3px);
}

.alert-modal {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 18px;
  width: min(100%, 520px);
  padding: 26px;
  border: 1px solid #e5bbb7;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 30px 80px rgba(14, 38, 24, 0.26);
}

.alert-modal.success {
  border-color: #b8d9c8;
}

.modal-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 28px;
  font-weight: 900;
}

.alert-modal.success .modal-icon {
  background: var(--ok-soft);
  color: var(--ok);
}

.alert-modal h2 {
  margin: 0;
  color: var(--heading);
  font-size: 23px;
}

.alert-modal p {
  margin: 8px 0 0;
  color: var(--text);
  line-height: 1.7;
}

.modal-detail {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.alert-modal > button {
  grid-column: 2;
  justify-self: end;
}

.reset-email-summary,
.debug-code-box {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.reset-email-summary span,
.debug-code-box span,
.debug-code-box p {
  color: var(--muted);
  font-size: 13px;
}

.reset-email-summary strong {
  color: var(--heading);
}

.debug-code-box {
  border-color: #e4cfaa;
  background: var(--warn-soft);
  text-align: center;
}

.debug-code-box strong {
  color: var(--heading);
  font-size: 30px;
  letter-spacing: 8px;
}

.debug-code-box p {
  margin: 0;
}

.pill,
.status-badge,
.formula-chip,
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  gap: 8px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.pill,
.formula-chip,
.count-pill {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--heading);
}

.status-badge.pending {
  background: var(--warn-soft);
  color: #7c4f11;
}

.status-badge.approved {
  background: var(--ok-soft);
  color: #185c40;
}

.status-badge.returned {
  background: var(--danger-soft);
  color: #84231f;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: #fff;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

thead th {
  padding: 13px 12px;
  text-align: left;
  color: var(--heading);
  background: #f0f5ee;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

tbody td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tbody tr:hover {
  background: #fbf7f0;
}

.admin-claim-row {
  cursor: pointer;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.admin-claim-row.bulk-selected {
  background: #f4f8f1;
}

.admin-claim-row.active-review {
  background: var(--green-soft);
  box-shadow: inset 4px 0 0 var(--green);
}

.admin-claim-row:focus-visible {
  outline: 3px solid rgba(31, 107, 69, 0.2);
  outline-offset: -3px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.table-title {
  display: grid;
  gap: 4px;
}

.table-title strong {
  color: var(--heading);
  font-size: 15px;
}

.table-title span,
.table-note {
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  text-align: center;
}

.empty-logo {
  width: 70px;
  height: 70px;
  object-fit: contain;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
}

.formula-box,
.aside-note,
.detail-box,
.stat-box,
.muted-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.formula-value {
  align-items: baseline;
  margin-top: 18px;
}

.formula-value strong {
  color: var(--heading);
  font-size: 31px;
}

.formula-breakdown,
.legend-list,
.meta-list,
.stack {
  display: grid;
  gap: 12px;
}

.formula-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}

.legend-row,
.meta-row {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.legend-row:last-child,
.meta-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.legend-row strong,
.meta-row strong,
.aside-note strong,
.detail-box strong {
  color: var(--heading);
}

.section-head {
  align-items: flex-end;
  flex-wrap: wrap;
}

.role-card,
.story-card,
.strip-card,
.metric-card {
  padding: 18px;
}

.metric-card strong,
.story-card strong,
.stat-value {
  display: block;
  margin-top: 8px;
  color: var(--heading);
  font-size: 26px;
}

.metric-card span,
.story-card span,
.stat-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.role-card ul,
.story-card ul,
.bullet-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.mono {
  font-variant-numeric: tabular-nums;
}

.spaced {
  margin-top: 18px;
}

.text-right {
  text-align: right;
}

.mobile-only {
  display: none;
}

.desktop-only {
  display: inline-flex;
}

.inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.checkbox-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkbox-cell input {
  width: 18px;
  min-height: 18px;
  height: 18px;
}

.footer-note {
  margin-top: 26px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
  text-align: center;
}

.audit-list {
  display: grid;
  gap: 10px;
}

.audit-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.audit-item p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-intro p {
  margin: 6px 0 0;
  color: var(--muted);
}

.admin-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.admin-nav {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.admin-nav-item {
  display: grid;
  gap: 3px;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  color: var(--text);
}

.admin-nav-item strong {
  color: var(--heading);
  font-size: 15px;
}

.admin-nav-item span {
  color: var(--muted);
  font-size: 12px;
}

.admin-nav-item:hover {
  background: var(--surface-soft);
}

.admin-nav-item.active {
  background: var(--green);
}

.admin-nav-item.active strong,
.admin-nav-item.active span {
  color: #fff;
}

.admin-page-content {
  min-width: 0;
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-review-grid {
  margin-top: 0;
}

.admin-shortcuts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-shortcut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 118px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--text);
}

.admin-shortcut strong {
  color: var(--heading);
  font-size: 19px;
}

.admin-shortcut p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.admin-shortcut > span {
  flex: 0 0 auto;
  color: var(--accent);
  font-weight: 800;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.settings-grid small {
  color: var(--muted);
  line-height: 1.5;
}

.field-help {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.settings-section {
  display: grid;
  gap: 14px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.settings-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.settings-section-head h3 {
  margin: 0;
  color: var(--heading);
  font-size: 19px;
}

.settings-section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.settings-table {
  display: grid;
  gap: 8px;
  overflow-x: auto;
}

.settings-row {
  display: grid;
  gap: 10px;
  align-items: end;
  min-width: 760px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.settings-row-head {
  padding-top: 8px;
  padding-bottom: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.course-rule-grid {
  grid-template-columns: 0.8fr 1fr 0.72fr 0.8fr 1.4fr auto;
}

.size-rule-grid {
  grid-template-columns: 0.8fr 0.8fr 0.8fr 1.5fr auto;
}

.settings-row label {
  display: grid;
  gap: 6px;
}

.settings-row label > span {
  display: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.danger-text {
  color: var(--danger);
}

.settings-save-bar {
  position: sticky;
  bottom: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
}

.settings-save-bar div {
  display: grid;
  gap: 4px;
}

.settings-save-bar strong {
  color: var(--heading);
}

.settings-save-bar span {
  color: var(--muted);
  font-size: 13px;
}

.department-list {
  display: grid;
  gap: 10px;
}

.department-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.department-row label {
  display: grid;
  gap: 6px;
}

.department-row label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.department-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--accent);
  font-weight: 800;
}

.fade-up {
  animation: fadeUp 300ms ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1120px) {
  .app-shell {
    width: min(100% - 28px, 1360px);
  }

  .home-stage,
  .dashboard-grid,
  .review-grid,
  .auth-layout,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .experience-grid,
  .experience-flow {
    grid-template-columns: 1fr;
  }

  .admin-nav {
    position: static;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .admin-nav-item span {
    display: none;
  }

  .home-identity {
    justify-items: center;
    text-align: center;
    padding-bottom: 0;
  }

  .home-wordmark {
    object-position: center;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 16px, 1360px);
    padding-top: 10px;
    padding-bottom: 34px;
  }

  .topbar,
  .dashboard-intro,
  .panel-head,
  .helper-row,
  .formula-value,
  .chip-row {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar {
    padding: 14px;
  }

  .alert-modal {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .modal-icon {
    margin: 0 auto;
  }

  .alert-modal > button {
    grid-column: 1;
    width: 100%;
  }

  .brand-copy strong,
  .brand-copy span {
    white-space: normal;
  }

  .topbar-actions,
  .inline-actions,
  .auth-links,
  .filter-actions,
  .brand {
    width: 100%;
  }

  .topbar-actions > *,
  .inline-actions > *,
  .auth-links > *,
  .filter-actions > * {
    width: 100%;
  }

  .home-stage {
    min-height: auto;
    gap: 18px;
    padding: 18px 0;
  }

  .home-identity {
    padding: 10px 0 0;
    gap: 14px;
  }

  .home-emblem {
    width: 128px;
    height: 128px;
  }

  .home-wordmark {
    max-height: 112px;
    padding: 12px;
  }

  .home-card,
  .auth-card,
  .panel {
    padding: 18px;
  }

  .home-card h1 {
    font-size: 30px;
  }

  .entry-grid,
  .field-grid,
  .filter-grid,
  .admin-export-grid,
  .summary-grid,
  .feature-grid,
  .panel-grid,
  .info-grid,
  .settings-grid,
  .admin-shortcuts {
    grid-template-columns: 1fr;
  }

  .admin-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-nav-item {
    padding: 11px 12px;
  }

  .settings-section-head,
  .settings-save-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-section-head > button,
  .settings-save-bar > button {
    width: 100%;
  }

  .settings-row {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .settings-row-head {
    display: none;
  }

  .settings-row label > span {
    display: block;
  }

  .department-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .department-row > button {
    grid-column: 2;
    width: 100%;
  }

  .muted-entry {
    grid-column: auto;
  }

  .intro-title {
    align-items: flex-start;
  }

  .intro-title img {
    width: 58px;
    height: 58px;
  }

  .dashboard-intro h1 {
    font-size: 24px;
  }

  .auth-brand {
    align-items: flex-start;
  }

  .desktop-only {
    display: none;
  }

  .mobile-only {
    display: inline-flex;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
    width: 100%;
  }

  table {
    min-width: 100%;
  }

  .table-wrap {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  thead {
    display: none;
  }

  tbody tr {
    margin-bottom: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: var(--shadow);
  }

  tbody td {
    padding: 8px 0;
    border-bottom: 0;
  }

  tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
  }

  .checkbox-cell {
    justify-content: flex-start;
  }

  .formula-row {
    display: grid;
  }
}
