:root {
  color-scheme: light;
  --bg: #f2f4f5;
  --panel: #ffffff;
  --panel-soft: #f7f9fb;
  --ink: #17262e;
  --muted: #66747e;
  --subtle: #8b979f;
  --line: #dfe5e9;
  --line-soft: #edf1f3;
  --primary: #2463eb;
  --primary-dark: #1748b8;
  --primary-soft: #edf4ff;
  --primary-container: #2463eb;
  --primary-fixed: #dce9ff;
  --inverse: #17262e;
  --inverse-2: #101c22;
  --inverse-text: #f7fafb;
  --surface-low: #f7f9fb;
  --surface: #f2f4f5;
  --surface-high: #e9eef1;
  --surface-highest: #dfe5e9;
  --green: #14805e;
  --green-soft: #e8f6f0;
  --amber: #a16207;
  --amber-soft: #fff5df;
  --danger: #c43e3e;
  --danger-soft: #ffeded;
  --brick: #c43e3e;
  --brick-soft: #ffeded;
  --violet: #6256a3;
  --violet-soft: #f0edff;
  --shadow: 0 0.75rem 2rem rgba(23, 38, 46, 0.08);
  --shadow-soft: 0 0.25rem 0.9rem rgba(23, 38, 46, 0.055);
  --radius: 0.5rem;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --sidebar-width: 15rem;
  --topbar-height: 4.75rem;
}

html,
body {
  background: var(--bg);
}

body {
  color: var(--ink);
  background-image: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 0.9375rem;
  line-height: 1.55;
}

body.access-checking,
body.access-locked {
  background-color: #eef2f4;
  background-image: none;
}

.access-gate {
  background: linear-gradient(90deg, #17262e 0, #17262e 32%, #eef2f4 32%, #eef2f4 100%);
}

.access-card {
  width: min(28rem, calc(100% - 2rem));
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 1.5rem 4rem rgba(23, 38, 46, 0.14);
  backdrop-filter: none;
  text-align: left;
}

.access-card::before {
  content: "M";
  width: 2.75rem;
  height: 2.75rem;
  margin: 0 0 1.5rem;
  border: 0;
  border-radius: 0.375rem;
  color: #fff;
  background: var(--primary);
  box-shadow: none;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
}

.access-card h2,
.access-card p {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  text-align: left;
}

.access-card h2 {
  font-size: 1.625rem;
  line-height: 1.25;
}

.access-card p {
  margin-bottom: 1.5rem;
  font-size: 0.9375rem;
}

.access-card label {
  text-transform: none;
}

.access-card input,
input,
textarea,
select {
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  background: #fff;
  box-shadow: none;
}

.access-card input {
  min-height: 3rem;
  background: #fff;
  box-shadow: inset 0 0 0 1px transparent;
}

.access-card .primary-btn,
.access-card .ghost-btn,
.access-sso-btn {
  min-height: 3rem;
  border-radius: 0.375rem;
}

.access-card .primary-btn,
.access-sso-btn {
  color: #fff;
  background: var(--primary);
}

.app-shell {
  background: var(--bg);
}

.sidebar {
  color: #dce5e9;
  background: #17262e;
  border-color: rgba(255, 255, 255, 0.08);
  backdrop-filter: none;
}

.brand-block {
  border-color: rgba(255, 255, 255, 0.12);
}

.brand-mark {
  border-radius: 0.375rem;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 0.4rem 1rem rgba(36, 99, 235, 0.24);
}

.brand-label {
  color: #8fb3ff;
}

.brand-block h1 {
  color: #fff;
}

.brand-block p {
  color: #93a4ae;
}

.mobile-nav-toggle {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.375rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.main-nav {
  color: #dce5e9;
  background: #17262e;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 1rem 2rem rgba(10, 18, 22, 0.24);
}

.nav-section > span {
  color: #788b96;
  font-size: 0.6875rem;
}

.nav-item {
  min-height: 2.5rem;
  margin: 0.0625rem 0;
  padding: 0.55rem 0.7rem;
  border-radius: 0.375rem;
  color: #b9c6cd;
  font-size: 0.875rem;
}

.nav-item:hover,
.nav-item.active,
.nav-item.role-secondary.active,
.nav-item.role-secondary:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
  background: var(--primary);
  box-shadow: none;
}

.sidebar .nav-item::before {
  color: #8fb3ff;
}

.sidebar .nav-item.active {
  color: #fff;
  background: var(--primary);
  box-shadow: none;
}

.sidebar .nav-item.active::before {
  color: #fff;
}

.side-status {
  color: #93a4ae;
  border-color: rgba(255, 255, 255, 0.1);
  background: transparent;
}

.side-status strong {
  color: #dce5e9;
}

.main {
  background: var(--bg);
}

.topbar {
  min-height: var(--topbar-height);
  margin-bottom: 1.25rem;
  border-color: var(--line);
  background: rgba(242, 244, 245, 0.96);
  backdrop-filter: blur(0.75rem);
}

.topbar h2 {
  color: var(--ink);
  font-size: 1.375rem;
  font-weight: 700;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.6875rem;
}

.app-switcher {
  display: inline-flex;
  min-width: 8.75rem;
  min-height: 2.75rem;
  padding: 0.4rem 0.65rem;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow-soft);
  text-decoration: none;
}

.app-switcher:hover {
  border-color: rgba(36, 99, 235, 0.4);
}

.app-switcher-grid {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(3, 0.22rem);
  gap: 0.16rem;
  padding: 0.45rem;
  border-radius: 0.375rem;
  background: var(--primary-soft);
}

