:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --bg-soft: #eef2f5;
  --panel: rgba(255, 255, 255, 0.84);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --ink: #111827;
  --muted: #667085;
  --line: rgba(17, 24, 39, 0.1);
  --line-strong: rgba(17, 24, 39, 0.16);
  --accent: #007aff;
  --accent-soft: rgba(0, 122, 255, 0.12);
  --mint: #30d158;
  --mint-soft: rgba(48, 209, 88, 0.13);
  --bad: #ff3b30;
  --bad-soft: rgba(255, 59, 48, 0.12);
  --warn: #ff9f0a;
  --warn-soft: rgba(255, 159, 10, 0.14);
  --shadow: 0 18px 50px rgba(17, 24, 39, 0.08);
  --shadow-soft: 0 10px 28px rgba(17, 24, 39, 0.06);
  --radius: 22px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 18% 0%, rgba(0, 122, 255, 0.12), transparent 34%),
    radial-gradient(circle at 92% 10%, rgba(48, 209, 88, 0.1), transparent 28%),
    linear-gradient(180deg, #fbfcfd 0%, var(--bg) 38%, var(--bg-soft) 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image: linear-gradient(rgba(17, 24, 39, 0.035) 1px, transparent 1px);
  background-size: 100% 48px;
  mask-image: linear-gradient(180deg, black, transparent 70%);
}

h1,
h2,
h3,
p {
  margin: 0;
}

img,
video,
canvas,
iframe,
embed,
object {
  display: block;
  max-width: 100%;
}

img,
video,
canvas {
  height: auto;
}

svg {
  max-width: 100%;
}

h1 {
  font-size: clamp(32px, 5vw, 58px);
  line-height: 0.96;
  font-weight: 780;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 740;
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px clamp(16px, 4vw, 44px) 18px;
  color: var(--ink);
  background: rgba(251, 252, 253, 0.72);
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}

.topbar p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
}

.status {
  min-width: 120px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid rgba(0, 122, 255, 0.18);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 720;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.status.warn {
  color: #8a5200;
  background: var(--warn-soft);
  border-color: rgba(255, 159, 10, 0.25);
}

.status.bad {
  color: #b42318;
  background: var(--bad-soft);
  border-color: rgba(255, 59, 48, 0.22);
}

.layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  width: min(1380px, 100%);
  margin: 0 auto;
  padding: 22px clamp(14px, 3vw, 36px) 42px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 18px;
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
}

.hero-panel {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(242, 247, 255, 0.78));
  box-shadow: var(--shadow);
}

.analytics-panel {
  background: rgba(255, 255, 255, 0.76);
}

.priority-panel {
  border-color: rgba(0, 122, 255, 0.22);
}

.span-2 {
  grid-column: span 2;
}

.panel-head,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #1688ff, #007aff);
  color: #fff;
  padding: 0 15px;
  font-size: 14px;
  font-weight: 720;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 122, 255, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 122, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

button.secondary {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
}

.summary-grid,
.charts-grid,
.project-list,
.backup-grid,
.notes-grid,
.kanban {
  display: grid;
  gap: 12px;
}

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

.charts-grid {
  grid-template-columns: 1.05fr 1fr 1fr 1fr;
  margin-top: 16px;
}

