:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-strong: #f8fafc;
  --ink: #172033;
  --muted: #6b7280;
  --line: #dce3ee;
  --line-strong: #cbd5e1;
  --green: #2e8b57;
  --teal: #147c86;
  --blue: #3867d6;
  --red: #b64242;
  --yellow: #b88320;
  --violet: #7653b7;
  --shadow: 0 18px 44px rgba(31, 41, 55, 0.12);
  font-family:
    Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
}

body {
  background:
    linear-gradient(0deg, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.52)),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 38px,
      rgba(148, 163, 184, 0.16) 39px,
      transparent 40px
    ),
    var(--bg);
  color: var(--ink);
}

body.onboarding-open {
  overflow: hidden;
}

button {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 10px;
  overflow: hidden;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(31, 41, 55, 0.08);
  padding: 12px 14px;
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(21px, 3vw, 28px);
  line-height: 1.04;
}

h2 {
  font-size: 22px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(72px, 1fr));
  gap: 8px;
}

.metric {
  min-width: 72px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  padding: 10px 12px;
}

.metric span,
.target-panel span,
.panel-title span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  line-height: 1.1;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  gap: 7px;
  justify-content: flex-end;
}

.icon-button {
  position: relative;
  display: grid;
  grid-template-rows: 20px 13px;
  place-items: center;
  gap: 2px;
  min-width: 54px;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  padding: 5px 8px 4px;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.button-label {
  display: block;
  color: currentColor;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--teal);
  outline: none;
  transform: translateY(-1px);
}

.icon-button.active {
  background: #e8f5f4;
  border-color: var(--teal);
  color: var(--teal);
}

.mode-button[data-review-level="low"].active {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.mode-button[data-review-level="normal"].active {
  border-color: #86efac;
  background: #ecfdf5;
  color: #047857;
}

.mode-button[data-review-level="high"].active {
  border-color: #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}

.mode-button[data-trend-metric="efficiency"].active {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.mode-button[data-trend-metric="cost"].active {
  border-color: #fde68a;
  background: #fffbeb;
  color: #a16207;
}

.mode-button[data-trend-metric="risk"].active {
  border-color: #ddd6fe;
  background: #f5f3ff;
  color: #6d28d9;
}

body.paused #pauseButton {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #475569;
}

body.graphic-mode #workButton {
  border-color: #86efac;
  background: #ecfdf5;
  color: #15803d;
}

body.graphic-mode {
  background:
    linear-gradient(0deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.66)),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 38px,
      rgba(34, 197, 94, 0.12) 39px,
      transparent 40px
    ),
    #f0fdf4;
}

body.graphic-mode .topbar,
body.graphic-mode .board-panel,
body.graphic-mode .side-panel {
  border-color: #bbf7d0;
  box-shadow: 0 10px 24px rgba(22, 101, 52, 0.08);
}

body.graphic-mode .board-head {
  border-bottom-color: #dcfce7;
}

body.graphic-mode .board-tabs .active {
  color: #166534;
  box-shadow: 0 1px 5px rgba(22, 101, 52, 0.16);
}

body.graphic-mode .sheet-chrome {
  display: block;
  border-color: #e8edf4;
  background: #ffffff;
}

body.graphic-mode .sheet-menu {
  border-bottom-color: #edf2f7;
  background: #fafbfc;
  color: #64748b;
}

body.graphic-mode .formula-line {
  color: #475569;
}

body.graphic-mode .formula-line span {
  border-right-color: #edf2f7;
  color: #2e8b57;
  opacity: 0.8;
}

body.graphic-mode .sheet-columns {
  border-top-color: #edf2f7;
  background: #f7f9fc;
}

body.graphic-mode .sheet-columns span {
  border-right-color: #edf2f7;
  color: #7b8794;
}

body.hell-mode #workButton {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #b91c1c;
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.button-badge {
  position: absolute;
  right: -6px;
  top: -7px;
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  border: 1px solid #fff;
  border-radius: 999px;
  background: #0f766e;
  color: #fff;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
}

.stealth-help {
  position: relative;
}

.stealth-help::after {
  content: attr(data-help-tip);
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  width: max-content;
  max-width: 190px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #172033;
  color: #fff;
  opacity: 0;
  padding: 7px 9px;
  pointer-events: none;
  transform: translateY(4px);
  transition:
    opacity 0.14s ease,
    transform 0.14s ease;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: normal;
}

body.control-help .stealth-help:hover::after,
body.control-help .stealth-help:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.workspace {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 318px;
  gap: 10px;
  min-height: 0;
  margin-top: 10px;
  overflow: hidden;
}

.board-panel,
.side-panel {
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 18px rgba(31, 41, 55, 0.08);
}

.board-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-height: 0;
  overflow: auto;
  padding: 12px 16px;
}

body.review-view .board-panel {
  display: block;
  overflow: auto;
}

body.review-view .review-board,
body.review-view .risk-review {
  min-height: 0;
  height: auto;
}

body.review-view .board,
body.review-view .review-board {
  display: block;
  width: 100%;
  min-width: 0;
}

body.review-view .risk-review {
  display: grid;
  grid-template-rows: auto auto auto;
}

body.paused .workspace::after {
  content: "已封存";
  position: absolute;
  inset: 0;
  z-index: 42;
  display: grid;
  place-items: center;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(248, 250, 252, 0.72);
  color: #475569;
  pointer-events: none;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0;
  backdrop-filter: blur(2.2px);
}

.board-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.board-tabs {
  display: flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px;
  background: var(--panel-strong);
}

.board-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 30px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 0 10px;
}

.board-tabs button:hover,
.board-tabs button:focus-visible {
  color: var(--ink);
  outline: none;
}

.board-tabs .active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.sheet-chrome {
  display: none;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.sheet-menu {
  display: flex;
  gap: 18px;
  min-height: 34px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  padding: 0 12px;
  color: #475569;
  font-size: 13px;
}

.formula-line {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  min-height: 34px;
  color: #334155;
  font-size: 13px;
}

.formula-line span {
  display: grid;
  place-items: center;
  height: 100%;
  border-right: 1px solid var(--line);
  color: var(--green);
  font-weight: 800;
  font-style: italic;
}

.formula-line strong {
  padding: 0 12px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-columns {
  display: grid;
  grid-template-columns: repeat(8, minmax(82px, 1fr));
  min-width: 720px;
  border-top: 1px solid var(--line);
  background: #edf2f7;
}

.sheet-columns span {
  display: grid;
  place-items: center;
  min-height: 26px;
  border-right: 1px solid var(--line-strong);
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.sheet-columns span:last-child {
  border-right: 0;
}

.board {
  --cell-gap: 8px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: var(--cell-gap);
  width: 100%;
  max-width: none;
  margin: 14px 0 0;
  align-self: stretch;
  user-select: none;
}

body.graphic-mode .board {
  --cell-gap: 8px;
  width: 100%;
  max-width: none;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #e7f8ee;
  padding: 8px;
  justify-self: stretch;
  align-self: stretch;
}

.tile {
  position: relative;
  container-type: size;
  container-name: task-tile;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: stretch;
  min-width: 0;
  min-height: clamp(70px, calc((100vh - 250px) / 8), 108px);
  aspect-ratio: auto;
  overflow: hidden;
  border: 1px solid var(--tile-border);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.58)),
    var(--tile-bg);
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -3px 0 rgba(15, 23, 42, 0.06),
    0 4px 10px rgba(15, 23, 42, 0.05);
  cursor: grab;
  touch-action: none;
  will-change: transform, opacity;
  transition:
    transform 0.18s cubic-bezier(0.2, 0.9, 0.2, 1),
    box-shadow 0.18s ease,
    opacity 0.18s ease,
    border-color 0.18s ease,
    filter 0.18s ease;
}

body.graphic-mode .tile {
  aspect-ratio: auto;
  min-height: clamp(70px, calc((100vh - 270px) / 8), 108px);
  border-radius: 8px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.94),
    inset 0 -3px 0 rgba(15, 23, 42, 0.05),
    0 6px 14px rgba(15, 23, 42, 0.08);
}

body.graphic-mode .tile-code {
  border-bottom-color: rgba(15, 23, 42, 0.06);
  background: rgba(255, 255, 255, 0.46);
}

body.graphic-mode .tile-label {
  font-size: clamp(8px, min(10cqw, 18cqh), 16px);
  font-weight: 900;
}

body.graphic-mode .tile-sub {
  opacity: 0.82;
}

.tile::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--tile-accent);
  opacity: 0.72;
  pointer-events: none;
}

.tile::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 24%;
  max-width: 24px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 34%, rgba(255, 255, 255, 0.92) 0 22%, transparent 24%),
    var(--tile-accent);
  opacity: 0.18;
}

.tile:hover,
.tile:focus-visible {
  outline: none;
  transform: translateY(-2px);
  box-shadow:
    inset 0 -3px 0 rgba(15, 23, 42, 0.06),
    0 8px 18px rgba(15, 23, 42, 0.12);
}

.tile.selected {
  z-index: 3;
  border-color: #2563eb;
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, 0.22),
    0 10px 22px rgba(15, 23, 42, 0.12),
    inset 0 -3px 0 rgba(15, 23, 42, 0.06);
  transform: translateY(-3px);
}

.tile.clearing {
  animation: tileClear 0.42s cubic-bezier(0.22, 0.8, 0.24, 1) forwards;
}

.tile.invalid {
  animation: shake 0.24s ease;
}

.tile.dragging {
  cursor: grabbing;
  opacity: 0.62;
  transform: scale(0.96);
  filter: saturate(1.2);
}

.tile.drag-over {
  z-index: 3;
  border-color: #2563eb;
  box-shadow:
    0 0 0 4px rgba(37, 99, 235, 0.22),
    inset 0 -3px 0 rgba(15, 23, 42, 0.06);
}

.tile.hint {
  z-index: 4;
  animation: hintPulse 1.05s ease-in-out infinite;
  border-color: #1d4ed8;
}

.tile.hint::after {
  content: "CHK";
  display: grid;
  place-items: center;
  right: 7px;
  bottom: 7px;
  width: auto;
  max-width: none;
  min-width: 30px;
  height: 20px;
  aspect-ratio: auto;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  opacity: 1;
}

.tile.guide-source,
.tile.guide-target {
  z-index: 7;
  border-color: #0d9488;
  animation: guideCellPulse 0.95s ease-in-out infinite;
  box-shadow:
    0 0 0 5px rgba(20, 184, 166, 0.24),
    0 0 0 10px rgba(20, 184, 166, 0.1),
    0 14px 30px rgba(15, 118, 110, 0.22),
    inset 0 -3px 0 rgba(15, 23, 42, 0.06);
  transform: translateY(-3px) scale(1.02);
}

.tile.guide-source::after,
.tile.guide-target::after {
  display: grid;
  place-items: center;
  right: 6px;
  bottom: 6px;
  width: auto;
  max-width: none;
  min-width: 26px;
  height: 18px;
  aspect-ratio: auto;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 999px;
  background: #0f766e;
  color: #0f766e;
  font-size: 10px;
  font-weight: 1000;
  opacity: 1;
}

.tile.guide-source::after {
  content: "拖";
  color: #fff;
}

.tile.guide-target::after {
  content: "放";
  color: #fff;
}

.week-swap-guide {
  position: absolute;
  left: var(--guide-x);
  top: var(--guide-y);
  z-index: 10;
  width: var(--guide-distance);
  height: 0;
  pointer-events: none;
  transform: translateY(-50%) rotate(var(--guide-angle));
  transform-origin: 0 50%;
}

.week-swap-guide-line {
  position: absolute;
  left: 14px;
  right: 18px;
  top: -3px;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(20, 184, 166, 0.28), #0d9488 74%, #064e3b);
  box-shadow: 0 6px 18px rgba(15, 118, 110, 0.22);
  animation: weekGuideFlow 0.72s ease-in-out infinite;
}

