/* =========================================================================
 * EnergyFlow 工作台 · 重构设计稿
 * 设计基调：暖白纸面 + 近黑行动色 + 克制的状态色
 * ========================================================================= */

/* ---------------- 设计令牌 ---------------- */
:root {
  --page: #f4f4ee;
  --surface: #ffffff;
  --surface-2: #eeeeE7;
  --surface-3: #e6e6de;
  --ink: #15171a;
  --ink-2: #565d63;
  --ink-3: #8a9197;
  --line: #e2e2da;
  --line-strong: #cbccc2;

  --accent: #17191c;
  --accent-ink: #ffffff;
  --accent-soft: #e9e9e2;

  --series-1: #2f6bdb;
  --series-1-soft: #e5ecfb;
  --status-good: #2c7a4b;
  --status-normal: #2f6bdb;
  --status-low: #b87a00;
  --status-critical: #b93a2f;
  --danger-soft: #fbeeec;

  --ring-track: #ecece4;
  --shadow: 0 1px 2px rgba(21, 23, 26, .04), 0 14px 34px rgba(21, 23, 26, .05);
  --shadow-lift: 0 18px 44px rgba(21, 23, 26, .10);

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --rail-w: 236px;
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI",
          system-ui, -apple-system, sans-serif;
}

:root[data-theme="dark"] {
  --page: #0f1110;
  --surface: #171918;
  --surface-2: #202321;
  --surface-3: #282c29;
  --ink: #f3f4ef;
  --ink-2: #a8ada9;
  --ink-3: #7b817c;
  --line: #2a2e2b;
  --line-strong: #3a3f3b;

  --accent: #f3f4ef;
  --accent-ink: #121413;
  --accent-soft: #262a27;

  --series-1: #7aa2f7;
  --series-1-soft: #1d2740;
  --status-good: #5fbf86;
  --status-normal: #7aa2f7;
  --status-low: #e0a23a;
  --status-critical: #e26a5f;
  --danger-soft: #2c1d1b;

  --ring-track: #262a27;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px rgba(0, 0, 0, .35);
  --shadow-lift: 0 20px 50px rgba(0, 0, 0, .5);
}

/* ---------------- 基础 ---------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--series-1);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection { background: var(--series-1-soft); }

/* ---------------- 应用骨架 ---------------- */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100dvh;
}

/* ---------------- 左侧导航 ---------------- */
.rail {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 26px 18px 20px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 55%, var(--page));
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px 22px;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 14px rgba(21, 23, 26, .18);
}

.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__text b { font-size: 15.5px; letter-spacing: -.01em; }
.brand__text i { font-style: normal; font-size: 11.5px; color: var(--ink-3); }

.nav { display: flex; flex-direction: column; gap: 3px; }

.nav__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 11px;
  color: var(--ink-2);
  font-size: 13.5px;
  transition: background .16s ease, color .16s ease;
}

.nav__item svg { flex: none; opacity: .9; }
.nav__item:hover { background: var(--surface-2); color: var(--ink); }

.nav__item.is-active {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 18px rgba(21, 23, 26, .12);
}

.rail__spacer { flex: 1; }

.rail__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.rail__user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.rail__user-text b { font-size: 12.5px; }
.rail__user-text i {
  display: flex; align-items: center; gap: 5px;
  font-style: normal; font-size: 11px; color: var(--ink-3);
  white-space: nowrap;
}

/* ---------------- 头像 / 圆点 ---------------- */
.avatar {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}
.avatar--sm { width: 30px; height: 30px; font-size: 12px; }
.avatar--lg { width: 56px; height: 56px; font-size: 20px; }

.dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-3);
}
.dot--good { background: var(--status-good); }

/* ---------------- 主区域 ---------------- */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 36px;
  border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--page) 82%, transparent);
  backdrop-filter: blur(14px);
}

.topbar__left { display: flex; align-items: center; gap: 18px; }
.topbar__date {
  font-size: 12.5px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar__sync { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-3); }