.app-switcher-grid i {
  width: 0.22rem;
  height: 0.22rem;
  border-radius: 0.1rem;
  background: var(--primary);
}

.app-switcher > span:last-child {
  display: grid;
}

.app-switcher strong {
  font-size: 0.75rem;
  line-height: 1.25;
}

.app-switcher small {
  color: var(--muted);
  font-size: 0.625rem;
}

.topbar-icon {
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  color: var(--muted);
  background: #fff;
}

.identity-authority-summary,
.role-tabs {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: none;
}

.identity-status-link,
.role-tab {
  border-radius: 0.375rem;
}

.role-tab.active {
  color: #fff;
  background: var(--primary);
}

.route-brief {
  border-radius: 0.5rem;
}

.section-band {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: none;
  backdrop-filter: none;
}

.section-head {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line-soft);
}

.section-head h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.stitch-page-hero h3,
.stitch-assessment-head h3,
.stitch-formal-head h3,
.stitch-report-hero h3 {
  max-width: none;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.25;
}

.stitch-page-hero p,
.stitch-formal-head p {
  margin-top: 0.35rem;
  font-size: 0.875rem;
}

.stitch-timer strong {
  color: var(--primary);
  font-size: 2.5rem;
  font-weight: 400;
}

.stitch-hurdle-number {
  border-radius: 0.5rem;
}

.section-head p {
  color: var(--muted);
  font-size: 0.875rem;
}

.pill,
.tag {
  border: 1px solid #d8e5ff;
  border-radius: 999px;
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.primary-btn,
.ghost-btn,
.soft-btn,
.danger-btn {
  min-height: 2.75rem;
  border-radius: 0.375rem;
  font-weight: 650;
}

.primary-btn {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
  box-shadow: none;
}

.primary-btn:hover {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
  transform: none;
}

.primary-btn::after {
  display: none;
}

.ghost-btn,
.soft-btn {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.ghost-btn:hover,
.soft-btn:hover {
  border-color: #b9c7d0;
  background: var(--panel-soft);
  transform: none;
}

.detail-panel,
.metric,
.task-card,
.course-card,
.logic-card,
.stage-card,
.template-card,
.pdd-card,
.quiz-result,
.formal-question,
.stitch-card,
.stitch-panel {
  border-color: var(--line);
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: none;
}

.metric:hover,
.task-card:hover,
.course-card:hover,
.logic-card:hover,
.stage-card:hover {
  border-color: #bdc9d1;
  box-shadow: var(--shadow-soft);
  transform: none;
}

.metric-value {
  color: var(--ink);
}

.metric-label {
  color: var(--muted);
}

.task-card.active,
.course-card.active,
.logic-card.active,
.stage-card.active {
  border-color: rgba(36, 99, 235, 0.55);
  background: var(--primary-soft);
  box-shadow: inset 0.2rem 0 0 var(--primary);
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: none;
}

table {
  background: #fff;
}

th {
  color: #51616b;
  background: #f5f7f8;
  font-size: 0.75rem;
  font-weight: 700;
}

td {
  border-color: var(--line-soft);
  color: var(--ink);
}

tbody tr:hover td {
  background: #f8fafb;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(36, 99, 235, 0.12);
}

.option-list label,
.formal-question .option-list label,
.stitch-role-card {
  border-radius: 0.5rem;
}

.option-list label:has(input:checked),
.formal-question .option-list label:has(input:checked),
.stitch-role-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.toast {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.5rem;
  color: #fff;
  background: #17262e;
  box-shadow: var(--shadow);
}

@media (max-width: 47.99rem) {
  .access-gate {
    background: #eef2f4;
  }

  .app-switcher {
    min-width: 2.75rem;
    width: 2.75rem;
    padding: 0;
    justify-content: center;
  }

  .app-switcher > span:last-child {
    display: none;
  }

  .topbar {
    align-items: center;
  }

  .topbar h2 {
    font-size: 1.125rem;
  }

  .stitch-page-hero h3,
  .stitch-assessment-head h3,
  .stitch-formal-head h3,
  .stitch-report-hero h3 {
    font-size: 1.5rem;
  }

  .identity-authority-summary {
    background: transparent;
  }

  .section-band {
    padding: 1rem;
  }
}

@media (min-width: 48rem) {
  .main {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 64rem) {
  .app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    width: var(--sidebar-width);
    height: 100vh;
    padding: 1rem 0.75rem;
    flex-direction: column;
    align-items: stretch;
  }

  .brand-block {
    padding: 0 0.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  }

  .main-nav {
    position: static;
    display: block;
    max-height: none;
    padding: 1rem 0 0;
    flex: 1;
    border: 0;
    box-shadow: none;
  }

  .nav-section {
    margin-bottom: 0.8rem;
  }

  .side-status {
    display: block;
    padding: 0.9rem 0.6rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.09);
  }

  .main {
    padding: 0 2rem 3rem;
  }

  .topbar {
    top: 0;
    margin: 0 -2rem 1.5rem;
    padding: 0.8rem 2rem;
    align-items: center;
  }

  .topbar p:last-child {
    display: block;
    max-width: 52rem;
    margin: 0.18rem 0 0;
    color: var(--muted);
    font-size: 0.75rem;
  }

  .topbar-actions {
    align-items: center;
  }

  .page {
    max-width: 100rem;
    margin: 0 auto;
  }

  .section-band {
    padding: 1.25rem;
  }
}

@media (min-width: 90rem) {
  :root {
    --sidebar-width: 16rem;
  }

  .main {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }

  .topbar {
    margin-left: -2.5rem;
    margin-right: -2.5rem;
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }
}