.week-swap-guide-line::after {
  content: "";
  position: absolute;
  right: -10px;
  top: 50%;
  width: 16px;
  height: 16px;
  border-top: 7px solid #064e3b;
  border-right: 7px solid #064e3b;
  transform: translateY(-50%) rotate(45deg);
}

.week-swap-guide-copy {
  position: absolute;
  left: 50%;
  top: -52px;
  display: grid;
  gap: 2px;
  min-width: 148px;
  border: 2px solid #5eead4;
  border-radius: 16px;
  background: rgba(240, 253, 250, 0.98);
  box-shadow:
    0 0 0 5px rgba(20, 184, 166, 0.12),
    0 18px 42px rgba(15, 23, 42, 0.18);
  color: #0f172a;
  padding: 11px 14px;
  text-align: center;
  transform: translateX(-50%) rotate(var(--guide-copy-angle));
  animation: weekGuideCopyPulse 1.05s ease-in-out infinite;
}

.week-swap-guide-copy strong {
  color: #0f766e;
  font-size: 15px;
  font-weight: 1000;
  line-height: 1;
}

.week-swap-guide-copy em {
  color: #475569;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  line-height: 1.2;
}

.tile.priority {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -3px 0 rgba(15, 23, 42, 0.06),
    0 0 0 2px var(--tile-border),
    0 6px 16px rgba(15, 23, 42, 0.08);
}

.tile.locked {
  cursor: not-allowed;
  border-color: #1d4ed8;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(37, 99, 235, 0.2) 0,
      rgba(37, 99, 235, 0.2) 6px,
      rgba(255, 255, 255, 0.36) 6px,
      rgba(255, 255, 255, 0.36) 12px
    ),
    linear-gradient(135deg, rgba(239, 246, 255, 0.96), rgba(219, 234, 254, 0.82)),
    var(--tile-bg);
  box-shadow:
    inset 0 0 0 2px rgba(37, 99, 235, 0.34),
    inset 0 -3px 0 rgba(15, 23, 42, 0.06),
    0 6px 16px rgba(37, 99, 235, 0.18);
}

.tile.locked::before {
  width: 5px;
  background: #3b82f6;
  opacity: 0.62;
}

.tile.locked::after {
  content: "FX";
  display: grid;
  place-items: center;
  right: 6px;
  bottom: 6px;
  width: 32px;
  height: 20px;
  max-width: none;
  aspect-ratio: auto;
  border: 1px solid rgba(29, 78, 216, 0.34);
  border-radius: 7px;
  background: #1d4ed8;
  color: #ffffff;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0;
  opacity: 1;
}

.tile.blocker {
  cursor: not-allowed;
  border-style: dashed;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(100, 116, 139, 0.14) 0,
      rgba(100, 116, 139, 0.14) 6px,
      rgba(255, 255, 255, 0.55) 6px,
      rgba(255, 255, 255, 0.55) 12px
    ),
    var(--tile-bg);
  filter: saturate(0.62);
}

.tile.blocker::before {
  width: 100%;
  opacity: 0.08;
}

.tile.blocker::after {
  display: none;
}

.tile.blocker .tile-code,
.tile.locked .tile-code {
  background: rgba(255, 255, 255, 0.62);
}

.tile.locked .tile-code,
.tile.locked .tile-sub {
  color: #1d4ed8;
}

.tile.settling {
  animation: tileSettle 0.32s cubic-bezier(0.18, 0.9, 0.18, 1.15) both;
  animation-delay: calc(var(--fall-index) * 12ms);
}

.tile.swapping {
  z-index: 5;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(0.18, 0.9, 0.2, 1);
}

.review-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  min-width: 0;
  user-select: none;
}

body.work-mode .review-board,
body.hell-mode .review-board {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
}

.review-ledger,
.review-detail {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.review-ledger {
  align-self: start;
}

.review-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--line);
}

.review-summary span {
  min-width: 0;
  background: #fff;
  padding: 8px 9px;
}

.review-summary b,
.review-summary strong {
  display: block;
  line-height: 1.05;
}

.review-summary b {
  color: var(--muted);
  font-size: 10px;
}

.review-summary strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 16px;
}

.review-head,
.review-row {
  display: grid;
  grid-template-columns: 78px minmax(150px, 1.2fr) 82px 64px 78px 62px minmax(96px, 0.8fr);
  align-items: stretch;
}

.review-head {
  border-bottom: 1px solid var(--line-strong);
  background: #edf2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.review-head span,
.review-row span {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 36px;
  border-right: 1px solid var(--line);
  padding: 0 8px;
}

.review-head span:last-child,
.review-row span:last-child {
  border-right: 0;
}

.review-row {
  border-bottom: 1px solid var(--line);
  color: #334155;
  font-size: 12px;
}

.review-row:last-child {
  border-bottom: 0;
}

.review-row.current {
  background:
    linear-gradient(90deg, rgba(20, 124, 134, 0.08), transparent 62%),
    #f8fafc;
  color: var(--ink);
  font-weight: 800;
}

.review-row.urgent:not(.current) {
  background:
    linear-gradient(90deg, rgba(185, 28, 28, 0.07), transparent 46%),
    #fff;
}

.review-row.done {
  color: #64748b;
  background: #f8fafc;
}

.review-row .review-id {
  color: #475569;
  font-weight: 900;
}

.review-row .review-money {
  justify-content: flex-end;
  color: #0f766e;
  font-weight: 900;
}

.review-row .review-priority.high {
  color: #b64242;
  font-weight: 900;
}

.review-risk {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.review-detail {
  order: -1;
  display: grid;
  gap: 12px;
  align-content: stretch;
  overflow: hidden;
  padding: 14px;
}

.risk-board {
  gap: 12px;
}

.risk-review {
  container: risk-review / inline-size;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96)),
    repeating-linear-gradient(0deg, transparent 0, transparent 31px, rgba(226, 232, 240, 0.28) 32px);
}

.risk-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #dbe3ee;
  overflow: hidden;
}

.risk-kpis span {
  display: grid;
  gap: 4px;
  min-width: 0;
  background: rgba(255, 255, 255, 0.94);
  padding: 10px;
}

.risk-kpis b {
  color: #64748b;
  font-size: 10px;
  font-weight: 900;
}

.risk-kpis strong {
  color: #172033;
  font-size: 18px;
  line-height: 1;
}

.risk-workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
  min-height: 0;
}

.risk-chart-card,
.risk-side {
  min-width: 0;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  overflow: hidden;
}

.risk-chart-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-self: stretch;
  justify-items: stretch;
}

.risk-pie-stage {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  width: 100%;
  padding: 16px 12px 12px;
}

.risk-chart-head {
  justify-self: stretch;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
}

.risk-chart-head strong {
  color: #172033;
  font-size: 13px;
}

.risk-pie-shell {
  position: relative;
  justify-self: center;
  align-self: center;
  width: min(100%, clamp(360px, calc(100vh - 260px), 540px));
  aspect-ratio: 1;
  margin: 0;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: var(--risk-pie);
  box-shadow:
    inset 0 0 0 12px rgba(255, 255, 255, 0.72),
    0 18px 42px rgba(15, 23, 42, 0.11);
  padding: clamp(24px, 4vw, 42px);
}

.risk-pie-shell::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.92) 0 23%, transparent 24%),
    repeating-radial-gradient(circle at center, transparent 0 46px, rgba(255, 255, 255, 0.38) 47px 48px),
    repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.32) 0 1deg, transparent 1deg 12deg);
  pointer-events: none;
}

.risk-pie-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(var(--grid-size), minmax(0, 1fr));
  gap: clamp(1px, 0.22vw, 3px);
  width: 100%;
  height: 100%;
}

.risk-cell {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border: 1px solid color-mix(in srgb, var(--risk-color, #94a3b8), white 56%);
  border-radius: 4px;
  background: color-mix(in srgb, var(--risk-color, #94a3b8), white 74%);
  color: #172033;
  cursor: pointer;
  font-size: clamp(10px, 1.2vw, 14px);
  font-weight: 900;
  line-height: 1;
  padding: 0;
  touch-action: manipulation;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    transform 0.14s ease,
    box-shadow 0.14s ease;
}

.risk-cell:hover:not(:disabled) {
  border-color: var(--risk-color);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.risk-cell.is-empty {
  border: 0;
  background: transparent;
  pointer-events: none;
}

.risk-cell.is-revealed {
  border-color: #dbe3ee;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 1px rgba(203, 213, 225, 0.35);
}

.risk-cell.is-flagged {
  border-color: rgba(15, 23, 42, 0.34);
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.08), transparent 58%),
    color-mix(in srgb, var(--risk-color, #94a3b8), white 84%);
  color: #172033;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.1);
}

.risk-cell.is-flagged span {
  position: relative;
  display: block;
  width: 58%;
  height: 66%;
  background: transparent;
  color: transparent;
  font-size: 0;
  line-height: 1;
}

.risk-cell.is-flagged span::before {
  content: "";
  position: absolute;
  top: 10%;
  left: 30%;
  width: 2px;
  height: 82%;
  border-radius: 999px;
  background: #111827;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.risk-cell.is-flagged span::after {
  content: "";
  position: absolute;
  top: 13%;
  left: 36%;
  width: 56%;
  height: 34%;
  border-radius: 2px 3px 3px 1px;
  background: #111827;
  clip-path: polygon(0 0, 100% 14%, 78% 54%, 100% 100%, 0 86%);
}

.risk-cell.is-mine,
.risk-cell.is-hit {
  border-color: rgba(127, 29, 29, 0.3);
  background:
    radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.08) 0 26%, transparent 27%),
    linear-gradient(135deg, rgba(254, 242, 242, 0.96), rgba(255, 255, 255, 0.84));
  color: #111827;
  box-shadow:
    inset 0 0 0 1px rgba(127, 29, 29, 0.12),
    inset 0 -4px 12px rgba(127, 29, 29, 0.07);
}

.risk-cell.is-hit {
  animation: mineStamp 0.34s cubic-bezier(0.18, 0.9, 0.24, 1.12);
}

.risk-cell.is-mine span,
.risk-cell.is-hit span {
  position: relative;
  display: block;
  width: 54%;
  aspect-ratio: 1;
  border: 1px solid rgba(185, 28, 28, 0.42);
  border-radius: 7px;
  background:
    linear-gradient(180deg, #ef4444, #b91c1c);
  color: transparent;
  box-shadow:
    0 3px 9px rgba(185, 28, 28, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
  font-size: 0;
  transform: rotate(-6deg);
}

.risk-cell.is-mine span::before,
.risk-cell.is-hit span::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 23%;
  width: 3px;
  height: 54%;
  border-radius: 999px;
  background: #ffffff;
  transform: translateX(-50%) rotate(45deg);
}

.risk-cell.is-mine span::after,
.risk-cell.is-hit span::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 23%;
  width: 3px;
  height: 54%;
  border-radius: 999px;
  background: #ffffff;
  transform: translateX(-50%) rotate(-45deg);
}

.risk-cell.is-suggested {
  border-color: #2563eb;
  animation: reviewHintPulse 1.05s ease-in-out infinite;
}

.risk-cell.is-last {
  box-shadow:
    inset 0 0 0 2px rgba(37, 99, 235, 0.28),
    0 0 0 2px rgba(37, 99, 235, 0.08);
}

.risk-pie-center {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  align-content: center;
  width: 28%;
  aspect-ratio: 1;
  border: 1px solid rgba(219, 227, 238, 0.82);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.9) 68%, rgba(248, 250, 252, 0.78));
  color: #64748b;
  transform: translate(-50%, -50%);
  overflow: hidden;
  pointer-events: none;
  box-shadow:
    0 10px 26px rgba(15, 23, 42, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.risk-center-metric {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  min-width: 0;
}

.risk-center-metric small,
.risk-center-metric strong {
  line-height: 1;
}

.risk-center-metric small {
  font-size: 9px;
  font-weight: 900;
}

.risk-center-metric strong {
  color: #172033;
  font-size: clamp(16px, 1.7vw, 23px);
}

.risk-side {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: stretch;
  align-self: stretch;
  gap: 12px;
  min-height: 0;
  padding: 12px;
}

.risk-side-head,
.risk-trend-head,
.risk-trend-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.risk-side-head {
  min-height: 32px;
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
}

.risk-side-head strong,
.risk-trend-head strong {
  color: #172033;
  font-size: 13px;
}

.risk-mode-switch {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.risk-mode-switch button {
  min-height: 34px;
  border: 1px solid #dbe3ee;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.risk-mode-switch button.active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.risk-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.risk-legend-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px 48px;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #fff;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 8px;
  text-align: left;
  overflow: hidden;
}

.risk-legend-row:hover,
.risk-legend-row.is-active {
  border-color: color-mix(in srgb, var(--risk-color), white 42%);
  background: color-mix(in srgb, var(--risk-color), white 92%);
}

.risk-legend-row span,
.risk-table-row span:first-child {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #172033;
  font-weight: 900;
}

.risk-legend-row i,
.risk-table-row i {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--risk-color);
}

.risk-legend-row b,
.risk-legend-row em {
  color: #64748b;
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
  text-align: right;
}

.risk-legend-row strong {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  background: var(--risk-color);
}

.risk-trend-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  min-width: 0;
  min-height: clamp(340px, calc(100vh - 430px), 560px);
  border: 1px solid color-mix(in srgb, var(--risk-color), white 72%);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.92)),
    repeating-linear-gradient(0deg, transparent 0, transparent 35px, rgba(226, 232, 240, 0.26) 36px);
  padding: 12px;
}

