:root {
  --ink: #1c2b33;
  --muted: #718087;
  --paper: #f2f0ea;
  --surface: #fffefb;
  --line: #dcd8ce;
  --sidebar: #182b33;
  --sidebar-deep: #102229;
  --accent: #b48745;
  --bunker: #b48745;
  --inventory: #2e7b79;
  --inspection: #376f9e;
  --learning: #815b8f;
  --shadow: 0 16px 38px rgba(30, 47, 54, 0.08);
  color-scheme: light;
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 8%, rgba(180, 135, 69, 0.09), transparent 28rem),
    var(--paper);
}

a { color: inherit; }

.portalSidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  width: 248px;
  flex-direction: column;
  color: #f5f1e8;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.04), transparent 35%),
    linear-gradient(180deg, var(--sidebar), var(--sidebar-deep));
  box-shadow: 12px 0 36px rgba(16, 34, 41, 0.12);
}

.portalSidebar::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.22;
  background-image: linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 100% 7px;
}

.brand {
  position: relative;
  display: grid;
  gap: 5px;
  padding: 34px 30px 30px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand strong {
  font-family: "Songti SC", SimSun, serif;
  font-size: 26px;
  letter-spacing: 0.18em;
}

.brand span {
  color: #c8d1d2;
  font-size: 13px;
  letter-spacing: 0.28em;
}

.portalSidebar nav {
  position: relative;
  display: grid;
  gap: 7px;
  padding: 26px 16px;
}

.portalSidebar nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  color: #c5cfd1;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 14px;
  text-decoration: none;
  transition: 160ms ease;
}

.portalSidebar nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.portalSidebar nav a.active {
  color: #fff;
  border-color: rgba(216, 181, 121, 0.22);
  background: linear-gradient(90deg, rgba(180, 135, 69, 0.25), rgba(180, 135, 69, 0.08));
}