.topbar__right { display: flex; align-items: center; gap: 10px; }
.brand--mobile { display: none; }

.content {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 36px 56px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  transition: background .16s ease, color .16s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn--m { display: none; }

:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: none; }

/* ---------------- 页头 ---------------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 0 24px;
}

.eyebrow {
  font-size: 11.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 7px;
}

h1 {
  font-size: clamp(26px, 2.6vw, 32px);
  line-height: 1.2;
  letter-spacing: -.025em;
  font-weight: 650;
}

.page-sub {
  margin-top: 8px;
  max-width: 640px;
  color: var(--ink-2);
  font-size: 13px;
}

.page-head__actions { display: flex; align-items: center; gap: 9px; flex: none; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
  transition: transform .14s ease, background .16s ease, border-color .16s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 18px rgba(21, 23, 26, .14);
}
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--page)); }

.btn--ghost { background: transparent; border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--surface-2); }

.btn--quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--quiet:hover { background: var(--surface-2); color: var(--ink); }

.btn--danger { color: var(--status-critical); border-color: color-mix(in srgb, var(--status-critical) 35%, var(--line)); }
.btn--danger:hover { background: var(--danger-soft); }

.btn--sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn--block { width: 100%; }
.btn--icon { width: 38px; padding: 0; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px;
}

.card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card__head h2 { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.card__head--row { align-items: center; }
.card-sub { margin-top: 3px; font-size: 12px; color: var(--ink-3); }

.muted { font-size: 12px; color: var(--ink-3); }
.hint { margin-top: 12px; font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.link { font-size: 12.5px; color: var(--ink-2); border-bottom: 1px solid var(--line-strong); }
.link:hover { color: var(--ink); }

/* ---------------- 首页布局 ---------------- */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 18px;
}

/* 精力主卡 */
.hero {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 26px;
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--series-1) 7%, transparent), transparent 60%),
    var(--surface);
}

.hero__ring { position: relative; flex: none; width: 180px; height: 180px; }
.hero__ring svg { display: block; }

.hero__ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.hero__ring-text b {
  font-size: 46px;
  line-height: 1;
  letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
}
.hero__ring-text span { font-size: 11px; color: var(--ink-3); }

.hero__body { flex: 1; min-width: 0; }
.hero__top { display: flex; align-items: center; gap: 12px; }
.hero__delta { font-size: 12px; color: var(--status-good); }

.hero__lead {
  margin-top: 12px;
  font-size: 17px;
  line-height: 1.45;
  letter-spacing: -.015em;
  font-weight: 550;
  max-width: 340px;
}