.metric,
.row,
.project,
.chart-card,
.link-node,
.backup-metric,
.detail-section,
.kanban-column {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.metric {
  position: relative;
  min-height: 112px;
  overflow: hidden;
  padding: 16px;
}

.metric::after {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  content: "";
  background: var(--accent-soft);
}

.metric.ok::after {
  background: var(--mint-soft);
}

.metric.warn::after {
  background: var(--warn-soft);
}

.metric strong {
  display: block;
  position: relative;
  z-index: 1;
  font-size: 34px;
  line-height: 1;
  font-weight: 780;
}

.metric span,
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.metric span {
  display: block;
  position: relative;
  z-index: 1;
  margin-top: 10px;
}

.chart-card {
  min-width: 0;
  padding: 15px;
}

.focus-chart {
  display: grid;
  justify-items: center;
}

.chart-title {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 760;
}

.chart-caption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.donut-wrap {
  position: relative;
  width: 132px;
  height: 132px;
  color: var(--accent);
}

.donut-wrap.ok {
  color: var(--mint);
}

.donut-wrap.warn {
  color: var(--warn);
}

.donut {
  width: 132px;
  height: 132px;
  transform: rotate(-90deg);
}

.donut-track,
.donut-value {
  fill: none;
  stroke-width: 12;
}

.donut-track {
  stroke: rgba(17, 24, 39, 0.08);
}

.donut-value {
  stroke: currentColor;
  stroke-linecap: round;
  transition: stroke-dashoffset 260ms ease;
}

.donut-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 780;
  color: var(--ink);
}

.bar-list {
  display: grid;
  gap: 13px;
}

.bar-row {
  display: grid;
  gap: 7px;
}

.bar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.bar-meta strong {
  color: var(--ink);
  font-weight: 780;
}

.bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.08);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.bar-row.ok .bar-fill {
  background: var(--mint);
}

.bar-row.warn .bar-fill {
  background: var(--warn);
}

.bar-row.bad .bar-fill {
  background: var(--bad);
}

.bar-row.muted .bar-fill {
  background: rgba(17, 24, 39, 0.24);
}

.backup-pulse {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
}

.backup-pulse.ok {
  background: var(--mint-soft);
  color: #157a35;
}

.backup-pulse.bad {
  background: var(--bad-soft);
  color: #b42318;
}

.backup-pulse strong {
  font-size: 26px;
  line-height: 1;
}

.backup-pulse span {
  font-size: 12px;
  color: currentColor;
  opacity: 0.82;
}

.stack {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.row {
  padding: 13px;
  display: grid;
  gap: 7px;
}

.container-row {
  position: relative;
}

.row-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  font-weight: 740;
}