.risk-trend-head {
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
}

.risk-trend-head span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.risk-trend-head b {
  color: #172033;
  font-size: 16px;
}

.risk-trend-head small {
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
}

.risk-heatmap {
  display: grid;
  grid-template-columns: repeat(var(--heat-columns), var(--heat-cell, 20px));
  grid-template-rows: repeat(var(--heat-rows), var(--heat-cell, 20px));
  grid-auto-rows: var(--heat-cell, 20px);
  gap: clamp(3px, 0.22vw, 5px);
  place-content: center;
  min-height: 0;
  height: 100%;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.78);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.86);
  padding: 10px;
}

.risk-heatmap-cell {
  width: var(--heat-cell, 20px);
  height: var(--heat-cell, 20px);
  aspect-ratio: 1;
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(203, 213, 225, 0.62);
  border-radius: 3px;
  background: #f6f8fb;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.risk-heatmap-cell.is-l1,
.risk-heatmap-scale .is-l1 {
  border-color: color-mix(in srgb, var(--risk-color), white 78%);
  background: color-mix(in srgb, var(--risk-color), white 90%);
}

.risk-heatmap-cell.is-l2,
.risk-heatmap-scale .is-l2 {
  border-color: color-mix(in srgb, var(--risk-color), white 66%);
  background: color-mix(in srgb, var(--risk-color), white 80%);
}

.risk-heatmap-cell.is-l3,
.risk-heatmap-scale .is-l3 {
  border-color: color-mix(in srgb, var(--risk-color), white 54%);
  background: color-mix(in srgb, var(--risk-color), white 68%);
}

.risk-heatmap-cell.is-l4,
.risk-heatmap-scale .is-l4 {
  border-color: color-mix(in srgb, var(--risk-color), white 42%);
  background: color-mix(in srgb, var(--risk-color), white 54%);
}

.risk-heatmap-scale {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 900;
}

.risk-heatmap-scale i {
  width: 11px;
  height: 11px;
  border: 1px solid rgba(203, 213, 225, 0.7);
  border-radius: 3px;
  background: #f1f5f9;
}

.risk-trend-meta {
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
}

.risk-table {
  display: grid;
  background: #e2e8f0;
  gap: 1px;
}

.risk-table-head,
.risk-table-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 70px 82px 70px 80px;
}

.risk-table-head span,
.risk-table-row span {
  display: flex;
  align-items: center;
  min-height: 34px;
  background: #fff;
  color: #334155;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
}

.risk-table-head span {
  background: #edf2f7;
  color: #475569;
  font-weight: 900;
}

.review-compare-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  background: #f8fbff;
  color: #334155;
  padding: 9px 10px;
}

.review-compare-note span,
.review-compare-note strong {
  min-width: 0;
  line-height: 1.2;
}

.review-compare-note span {
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
}

.review-compare-note strong {
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 900;
}

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

.review-paper {
  min-width: 0;
  border: 1px solid #dbe3ee;
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.84), rgba(255, 255, 255, 0.96)),
    repeating-linear-gradient(0deg, transparent 0, transparent 35px, rgba(226, 232, 240, 0.38) 36px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
  overflow: hidden;
}

.review-paper.is-target {
  border-color: #ccd7e6;
}

.review-paper-head,
.review-paper-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  border-bottom: 1px solid #e2e8f0;
  background: rgba(248, 250, 252, 0.94);
  color: #475569;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 900;
}

.review-paper-head strong,
.review-paper-foot b {
  color: #64748b;
  font-size: 10px;
}

.review-paper-foot {
  min-height: 30px;
  border-top: 1px solid #e2e8f0;
  border-bottom: 0;
  background: rgba(255, 255, 255, 0.86);
}

.review-doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: #e2e8f0;
  padding: 1px;
}

.review-doc-field {
  position: relative;
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
  min-height: clamp(52px, 6.8vh, 74px);
  border: 0;
  background: rgba(255, 255, 255, 0.96);
  color: #172033;
  cursor: pointer;
  padding: 8px 9px;
  text-align: left;
}

.review-doc-field:hover:not(:disabled),
.review-doc-field:focus-visible:not(:disabled) {
  outline: 2px solid rgba(37, 99, 235, 0.2);
  outline-offset: -2px;
  background: #f8fbff;
}

.review-doc-field:disabled {
  cursor: default;
}

.review-doc-field span,
.review-doc-field strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-doc-field span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #64748b;
  font-size: 10px;
  font-weight: 900;
}

.review-doc-field span b {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid #dbe3ee;
  border-radius: 50%;
  color: #64748b;
  font-size: 9px;
}

.review-doc-field strong {
  color: #172033;
  font-size: clamp(13px, 1.2vw, 16px);
  font-weight: 900;
}

.review-doc-field.found {
  background: #fff;
}

.review-doc-field.found span,
.review-doc-field.found strong {
  color: #991b1b;
}

.review-doc-field.found::after {
  content: "";
  position: absolute;
  inset: 8px 6px;
  border: 3px solid rgba(220, 38, 38, 0.88);
  border-radius: 52% 48% 54% 46% / 45% 58% 42% 55%;
  transform: rotate(-5deg);
  pointer-events: none;
  animation: diffCircleIn 0.26s ease both;
}

.review-doc-field.suggested {
  background: #eff6ff;
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.5);
  animation: reviewHintPulse 1s ease-in-out infinite;
}

.review-doc-field.suggested::before {
  content: "线索";
  position: absolute;
  top: 5px;
  right: 5px;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 999px;
  background: #fff;
  color: #1d4ed8;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 900;
}

.review-doc-field.wrong {
  background: #fef2f2;
  animation: shake 0.24s ease;
}

.review-case-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.review-case-top h3 {
  margin: 4px 0 0;
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1.08;
}

.review-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid #fecaca;
  border-radius: 999px;
  background: #fef2f2;
  color: #991b1b;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.review-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.review-field {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--ink);
  cursor: pointer;
  padding: 9px 10px;
  text-align: left;
}

.review-field:hover:not(:disabled),
.review-field:focus-visible:not(:disabled) {
  border-color: var(--teal);
  outline: none;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

.review-field:disabled {
  cursor: default;
}

.review-field.found {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.review-field.found strong,
.review-field.found span {
  color: #166534;
}

.review-field.suggested {
  border-color: #93c5fd;
  background: #eff6ff;
}

.review-field.wrong {
  border-color: #fecaca;
  background: #fef2f2;
}

.review-field span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.review-field strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-rule {
  display: grid;
  gap: 4px;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  background: #eff6ff;
  color: #1e3a8a;
  padding: 10px 11px;
}

.review-rule span {
  color: #64748b;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.review-rule strong {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.review-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.review-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid #dbe3ee;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 900;
}

.review-playbook {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.review-playbook div {
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--action-color), white 70%);
  border-radius: 6px;
  background: #fff;
  padding: 8px;
}

.review-playbook b,
.review-playbook span {
  display: block;
  line-height: 1.2;
}

.review-playbook b {
  color: var(--action-color);
  font-size: 12px;
  font-weight: 900;
}

.review-playbook span {
  margin-top: 4px;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.review-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.review-action {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
}

.review-action span,
.review-action strong {
  display: block;
  line-height: 1;
}

.review-action span {
  color: var(--action-color);
  font-size: 10px;
  letter-spacing: 0;
}

.review-action strong {
  font-size: 13px;
}

.review-action:hover:not(:disabled),
.review-action:focus-visible:not(:disabled) {
  border-color: var(--action-color, var(--teal));
  outline: none;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

.review-action.suggested {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.review-action:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.review-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #475569;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.risk-chart-card .review-result {
  margin: 0 12px 12px;
}

.risk-mode-panel {
  justify-self: center;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: min(calc(100% - 24px), 520px);
  min-height: 50px;
  margin: 0 0 12px;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  background: #eff6ff;
  padding: 6px;
}

.risk-mode-tab {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #1e3a8a;
  cursor: pointer;
  font: inherit;
  letter-spacing: 0;
  padding: 0 8px;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.risk-mode-tab span {
  color: currentColor;
  font-size: 13px;
  font-weight: 1000;
  line-height: 1;
}

.risk-mode-tab small {
  color: currentColor;
  opacity: 0.62;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.risk-mode-tab:hover {
  border-color: #bfdbfe;
  background: rgba(255, 255, 255, 0.46);
  color: #1d4ed8;
  transform: translateY(-1px);
}

.risk-mode-tab.is-active {
  border-color: #bfdbfe;
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.07);
}

.risk-mode-tab:last-child.is-active {
  border-color: #cbd5e1;
  background: #fff;
  color: #111827;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.07);
}

.risk-mode-tab.is-active small {
  color: currentColor;
  opacity: 0.66;
}

.review-result strong {
  min-width: 0;
  color: currentColor;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.25;
}

.risk-status-modes {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(48px, 1fr));
  gap: 2px;
  align-items: center;
  min-width: 106px;
  border: 1px solid rgba(203, 213, 225, 0.74);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.72);
  padding: 2px;
}

.risk-status-mode {
  min-height: 24px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  padding: 0 8px;
}

.risk-status-mode:hover {
  color: #1d4ed8;
}

.risk-status-mode.is-active {
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.risk-status-mode:last-child.is-active {
  color: #b64242;
}

.review-result.is-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.review-result.is-bad {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.review-result.is-info {
  border-color: #dbeafe;
  background: #eff6ff;
  color: #1e3a8a;
}

.review-empty {
  display: grid;
  place-items: center;
  min-height: 300px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: #64748b;
  font-weight: 800;
}

body.archive-view .board-panel {
  overflow: hidden;
}

body.archive-view .items-panel {
  display: none;
}

body.trend-view .items-panel {
  display: none;
}

body.trend-view .board-panel {
  overflow: hidden;
}

.archive-board {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
}

.archive-detail {
  display: grid;
  gap: 12px;
  min-width: 0;
  min-height: clamp(520px, calc(100vh - 270px), 760px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.97)),
    repeating-linear-gradient(0deg, transparent 0, transparent 31px, rgba(226, 232, 240, 0.24) 32px);
  overflow: hidden;
  padding: 14px;
}

.archive-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1e3a8a;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.archive-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #dbe3ee;
  overflow: hidden;
}

.archive-kpis span {
  display: grid;
  gap: 4px;
  min-width: 0;
  background: rgba(255, 255, 255, 0.94);
  padding: 10px;
}

.archive-kpis b {
  color: #64748b;
  font-size: 10px;
  font-weight: 900;
}

.archive-kpis strong {
  color: #172033;
  font-size: 18px;
  line-height: 1;
}

.archive-chart-card {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  min-width: 0;
  min-height: 0;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  overflow: hidden;
}

.archive-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
}

.archive-chart-stage {
  --cursor-x: 120px;
  --cursor-y: 50%;
  position: relative;
  min-width: 0;
  min-height: clamp(360px, calc(100vh - 430px), 560px);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.08), transparent 19%, transparent 100%),
    repeating-linear-gradient(90deg, transparent 0, transparent 74px, rgba(203, 213, 225, 0.45) 75px),
    repeating-linear-gradient(0deg, transparent 0, transparent 58px, rgba(203, 213, 225, 0.45) 59px),
    #ffffff;
  cursor: pointer;
}