.navIndex {
  width: 20px;
  color: #9babad;
  font-family: Georgia, serif;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.portalSidebar nav a.active .navIndex { color: #ddbf88; }

.sidebarFoot {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: auto 20px 22px;
  padding: 15px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.035);
}

.sidebarFoot div { display: grid; gap: 4px; }
.sidebarFoot strong { font-size: 12px; font-weight: 500; }
.sidebarFoot small { color: #8fa0a3; font-size: 10px; }

.statusDot {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  margin-top: 4px;
  border-radius: 50%;
  background: #d3a85f;
  box-shadow: 0 0 0 4px rgba(211, 168, 95, 0.12);
}

.portalCanvas { min-height: 100vh; margin-left: 248px; }

.portalTopbar {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(24px, 4vw, 58px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 254, 251, 0.78);
  backdrop-filter: blur(12px);
}

.eyebrow,
.heroKicker {
  margin: 0 0 7px;
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.portalTopbar h1 {
  margin: 0;
  font-family: "Songti SC", SimSun, serif;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.topbarMeta {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 12px;
}

.topbarMeta strong { color: var(--ink); font-weight: 600; }

.safetyMotto {
  color: #265f83;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.topbarMeta a {
  padding-left: 18px;
  color: var(--ink);
  border-left: 1px solid var(--line);
  text-decoration: none;
}

.previewBadge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  color: #7d5a24;
  border: 1px solid #dbc394;
  border-radius: 999px;
  background: #fff6df;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.portalMain {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 30px clamp(24px, 4vw, 58px) 26px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 38px;
  align-items: end;
  overflow: hidden;
  padding: 34px 38px;
  color: #f6f2e9;
  background:
    linear-gradient(115deg, rgba(28,43,51,.98), rgba(28,52,60,.94)),
    var(--sidebar);
  box-shadow: var(--shadow);
}

.hero::after {
  position: absolute;
  top: -90px;
  right: -70px;
  width: 310px;
  height: 310px;
  content: "";
  border: 1px solid rgba(216,181,121,.2);
  border-radius: 50%;
  box-shadow: 0 0 0 38px rgba(216,181,121,.035), 0 0 0 82px rgba(216,181,121,.025);
}

.hero > * { position: relative; z-index: 1; }
.heroKicker { color: #ddbf88; }

.hero h2 {
  margin: 0 0 12px;
  font-family: "Songti SC", SimSun, serif;
  font-size: clamp(25px, 2.3vw, 36px);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.hero p:not(.heroKicker) {
  max-width: 780px;
  margin: 0;
  color: #bdc9ca;
  font-size: 13px;
  line-height: 1.85;
}

.cadenceLegend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px 20px;
  padding: 18px 0 2px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.cadenceLegend span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d4dcdd;
  font-size: 11px;
}

.cadenceLegend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legendBunker { background: var(--bunker); }
.legendInventory { background: #55a09e; }
.legendInspection { background: #6096c3; }
.legendLearning { background: #a87cb8; }

.metricGrid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border: solid var(--line);
  border-width: 0 1px 1px 0;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metricCard {
  position: relative;
  display: grid;
  min-height: 134px;
  align-content: center;
  gap: 8px;
  padding: 22px;
  border: solid var(--line);
  border-width: 1px 0 0 1px;
}

.metricCard::before {
  position: absolute;
  top: -1px;
  left: 20px;
  width: 34px;
  height: 2px;
  content: "";
  background: var(--tone);
}

.metricCard > span { color: var(--muted); font-size: 11px; }
.metricCard > strong { font-family: Georgia, "Songti SC", serif; font-size: 25px; font-weight: 500; }
.metricCard > small { color: #98a1a5; font-size: 10px; line-height: 1.45; }

.bunkerTone { --tone: var(--bunker); }
.inventoryTone { --tone: var(--inventory); }
.inspectionTone { --tone: var(--inspection); }
.learningTone { --tone: var(--learning); }

.sectionHead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 38px 0 19px;
}

.sectionHead h2 {
  margin: 0;
  font-family: "Songti SC", SimSun, serif;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.sectionHead > p { margin: 0; color: var(--muted); font-size: 11px; }

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

.modulePanel {
  --module-color: var(--accent);
  position: relative;
  overflow: hidden;
  padding: 25px 26px 0;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(30, 47, 54, 0.055);
}

.modulePanel::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  content: "";
  background: var(--module-color);
}

.bunkerModule { --module-color: var(--bunker); }
.inventoryModule { --module-color: var(--inventory); }
.inspectionModule { --module-color: var(--inspection); }
.learningModule { --module-color: var(--learning); }

.moduleHead,
.moduleHead > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.moduleHead > div { justify-content: flex-start; }

.moduleNumber {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--module-color);
  border: 1px solid color-mix(in srgb, var(--module-color), transparent 65%);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 10px;
}

.moduleHead h3 {
  margin: 0;
  font-family: "Songti SC", SimSun, serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.periodLabel {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 20px 0 0;
  padding: 11px 13px;
  background: #f5f3ed;
}

.periodLabel span { color: var(--muted); font-size: 10px; }
.periodLabel strong { font-size: 12px; font-weight: 600; }

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

.moduleStats p {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-right: 12px;
  border-right: 1px solid var(--line);
}

.moduleStats p:last-child { border-right: 0; }
.moduleStats strong { min-height: 28px; font-family: Georgia, "Songti SC", serif; font-size: 22px; font-weight: 500; }
.moduleStats span { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.chartWrap {
  padding: 14px 0 5px;
  border-top: 1px solid var(--line);
}

.chartTitle { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.chartTitle span { font-size: 11px; font-weight: 600; }
.chartTitle small { color: var(--muted); font-size: 9px; }
.chartWrap canvas { display: block; width: 100%; height: 148px; }

.moduleLink {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 -26px;
  padding: 14px 26px;
  color: var(--ink);
  border-top: 1px solid var(--line);
  background: #faf9f5;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  transition: 150ms ease;
}

.moduleLink:hover { color: var(--module-color); background: #f4f2ec; }
.moduleLink span { color: var(--module-color); font-size: 17px; font-weight: 400; }

.portalFoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  padding: 18px 0 0;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 10px;
}

.portalFoot p { display: flex; align-items: center; gap: 9px; margin: 0; }
.portalFoot .statusDot { margin-top: 0; }
.portalFoot a { color: var(--ink); text-decoration: none; }

@media (max-width: 1240px) {
  .safetyMotto { display: none; }
  .metricGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; }
  .cadenceLegend { max-width: 650px; }
}

@media (max-width: 900px) {
  .portalSidebar { position: static; width: auto; }
  .brand { padding: 20px 24px; }
  .portalSidebar nav { display: flex; overflow-x: auto; padding: 10px 16px 14px; }
  .portalSidebar nav a { flex: 0 0 auto; padding: 10px 12px; }
  .sidebarFoot { display: none; }
  .portalCanvas { margin-left: 0; }
  .moduleGrid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
  .portalTopbar { align-items: flex-start; gap: 14px; }
  .topbarMeta { flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
  .topbarMeta a { padding-left: 9px; }
  .portalMain { padding-inline: 16px; }
  .hero { padding: 28px 24px; }
  .cadenceLegend { grid-template-columns: 1fr; }
  .metricGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sectionHead { align-items: flex-start; flex-direction: column; }
  .modulePanel { padding-inline: 20px; }
  .moduleLink { margin-inline: -20px; padding-inline: 20px; }
  .portalFoot { align-items: flex-start; flex-direction: column; gap: 12px; }
}

@media (max-width: 420px) {
  .portalTopbar { flex-direction: column; }
  .topbarMeta { justify-content: flex-start; }
  .metricGrid { grid-template-columns: 1fr; }
  .moduleStats { grid-template-columns: 1fr; }
  .moduleStats p { padding-bottom: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .moduleStats p:last-child { border-bottom: 0; }
}

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