.hero__stats {
  display: flex;
  gap: 30px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.hero__stats dt { font-size: 11.5px; color: var(--ink-3); }
.hero__stats dd {
  margin: 3px 0 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.hero__actions { display: flex; gap: 9px; margin-top: 20px; }

/* 状态标签 */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; background: currentColor; }
.pill--normal { color: var(--status-normal); background: color-mix(in srgb, var(--status-normal) 10%, var(--surface)); }
.pill--good { color: var(--status-good); background: color-mix(in srgb, var(--status-good) 10%, var(--surface)); }
.pill--low { color: var(--status-low); background: color-mix(in srgb, var(--status-low) 12%, var(--surface)); }
.pill--critical { color: var(--status-critical); background: color-mix(in srgb, var(--status-critical) 10%, var(--surface)); }
.pill--done { color: var(--ink-3); background: var(--surface-2); }
.pill--pending { color: var(--ink-2); background: var(--surface-2); }
.pill--local {
  height: 20px;
  padding: 0 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  vertical-align: 2px;
  margin-left: 8px;
}

/* 下一项 */
.next { display: flex; flex-direction: column; }
.next__time { margin-bottom: 6px; }
.next__clock {
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.next__title { font-size: 22px; letter-spacing: -.02em; font-weight: 620; margin-bottom: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11.5px;
  white-space: nowrap;
}

.next__impact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin: 18px 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.impact-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.impact-row span { font-size: 12px; color: var(--ink-3); }
.impact-row b { font-size: 16px; font-variant-numeric: tabular-nums; }
.next .btn { margin-top: 8px; }
.next .btn--quiet { margin-top: 2px; }

.is-warn { color: var(--status-low); }
.is-good { color: var(--status-good); }
.is-critical { color: var(--status-critical); }

/* 指标条 */
.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.tile {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.tile__label { display: block; font-size: 11.5px; color: var(--ink-3); }
.tile__value {
  display: block;
  margin-top: 6px;
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.tile__value span { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 3px; letter-spacing: 0; }
.tile__hint { display: block; margin-top: 7px; font-size: 11.5px; color: var(--ink-3); }
.tile__hint.is-up { color: var(--status-good); }

.tile__bar {
  height: 4px;
  margin-top: 12px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}
.tile__bar i { display: block; height: 100%; border-radius: 2px; background: var(--series-1); }

/* 任务列表 */
.list-card { padding: 22px 22px 8px; }

.task-table { display: flex; flex-direction: column; }

.task-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 76px 84px 96px;
  align-items: center;
  gap: 12px;
  padding: 13px 2px;
  border-top: 1px solid var(--line);
}
.task-row--head {
  border-top: 0;
  padding: 0 2px 10px;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.task-row.is-done .task-name { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1px; }
.task-row.is-next { background: color-mix(in srgb, var(--series-1) 4%, transparent); border-radius: 10px; margin: 0 -8px; padding-left: 10px; padding-right: 10px; }

.task-time { display: flex; flex-direction: column; line-height: 1.3; font-variant-numeric: tabular-nums; }
.task-time small { font-size: 10.5px; color: var(--ink-3); }
.task-name { font-size: 13.5px; font-weight: 520; display: flex; align-items: center; gap: 7px; }
.task-tag { font-size: 12px; color: var(--ink-3); }
.task-num { font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.task-state { text-align: right; }
.tag-next {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--series-1);
  background: var(--series-1-soft);
  border-radius: 5px;
  padding: 2px 6px;
}

/* ---------------- 计划页 ---------------- */
.plan-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.plan-main { min-width: 0; }
.plan-side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 78px; }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  margin-bottom: 14px;
}
.alert--warn {
  border-color: color-mix(in srgb, var(--status-low) 38%, var(--line));
  background: color-mix(in srgb, var(--status-low) 7%, var(--surface));
}
.alert__icon { flex: none; color: var(--status-low); padding-top: 1px; }
.alert__body { flex: 1; min-width: 0; }
.alert__body b { font-size: 13px; }
.alert__body p { margin-top: 3px; font-size: 12px; color: var(--ink-2); line-height: 1.55; }

.timeline { display: flex; flex-direction: column; gap: 10px; }

.plan-item {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.plan-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.plan-item.is-done { opacity: .62; }
.plan-item.is-overlap { border-left: 3px solid var(--status-low); }
.plan-item.is-rest { background: color-mix(in srgb, var(--status-good) 4%, var(--surface)); }

/* 拖动排序：整行可拖，拖动时半透明、落点用一条主色线提示插到哪里。
   不写 transition 是因为拖动过程中要跟手，动画反而显得迟钝。 */
.plan-item[draggable="true"] { cursor: grab; }
.plan-item.is-dragging { opacity: .45; cursor: grabbing; }
.plan-item.is-drop-before { box-shadow: 0 -3px 0 0 var(--accent); }
.plan-item.is-drop-after { box-shadow: 0 3px 0 0 var(--accent); }
.timeline__hint { margin-top: 10px; font-size: 11.5px; color: var(--ink-3); }

.plan-item__time { display: flex; flex-direction: column; line-height: 1.3; font-variant-numeric: tabular-nums; }
.plan-item__time b { font-size: 14px; }
.plan-item__time span { font-size: 11px; color: var(--ink-3); }

.plan-item__body { min-width: 0; }
.plan-item__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 560;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.plan-item__curve { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.curve-label { font-size: 11px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.curve-track {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}
.curve-track i { display: block; height: 100%; border-radius: 2px; background: var(--series-1); }
.curve-track i.is-warn { background: var(--status-low); }

.plan-item__impact { text-align: right; font-variant-numeric: tabular-nums; }
.plan-item__impact span { display: block; font-size: 10.5px; color: var(--ink-3); }
.plan-item__impact b { font-size: 14px; }

.plan-item__actions { display: flex; gap: 6px; }

/* 曲线图 */
.curve-chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart-value { font-size: 11px; font-weight: 600; fill: var(--ink); font-variant-numeric: tabular-nums; }
.chart-value.is-critical { fill: var(--status-critical); }
.chart-label { font-size: 10.5px; fill: var(--ink-3); }
.chart-note { font-size: 10px; fill: var(--status-critical); }
.chart-caption { margin-top: 10px; font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }

/* 建议 */
.insight-list { display: flex; flex-direction: column; gap: 14px; }
.insight-list li { display: flex; gap: 11px; }
.insight__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 650;
}
.insight__icon--warn { background: color-mix(in srgb, var(--status-low) 14%, var(--surface)); color: var(--status-low); }
.insight-list b { display: block; font-size: 12.5px; font-weight: 560; }
.insight-list p { margin-top: 2px; font-size: 11.5px; color: var(--ink-3); line-height: 1.55; }

/* ---------------- 统计页 ---------------- */
.tiles--kpi { margin-top: 0; }

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.chart-card { min-width: 0; }
.legend-single { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-3); }
.legend-single i { width: 14px; height: 2px; border-radius: 1px; background: var(--series-1); }

.trend-chart { display: block; width: 100%; height: auto; overflow: visible; }
.grid line { stroke: var(--line); stroke-width: 1; }
.axis-label text { font-size: 10.5px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.trend-dots circle { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.trend-dots .is-last { stroke-width: 2; }

.bars { display: flex; flex-direction: column; gap: 16px; padding: 8px 0 4px; }
.bar-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) 40px; align-items: center; gap: 10px; }
.bar-label { font-size: 12px; color: var(--ink-2); }
.bar-track { height: 14px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar-track i {
  display: block;
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: var(--series-1);
  min-width: 4px;
}
.bar-value { text-align: right; font-size: 12px; font-weight: 560; font-variant-numeric: tabular-nums; }

.table-view { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.table-view summary {
  cursor: pointer;
  font-size: 11.5px;
  color: var(--ink-3);
  list-style: none;
}
.table-view summary::-webkit-details-marker { display: none; }
.table-view summary::before { content: "▸ "; }
.table-view[open] summary::before { content: "▾ "; }
.table-view table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 12px; }
.table-view th, .table-view td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.table-view th { color: var(--ink-3); font-weight: 500; }
.table-view td:last-child, .table-view th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* 计划 vs 实际 */
.legend-pair { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-3); }
.legend-pair i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend-pair__plan { background: var(--surface-3); }
.legend-pair__actual { background: var(--series-1); margin-left: 8px; }

.compare { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.compare-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 96px; align-items: center; gap: 14px; }
.compare-label { font-size: 12.5px; color: var(--ink-2); }
.compare-bars { display: flex; flex-direction: column; gap: 3px; }
.compare-bar { display: block; height: 8px; border-radius: 4px; }
.compare-bar--plan { background: var(--surface-3); }
.compare-bar--actual { background: var(--series-1); }
.compare-value { font-size: 12px; text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------------- 设置页 ---------------- */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.settings-card { display: flex; flex-direction: column; }
.settings-card > .hint { margin-top: 10px; }
.settings-card--wide { grid-column: 1 / -1; }

.account { display: flex; align-items: center; gap: 16px; }
.account__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.account__info b { font-size: 16px; letter-spacing: -.01em; }
.account__info > span { font-size: 12.5px; color: var(--ink-2); }
.account__sync { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3) !important; font-size: 11.5px !important; margin-top: 3px; }
.account__actions { margin-left: auto; display: flex; gap: 8px; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.setting-row:first-of-type { border-top: 0; }
.setting-row > span:first-child { font-size: 13px; color: var(--ink-2); }
.setting-title { display: block; font-size: 13px; font-weight: 520; }
.setting-desc { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }

.input-wrap { display: inline-flex; align-items: center; gap: 6px; }
.input {
  width: 96px;
  height: 34px;
  padding: 0 10px;
  text-align: right;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  font-variant-numeric: tabular-nums;
}
.input:focus { outline: 2px solid var(--series-1); outline-offset: 0; border-color: transparent; }
.input--time { width: 118px; }
.unit { font-size: 11.5px; color: var(--ink-3); }

/* 开关 */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 2; }
.switch i {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--surface-3);
  transition: background .18s ease;
}
.switch i::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .18s ease;
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }

.data-actions { display: flex; flex-wrap: wrap; gap: 9px; }

/* 同步卡片 */
.sync-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(240px, 1fr);
  gap: 24px;
  align-items: start;
  margin-top: 12px;
}
.sync-main { min-width: 0; }