.archive-chart-stage:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: -3px;
}

.archive-grid-lines {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(15, 23, 42, 0.05) 0 1px, transparent 1px),
    linear-gradient(0deg, rgba(15, 23, 42, 0.05) 0 1px, transparent 1px);
  background-size: 25% 100%, 100% 25%;
  pointer-events: none;
}

.archive-baseline {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(100, 116, 139, 0.42);
  box-shadow: 0 -80px 0 rgba(226, 232, 240, 0.5), 0 80px 0 rgba(226, 232, 240, 0.5);
  pointer-events: none;
}

.archive-gate-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.archive-gate {
  position: absolute;
  top: 0;
  left: var(--gate-x);
  width: var(--gate-width);
  height: 100%;
}

.archive-column {
  position: absolute;
  left: 0;
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--gate-color), white 52%);
  border-radius: 6px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--gate-color), white 72%), color-mix(in srgb, var(--gate-color), white 52%));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 5px 12px rgba(15, 23, 42, 0.08);
}

.archive-column.is-top {
  top: 0;
  height: var(--gate-gap-y);
}

.archive-column.is-bottom {
  bottom: 0;
  height: var(--gate-bottom-height);
}

.archive-column span {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: color-mix(in srgb, var(--gate-color), black 22%);
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.archive-column.is-top span {
  bottom: 8px;
}

.archive-column.is-bottom span {
  top: 8px;
}

.archive-lane {
  position: absolute;
  top: var(--gate-gap-y);
  left: -18px;
  display: grid;
  place-items: center;
  width: calc(var(--gate-width) + 36px);
  height: var(--gate-gap-height);
  border-block: 1px dashed rgba(100, 116, 139, 0.32);
}

.archive-lane span {
  border: 1px solid rgba(203, 213, 225, 0.88);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: #64748b;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 900;
  opacity: 0.72;
  white-space: nowrap;
}

.archive-gate.is-intro .archive-lane {
  background: rgba(219, 234, 254, 0.22);
}

.archive-gate.is-intro .archive-lane span {
  color: #1e3a8a;
  opacity: 0.86;
}

.archive-cursor {
  position: absolute;
  z-index: 4;
  left: var(--cursor-x);
  top: var(--cursor-y);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(219, 234, 254, 0.92));
  color: #1d4ed8;
  box-shadow:
    0 10px 24px rgba(37, 99, 235, 0.18),
    inset 0 0 0 2px rgba(255, 255, 255, 0.68);
  transform: translate(-50%, -50%) rotate(45deg);
  transition: box-shadow 0.16s ease, border-color 0.16s ease;
  pointer-events: none;
}

.archive-cursor span {
  position: absolute;
  inset: 6px;
  border-radius: 7px;
  background: rgba(37, 99, 235, 0.12);
}

.archive-cursor b {
  position: relative;
  z-index: 1;
  font-size: 9px;
  font-weight: 1000;
  letter-spacing: 0;
  transform: rotate(-45deg);
}

.archive-chart-stage.is-guarded .archive-cursor {
  border-color: rgba(46, 139, 87, 0.42);
  color: #166534;
  box-shadow:
    0 0 0 6px rgba(46, 139, 87, 0.12),
    0 10px 24px rgba(37, 99, 235, 0.16),
    inset 0 0 0 2px rgba(255, 255, 255, 0.72);
}

.archive-chart-stage.is-impact {
  animation: archiveSoftImpact 0.62s ease both;
  box-shadow: inset 0 0 0 1px rgba(184, 131, 32, 0.16);
}

.archive-chart-stage.is-impact .archive-cursor {
  border-color: rgba(184, 131, 32, 0.42);
  color: #92400e;
  animation: archiveCursorBump 0.58s cubic-bezier(0.2, 0.9, 0.25, 1) both;
  box-shadow:
    0 0 0 6px rgba(184, 131, 32, 0.09),
    0 10px 24px rgba(37, 99, 235, 0.14),
    inset 0 0 0 2px rgba(255, 255, 255, 0.72);
}

.archive-chart-stage.is-recovering .archive-cursor {
  filter: saturate(0.92);
}

.archive-chart-stage.is-transitioning .archive-gate-layer,
.archive-chart-stage.is-transitioning .archive-cursor {
  opacity: 0.45;
  filter: saturate(0.82);
}

.archive-chart-stage.is-ready {
  animation: archiveReadyWash 0.9s ease both;
}

.archive-gate.is-hit {
  opacity: 0.36;
  filter: saturate(0.78);
  transition: opacity 0.22s ease, filter 0.22s ease;
}

.archive-gate.is-hit .archive-column {
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.94), color-mix(in srgb, var(--gate-color), white 78%));
}

.archive-chart-stage.is-smooth .archive-lane {
  background: rgba(219, 234, 254, 0.26);
}

.archive-start-hint {
  position: absolute;
  left: var(--cursor-x);
  top: calc(var(--cursor-y) + 42px);
  z-index: 5;
  transform: translateX(-50%);
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #1e3a8a;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  pointer-events: none;
}

.archive-chart-stage.is-running .archive-start-hint {
  display: none;
}

.archive-impact {
  position: absolute;
  left: var(--cursor-x);
  top: calc(var(--cursor-y) - 52px);
  z-index: 6;
  transform: translate(-50%, 8px);
  border: 1px solid rgba(251, 191, 36, 0.34);
  border-radius: 999px;
  background: rgba(255, 251, 235, 0.94);
  color: #92400e;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.26s ease, transform 0.32s cubic-bezier(0.2, 0.9, 0.25, 1);
  white-space: nowrap;
}

.archive-chart-stage.is-impact .archive-impact {
  opacity: 1;
  transform: translate(-50%, 0);
}

.archive-round-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 7;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  width: min(330px, calc(100% - 32px));
  min-height: 90px;
  border: 1px solid rgba(191, 219, 254, 0.8);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  color: #172033;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translate(-50%, -44%) scale(0.98);
  transition: opacity 0.42s ease, transform 0.52s cubic-bezier(0.2, 0.82, 0.25, 1);
  pointer-events: none;
}

.archive-round-overlay strong {
  font-size: 22px;
  font-weight: 1000;
}