.row-title.compact {
  font-size: 13px;
  font-weight: 680;
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  max-width: 100%;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.tag.ok {
  background: var(--mint-soft);
  color: #157a35;
}

.tag.warn {
  background: var(--warn-soft);
  color: #8a5200;
}

.tag.bad {
  background: var(--bad-soft);
  color: #b42318;
}

.project-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.project {
  padding: 15px;
  display: grid;
  gap: 11px;
  align-content: start;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.project:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.project h3 {
  font-size: 17px;
  line-height: 1.2;
  font-weight: 760;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.link-map,
.backup-board,
.mirror-board,
.event-timeline {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.link-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 30px minmax(0, 1.1fr) 30px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.link-node {
  min-width: 0;
  padding: 13px;
}

.link-node strong,
.link-node span {
  display: block;
}

.link-node strong {
  font-size: 14px;
}

.link-node span {
  margin-top: 7px;
  color: var(--muted);
  font-family: "SFMono-Regular", ui-monospace, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.link-node button {
  margin-top: 10px;
}

.link-arrow {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 800;
}

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

.mirror-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

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

.mirror-row,
.event-row {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.mirror-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 13px;
}

.mirror-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 260px;
}

.event-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 12px;
  padding: 13px;
}

.event-dot {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
}

.event-row.ok .event-dot {
  background: var(--mint);
  box-shadow: 0 0 0 5px var(--mint-soft);
}

.event-row.warn .event-dot {
  background: var(--warn);
  box-shadow: 0 0 0 5px var(--warn-soft);
}

.event-row.bad .event-dot {
  background: var(--bad);
  box-shadow: 0 0 0 5px var(--bad-soft);
}

.backup-metric {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 13px;
}

.backup-metric span:first-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 740;
}

.path {
  color: var(--muted);
  font-family: "SFMono-Regular", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.notes-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 740;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

textarea {
  resize: vertical;
  padding: 12px;
  font: 14px/1.45 "SFMono-Regular", ui-monospace, monospace;
}

input {
  min-height: 40px;
  padding: 8px 10px;
  font: 14px/1.3 "SFMono-Regular", ui-monospace, monospace;
}

.detail-section label + label {
  margin-top: 10px;
}

.actions {
  margin-top: 14px;
  justify-content: flex-start;
}

#saveStatus,
#projectSaveStatus {
  color: var(--muted);
  font-size: 13px;
}

.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  justify-content: flex-end;
  background: rgba(17, 24, 39, 0.34);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.detail-overlay[hidden] {
  display: none;
}

.detail-panel {
  width: min(980px, 100%);
  height: 100%;
  overflow: auto;
  background: rgba(244, 246, 248, 0.92);
  border-left: 1px solid var(--line);
  box-shadow: -22px 0 58px rgba(17, 24, 39, 0.16);
  padding: 22px;
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
}

.compact-panel {
  width: min(760px, 100%);
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.detail-head h2 {
  margin-top: 6px;
  margin-bottom: 12px;
  font-size: 28px;
  line-height: 1.05;
}

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

.detail-section {
  min-width: 0;
  padding: 14px;
}

.detail-section h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.span-detail {
  grid-column: span 2;
}

ul {
  margin: 0;
  padding-left: 18px;
  min-width: 0;
}

li {
  margin: 6px 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

li span {
  color: var(--muted);
  font-size: 12px;
  margin-left: 6px;
}

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

.kanban-column {
  min-width: 0;
  min-height: 180px;
  padding: 12px;
}

.kanban-title {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  font-size: 13px;
}

.timeline-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.timeline-item span {
  color: var(--muted);
  text-align: right;
}

@media (max-width: 1080px) {
  .charts-grid,
  .backup-grid,
  .mirror-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .layout,
  .summary-grid,
  .charts-grid,
  .project-list,
  .notes-grid,
  .backup-grid,
  .mirror-summary,
  .mirror-row,
  .link-row {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .panel {
    border-radius: 18px;
    padding: 15px;
  }

  .link-arrow {
    min-height: 16px;
    transform: rotate(90deg);
  }

  .detail-panel {
    padding: 16px;
  }

  .detail-head,
  .timeline-item {
    display: grid;
  }

  .detail-body,
  .kanban {
    grid-template-columns: 1fr;
  }

  .span-detail {
    grid-column: auto;
  }
}

@media (max-width: 430px) and (orientation: portrait) {
  h1 {
    font-size: 30px;
  }

  .topbar {
    gap: 18px;
    padding: 24px 16px 18px;
  }

  .topbar p {
    font-size: 14px;
  }

  .layout {
    gap: 14px;
    padding: 22px 14px 34px;
  }

  .panel {
    padding: 14px;
  }

  .metric {
    min-height: 96px;
    padding: 14px;
  }

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

  .metric::after {
    width: 52px;
    height: 52px;
  }

  .detail-head h2 {
    font-size: 26px;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  h1 {
    font-size: 34px;
  }

  .topbar {
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 18px 24px 16px;
  }

  .topbar p {
    margin-top: 6px;
    font-size: 14px;
  }

  .layout {
    gap: 12px;
    padding: 16px 18px 28px;
  }

  .panel {
    border-radius: 18px;
    padding: 14px;
  }

  .summary-grid,
  .charts-grid,
  .project-list,
  .backup-grid,
  .mirror-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    min-height: 86px;
    padding: 13px;
  }

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

  .metric span {
    margin-top: 8px;
  }

  .metric::after {
    width: 48px;
    height: 48px;
  }

  .donut-wrap,
  .donut {
    width: 108px;
    height: 108px;
  }

  .donut-label {
    font-size: 24px;
  }

  .detail-panel {
    padding: 14px 18px;
  }

  .detail-head {
    align-items: flex-start;
    margin-bottom: 12px;
  }

  .detail-head h2 {
    font-size: 28px;
  }
}

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