.sync-state {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  padding: 16px 16px 14px;
}
.sync-state__eyebrow {
  margin: 0 0 6px;
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.sync-state__head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.sync-state__meta { margin: 0 0 12px; display: grid; gap: 7px; }
.sync-state__meta > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sync-state__meta dt { font-size: 12px; color: var(--ink-3); }
.sync-state__meta dd {
  margin: 0;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.sync-state .btn { width: 100%; justify-content: center; }

.device-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.device {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  min-width: 0;
}
.device__glyph {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink-2);
}
.device__text { display: flex; flex-direction: column; min-width: 0; }
.device__text b { font-size: 12.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device__text i { font-style: normal; font-size: 11px; color: var(--ink-3); }
.device .pill { margin-left: auto; height: 22px; padding: 0 8px; font-size: 10.5px; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
}

/* ---------------- 移动端底栏 ---------------- */
.tabbar { display: none; }

.tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  color: var(--ink-3);
  flex: 1;
}
.tabbar__item.is-active { color: var(--ink); }
.tabbar__item.is-active svg { color: var(--series-1); }

.tabbar__item--fab { flex: 0 0 auto; }
.fab {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  margin-top: -26px;
  border-radius: 18px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 12px 26px rgba(21, 23, 26, .28);
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1080px) {
  :root { --rail-w: 76px; }
  .rail { padding: 24px 12px 18px; align-items: center; }
  .brand { padding: 0 0 22px; }
  .brand__text { display: none; }
  .nav__item { justify-content: center; padding: 12px; }
  .nav__item span { display: none; }
  .rail__user { flex-direction: column; padding: 8px; }
  .rail__user-text { display: none; }
  .hero { flex-direction: column; align-items: flex-start; gap: 18px; }
  .hero__ring { align-self: center; }
}

@media (max-width: 860px) {
  .home-grid, .plan-grid, .chart-grid { grid-template-columns: minmax(0, 1fr); }
  .plan-side { position: static; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .sync-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .device-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content { padding: 12px 22px 48px; }
  .topbar { padding: 12px 22px; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 14px; }
  .page-head__actions { width: 100%; }
}

@media (max-width: 720px) {
  .app { display: block; }
  .rail { display: none; }

  .topbar {
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--page) 92%, transparent);
  }
  .topbar__left { gap: 10px; }
  .brand--mobile { display: flex; align-items: center; gap: 8px; padding: 0; }
  .brand--mobile .brand__mark { width: 28px; height: 28px; border-radius: 9px; }
  .brand--mobile b { font-size: 14px; }
  .topbar__date { font-size: 11.5px; }
  .topbar__sync { display: none; }
  .icon-btn--m { display: grid; width: 32px; height: 32px; }
  .topbar__right .avatar { width: 30px; height: 30px; font-size: 12px; }

  .content { padding: 8px 16px calc(96px + env(safe-area-inset-bottom)); }

  .page-head { padding: 10px 0 18px; }
  h1 { font-size: 25px; }
  .page-sub { font-size: 12.5px; }
  .page-head__actions { gap: 8px; }
  .page-head__actions .btn--ghost:not(.btn--icon) { display: none; }

  .card { padding: 18px; border-radius: 18px; }

  .hero { padding: 20px; }
  .hero__ring { width: 150px; height: 150px; align-self: flex-start; }
  .hero__ring svg { width: 150px; height: 150px; }
  .hero__ring-text b { font-size: 38px; }
  .hero__lead { font-size: 15px; }
  .hero__stats { gap: 20px; }
  .hero__stats dd { font-size: 17px; }
  .hero__actions { width: 100%; }
  .hero__actions .btn { flex: 1; padding: 0 10px; }

  .next__title { font-size: 20px; }

  .tile { padding: 14px; }
  .tile__value { font-size: 22px; }

  .list-card { padding: 18px 18px 4px; }
  .task-row {
    grid-template-columns: 54px minmax(0, 1fr) auto;
    grid-template-areas:
      "time name state"
      "time meta num";
    row-gap: 4px;
    padding: 12px 0;
  }
  .task-row--head { display: none; }
  .task-time { grid-area: time; }
  .task-name { grid-area: name; }
  .task-state { grid-area: state; }
  .task-tag { grid-area: meta; }
  .task-num { grid-area: num; text-align: right; }
  .task-row.is-next { margin: 0 -6px; padding: 12px 6px; }

  .plan-item {
    grid-template-columns: 56px minmax(0, 1fr);
    align-items: start;
    padding: 14px;
    gap: 12px;
  }
  .plan-item__actions { grid-column: 1 / -1; justify-content: flex-end; }
  .plan-item__impact { grid-column: 2; text-align: left; }
  .plan-item__impact span { display: inline; margin-right: 4px; }

  .compare-row { grid-template-columns: 80px minmax(0, 1fr); }
  .compare-value { display: none; }

  .account { flex-wrap: wrap; }
  .account__actions { margin-left: 0; width: 100%; }
  .account__actions .btn { flex: 1; }

  .data-actions .btn { flex: 1 1 calc(50% - 9px); }
  .device-list { grid-template-columns: minmax(0, 1fr); }
  .device { padding: 10px 11px; }

  .tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 4px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(16px);
  }
}