.archive-round-overlay span {
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

.archive-chart-stage.is-transitioning .archive-round-overlay {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.archive-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  border-top: 1px solid #dbeafe;
  background: #eff6ff;
  padding: 6px;
}

.archive-actions button {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #fff;
  color: #1e3a8a;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.archive-actions button:hover,
.archive-actions button:focus-visible {
  border-color: #bfdbfe;
  outline: none;
}

.archive-actions button span {
  color: currentColor;
  opacity: 0.62;
  font-size: 10px;
  line-height: 1;
}

.trend-board {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
}

.trend-detail {
  display: grid;
  gap: 12px;
  min-width: 0;
  min-height: clamp(520px, calc(100vh - 270px), 760px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.97)),
    repeating-linear-gradient(0deg, transparent 0, transparent 31px, rgba(226, 232, 240, 0.24) 32px);
  overflow: hidden;
  padding: 14px;
}

.trend-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid color-mix(in srgb, var(--trend-color, #3867d6), white 72%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--trend-color, #3867d6), white 92%);
  color: color-mix(in srgb, var(--trend-color, #3867d6), black 16%);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.trend-chart-card {
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr);
  min-width: 0;
  min-height: 0;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  overflow: hidden;
}

.trend-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
}

.trend-chart-head strong {
  color: color-mix(in srgb, var(--trend-color, #3867d6), black 12%);
}

.trend-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.trend-head-actions button {
  min-height: 26px;
  border: 1px solid color-mix(in srgb, var(--trend-color, #3867d6), white 70%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--trend-color, #3867d6), white 94%);
  color: color-mix(in srgb, var(--trend-color, #3867d6), black 14%);
  padding: 0 10px;
  font: inherit;
  font-size: 11px;
  font-weight: 1000;
  cursor: pointer;
}

.trend-head-actions button:hover,
.trend-head-actions button:focus-visible {
  border-color: color-mix(in srgb, var(--trend-color, #3867d6), white 40%);
  outline: none;
}

.trend-chart-stage {
  --trend-color: #3867d6;
  --trend-effect-color: var(--trend-color);
  position: relative;
  min-width: 0;
  min-height: clamp(420px, calc(100vh - 390px), 640px);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.06), transparent 18%, transparent 100%),
    #ffffff;
  cursor: pointer;
  transition: background-color 0.24s ease, box-shadow 0.24s ease;
}

.trend-chart-stage.is-inverted {
  background:
    radial-gradient(circle at 50% 46%, rgba(79, 70, 229, 0.16), transparent 32%),
    linear-gradient(90deg, rgba(79, 70, 229, 0.11), transparent 22%, rgba(79, 70, 229, 0.08)),
    #ffffff;
  box-shadow: inset 0 0 0 2px rgba(79, 70, 229, 0.16);
}

.trend-chart-stage.is-rushing {
  background:
    linear-gradient(90deg, rgba(184, 131, 32, 0.16), rgba(184, 131, 32, 0.04) 32%, transparent 72%),
    #ffffff;
}

.trend-chart-stage.is-slowing {
  background:
    radial-gradient(circle at 50% 46%, rgba(46, 139, 87, 0.12), transparent 34%),
    linear-gradient(90deg, rgba(46, 139, 87, 0.08), transparent 28%, transparent 100%),
    #ffffff;
}

.trend-chart-stage.is-effect-tinted {
  background:
    radial-gradient(circle at 50% 48%, color-mix(in srgb, var(--trend-effect-color), transparent 84%), transparent 36%),
    linear-gradient(90deg, color-mix(in srgb, var(--trend-effect-color), transparent 88%), transparent 28%, color-mix(in srgb, var(--trend-effect-color), transparent 92%)),
    #ffffff;
}

.trend-chart-stage.is-repel-rescue {
  box-shadow:
    inset 0 0 0 2px rgba(20, 124, 134, 0.12),
    inset 0 0 30px rgba(20, 124, 134, 0.08);
}

.trend-chart-stage.is-repel-kick {
  box-shadow:
    inset 0 0 0 2px rgba(182, 66, 66, 0.18),
    inset 0 0 38px rgba(182, 66, 66, 0.1);
}

.trend-special-legend {
  position: absolute;
  right: 12px;
  top: 10px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  max-width: min(420px, calc(100% - 24px));
  pointer-events: none;
}

.trend-special-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 20px;
  border: 1px solid color-mix(in srgb, var(--legend-color), white 66%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: color-mix(in srgb, var(--legend-color), black 18%);
  padding: 0 7px;
  font-size: 10px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.trend-special-legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--legend-color);
}

.trend-special-legend small {
  color: color-mix(in srgb, var(--legend-color), #64748b 52%);
  font-size: 9px;
  font-weight: 900;
}

.trend-special-legend .trend-control-chip {
  border-color: #cbd5e1;
  background: rgba(248, 250, 252, 0.9);
  color: #475569;
}

.trend-special-legend .trend-control-chip i {
  border-radius: 2px;
  background: #64748b;
}

.trend-chart-stage:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: -3px;
}

.trend-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.trend-grid line {
  stroke: rgba(148, 163, 184, 0.32);
  stroke-width: 1;
}

.trend-axis-line {
  stroke: rgba(100, 116, 139, 0.42);
  stroke-width: 1.4;
}

.trend-axis-label,
.trend-axis-title {
  fill: rgba(71, 85, 105, 0.74);
  font-weight: 900;
  letter-spacing: 0;
  pointer-events: none;
}

.trend-axis-label {
  font-size: 10px;
}

.trend-axis-title {
  font-size: 11px;
  fill: color-mix(in srgb, var(--trend-color), #475569 58%);
}

.trend-axis-label-x {
  text-anchor: middle;
}

.trend-axis-label-y {
  text-anchor: start;
}

.trend-axis-title-x {
  text-anchor: end;
}

.trend-axis-title-y {
  text-anchor: start;
}

.trend-grid-bg {
  fill: rgba(248, 250, 252, 0.82);
  stroke: rgba(203, 213, 225, 0.86);
  stroke-width: 1.5;
}

.trend-window {
  fill: color-mix(in srgb, var(--trend-color), white 90%);
  stroke: color-mix(in srgb, var(--trend-color), white 62%);
  stroke-width: 2;
}

.trend-window-line {
  stroke: color-mix(in srgb, var(--trend-color), black 12%);
  stroke-width: 2;
  stroke-dasharray: 6 7;
  opacity: 0.45;
}

.trend-window-label {
  fill: color-mix(in srgb, var(--trend-color), black 16%);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

.trend-area {
  fill: url(#trendAreaFill);
}

.trend-line {
  fill: none;
  stroke: color-mix(in srgb, var(--trend-color), black 6%);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-target-line {
  fill: none;
  stroke: rgba(100, 116, 139, 0.34);
  stroke-width: 1.6;
  stroke-dasharray: 7 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-snake-line {
  stroke-width: 4;
  filter: drop-shadow(0 6px 14px rgba(15, 23, 42, 0.12));
}

.trend-snake-head {
  fill: #ffffff;
  stroke: color-mix(in srgb, var(--trend-color), black 6%);
  stroke-width: 3.2;
  filter: drop-shadow(0 5px 10px rgba(15, 23, 42, 0.14));
}

.trend-guide {
  pointer-events: none;
}

.trend-guide line {
  stroke: #147c86;
  stroke-width: 2.2;
  stroke-dasharray: 7 9;
  stroke-linecap: round;
  opacity: 0.42;
  animation: trendGuideFlow 0.9s linear infinite;
}

.trend-guide.is-repel line {
  stroke: #b64242;
  stroke-dasharray: 3 9;
}

.trend-guide-ring {
  fill: none;
  stroke: #147c86;
  stroke-width: 3;
  opacity: 0.72;
  transform-box: fill-box;
  transform-origin: center;
  animation: trendGuideRing 1.05s ease-in-out infinite;
}

.trend-guide.is-repel .trend-guide-ring {
  stroke: #b64242;
}

.trend-guide-label {
  fill: #0f766e;
  font-size: 10px;
  font-weight: 1000;
  paint-order: stroke;
  pointer-events: none;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 4;
  text-anchor: middle;
}

.trend-guide.is-repel .trend-guide-label {
  fill: #991b1b;
}

.trend-point {
  fill: #fff;
  stroke: color-mix(in srgb, var(--trend-color), white 22%);
  stroke-width: 2.1;
  cursor: pointer;
  pointer-events: auto;
  transform-box: fill-box;
  transform-origin: center;
  transition:
    fill 0.16s ease,
    stroke 0.16s ease,
    r 0.16s ease;
}

.trend-point.is-window {
  fill: color-mix(in srgb, var(--trend-color), white 78%);
  stroke-width: 3;
}

.trend-point.is-hinted {
  fill: #fff7ed;
  stroke: #111827;
  stroke-dasharray: 4 3;
  animation: trendHintPulse 0.9s ease-in-out infinite;
}

.trend-special-halo {
  fill: none;
  stroke: var(--point-color);
  stroke-width: 1.8;
  pointer-events: none;
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--point-color), transparent 74%));
}

.trend-point.is-peak,
.trend-point.is-surge {
  fill: #fef3c7;
  stroke: #b88320;
  stroke-width: 2.8;
}

.trend-point.is-drop {
  fill: #dcfce7;
  stroke: #2e8b57;
  stroke-width: 2.8;
}

.trend-point.is-invert {
  fill: #e0e7ff;
  stroke: #4f46e5;
  stroke-width: 2.9;
}

.trend-point.is-magnet {
  fill: #cffafe;
  stroke: #147c86;
  stroke-width: 2.9;
}

.trend-point.is-repel {
  fill: #fee2e2;
  stroke: #b64242;
  stroke-width: 2.9;
}

.trend-point.is-slow {
  fill: #dcfce7;
  stroke: #2e8b57;
  stroke-width: 2.8;
}

.trend-point.is-magnet-target,
.trend-point.is-repel-target {
  stroke-width: 3.6;
  animation: trendTargetGlow 0.9s ease-in-out infinite;
}

.trend-point.is-magnet-target {
  filter: drop-shadow(0 0 8px rgba(20, 124, 134, 0.46));
}

.trend-point.is-repel-target {
  filter: drop-shadow(0 0 8px rgba(182, 66, 66, 0.44));
}

.trend-point.is-eaten {
  fill: #111827;
  stroke: #111827;
}

.trend-point.is-just-hit {
  animation: trendPointHit 0.48s cubic-bezier(0.18, 0.82, 0.22, 1) both;
}

.trend-point.is-missed {
  fill: #f8fafc;
  stroke: #b64242;
  stroke-dasharray: 3 3;
}

.trend-value-label {
  fill: #172033;
  font-size: 12px;
  font-weight: 1000;
  text-anchor: middle;
}

.trend-special-label {
  fill: var(--point-color);
  font-size: 10px;
  font-weight: 1000;
  paint-order: stroke;
  pointer-events: none;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 4;
  text-anchor: middle;
}

.trend-popup rect {
  fill: rgba(255, 255, 255, 0.94);
  stroke: rgba(191, 219, 254, 0.88);
  stroke-width: 1;
}

.trend-popup text {
  fill: #1e3a8a;
  font-size: 11px;
  font-weight: 1000;
  text-anchor: middle;
}

.trend-point.is-hit {
  fill: #111827;
  stroke: #111827;
}

.trend-point.is-miss {
  fill: #f8fafc;
  stroke: #b64242;
  stroke-width: 4;
}

.trend-point.is-false {
  fill: #fff7ed;
  stroke: #b88320;
  stroke-width: 4;
}

.trend-start-hint {
  position: absolute;
  left: 50%;
  top: 56%;
  z-index: 5;
  display: grid;
  gap: 3px;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 1px solid #dbeafe;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  color: #1e3a8a;
  box-shadow: 0 12px 32px rgba(30, 58, 138, 0.1);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 900;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
}

.trend-start-hint strong {
  font-size: 12px;
  line-height: 1.1;
}

.trend-start-hint span {
  color: #1e3a8a;
  font-size: 11px;
  line-height: 1.1;
}

.trend-chart-stage:not(.is-teaching) .trend-start-hint {
  display: none;
}

.trend-chart-stage.is-running .trend-start-hint {
  display: none;
}

.trend-impact {
  position: absolute;
  left: 50%;
  top: 42%;
  z-index: 6;
  transform: translate(-50%, 8px);
  border: 1px solid rgba(251, 191, 36, 0.34);
  border-radius: 999px;
  background: rgba(255, 251, 235, 0.94);
  color: #92400e;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.26s ease, transform 0.32s cubic-bezier(0.2, 0.9, 0.25, 1);
  white-space: nowrap;
}

.trend-chart-stage.is-impact .trend-impact {
  opacity: 1;
  transform: translate(-50%, 0);
}

.trend-invert-burst {
  position: absolute;
  left: 50%;
  top: 48%;
  z-index: 8;
  border: 1px solid rgba(79, 70, 229, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #4f46e5;
  opacity: 0;
  padding: 10px 20px;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.82);
  font-size: 24px;
  font-weight: 1000;
  letter-spacing: 0;
  box-shadow: 0 18px 42px rgba(79, 70, 229, 0.18);
}

.trend-chart-stage.is-invert-pop .trend-invert-burst {
  animation: trendInvertBurst 1.05s cubic-bezier(0.18, 0.82, 0.22, 1) both;
}

.trend-round-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 7;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  width: min(330px, calc(100% - 32px));
  min-height: 90px;
  border: 1px solid rgba(191, 219, 254, 0.8);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  color: #172033;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translate(-50%, -44%) scale(0.98);
  transition: opacity 0.42s ease, transform 0.52s cubic-bezier(0.2, 0.82, 0.25, 1);
  pointer-events: none;
}

.trend-round-overlay strong {
  font-size: 22px;
  font-weight: 1000;
}

.trend-round-overlay span {
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

.trend-chart-stage.is-transitioning .trend-round-overlay {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.trend-chart-stage.is-ready {
  animation: archiveReadyWash 0.9s ease both;
}

.trend-chart-stage.is-impact {
  animation: archiveSoftImpact 0.62s ease both;
}

.tile-code,
.tile-label,
.tile-sub {
  position: relative;
  z-index: 1;
}

.tile-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: clamp(15px, 31cqh, 24px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  padding:
    clamp(2px, 5.5cqh, 5px)
    clamp(3px, 6cqw, 7px)
    clamp(1px, 3.2cqh, 3px);
  color: var(--tile-accent);
  font-size: clamp(7px, min(5.6cqw, 13cqh), 11px);
  font-weight: 800;
  line-height: 1;
  background: rgba(255, 255, 255, 0.34);
}

.tile-code i {
  display: inline-block;
  width: clamp(5px, min(5cqw, 12cqh), 9px);
  height: clamp(5px, min(5cqw, 12cqh), 9px);
  border-radius: 50%;
  background: var(--tile-accent);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.7);
}

.tile-label {
  display: grid;
  place-items: center;
  padding:
    clamp(2px, 6cqh, 5px)
    clamp(3px, 6cqw, 7px);
  text-align: center;
  font-size: clamp(8px, min(10cqw, 18cqh), 16px);
  font-weight: 800;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.tile-sub {
  min-height: clamp(12px, 25cqh, 22px);
  padding:
    0
    clamp(3px, 6cqw, 8px)
    clamp(2px, 7cqh, 7px);
  color: var(--tile-accent);
  font-size: clamp(6px, min(4.8cqw, 10cqh), 10px);
  font-weight: 700;
  line-height: 1.1;
  text-transform: uppercase;
}

.status-line {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 42px;
  margin: 12px 0 max(18px, env(safe-area-inset-bottom));
  border: 1px solid #dbeafe;
  border-radius: 6px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
  text-align: left;
  padding: 0 14px;
}

.stage-clear-toast {
  position: fixed;
  left: 50%;
  top: 92px;
  z-index: 44;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: min(420px, calc(100vw - 32px));
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  background: rgba(240, 253, 244, 0.96);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
  color: #14532d;
  padding: 12px 14px;
  pointer-events: none;
  transform: translateX(-50%);
  animation: stageClearIn 0.42s cubic-bezier(0.2, 0.82, 0.25, 1) both;
}

.stage-clear-toast.leaving {
  animation: stageClearOut 0.3s ease both;
}

.stage-clear-toast.is-center {
  top: 50%;
  z-index: 80;
  min-width: min(460px, calc(100vw - 32px));
  animation: stageClearCenterIn 0.42s cubic-bezier(0.2, 0.82, 0.25, 1) both;
}

.stage-clear-toast.is-center.leaving {
  animation: stageClearCenterOut 0.3s ease both;
}

.stage-clear-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: #16a34a;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.12);
}

.stage-clear-copy {
  min-width: 0;
}

.stage-clear-copy span,
.stage-clear-copy strong {
  display: block;
}

.stage-clear-copy span {
  color: #15803d;
  font-size: 12px;
  font-weight: 900;
}

.stage-clear-copy strong {
  margin-top: 2px;
  color: #052e16;
  font-size: 18px;
  line-height: 1.12;
}

.stage-clear-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.stage-clear-stats b {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  background: #fff;
  color: #166534;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 900;
}

.board.stage-pulse {
  animation: boardStagePulse 1.1s ease both;
}

.side-panel {
  display: grid;
  gap: 14px;
  align-content: start;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.target-panel,
.phase-panel,
.items-panel,
.queue-panel,
.leaderboard-panel,
.log-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 14px;
}

.target-panel strong {
  display: block;
  margin-top: 6px;
  font-size: 30px;
  line-height: 1;
}

.phase-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.phase-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.phase-chips span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #334155;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.phase-chips .phase-chip::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.75;
}

.phase-chips .phase-chip.is-complete {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.phase-chips .phase-chip.is-complete::before {
  content: "OK";
  display: grid;
  place-items: center;
  width: 18px;
  height: 16px;
  border-radius: 999px;
  background: #16a34a;
  color: #fff;
  font-size: 8px;
  font-weight: 900;
  opacity: 1;
}

.phase-chips .phase-chip.is-pending {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.phase-chips .phase-chip.is-pending::before {
  background: #f97316;
  opacity: 1;
}

.phase-chips .phase-chip.is-info {
  border-color: #dbe3ee;
  background: #f8fafc;
  color: #64748b;
}

.progress-track {
  height: 10px;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--teal), var(--blue));
  transition: width 0.2s ease;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.info-dot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  appearance: none;
  background: #fff;
  color: #64748b;
  cursor: help;
  font-family: Arial, sans-serif;
  font-size: 12px;
  font-weight: 800;
  line-height: 20px;
  padding: 0;
  text-align: center;
}

.info-dot::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  z-index: 20;
  width: max-content;
  max-width: 150px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #172033;
  color: #fff;
  opacity: 0;
  padding: 7px 9px;
  pointer-events: none;
  transform: translateY(-50%) translateX(-4px);
  transition:
    opacity 0.14s ease,
    transform 0.14s ease;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.info-dot:hover::after,
.info-dot:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.panel-title strong {
  color: var(--ink);
  font-size: 18px;
}

.item-dock {
  display: grid;
  gap: 8px;
}

.item-button {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 9px;
  align-items: center;
  min-height: 52px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  padding: 8px;
  text-align: left;
}

.item-button:hover:not(:disabled),
.item-button:focus-visible:not(:disabled) {
  border-color: var(--teal);
  outline: none;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

.item-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.item-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: var(--item-bg);
  color: var(--item-color);
}

.item-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.item-copy {
  min-width: 0;
}

.item-copy strong,
.item-copy span {
  display: block;
}

.item-copy strong {
  font-size: 13px;
  line-height: 1.15;
}

.item-copy span {
  display: none;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.control-help .item-copy span {
  display: block;
}

.item-count {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-strong);
  font-size: 13px;
  font-weight: 800;
}

.queue-list,
.leaderboard-list,
.activity-log {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.queue-list {
  list-style: none;
}

.leaderboard-list {
  list-style: none;
}

.queue-list li {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px;
  font-size: 13px;
}

.queue-list b {
  font-size: 12px;
}

.queue-list li > span:not(.queue-dot) {
  min-width: 0;
}

.queue-list strong,
.queue-list em {
  display: block;
  line-height: 1.15;
}

.queue-list strong {
  font-size: 13px;
}

.queue-list em {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--queue-color);
}

.leaderboard-list li {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px;
  font-size: 13px;
}

.leaderboard-rank {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #eef2ff;
  color: var(--blue);
  font-weight: 800;
}

.leaderboard-meta {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.leaderboard-list .empty {
  grid-template-columns: 1fr;
  color: var(--muted);
}

.activity-log {
  list-style-position: inside;
  color: var(--muted);
  font-size: 13px;
}

.activity-log li {
  min-height: 24px;
  border-bottom: 1px solid var(--line);
  padding: 0 0 7px;
}

.activity-log li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.result-dialog {
  width: min(360px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.result-dialog::backdrop {
  background: rgba(17, 24, 39, 0.42);
}

.result-shell {
  padding: 22px;
  text-align: center;
}

.result-score {
  display: grid;
  gap: 6px;
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 16px;
}

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

.result-score strong {
  font-size: 38px;
  line-height: 1;
}

.dialog-copy {
  margin: 12px 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: block;
  background: rgba(255, 255, 255, 0.86);
  padding: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
  backdrop-filter: blur(2.5px);
  cursor: pointer;
}

.onboarding-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.onboarding-overlay.is-guide {
  background: transparent;
  backdrop-filter: none;
}

.onboarding-welcome {
  position: absolute;
  left: 50%;
  top: 50%;
  text-align: center;
  transform: translate(-50%, -50%) scale(0.98);
  transition: opacity 0.2s ease, transform 0.28s cubic-bezier(0.2, 0.82, 0.25, 1);
  width: min(760px, calc(100vw - 34px));
  font-family: "HanziPen SC", "Hannotate SC", "Marker Felt", "Comic Sans MS", "Chalkboard SE", "PingFang SC", cursive;
}

.onboarding-prefix {
  margin: 0 0 14px;
  color: #334155;
  font-size: clamp(22px, 4vw, 38px);
  font-weight: 900;
  letter-spacing: 0;
}

.onboarding-wordmark {
  display: grid;
  gap: 2px;
  width: min(560px, calc(100vw - 54px));
  margin: 0 auto;
}

.onboarding-kicker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  margin: 0;
  color: #0f766e;
  font-size: clamp(19px, 4.4vw, 36px);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}

.onboarding-kicker span,
.onboarding-title span {
  display: block;
  min-width: 0;
}

.onboarding-title {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  color: #172033;
  font-size: clamp(58px, 12vw, 112px);
  font-weight: 1000;
  letter-spacing: 0;
  line-height: 0.98;
}

.onboarding-subtitle {
  margin: 18px 0 0;
  color: #64748b;
  font-size: clamp(17px, 3vw, 25px);
  font-weight: 900;
  letter-spacing: 0;
}

.onboarding-enter-hint {
  display: inline-block;
  margin-top: 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #475569;
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 900;
}

.onboarding-overlay.is-visible .onboarding-welcome {
  transform: translate(-50%, -50%) scale(1);
}

.onboarding-overlay.is-guide .onboarding-welcome {
  opacity: 0;
  pointer-events: none;
}

.onboarding-overlay:not(.is-visible) .onboarding-welcome {
  opacity: 0;
  pointer-events: none;
}

.onboarding-spotlight {
  position: fixed;
  left: var(--guide-x, 0);
  top: var(--guide-y, 0);
  width: var(--guide-w, 0);
  height: var(--guide-h, 0);
  border: 2px solid rgba(15, 118, 110, 0.72);
  border-radius: 12px;
  box-shadow:
    0 0 0 4px rgba(240, 253, 250, 0.82),
    0 16px 42px rgba(15, 23, 42, 0.12);
  background: rgba(240, 253, 250, 0.08);
  opacity: 0;
  pointer-events: none;
  transition:
    left 0.28s ease,
    top 0.28s ease,
    width 0.28s ease,
    height 0.28s ease,
    opacity 0.18s ease;
}

.onboarding-overlay.is-guide .onboarding-spotlight {
  opacity: 1;
  animation: onboardingSpotlightPulse 1.7s ease-in-out infinite;
}

.onboarding-callout {
  position: fixed;
  left: var(--guide-callout-x, 24px);
  top: var(--guide-callout-y, 24px);
  z-index: 2;
  display: grid;
  gap: 6px;
  width: min(280px, calc(100vw - 48px));
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.16);
  opacity: 0;
  padding: 14px 16px;
  pointer-events: none;
  transform: translateY(6px);
  transition:
    left 0.28s ease,
    top 0.28s ease,
    opacity 0.18s ease,
    transform 0.22s ease;
}

.onboarding-overlay.is-guide .onboarding-callout {
  opacity: 1;
  transform: translateY(0);
}

.onboarding-callout::before {
  content: "";
  position: absolute;
  top: 28px;
  width: 42px;
  height: 2px;
  background: #0f766e;
}

.onboarding-callout::after {
  content: "";
  position: absolute;
  top: 23px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.onboarding-callout.is-right::before {
  left: -42px;
}

.onboarding-callout.is-right::after {
  left: -48px;
  border-right: 8px solid #0f766e;
}

.onboarding-callout.is-left::before {
  right: -42px;
}

.onboarding-callout.is-left::after {
  right: -48px;
  border-left: 8px solid #0f766e;
}

.onboarding-callout b {
  color: #172033;
  font-size: 17px;
  font-weight: 1000;
}

.onboarding-callout span {
  color: #475569;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

.onboarding-callout em {
  color: #0f766e;
  font-size: 12px;
  font-style: normal;
  font-weight: 1000;
}

@keyframes onboardingSpotlightPulse {
  0%,
  100% {
    box-shadow:
      0 0 0 4px rgba(240, 253, 250, 0.82),
      0 16px 42px rgba(15, 23, 42, 0.12);
  }

  50% {
    box-shadow:
      0 0 0 9px rgba(45, 212, 191, 0.18),
      0 18px 46px rgba(15, 23, 42, 0.14);
  }
}

.primary-button {
  width: 100%;
  min-height: 44px;
  border: 1px solid #0f766e;
  border-radius: 6px;
  background: #0f766e;
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.primary-button:hover,
.primary-button:focus-visible {
  outline: none;
  background: #115e59;
}

.secondary-button {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  outline: none;
  border-color: var(--teal);
}

body.work-mode .brand h1 {
  font-size: clamp(21px, 3vw, 28px);
}

body.work-mode .brand h1::before {
  content: "项目管理";
}

body.work-mode .brand h1 {
  color: transparent;
  position: relative;
}

body.work-mode .brand h1::before {
  color: var(--ink);
  left: 0;
  position: absolute;
}

body.work-mode .tile {
  filter: saturate(0.88);
}

body.work-mode .tile-label {
  font-size: clamp(8px, min(9.2cqw, 17cqh), 14px);
}

body.work-mode {
  --line: #e8edf4;
  --line-strong: #dfe7f1;
  background: #f7f9fc;
}

body.work-mode .topbar,
body.work-mode .board-panel,
body.work-mode .side-panel {
  border-color: #e5ebf3;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
}

body.work-mode .sheet-chrome {
  display: block;
  border-color: #e8edf4;
  background: #ffffff;
}

body.work-mode .sheet-menu {
  border-bottom-color: #edf2f7;
  background: #fafbfc;
  color: #64748b;
}

body.work-mode .formula-line {
  color: #475569;
}

body.work-mode .formula-line span {
  border-right-color: #edf2f7;
  color: #2e8b57;
  opacity: 0.8;
}

body.work-mode .sheet-columns {
  border-top-color: #edf2f7;
  background: #f7f9fc;
}

body.work-mode .sheet-columns span {
  border-right-color: #edf2f7;
  color: #7b8794;
}

body.work-mode .board {
  --cell-gap: 3px;
  width: 100%;
  min-width: 720px;
  max-width: none;
  min-height: 0;
  align-self: stretch;
  border: 1px solid #e4ebf5;
  background: #e8eef7;
  padding: 3px;
}

body.work-mode .tile {
  min-height: clamp(56px, calc((100vh - 330px) / 8), 82px);
  aspect-ratio: auto;
  border-width: 1px;
  border-color: #e5ebf3;
  border-radius: 4px;
  background: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(15, 23, 42, 0.035);
}

body.work-mode .tile::before {
  display: block;
  inset: 0 0 auto 0;
  width: auto;
  height: 3px;
  background: var(--tile-accent);
  opacity: 0.42;
}

body.work-mode .tile::after {
  display: none;
}

body.work-mode .tile.locked {
  border-color: #c7ddff;
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.72), rgba(255, 255, 255, 0.98));
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}

body.work-mode .tile.locked::before {
  display: block;
  height: 3px;
  background: #60a5fa;
  opacity: 0.55;
}

body.work-mode .tile.locked::after {
  display: grid;
  width: 28px;
  height: 18px;
  border-color: rgba(37, 99, 235, 0.2);
  background: #eaf2ff;
  color: #2563eb;
}

body.work-mode .tile.locked .tile-code {
  background: rgba(239, 246, 255, 0.62);
  color: #2563eb;
}

body.work-mode .tile.blocker {
  border-color: #d8dee8;
  background: #f8fafc;
  box-shadow: inset 0 0 0 1px rgba(100, 116, 139, 0.08);
}

body.work-mode .tile-code {
  min-height: clamp(15px, 30cqh, 26px);
  border-bottom-color: #f1f5f9;
  background: transparent;
  color: #64748b;
  padding-top: clamp(2px, 5.5cqh, 6px);
}

body.work-mode .tile-code span {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  border: 1px solid var(--tile-line);
  border-radius: 999px;
  background: var(--tile-bg);
  color: var(--tile-accent);
  padding: 0 clamp(3px, 5.6cqw, 7px);
  font-size: clamp(6px, min(5cqw, 11cqh), 10px);
  font-weight: 900;
}

body.work-mode .tile-code i {
  width: clamp(5px, min(4.6cqw, 11cqh), 8px);
  height: clamp(5px, min(4.6cqw, 11cqh), 8px);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.86);
  opacity: 0.82;
}

body.work-mode .tile-label {
  justify-items: start;
  padding:
    clamp(2px, 5.5cqh, 5px)
    clamp(3px, 6cqw, 8px)
    clamp(1px, 3.8cqh, 3px);
  text-align: left;
  color: #1f2937;
  font-weight: 800;
}

body.work-mode .tile-sub {
  color: #94a3b8;
  font-size: clamp(5px, min(4.5cqw, 9cqh), 9px);
}

body.hell-mode .brand h1 {
  position: relative;
  color: transparent;
  font-size: clamp(21px, 3vw, 28px);
}

body.hell-mode .brand h1::before {
  content: "项目管理";
  position: absolute;
  left: 0;
  color: var(--ink);
}

body.hell-mode {
  background:
    linear-gradient(0deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.76)),
    repeating-linear-gradient(90deg, transparent 0, transparent 74px, rgba(239, 68, 68, 0.18) 75px),
    repeating-linear-gradient(0deg, transparent 0, transparent 28px, rgba(239, 68, 68, 0.14) 29px),
    #fff5f5;
}

body.hell-mode .topbar,
body.hell-mode .board-panel,
body.hell-mode .side-panel {
  border-color: #fecaca;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 20px rgba(185, 28, 28, 0.08);
}

body.hell-mode .sheet-chrome {
  display: block;
}

body.hell-mode .board {
  --cell-gap: 3px;
  width: 100%;
  min-width: 720px;
  max-width: none;
  min-height: 0;
  align-self: stretch;
  border: 0;
  background: transparent;
  padding: 0;
}

body.hell-mode .tile {
  min-height: clamp(54px, calc((100vh - 335px) / 8), 76px);
  aspect-ratio: auto;
  border-width: 0;
  border-color: transparent;
  border-radius: 3px;
  background: #fff;
  box-shadow: none;
  filter: saturate(0.72);
}

body.hell-mode .tile::before,
body.hell-mode .tile::after {
  display: none;
}

body.hell-mode .tile.locked {
  border-color: #2563eb;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(37, 99, 235, 0.18) 0,
      rgba(37, 99, 235, 0.18) 5px,
      rgba(219, 234, 254, 0.88) 5px,
      rgba(219, 234, 254, 0.88) 10px
    ),
    linear-gradient(90deg, rgba(219, 234, 254, 0.98), rgba(255, 255, 255, 0.98));
  box-shadow:
    inset 0 0 0 2px rgba(37, 99, 235, 0.34),
    inset 3px 0 0 rgba(37, 99, 235, 0.52);
}

body.hell-mode .tile.locked::before {
  display: block;
  width: 4px;
  background: #60a5fa;
  opacity: 0.5;
}

body.hell-mode .tile.locked::after {
  display: grid;
}

body.hell-mode .tile.blocker {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(100, 116, 139, 0.16) 0,
      rgba(100, 116, 139, 0.16) 5px,
      rgba(248, 250, 252, 0.72) 5px,
      rgba(248, 250, 252, 0.72) 10px
    );
}

body.hell-mode .tile-code {
  min-height: 22px;
  background: var(--panel-strong);
  color: #475569;
}

body.hell-mode .tile-label {
  justify-items: start;
  padding:
    clamp(2px, 5cqh, 4px)
    clamp(3px, 6cqw, 7px);
  text-align: left;
  font-size: clamp(8px, min(9.2cqw, 17cqh), 14px);
  font-weight: 700;
}

body.hell-mode .tile-sub {
  color: #64748b;
}

body.graphic-mode .tile.selected,
body.work-mode .tile.selected,
body.hell-mode .tile.selected {
  z-index: 5;
  border-color: #2563eb;
  transform: translateY(-2px);
}

body.graphic-mode .tile.selected {
  box-shadow:
    0 0 0 4px rgba(37, 99, 235, 0.24),
    0 10px 22px rgba(15, 23, 42, 0.13),
    inset 0 -3px 0 rgba(15, 23, 42, 0.06);
}

body.work-mode .tile.selected {
  background:
    linear-gradient(180deg, rgba(239, 246, 255, 0.78), rgba(255, 255, 255, 0.98));
  box-shadow:
    inset 0 0 0 2px rgba(37, 99, 235, 0.78),
    0 0 0 2px rgba(37, 99, 235, 0.1),
    0 5px 12px rgba(15, 23, 42, 0.08);
}

body.work-mode .tile.selected::after,
body.hell-mode .tile.selected::after {
  content: "";
  display: block;
  right: 4px;
  bottom: 4px;
  width: 8px;
  min-width: 8px;
  height: 8px;
  border: 1px solid #fff;
  border-radius: 50%;
  background: #2563eb;
  opacity: 1;
}

body.hell-mode .tile.selected {
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(255, 255, 255, 1));
  box-shadow:
    inset 0 0 0 2px #111827,
    0 0 0 2px rgba(17, 24, 39, 0.08);
}

body.graphic-mode .tile.hint,
body.work-mode .tile.hint,
body.hell-mode .tile.hint {
  z-index: 6;
  border-color: #1d4ed8;
  animation: hintPulse 1.05s ease-in-out infinite;
}

body.work-mode .tile.hint,
body.hell-mode .tile.hint {
  background:
    linear-gradient(180deg, rgba(239, 246, 255, 0.82), rgba(255, 255, 255, 0.98));
  box-shadow:
    inset 0 0 0 2px rgba(37, 99, 235, 0.7),
    0 0 0 4px rgba(37, 99, 235, 0.16),
    0 6px 16px rgba(37, 99, 235, 0.08);
}

body.work-mode .tile.hint::before,
body.hell-mode .tile.hint::before {
  display: block;
  inset: 0 0 auto 0;
  width: auto;
  height: 4px;
  background: #2563eb;
  opacity: 0.9;
}

body.work-mode .tile.hint::after,
body.hell-mode .tile.hint::after {
  content: "CHK";
  display: grid;
  place-items: center;
  right: 5px;
  bottom: 5px;
  width: auto;
  min-width: 28px;
  height: 18px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 9px;
  font-weight: 900;
  opacity: 1;
}

.boss-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  overflow: auto;
  background: #f8fafc;
  color: #172033;
  padding: 18px;
}

body.boss-mode .boss-screen {
  display: block;
}

body.boss-mode {
  overflow: hidden;
}

body.boss-mode .app-shell {
  display: none;
}

.boss-sheet {
  min-width: 900px;
  border: 1px solid #cbd5e1;
  background: #fff;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.12);
}

.boss-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  border-bottom: 1px solid #dce3ee;
  background: #eef6f3;
  padding: 0 14px;
}

.boss-titlebar strong {
  font-size: 15px;
}

.boss-titlebar span,
.boss-ribbon span {
  color: #475569;
  font-size: 13px;
}

.boss-ribbon {
  display: flex;
  gap: 22px;
  align-items: center;
  min-height: 38px;
  border-bottom: 1px solid #dce3ee;
  background: #fff;
  padding: 0 14px;
}

.boss-formula {
  display: grid;
  grid-template-columns: 54px 1fr;
  min-height: 36px;
  border-bottom: 1px solid #dce3ee;
}

.boss-formula span {
  display: grid;
  place-items: center;
  border-right: 1px solid #dce3ee;
  color: #2e8b57;
  font-weight: 800;
  font-style: italic;
}

.boss-formula strong {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.boss-grid {
  display: grid;
  grid-template-columns: 48px 1.3fr 0.9fr 0.9fr 1fr 1fr;
  background: #dce3ee;
  gap: 1px;
}

.boss-cell {
  min-height: 34px;
  background: #fff;
  padding: 8px 10px;
  color: #172033;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.boss-cell.header,
.boss-cell.index {
  background: #f1f5f9;
  color: #475569;
  font-weight: 800;
}

.boss-cell.good {
  color: #0f766e;
}

.boss-cell.warn {
  color: #b88320;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

@keyframes tileClear {
  0% {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1);
  }
  42% {
    opacity: 0.96;
    transform: scale(1.1) rotate(-1.5deg);
    filter: brightness(1.12) saturate(1.16);
  }
  72% {
    opacity: 0.62;
    transform: scale(0.9) rotate(1.2deg);
    filter: brightness(1.22) saturate(1.18);
  }
  100% {
    opacity: 0;
    transform: scale(0.64) rotate(3deg);
    filter: brightness(1.34) saturate(1.2);
  }
}

@keyframes tileSettle {
  0% {
    opacity: 0;
    transform: translateY(-22px) scale(0.94);
    filter: blur(2px);
  }
  70% {
    opacity: 1;
    transform: translateY(3px) scale(1.02);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes hintPulse {
  0%,
  100% {
    box-shadow:
      0 0 0 2px rgba(37, 99, 235, 0.18),
      0 8px 18px rgba(37, 99, 235, 0.08),
      inset 0 -3px 0 rgba(15, 23, 42, 0.06);
    filter: brightness(1.02) saturate(1.05);
  }
  50% {
    box-shadow:
      0 0 0 7px rgba(37, 99, 235, 0.18),
      0 12px 24px rgba(37, 99, 235, 0.12),
      inset 0 -3px 0 rgba(15, 23, 42, 0.06);
    filter: brightness(1.08) saturate(1.16);
  }
}

@keyframes guideCellPulse {
  0%,
  100% {
    box-shadow:
      0 0 0 4px rgba(20, 184, 166, 0.24),
      0 0 0 9px rgba(20, 184, 166, 0.1),
      0 12px 28px rgba(15, 118, 110, 0.2),
      inset 0 -3px 0 rgba(15, 23, 42, 0.06);
    filter: brightness(1.02) saturate(1.05);
  }
  50% {
    box-shadow:
      0 0 0 8px rgba(20, 184, 166, 0.28),
      0 0 0 16px rgba(20, 184, 166, 0.13),
      0 16px 34px rgba(15, 118, 110, 0.25),
      inset 0 -3px 0 rgba(15, 23, 42, 0.06);
    filter: brightness(1.12) saturate(1.18);
  }
}

@keyframes weekGuideFlow {
  0%,
  100% {
    opacity: 0.82;
    transform: scaleX(0.86);
  }
  50% {
    opacity: 1;
    transform: scaleX(1.08);
  }
}

@keyframes weekGuideCopyPulse {
  0%,
  100% {
    filter: brightness(1);
    box-shadow:
      0 0 0 5px rgba(20, 184, 166, 0.12),
      0 18px 42px rgba(15, 23, 42, 0.18);
  }
  50% {
    filter: brightness(1.04);
    box-shadow:
      0 0 0 10px rgba(20, 184, 166, 0.14),
      0 22px 50px rgba(15, 23, 42, 0.2);
  }
}

@keyframes diffCircleIn {
  0% {
    opacity: 0;
    transform: scale(0.78) rotate(-10deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(-5deg);
  }
}

@keyframes reviewHintPulse {
  0%,
  100% {
    box-shadow:
      inset 0 0 0 2px rgba(37, 99, 235, 0.45),
      0 0 0 0 rgba(37, 99, 235, 0.16);
  }
  50% {
    box-shadow:
      inset 0 0 0 2px rgba(37, 99, 235, 0.68),
      0 0 0 5px rgba(37, 99, 235, 0.12);
  }
}

@keyframes mineStamp {
  0% {
    transform: scale(0.92);
    filter: saturate(0.9);
  }
  62% {
    transform: scale(1.04);
    filter: saturate(1.08);
  }
  100% {
    transform: scale(1);
    filter: saturate(1);
  }
}

@keyframes stageClearIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -12px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes stageClearOut {
  0% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -8px) scale(0.98);
  }
}

@keyframes stageClearCenterIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -54%) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes stageClearCenterOut {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -54%) scale(0.98);
  }
}

@keyframes archiveSoftImpact {
  0% {
    background-color: rgba(255, 255, 255, 1);
  }
  40% {
    background-color: rgba(255, 251, 235, 0.82);
  }
  100% {
    background-color: rgba(255, 255, 255, 1);
  }
}

@keyframes archiveCursorBump {
  0% {
    transform: translate(-50%, -50%) rotate(45deg) scale(1);
  }
  42% {
    transform: translate(-50%, -50%) rotate(45deg) scale(1.12);
  }
  100% {
    transform: translate(-50%, -50%) rotate(45deg) scale(1);
  }
}

@keyframes archiveReadyWash {
  0% {
    filter: brightness(1.015);
  }
  100% {
    filter: brightness(1);
  }
}

@keyframes trendHintPulse {
  0%,
  100% {
    opacity: 0.72;
  }
  50% {
    opacity: 1;
  }
}

@keyframes trendPointHit {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  48% {
    opacity: 1;
    transform: scale(1.9);
  }
  100% {
    opacity: 0.9;
    transform: scale(1);
  }
}

@keyframes trendGuideFlow {
  0% {
    stroke-dashoffset: 0;
  }
  100% {
    stroke-dashoffset: -32;
  }
}

@keyframes trendGuideRing {
  0%,
  100% {
    opacity: 0.46;
    transform: scale(0.92);
  }
  50% {
    opacity: 0.95;
    transform: scale(1.12);
  }
}

@keyframes trendTargetGlow {
  0%,
  100% {
    opacity: 0.82;
  }
  50% {
    opacity: 1;
  }
}

@keyframes trendSpecialHalo {
  0%,
  100% {
    opacity: 0.5;
    transform: scale(0.82);
  }
  50% {
    opacity: 0.95;
    transform: scale(1.34);
  }
}

@keyframes boardStagePulse {
  0%,
  100% {
    filter: brightness(1);
  }
  42% {
    filter: brightness(1.018) saturate(1.025);
  }
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .workspace {
    grid-template-columns: 1fr;
    overflow: auto;
  }

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

  .review-board {
    grid-template-columns: 1fr;
  }

  .review-detail {
    order: -1;
  }

  .review-compare-grid {
    grid-template-columns: 1fr;
  }

  .risk-workspace {
    grid-template-columns: 1fr;
  }

  .risk-pie-shell {
    width: min(440px, calc(100vw - 64px), 100%);
    margin: 0;
  }

  .onboarding-callout {
    width: min(250px, calc(100vw - 42px));
  }
}

@media (max-width: 1180px) {
  body.review-view .risk-pie-stage {
    padding: 12px;
  }

  body.review-view .risk-pie-shell {
    width: min(520px, calc(100vw - 96px));
    margin: 0;
  }

  body.review-view .risk-side {
    align-self: stretch;
  }
}

@media (max-width: 1500px) {
  body.review-view .risk-pie-stage {
    padding: 12px;
  }

  body.review-view .risk-pie-shell {
    width: min(520px, calc(100vw - 96px));
    margin: 0;
  }

  body.review-view .risk-side {
    align-self: stretch;
  }
}

@media (max-width: 700px) {
  html,
  body {
    overflow: auto;
  }

  .app-shell {
    width: 100vw;
    height: auto;
    min-height: 100vh;
    padding: 8px;
    overflow: visible;
  }

  .topbar,
  .board-panel,
  .side-panel {
    padding: 12px;
  }

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

  .board-head {
    align-items: start;
    flex-direction: column;
  }

  .board {
    --cell-gap: 5px;
  }

  .tile-code {
    min-height: clamp(14px, 30cqh, 18px);
    padding:
      clamp(2px, 5cqh, 4px)
      clamp(3px, 5.5cqw, 5px)
      clamp(1px, 3cqh, 2px);
    font-size: clamp(6px, min(5.2cqw, 12cqh), 9px);
  }

  .trend-special-legend {
    left: 10px;
    right: 10px;
    justify-content: center;
  }

  .trend-special-legend span {
    min-height: 18px;
    padding: 0 6px;
    font-size: 9px;
  }

  .tile-code i {
    width: clamp(4px, min(4.4cqw, 10cqh), 7px);
    height: clamp(4px, min(4.4cqw, 10cqh), 7px);
  }

  .tile-label {
    font-size: clamp(7px, min(8.6cqw, 16cqh), 13px);
    padding: clamp(1px, 4cqh, 2px);
  }

  .tile-sub {
    display: none;
  }

  body.work-mode .board-panel,
  body.hell-mode .board-panel {
    overflow-x: auto;
  }

  body.work-mode .board,
  body.hell-mode .board {
    width: 660px;
    max-width: none;
  }

  body.work-mode .review-board,
  body.hell-mode .review-board {
    width: 100%;
    min-width: 0;
  }

  body.work-mode .tile-label,
  body.hell-mode .tile-label {
    font-size: clamp(7px, min(8.2cqw, 15cqh), 10px);
    line-height: 1.18;
  }

  body.week-view .tile-label,
  body.week-view .tile.dragging .tile-label {
    font-size: clamp(7px, min(8.2cqw, 15cqh), 10px);
    line-height: 1.14;
  }

  body.week-view .tile-code,
  body.week-view .tile.dragging .tile-code {
    font-size: clamp(6px, min(4.8cqw, 10cqh), 8px);
  }

  body.work-mode .status-line,
  body.hell-mode .status-line {
    min-width: 660px;
  }

  .review-ledger {
    overflow-x: auto;
  }

  .review-summary,
  .review-head,
  .review-row {
    min-width: 720px;
  }

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

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

  .archive-detail {
    min-height: 520px;
    padding: 12px;
  }

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

  .archive-chart-card {
    grid-template-rows: auto minmax(340px, 1fr) auto;
  }

  .archive-chart-stage {
    min-height: 340px;
  }

  .archive-lane span {
    display: none;
  }

  body.trend-view .board-panel {
    overflow-x: hidden;
  }

  body.trend-view .board,
  body.trend-view .review-board {
    display: block;
    width: 100%;
    min-width: 0;
  }

  body.trend-view .status-line {
    min-width: 0;
  }

  .trend-detail {
    min-height: 520px;
    padding: 12px;
  }

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

  .trend-chart-card {
    grid-template-rows: auto minmax(330px, 1fr) auto;
  }

  .trend-chart-stage {
    min-height: 330px;
  }

  body.review-view .board-panel {
    overflow-x: hidden;
  }

  body.review-view .board,
  body.review-view .review-board {
    display: block;
    width: 100%;
    min-width: 0;
  }

  body.review-view .status-line {
    min-width: 0;
  }

  body.review-view .risk-pie-shell {
    width: min(360px, calc(100vw - 72px), 100%);
  }

  body.review-view .risk-legend {
    grid-template-columns: 1fr;
  }

  body.review-view .risk-legend-row {
    grid-template-columns: minmax(0, 1fr) 34px 34px;
    min-height: 52px;
    padding: 7px;
  }

  body.review-view .risk-legend-row span {
    gap: 5px;
    font-size: 12px;
  }

  body.review-view .risk-trend-card {
    grid-template-rows: auto minmax(230px, 1fr) auto auto;
    min-height: 360px;
  }

  body.review-view .risk-heatmap {
    min-height: 230px;
    gap: 3px;
  }

  .risk-chart-card,
  .risk-side {
    overflow: hidden;
  }

  .risk-side,
  .risk-legend {
    grid-template-columns: 1fr;
  }

  .risk-table {
    overflow-x: auto;
  }

  .risk-table-head,
  .risk-table-row {
    min-width: 520px;
  }

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

  .review-doc-grid {
    grid-template-columns: 1fr;
  }

  .review-compare-note {
    align-items: start;
    flex-direction: column;
  }

  .side-panel {
    grid-template-columns: 1fr;
  }

  .sheet-menu {
    gap: 12px;
    overflow: hidden;
  }

  .formula-line strong {
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  body.review-view .risk-heatmap {
    min-height: 250px;
  }

  .board-tabs button {
    min-width: 40px;
    font-size: 12px;
  }

  .metric {
    padding: 8px;
  }

  .metric strong {
    font-size: 16px;
  }

  .tile-label {
    font-size: clamp(8px, 2.4vw, 11px);
  }

  body.week-view .tile-label,
  body.work-mode .tile-label,
  body.hell-mode .tile-label {
    font-size: clamp(6px, min(7.8cqw, 13cqh), 9px);
  }
}

@container risk-review (min-width: 1560px) {
  .risk-workspace {
    grid-template-columns: minmax(500px, 560px) minmax(760px, 1fr);
    min-height: clamp(520px, calc(100vh - 390px), 720px);
  }

  .risk-pie-shell {
    width: min(100%, clamp(380px, calc(100vh - 340px), 480px));
    margin: 0;
  }

  .risk-chart-card,
  .risk-side {
    align-self: stretch;
  }

  .risk-trend-card {
    min-height: 0;
  }
}
