:root {
  color-scheme: dark;
  --bg: #06101c;
  --panel: #0c1928;
  --panel-2: #101f30;
  --line: rgba(180, 205, 228, 0.14);
  --muted: #8ca0b3;
  --text: #f4f8fb;
  --yellow: #ffd84d;
  --cyan: #55d7e8;
  --green: #5ee2a0;
  --red: #ff7a7a;
  --orange: #ffaf57;
  --radius: 18px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; color: var(--text); background: radial-gradient(circle at 75% -10%, rgba(30, 114, 148, .2), transparent 35%), var(--bg); min-height: 100vh; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, label:focus-visible { outline: 3px solid rgba(85, 215, 232, .45); outline-offset: 2px; }

.app-shell { width: min(1500px, calc(100% - 48px)); margin: 0 auto; padding-bottom: 24px; }
.topbar { min-height: 92px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand-block { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 42px; height: 42px; border: 1px solid rgba(255,216,77,.35); background: rgba(255,216,77,.08); border-radius: 12px; display: flex; align-items: end; justify-content: center; gap: 4px; padding: 9px; }
.brand-mark span { display: block; width: 5px; background: var(--yellow); border-radius: 2px 2px 0 0; }
.brand-mark span:nth-child(1) { height: 10px; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 24px; }
.eyebrow, .section-kicker { color: var(--cyan); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; margin: 0 0 5px; font-weight: 800; }
h1 { font-size: 1.35rem; margin: 0; letter-spacing: .02em; }
.top-actions { display: flex; gap: 16px; align-items: center; }
.save-state { color: var(--muted); font-size: .8rem; display: flex; align-items: center; gap: 8px; }
.save-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(94,226,160,.65); }
.save-dot.offline { background: var(--red); box-shadow: 0 0 12px rgba(255,122,122,.55); }
.icon-button { width: 42px; height: 42px; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 11px; cursor: pointer; display: grid; place-items: center; }
.icon-button:hover { background: rgba(255,255,255,.08); }
.icon-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }

main { padding: 24px 0; }
.mission-strip { background: linear-gradient(100deg, rgba(85,215,232,.09), rgba(255,216,77,.05)); border: 1px solid rgba(85,215,232,.18); border-radius: var(--radius); padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; gap: 24px; position: relative; overflow: hidden; }
.mission-strip::after { content: "60"; position: absolute; right: 190px; top: -35px; font-size: 9rem; line-height: 1; font-weight: 900; color: rgba(255,255,255,.025); }
.target-icon { color: var(--yellow); }
.mission-copy { margin: 0; font-size: 1.02rem; line-height: 1.7; color: #c8d5df; }
.mission-copy strong { color: var(--yellow); font-size: 1.15em; }
.mission-date { min-width: 185px; border-left: 1px solid var(--line); padding-left: 24px; display: grid; gap: 4px; }
.mission-date span, .mission-date small { color: var(--muted); font-size: .75rem; }
.mission-date strong { letter-spacing: .06em; }

.score-grid { display: grid; grid-template-columns: 1fr 1fr .7fr; gap: 16px; margin: 16px 0; }
.score-card, .verdict-card, .panel { background: linear-gradient(145deg, rgba(16,31,48,.98), rgba(10,23,36,.98)); border: 1px solid var(--line); border-radius: var(--radius); }
.score-card { padding: 22px; min-height: 258px; }
.card-topline, .panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.metric-tag { display: inline-block; padding: 4px 8px; border-radius: 5px; font-size: .68rem; margin: 0 0 7px; font-weight: 800; letter-spacing: .08em; }
.metric-tag.lag { color: var(--cyan); background: rgba(85,215,232,.1); }
.metric-tag.lead { color: var(--yellow); background: rgba(255,216,77,.1); }
.card-topline h2, .panel h2 { margin: 0; font-size: 1.05rem; }
.status-pill { font-size: .72rem; color: var(--muted); background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 99px; padding: 6px 10px; white-space: nowrap; }
.status-pill.good { color: var(--green); border-color: rgba(94,226,160,.35); background: rgba(94,226,160,.08); }
.status-pill.warn { color: var(--orange); border-color: rgba(255,175,87,.35); background: rgba(255,175,87,.08); }
.metric-body { min-height: 110px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.metric-number { display: flex; align-items: baseline; gap: 8px; }
.metric-number strong { font-size: clamp(3rem, 4vw, 4.4rem); line-height: 1; letter-spacing: -.05em; }
.metric-number span { color: var(--muted); font-weight: 700; }
.ring { --p: 0deg; width: 86px; height: 86px; flex: 0 0 auto; border-radius: 50%; background: conic-gradient(var(--cyan) var(--p), rgba(255,255,255,.08) 0); display: grid; place-items: center; }
.ring::before { content: ""; width: 68px; height: 68px; background: var(--panel); border-radius: 50%; grid-area: 1/1; }
.ring div { grid-area: 1/1; z-index: 1; text-align: center; display: grid; }
.ring strong { font-size: 1rem; }
.ring span { font-size: .62rem; color: var(--muted); }
.week-badge { width: 84px; height: 84px; border-radius: 16px; background: rgba(255,216,77,.08); border: 1px solid rgba(255,216,77,.17); display: grid; place-content: center; text-align: center; transform: rotate(2deg); }
.week-badge strong { font-size: 1.25rem; color: var(--yellow); }
.week-badge span { color: var(--muted); font-size: .65rem; }
.week-range { margin: 8px 0 0; color: var(--muted); font-size: .78rem; }
.progress-track { height: 7px; background: rgba(255,255,255,.07); border-radius: 10px; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2d8eaa, var(--cyan)); transition: width .45s ease; }
.progress-track.yellow span { background: linear-gradient(90deg, #c28e15, var(--yellow)); }
.metric-foot { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: .72rem; margin-top: 12px; }
.metric-foot strong { color: var(--text); }
.verdict-card { padding: 24px; display: flex; flex-direction: column; justify-content: center; gap: 20px; background: radial-gradient(circle at 100% 0, rgba(255,216,77,.14), transparent 48%), linear-gradient(145deg, #142335, #0d1b2a); }
.verdict-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.06); border: 1px solid var(--line); font-size: 1.4rem; font-weight: 900; }
.verdict-card p { color: var(--muted); font-size: .76rem; margin: 0 0 7px; }
.verdict-card h2 { font-size: 1.45rem; margin: 0 0 8px; }
.verdict-card span { color: var(--muted); font-size: .74rem; line-height: 1.5; }
.verdict-card.winning { border-color: rgba(94,226,160,.35); }
.verdict-card.winning .verdict-icon { color: var(--green); border-color: rgba(94,226,160,.4); background: rgba(94,226,160,.1); }
.verdict-card.behind { border-color: rgba(255,175,87,.35); }
.verdict-card.behind .verdict-icon { color: var(--orange); border-color: rgba(255,175,87,.4); background: rgba(255,175,87,.1); }

.workspace-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 16px; }
.panel { padding: 22px; }
.panel-header { margin-bottom: 20px; align-items: center; }
.week-nav { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.week-nav > button { border: 0; background: rgba(255,255,255,.03); cursor: pointer; min-height: 42px; }
.week-nav > button:hover { background: rgba(255,255,255,.08); }
.week-nav > button:disabled { opacity: .25; cursor: not-allowed; }
.week-nav > button:first-child, .week-nav > button:last-child { width: 38px; font-size: 1.1rem; }
.week-picker { border-inline: 1px solid var(--line) !important; min-width: 126px; padding: 6px 12px; display: grid; }
.week-picker span { font-size: .76rem; font-weight: 800; }
.week-picker small { font-size: .62rem; color: var(--muted); }
.team-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.member-card { background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.member-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.member-head strong { font-size: .88rem; }
.member-avatar { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #07111f; font-weight: 900; font-size: .75rem; }
.member-card:nth-child(1) .member-avatar { background: #55d7e8; }
.member-card:nth-child(2) .member-avatar { background: #ffd84d; }
.member-card:nth-child(3) .member-avatar { background: #83e0a9; }
.member-card:nth-child(4) .member-avatar { background: #f5a7d4; }
.counter-block + .counter-block { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.counter-label { display: flex; justify-content: space-between; color: var(--muted); font-size: .7rem; margin-bottom: 8px; }
.counter-label strong { color: var(--text); }
.stepper { display: grid; grid-template-columns: 30px 1fr 30px; gap: 5px; }
.stepper button { height: 30px; border: 1px solid var(--line); background: rgba(255,255,255,.04); border-radius: 7px; cursor: pointer; }
.stepper button:hover { border-color: rgba(85,215,232,.45); }
.stepper input { min-width: 0; width: 100%; height: 30px; text-align: center; color: var(--text); border: 1px solid transparent; background: rgba(0,0,0,.16); border-radius: 7px; appearance: textfield; }
.stepper input::-webkit-inner-spin-button { appearance: none; }
.plan-entry-button { width: 100%; margin-top: 13px; padding: 9px 10px; display: flex; align-items: center; justify-content: space-between; color: #b8cad8; background: rgba(85,215,232,.045); border: 1px solid rgba(85,215,232,.14); border-radius: 8px; cursor: pointer; font-size: .72rem; font-weight: 800; }
.plan-entry-button:hover { color: var(--cyan); border-color: rgba(85,215,232,.38); background: rgba(85,215,232,.09); }
.weekly-total { display: grid; grid-template-columns: auto auto 1fr; gap: 24px; align-items: center; margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: rgba(85,215,232,.055); border: 1px solid rgba(85,215,232,.12); }
.weekly-total div { display: flex; gap: 8px; align-items: baseline; }
.weekly-total span, .weekly-total p { color: var(--muted); font-size: .7rem; margin: 0; }
.weekly-total p { text-align: right; }
.weekly-total p strong { color: var(--yellow); }
.trend-panel { min-width: 0; }
.legend { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: .7rem; }
.legend i { width: 12px; height: 3px; border-radius: 2px; background: var(--cyan); }
.legend i:nth-of-type(2) { background: transparent; border-top: 2px dashed rgba(255,216,77,.7); }
.chart-wrap { height: 220px; position: relative; }
#trendChart { width: 100%; height: 100%; overflow: visible; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .78rem; }
.chart-empty[hidden] { display: none !important; }
.chart-grid { stroke: rgba(180,205,228,.1); stroke-width: 1; }
.chart-label { fill: #758b9f; font-size: 10px; }
.actual-path { fill: none; stroke: var(--cyan); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 5px rgba(85,215,232,.35)); }
.actual-area { fill: url(#areaFill); }
.target-path { fill: none; stroke: rgba(255,216,77,.65); stroke-width: 2; stroke-dasharray: 7 7; }
.actual-dot { fill: var(--bg); stroke: var(--cyan); stroke-width: 3; }
.chart-value-label { fill: var(--cyan); font-size: 11px; font-weight: 800; }
.trend-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.trend-summary div { display: grid; gap: 4px; }
.trend-summary span { font-size: .65rem; color: var(--muted); }
.trend-summary strong { font-size: 1rem; }

.history-panel { margin-top: 16px; }
.history-tip { color: var(--muted); font-size: .72rem; margin: 0; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { color: var(--muted); text-align: left; font-size: .67rem; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 700; }
td { font-size: .78rem; padding: 11px 12px; border-bottom: 1px solid rgba(180,205,228,.07); }
tbody tr { cursor: pointer; transition: background .15s ease; }
tbody tr:hover, tbody tr.selected { background: rgba(85,215,232,.055); }
.week-cell { font-weight: 800; }
.bar-cell { min-width: 150px; display: flex; align-items: center; gap: 8px; }
.mini-bar { width: 88px; height: 5px; background: rgba(255,255,255,.07); border-radius: 4px; overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: var(--yellow); border-radius: inherit; }
.table-status { display: inline-flex; align-items: center; gap: 6px; }
.table-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.table-status.good { color: var(--green); }
.table-status.good::before { background: var(--green); }
.table-status.warn { color: var(--orange); }
.table-status.warn::before { background: var(--orange); }
footer { min-height: 54px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; color: #63798c; font-size: .68rem; letter-spacing: .04em; }

.popover { position: fixed; width: 300px; max-height: 440px; z-index: 20; background: #142336; border: 1px solid rgba(180,205,228,.22); border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.45); overflow: hidden; }
.popover-head { padding: 12px 14px; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); font-size: .8rem; }
.popover-head button { border: 0; background: none; cursor: pointer; font-size: 1.2rem; }
.week-list { max-height: 370px; overflow-y: auto; padding: 6px; }
.week-option { width: 100%; display: flex; justify-content: space-between; padding: 10px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; text-align: left; }
.week-option:hover, .week-option.active { background: rgba(85,215,232,.09); }
.week-option span { font-size: .75rem; font-weight: 800; }
.week-option small { color: var(--muted); font-size: .68rem; }

dialog { border: 0; padding: 0; background: transparent; color: var(--text); width: min(540px, calc(100% - 32px)); }
#planDialog { width: min(680px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(1,7,13,.76); backdrop-filter: blur(5px); }
.dialog-card { background: #111f30; border: 1px solid rgba(180,205,228,.2); border-radius: 18px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.55); }
.dialog-head { display: flex; justify-content: space-between; padding: 22px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 1.15rem; }
.close-button { border: 0; background: none; font-size: 1.5rem; cursor: pointer; }
.settings-section { padding: 18px 22px; border-bottom: 1px solid var(--line); }
.settings-section h3 { margin: 0 0 4px; font-size: .85rem; }
.settings-section p { margin: 0 0 14px; color: var(--muted); font-size: .72rem; }
.name-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.name-inputs label { display: grid; gap: 5px; color: var(--muted); font-size: .68rem; }
.name-inputs input { background: rgba(0,0,0,.18); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.backup-actions { display: flex; gap: 10px; }
.secondary-button, .ghost-button, .primary-button { border-radius: 8px; padding: 9px 14px; cursor: pointer; font-weight: 700; font-size: .76rem; }
.secondary-button { border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--text); }
label.secondary-button { display: inline-flex; align-items: center; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; }
.ghost-button { border: 1px solid var(--line); background: transparent; }
.primary-button { color: #07111f; background: var(--yellow); border: 1px solid var(--yellow); }
.plan-week-range { display: block; margin-top: 7px; color: var(--muted); font-size: .72rem; }
.plan-dialog-body { min-height: 310px; max-height: min(58vh, 540px); padding: 20px 22px; overflow-y: auto; }
.plan-summary { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; color: var(--muted); font-size: .72rem; }
.plan-summary strong { color: var(--text); }
.plan-list { display: grid; gap: 9px; }
.plan-row { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; gap: 8px; padding: 7px; background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 10px; transition: border-color .18s ease, opacity .18s ease; }
.plan-row:focus-within { border-color: rgba(85,215,232,.42); }
.plan-row.done { opacity: .66; }
.plan-row.done .plan-text { color: var(--muted); text-decoration: line-through; }
.plan-check { width: 28px; height: 28px; display: grid; place-items: center; cursor: pointer; }
.plan-check input { position: absolute; opacity: 0; pointer-events: none; }
.plan-check span { width: 21px; height: 21px; display: grid; place-items: center; color: transparent; border: 1px solid #52687a; border-radius: 6px; font-size: .72rem; font-weight: 900; transition: .15s ease; }
.plan-check input:focus-visible + span { outline: 3px solid rgba(85,215,232,.45); outline-offset: 2px; }
.plan-check input:checked + span { color: #07111f; background: var(--green); border-color: var(--green); }
.plan-text { width: 100%; min-width: 0; color: var(--text); background: transparent; border: 0; padding: 8px 4px; font-size: .82rem; }
.plan-text::placeholder { color: #657b8e; }
.plan-delete { width: 28px; height: 28px; color: var(--muted); background: transparent; border: 0; border-radius: 7px; cursor: pointer; font-size: 1.1rem; }
.plan-delete:hover { color: var(--red); background: rgba(255,122,122,.08); }
.plan-empty { min-height: 185px; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted); }
.plan-empty > span { width: 42px; height: 42px; margin-bottom: 12px; display: grid; place-items: center; color: var(--cyan); background: rgba(85,215,232,.08); border: 1px solid rgba(85,215,232,.18); border-radius: 12px; font-size: 1.4rem; }
.plan-empty strong { color: var(--text); font-size: .86rem; }
.plan-empty p { margin: 6px 0 0; font-size: .72rem; }
.add-plan-button { width: 100%; margin-top: 12px; padding: 11px; color: var(--cyan); background: rgba(85,215,232,.055); border: 1px dashed rgba(85,215,232,.32); border-radius: 10px; cursor: pointer; font-weight: 800; font-size: .78rem; }
.add-plan-button:hover { background: rgba(85,215,232,.1); border-style: solid; }
.add-plan-button span { margin-right: 5px; font-size: 1rem; }
.plan-dialog-actions { align-items: center; justify-content: space-between; border-top: 1px solid var(--line); }
.plan-dialog-actions > span { color: var(--muted); font-size: .68rem; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 50; background: #eaf5f8; color: #07111f; padding: 10px 16px; border-radius: 9px; box-shadow: 0 12px 30px rgba(0,0,0,.3); font-size: .78rem; font-weight: 700; transition: .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
  .score-grid { grid-template-columns: 1fr 1fr; }
  .verdict-card { grid-column: 1 / -1; min-height: 135px; flex-direction: row; align-items: center; }
  .workspace-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-shell { width: min(100% - 24px, 1500px); }
  .topbar { min-height: 76px; }
  .eyebrow, .save-state { display: none; }
  h1 { font-size: 1.05rem; }
  .brand-mark { width: 36px; height: 36px; }
  .mission-strip { align-items: flex-start; padding: 18px; }
  .mission-date { min-width: auto; }
  .score-grid { grid-template-columns: 1fr; }
  .verdict-card { grid-column: auto; }
  .team-grid { grid-template-columns: 1fr 1fr; }
  .panel-header { align-items: flex-start; }
  .team-panel .panel-header { flex-direction: column; }
  .week-nav { width: 100%; }
  .week-picker { flex: 1; }
  .weekly-total { grid-template-columns: 1fr 1fr; }
  .weekly-total p { grid-column: 1 / -1; text-align: left; }
  .desktop-only { display: none; }
  footer { flex-direction: column; justify-content: center; gap: 4px; align-items: flex-start; }
}
@media (max-width: 480px) {
  .mission-strip { flex-direction: column; }
  .mission-date { border-left: 0; border-top: 1px solid var(--line); padding: 12px 0 0; width: 100%; }
  .metric-number strong { font-size: 3.2rem; }
  .team-grid { grid-template-columns: 1fr; }
  .trend-summary { grid-template-columns: 1fr 1fr 1fr; }
  .name-inputs { grid-template-columns: 1fr; }
  .plan-dialog-body { padding: 16px; }
  .plan-dialog-actions { align-items: stretch; flex-direction: column; }
  .plan-dialog-actions .primary-button { width: 100%; }
}

@media print {
  :root { color-scheme: light; --bg:#fff; --panel:#fff; --panel-2:#fff; --text:#0a1622; --muted:#5e6b76; --line:rgba(0,0,0,.15); }
  body { background: #fff; }
  .app-shell { width: 100%; }
  .icon-button, .save-state, .week-nav, .history-tip, footer { display: none; }
  .score-card, .verdict-card, .panel, .mission-strip { break-inside: avoid; box-shadow: none; }
}