@media (max-width: 380px) {
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .hero__stats { gap: 14px; }
}

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

/* =========================================================================
 * 登录页
 * ========================================================================= */
.login-page { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }

.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 48px 52px;
  background:
    radial-gradient(90% 70% at 100% 0%, rgba(120, 160, 255, .18), transparent 60%),
    radial-gradient(80% 60% at 0% 100%, rgba(90, 200, 150, .14), transparent 60%),
    #14161a;
  color: #f3f4ef;
  overflow: hidden;
}

.login-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(70% 60% at 50% 40%, #000, transparent 85%);
  pointer-events: none;
}

.login-brand > * { position: relative; z-index: 1; }

.login-brand__top { display: flex; align-items: center; gap: 11px; }
.login-brand__top .brand__mark { background: #f3f4ef; color: #14161a; box-shadow: none; }
.login-brand__top b { font-size: 15px; }
.login-brand__top span { font-size: 11.5px; color: rgba(243, 244, 239, .55); }

.login-brand__body { max-width: 460px; }
.login-brand__body h2 {
  font-size: clamp(28px, 3.2vw, 40px);
  line-height: 1.22;
  letter-spacing: -.03em;
  font-weight: 600;
  margin-bottom: 18px;
}
.login-brand__body p { font-size: 13.5px; color: rgba(243, 244, 239, .6); line-height: 1.7; }

.login-points { display: flex; flex-direction: column; gap: 14px; margin-top: 34px; }
.login-points li { display: flex; align-items: flex-start; gap: 12px; }
.login-points .tick {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  margin-top: 1px;
  border-radius: 50%;
  background: rgba(243, 244, 239, .1);
  color: #9fd6b4;
}
.login-points b { display: block; font-size: 13px; font-weight: 550; }
.login-points span { display: block; font-size: 11.5px; color: rgba(243, 244, 239, .5); margin-top: 2px; }

.login-brand__foot { font-size: 11px; color: rgba(243, 244, 239, .38); }

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  background: var(--page);
}

