:root {
  color-scheme: dark;
  --bg: #07101e;
  --panel: #0d192a;
  --panel-soft: #101e31;
  --line: #1d2c41;
  --text: #f4f8fc;
  --muted: #8493a8;
  --cyan: #21c7d9;
  --green: #36d399;
  --amber: #f4bd50;
  --orange: #fb923c;
  --red: #fb7185;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 75% -10%, rgba(33, 199, 217, .11), transparent 32rem),
    linear-gradient(180deg, #07111f 0, #07101e 40%, #060d18 100%);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button, select { touch-action: manipulation; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 10px max(20px, calc((100vw - 1480px) / 2));
  border-bottom: 1px solid rgba(29, 44, 65, .85);
  background: rgba(7, 16, 30, .88);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  background: var(--cyan);
  color: #031019;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -.04em;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: .01em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; }

.topbar-meta { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; }
.mode-badge { border: 1px solid rgba(33, 199, 217, .24); border-radius: 999px; padding: 5px 9px; background: rgba(33, 199, 217, .08); color: #9aebf4; }
.clock-short { display: none; }

main {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 48px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  min-height: 154px;
  padding: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(circle at 90% 10%, rgba(33, 199, 217, .12), transparent 30%),
    linear-gradient(135deg, rgba(14, 31, 51, .96), rgba(9, 20, 35, .98));
  box-shadow: 0 24px 70px rgba(0, 0, 0, .18);
}

.eyebrow { margin: 0 0 10px; color: var(--cyan); font-size: 11px; font-weight: 700; letter-spacing: .17em; }
.hero h1 { margin: 0; font-size: clamp(26px, 3.2vw, 40px); line-height: 1.1; letter-spacing: -.04em; }
.hero p:last-child { margin: 12px 0 0; color: #9aa9bb; font-size: 14px; }

.hero-actions { display: flex; align-items: flex-end; gap: 10px; }
.date-control { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .06em; }
.date-control select {
  min-width: 154px;
  height: 44px;
  border: 1px solid rgba(33, 199, 217, .24);
  border-radius: 11px;
  padding: 0 34px 0 12px;
  background: #0b1c2e;
  color: #d9f8fb;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0;
}
.date-control select:focus { border-color: var(--cyan); outline: 2px solid rgba(33, 199, 217, .12); }
.date-control select:disabled { cursor: wait; opacity: .65; }

.sync-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 154px;
  height: 44px;
  border: 0;
  border-radius: 11px;
  background: var(--cyan);
  color: #03131d;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(33, 199, 217, .18);
}

.sync-button:hover { filter: brightness(1.05); transform: translateY(-1px); }
.sync-button:disabled { cursor: wait; filter: saturate(.6); opacity: .75; transform: none; }
.sync-icon { font-size: 20px; line-height: 1; }
.sync-button.running .sync-icon { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.status-panel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(13, 25, 42, .78);
}

.status-panel strong, .status-panel small { display: block; }
.status-panel strong { font-size: 13px; }
.status-panel small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px rgba(132, 147, 168, .08); }
.status-panel.success { border-color: rgba(54, 211, 153, .2); }
.status-panel.success .status-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(54, 211, 153, .09); }
.status-panel.warning { border-color: rgba(244, 189, 80, .22); background: rgba(244, 189, 80, .04); }
.status-panel.warning .status-dot { background: var(--amber); box-shadow: 0 0 0 4px rgba(244, 189, 80, .09); }
.status-panel.running { border-color: rgba(33, 199, 217, .24); }
.status-panel.running .status-dot { background: var(--cyan); box-shadow: 0 0 0 4px rgba(33, 199, 217, .09); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.source-chip { border-radius: 999px; padding: 5px 8px; background: rgba(255,255,255,.045); color: #bdc8d7; font-size: 10px; }
.source-chip.in-progress { background: rgba(33, 199, 217, .09); color: #9aebf4; }

.error-panel { margin-top: 12px; padding: 12px 14px; border: 1px solid rgba(251, 113, 133, .25); border-radius: 10px; background: rgba(251, 113, 133, .07); color: #fecdd6; font-size: 13px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.kpi-card { position: relative; min-height: 126px; padding: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: rgba(13, 25, 42, .83); }
.kpi-card::after { position: absolute; right: -24px; bottom: -38px; width: 110px; height: 110px; border-radius: 50%; background: currentColor; content: ""; opacity: .035; }
.kpi-label { display: block; margin-bottom: 18px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .09em; }
.kpi-card strong { display: block; color: var(--text); font-size: 21px; line-height: 1.2; }
.kpi-card small { display: block; margin-top: 8px; color: #8795a8; font-size: 11px; }
.kpi-card.cyan { color: var(--cyan); border-top-color: rgba(33, 199, 217, .45); }
.kpi-card.green { color: var(--green); border-top-color: rgba(54, 211, 153, .45); }
.kpi-card.amber { color: var(--amber); border-top-color: rgba(244, 189, 80, .45); }
.kpi-card.red { color: var(--red); border-top-color: rgba(251, 113, 133, .45); }

.panel { margin-top: 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(13, 25, 42, .8); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; }
.section-heading p { margin: 0 0 4px; color: var(--cyan); font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.section-heading h2 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.section-heading > span { border-radius: 999px; padding: 5px 8px; background: rgba(255,255,255,.045); color: var(--muted); font-size: 10px; }

.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; min-width: 1120px; border-collapse: collapse; font-size: 11px; }
th { padding: 11px 12px; background: rgba(5, 13, 24, .5); color: #74849a; font-size: 10px; font-weight: 700; text-align: left; white-space: nowrap; }
td { max-width: 220px; padding: 13px 12px; border-top: 1px solid rgba(29, 44, 65, .72); color: #a9b5c5; line-height: 1.65; vertical-align: top; }
tbody tr:hover { background: rgba(255,255,255,.018); }
td.owner { color: var(--text); font-size: 12px; font-weight: 700; white-space: nowrap; }
td.tomorrow { min-width: 280px; color: #c4f3f7; }
.effective { color: var(--green); font-size: 13px; }
.not-applicable { color: #9b8ce8; font-weight: 700; }
.person-status { display: inline-flex; border: 1px solid transparent; border-radius: 999px; padding: 3px 7px; font-size: 10px; white-space: nowrap; }
.person-status.green { border-color: rgba(54,211,153,.22); background: rgba(54,211,153,.08); color: #93f3c9; }
.person-status.yellow { border-color: rgba(244,189,80,.22); background: rgba(244,189,80,.08); color: #f8d78e; }
.person-status.orange { border-color: rgba(251,146,60,.25); background: rgba(251,146,60,.08); color: #fdba74; }
.person-status.red { border-color: rgba(251,113,133,.25); background: rgba(251,113,133,.08); color: #fda4b4; }
.person-status.gray { border-color: rgba(132,147,168,.2); background: rgba(132,147,168,.06); color: #aab6c5; }

.insight-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; }
.chart-body { padding: 4px 20px 20px; }
.chart-row { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; gap: 12px; margin-top: 13px; }
.chart-name { color: #b8c4d2; font-size: 11px; }
.bar-pair { display: grid; gap: 4px; }
.bar-pair::before, .bar-pair::after { grid-area: auto / 1; height: 7px; border-radius: 999px; background: #17253a; content: ""; }
.bar { z-index: 1; height: 7px; border-radius: 999px; margin-top: -11px; }
.bar.total { background: var(--cyan); }
.bar.valid { background: var(--green); }
.chart-value { color: var(--muted); font-size: 10px; text-align: right; }
.chart-value b { color: var(--green); }
.legend { display: flex; gap: 10px; color: var(--muted); font-size: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i { width: 7px; height: 7px; border-radius: 50%; }
.legend-total { background: var(--cyan); }
.legend-valid { background: var(--green); }

.conclusions-panel ol { display: grid; gap: 10px; margin: 0; padding: 4px 20px 20px; list-style: none; }
.conclusions-panel li { display: flex; gap: 10px; padding: 12px; border: 1px solid rgba(29,44,65,.8); border-radius: 10px; background: rgba(5,13,24,.32); }
.conclusions-panel li > span { display: grid; width: 23px; height: 23px; flex: 0 0 23px; place-items: center; border-radius: 50%; background: rgba(33,199,217,.1); color: var(--cyan); font-size: 10px; font-weight: 800; }
.conclusions-panel p { margin: 1px 0 0; color: #bbc6d4; font-size: 12px; line-height: 1.65; }

.action-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 0 20px 20px; }
.action-card { padding: 15px; border: 1px solid rgba(29,44,65,.85); border-radius: 12px; background: rgba(5,13,24,.35); }
.action-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.action-head small { color: var(--muted); font-size: 10px; }
.action-head h3 { margin: 4px 0 0; font-size: 13px; }
.action-head h3,
.action-card dd,
.staff-panel td { overflow-wrap: anywhere; }
.priority { border-radius: 6px; padding: 4px 7px; font-size: 10px; font-weight: 800; }
.priority.p0 { background: rgba(251,113,133,.1); color: #fda4b4; }
.priority.p1 { background: rgba(244,189,80,.1); color: #f8d78e; }
.action-card dl { display: grid; gap: 7px; margin: 13px 0; font-size: 11px; }
.action-card dl > div { display: grid; grid-template-columns: 60px 1fr; gap: 8px; }
.action-card dt { color: #65758b; }
.action-card dd { margin: 0; color: #b2bfce; line-height: 1.55; }
.action-card dl > div:nth-child(2) dd { color: #bdf1f5; }
.action-card dl > div:nth-child(3) dd { color: #f4d69a; }
.action-card footer { display: flex; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 1px solid rgba(29,44,65,.75); color: #66768c; font-size: 9px; }

.boundary-note { display: flex; justify-content: space-between; gap: 18px; margin-top: 14px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(5,13,24,.42); color: #718197; font-size: 10px; line-height: 1.5; }
.site-footer { padding: 20px; border-top: 1px solid rgba(29,44,65,.6); color: #536176; font-size: 10px; text-align: center; }

@media (max-width: 1050px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .insight-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  body { padding-bottom: env(safe-area-inset-bottom); }
  .topbar { padding: 10px 14px; }
  .topbar-meta { gap: 8px; }
  .mode-badge, .clock-full { display: none; }
  .clock-short { display: inline; font-size: 10px; white-space: nowrap; }
  .brand strong { font-size: 12px; }
  .brand small { font-size: 9px; }
  main { width: min(100% - 20px, 1480px); padding-top: 14px; }
  .hero { align-items: stretch; flex-direction: column; min-height: 0; padding: 20px; }
  .hero h1 { font-size: 27px; }
  .hero p:last-child { font-size: 12px; line-height: 1.7; }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .date-control select, .sync-button { width: 100%; }
  .status-panel { grid-template-columns: auto 1fr; }
  .source-chip { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-card { min-height: 122px; padding: 16px; }
  .kpi-card strong { font-size: 17px; }
  .kpi-label { margin-bottom: 14px; }
  .section-heading { align-items: flex-start; padding: 15px; }
  .section-heading h2 { font-size: 14px; }
  .staff-panel .table-wrap { overflow: visible; padding: 0 12px 12px; border-top: 0; }
  .staff-panel table,
  .staff-panel tbody,
  .staff-panel tr,
  .staff-panel td { display: block; width: 100%; min-width: 0; }
  .staff-panel table { font-size: 11px; }
  .staff-panel thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .staff-panel tbody { display: grid; gap: 10px; }
  .staff-panel tbody tr {
    padding: 12px;
    border: 1px solid rgba(29, 44, 65, .85);
    border-radius: 12px;
    background: rgba(5, 13, 24, .34);
  }
  .staff-panel td {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 9px;
    max-width: none;
    padding: 8px 0;
    border-top: 1px solid rgba(29, 44, 65, .58);
    line-height: 1.55;
    white-space: normal;
  }
  .staff-panel td:first-child { padding-top: 0; border-top: 0; }
  .staff-panel td:last-child { padding-bottom: 0; }
  .staff-panel td::before {
    color: #65758b;
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
  }
  .staff-panel td.owner { font-size: 13px; }
  .staff-panel td.tomorrow { min-width: 0; }
  .staff-panel .person-status { width: max-content; justify-self: start; }
  .chart-body { padding: 2px 15px 16px; }
  .chart-row { grid-template-columns: 46px 1fr 44px; gap: 8px; }
  .action-grid { grid-template-columns: 1fr; padding: 0 12px 12px; }
  .boundary-note { flex-direction: column; gap: 5px; }
  .site-footer { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}

@media (max-width: 390px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .hero { padding: 18px; }
  .hero h1 { font-size: 24px; }
}