.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 28px; letter-spacing: -.03em; margin-bottom: 6px; }
.login-sub { font-size: 13px; color: var(--ink-2); margin-bottom: 28px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 550; color: var(--ink-2); margin-bottom: 6px; }
.field .input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  text-align: left;
  border-radius: 11px;
  font-size: 13.5px;
}
.field .input::placeholder { color: var(--ink-3); }

.login-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 20px; }
.checkbox { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--accent); }
.forgot { font-size: 12px; color: var(--ink-2); border-bottom: 1px solid var(--line-strong); }

.login-card .btn { height: 42px; border-radius: 11px; font-size: 13.5px; }

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  font-size: 11px;
  color: var(--ink-3);
}
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.login-alt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 22px;
}
.login-alt a { color: var(--ink); border-bottom: 1px solid var(--line-strong); }

.login-note {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.7;
}
.login-note b { color: var(--ink-2); font-weight: 600; }

/* 登录/注册错误提示 */
.login-error {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--status-critical) 34%, transparent);
  background: color-mix(in srgb, var(--status-critical) 10%, transparent);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 860px) {
  .login-page { grid-template-columns: minmax(0, 1fr); }
  .login-brand { padding: 30px 24px 34px; gap: 26px; }
  .login-brand__body h2 { font-size: 26px; }
  .login-brand__body p, .login-points, .login-brand__foot { display: none; }
  .login-panel { padding: 36px 22px 56px; }
}

/* ---------------- 新建任务弹窗（cloud.js 动态创建） ---------------- */
.task-state { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.task-state .btn--sm { height: 24px; padding: 0 9px; font-size: 11.5px; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal__mask {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 12, .58);
  backdrop-filter: blur(2px);
}
.modal__card {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 88vh;
  overflow: auto;
  animation: modal-in .16s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.modal__body { padding: 2px 0 0; }
.modal__card .field { margin-bottom: 12px; }
.modal__card .field .input { height: 38px; }
.modal__card select.input { appearance: none; padding-right: 28px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal__error { margin: 2px 0 0; font-size: 12px; color: var(--status-critical); }

/* ---------------- 时间范围分段控件 / 按钮禁用态 ---------------- */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.segmented__btn {
  height: 26px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.segmented__btn:hover { color: var(--ink); }
.segmented__btn.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .14);
}
.segmented__btn:focus-visible { outline: 2px solid var(--series-1); outline-offset: 1px; }

.btn:disabled,
.btn[disabled] {
  opacity: .42;
  cursor: not-allowed;
  pointer-events: none;
}

/* --------------------------------------------------- 三级反馈弹窗（完成时） */

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

.feedback-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.feedback-opt b { font-size: 15px; font-weight: 600; }
.feedback-opt span { font-size: 12.5px; color: var(--ink-3); line-height: 1.45; }

.feedback-opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.feedback-opt:active { transform: scale(.994); }
.feedback-opt.is-picked { border-color: var(--accent); background: var(--accent-soft); }
.feedback-opt[disabled] { opacity: .5; cursor: not-allowed; }
