/* Skooch 自适应日程规划助手 —— 样式
   ------------------------------------------------------------------
   视觉风格参照 Taskade（https://www.taskade.com）：
     · 近黑分层深色界面（#050505 / #0a0a0c / #18181b / #1c1e21）
     · 品牌主色为红粉 #ff2d60，辅以紫 #a767e5 / 青 #12bcfe / 绿 #4fcf70 / 黄 #fad648
     · 几何无衬线字体（Geist Sans），中文走系统中文字体
     · 大圆角、极细描边、柔和发光阴影、渐变高光
   工程约束（不得违反）：
     · 核心页面支持 360~1920 像素宽度（USR-0049）
     · 零外部依赖：不引用 CDN、在线字体或外部图片；
       Geist 不可用时回落到 system-ui，观感保持一致
     · 所有原有类名与 CSS 变量名保持不变，JS 无需改动
   ------------------------------------------------------------------ */

:root {
  color-scheme: dark;

  /* ---------- 品牌色（取自 Taskade 实际样式表） ---------- */
  --brand: #ff2d60;
  --brand-dark: #d01a45;
  --brand-soft: rgba(255, 45, 96, .14);
  --brand-line: rgba(255, 45, 96, .38);
  --brand-glow: rgba(255, 45, 96, .40);

  --violet: #a767e5;
  --cyan: #12bcfe;
  --lime: #4fcf70;
  --gold: #fad648;

  /* ---------- 背景分层（由深到浅：页面 / 卡片 / 悬浮 / 输入） ---------- */
  --bg: #0a0a0c;
  --panel: #141417;
  --panel-2: #18181b;
  --panel-3: #1c1e21;
  --input-bg: #101013;

  /* ---------- 文字与描边 ---------- */
  --ink: #fafafa;
  --ink-2: #a1a1aa;
  --ink-3: #71717a;
  --line: #26262b;
  --line-2: #34343b;

  /* ---------- 语义色 ---------- */
  --ok: #4fcf70;
  --ok-soft: rgba(79, 207, 112, .13);
  --ok-line: rgba(79, 207, 112, .34);

  --warn: #fad648;
  --warn-bg: rgba(250, 214, 72, .12);
  --warn-line: rgba(250, 214, 72, .32);

  --err: #ff5c80;
  --err-bg: rgba(255, 92, 128, .12);
  --err-line: rgba(255, 92, 128, .34);

  --info-soft: rgba(18, 188, 254, .12);
  --info-line: rgba(18, 188, 254, .30);

  /* ---------- 形制 ---------- */
  --radius: 12px;
  --radius-sm: 9px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-2: 0 8px 28px rgba(0, 0, 0, .45);
  --shadow-3: 0 24px 64px rgba(0, 0, 0, .6);

  --font-ui: "Geist", "Geist Sans", "Segoe UI Variable Display", system-ui,
             -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-cn: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB",
             "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", "Cascadia Mono",
               "Liberation Mono", "Courier New", monospace;

  /* ---------- 图表专用令牌（Canvas 通过 getComputedStyle 读取） ---------- */
  --energy-grid: #26262b;
  --energy-text: #71717a;
  --energy-ring: rgba(255, 255, 255, .85);

  /* ---------- 任务优先级 ----------
     深色底上提高明度与饱和度以保证可辨识；各级仍保持同明度梯度。
     P5 用品牌红系，向下过渡到青绿与中性灰。 */
  --p5: #ff2d60; --p4: #fad648; --p3: #12bcfe; --p2: #4fcf70; --p1: #8b8b96;
  --p5-soft: rgba(255, 45, 96, .16); --p4-soft: rgba(250, 214, 72, .15);
  --p3-soft: rgba(18, 188, 254, .15); --p2-soft: rgba(79, 207, 112, .15);
  --p1-soft: rgba(139, 139, 150, .16);
}

* { box-sizing: border-box; }

/* 必须保留：hidden 属性依赖浏览器默认的 display:none，而作者样式里的
   display:grid/flex 会覆盖它（例如 .auth-form、.drawer、[hidden] 的视图），
   导致「隐藏」的元素仍然可见。这里显式声明，使 hidden 始终生效。 */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui), var(--font-cn);
  font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 中文单独指定字体，避免几何无衬线字体缺中文字形时观感断裂 */
:lang(zh), body { font-family: var(--font-ui); }
h1, h2, h3, h4, strong, b { font-family: var(--font-ui); letter-spacing: -.01em; }

button, input, select, textarea { font: inherit; color: inherit; }

/* 焦点可见性：深色界面下用品牌色描边，兼顾键盘可达 */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* 滚动条与深色主题协调 */
* { scrollbar-width: thin; scrollbar-color: #3a3a42 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #34343b; border-radius: 8px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: #45454e; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- 登录页 */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem;
  background:
    radial-gradient(1100px 640px at 8% -14%, rgba(255, 45, 96, .34), transparent 58%),
    radial-gradient(920px 600px at 96% 4%, rgba(167, 103, 229, .30), transparent 56%),
    radial-gradient(880px 560px at 52% 112%, rgba(18, 188, 254, .20), transparent 58%),
    radial-gradient(600px 400px at 0% 100%, rgba(79, 207, 112, .12), transparent 60%),
    #08080a;
}
/* 细密网格纹理：增强「工作台」质感，纯 CSS 实现，无外部图片 */
.auth-wrap::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .028) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(720px 520px at 50% 44%, #000 8%, transparent 78%);
  -webkit-mask-image: radial-gradient(720px 520px at 50% 44%, #000 8%, transparent 78%);
}
.auth-card {
  position: relative;
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(30, 30, 36, .92), rgba(18, 18, 22, .95));
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3), 0 0 0 1px rgba(255, 45, 96, .07), 0 0 90px rgba(255, 45, 96, .13);
  padding: 2.1rem 1.8rem;
  backdrop-filter: blur(18px);
}
/* 卡片顶部高光：Taskade 风格的渐变细线 */
.auth-card::before {
  content: ""; position: absolute; left: 18%; right: 18%; top: -1px; height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--brand), var(--violet), transparent);
  border-radius: var(--radius-pill);
}
.auth-card h1 {
  margin: 0; font-size: 2.2rem; letter-spacing: -.035em; font-weight: 800;
  background: linear-gradient(96deg, #ffffff 6%, var(--brand) 52%, var(--violet) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--brand);
}
.auth-card .sub { margin: .35rem 0 1.4rem; color: var(--ink-2); font-size: .92rem; }

.tabs {
  display: flex; gap: .35rem; margin-bottom: 1.1rem;
  background: var(--input-bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .22rem;
}
.tab {
  flex: 1; padding: .5rem; border: 0; background: transparent; color: var(--ink-2);
  border-radius: 7px; cursor: pointer; font-weight: 500;
  transition: background .16s, color .16s;
}
.tab:hover { color: var(--ink); }
.tab.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; font-weight: 600;
  box-shadow: 0 4px 16px var(--brand-glow);
}

.auth-form { display: grid; gap: .85rem; }
.auth-form label { display: grid; gap: .35rem; font-size: .88rem; color: var(--ink-2); }

input, select, textarea {
  width: 100%; padding: .55rem .7rem;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--ink);
  transition: border-color .16s, box-shadow .16s, background .16s;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, select:hover, textarea:hover { border-color: #45454e; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
select option { background: var(--panel-2); color: var(--ink); }

/* ---------------------------------------------------------------- 按钮 */
.btn {
  padding: .52rem .95rem;
  border: 1px solid var(--line-2);
  background: var(--panel-3);
  color: var(--ink);
  border-radius: var(--radius-sm);
  cursor: pointer; white-space: nowrap; font-weight: 500;
  transition: background .16s, border-color .16s, transform .08s, box-shadow .16s;
}
.btn:hover { background: #26262b; border-color: #45454e; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-color: transparent; color: #fff; font-weight: 600;
  box-shadow: 0 4px 18px var(--brand-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #ff456f 0%, #e01c4b 100%);
  box-shadow: 0 6px 24px var(--brand-glow);
}
.btn-primary:disabled, .btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(255, 255, 255, .06); color: var(--ink); }
.btn-sm { padding: .28rem .55rem; font-size: .84rem; }

/* ---------------------------------------------------------------- 主布局 */
.brand strong { font-size: 1.15rem; }
.brand span { color: var(--ink-2); margin-left: .5rem; font-size: .85rem; }
.user-box { margin-left: auto; display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.sync-status { color: var(--ink-3); font-size: .8rem; }

.view { padding: 1.25rem; max-width: 1680px; margin: 0 auto; width: 100%; box-sizing: border-box; }
h2 { font-size: 1.15rem; margin: 1.35rem 0 .6rem; font-weight: 700; letter-spacing: -.02em; }
h3 { font-size: 1rem; margin: .85rem 0 .55rem; font-weight: 600; }
.hint { color: var(--ink-3); font-size: .84rem; }

/* ---------------------------------------------------------------- 工具条 */
.toolbar {
  display: flex; gap: .5rem .75rem; flex-wrap: wrap; align-items: center;
  justify-content: space-between; margin-bottom: .9rem;
}
.toolbar-group { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
/* 算法下拉不要吃掉整行：限制宽度，避免把按钮挤到右侧远处 */
.toolbar select { max-width: 13rem; }
.range-label { font-weight: 600; margin-left: .25rem; white-space: nowrap; color: var(--ink); }
.seg {
  display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--input-bg); padding: .18rem; gap: .18rem;
}
.seg-btn {
  padding: .38rem .72rem; border: 0; background: transparent; color: var(--ink-2);
  cursor: pointer; border-radius: 6px; font-weight: 500;
  transition: background .16s, color .16s;
}
.seg-btn:hover { color: var(--ink); background: rgba(255, 255, 255, .05); }
.seg-btn.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; font-weight: 600; box-shadow: 0 2px 10px var(--brand-glow);
}
/* 中等宽度下优先让工具条保持单行，把两组合并压缩 */
@media (max-width: 1500px) {
  .toolbar { gap: .35rem .5rem; }
  .toolbar .btn { padding: .42rem .62rem; font-size: .9rem; }
  .toolbar select { max-width: 11rem; font-size: .88rem; }
}

/* ---------------------------------------------------------------- 指标条 */
.metric-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .7rem; margin-bottom: .9rem;
}
.metric {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .015));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .75rem .9rem;
  overflow: hidden;
  transition: border-color .18s, transform .18s;
}
.metric::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--brand), var(--violet));
  opacity: .85;
}
.metric:hover { border-color: var(--line-2); transform: translateY(-1px); }
.metric .k { color: var(--ink-2); font-size: .78rem; letter-spacing: .01em; }
.metric .v { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; }
.metric .v.ok { color: var(--ok); }
.metric .v.warn { color: var(--warn); }

/* ---------------------------------------------------------------- 日历 */
.cal-wrap {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-1);
}
.cal-head { display: flex; border-bottom: 1px solid var(--line-2); background: var(--panel-2); }
.cal-head .gutter { width: 56px; flex: 0 0 56px; }
.cal-head .day-head {
  flex: 1; text-align: center; padding: .5rem .2rem; font-size: .84rem;
  border-left: 1px solid var(--line); color: var(--ink-2); font-weight: 500;
}
.cal-head .day-head.today {
  background: var(--brand-soft); color: #fff; font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--brand);
}
/* 周末列表头区分（改进方案 2.0 日程视图优化） */
.cal-head .day-head.weekend { background: rgba(167, 103, 229, .09); }
.cal-head .day-head.weekend.today { background: var(--brand-soft); }
.cal-body { display: flex; max-height: 66vh; overflow-y: auto; }
.cal-body .gutter { width: 56px; flex: 0 0 56px; }
.cal-body .gutter .hour {
  height: 60px; font-size: .72rem; color: var(--ink-3);
  text-align: right; padding-right: .45rem; border-bottom: 1px solid var(--line);
}
.cal-cols { display: flex; flex: 1; }
.cal-col { flex: 1; position: relative; border-left: 1px solid var(--line); min-width: 0; }
.cal-col .slot-line { height: 30px; border-bottom: 1px solid #1c1c20; }
.cal-col .slot-line.hour { border-bottom-color: var(--line); }
/* 已过去的时段淡化；整天已过去再加一层整体遮罩（改进方案 2.0） */
.cal-col .slot-line.is-past { background: repeating-linear-gradient(
  135deg, rgba(255,255,255,.022) 0 4px, rgba(255,255,255,.045) 4px 8px); }
.cal-col.is-past-day { background: rgba(255, 255, 255, .022); }
/* 当前时间指示线 */
.cal-col .now-line {
  position: absolute; left: 0; right: 0; height: 0;
  border-top: 2px solid var(--brand); z-index: 5; pointer-events: none;
  box-shadow: 0 0 10px var(--brand-glow);
}
.cal-col .now-line::before {
  content: ""; position: absolute; left: -4px; top: -4px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
  box-shadow: 0 0 8px var(--brand-glow);
}
.task-block {
  position: absolute; left: 2px; right: 2px; border-radius: 7px;
  padding: 3px 6px; font-size: .74rem; line-height: 1.28; overflow: hidden;
  color: #fff; cursor: pointer;
  border-left: 3px solid rgba(0, 0, 0, .35);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
  transition: filter .15s, transform .12s;
}
.task-block:hover { filter: brightness(1.14); transform: translateX(1px); }
.task-block .t-name { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-block .t-meta { opacity: .92; }
.task-block.p5 { background: linear-gradient(135deg, #ff2d60, #c81e46); }
.task-block.p4 { background: linear-gradient(135deg, #f5c93a, #c99a12); }
.task-block.p3 { background: linear-gradient(135deg, #12bcfe, #0b7fb0); }
.task-block.p2 { background: linear-gradient(135deg, #4fcf70, #2c8f47); }
.task-block.p1 { background: linear-gradient(135deg, #8b8b96, #5c5c66); }
.task-block.p4, .task-block.p2 { color: #0a0a0c; }
.task-block.is-fixed { outline: 2px dashed rgba(255, 255, 255, .8); outline-offset: -3px; }
.task-block.is-locked::after { content: "🔒"; position: absolute; top: 1px; right: 4px; font-size: .7rem; }

.legend { margin: .6rem 0 0; color: var(--ink-2); font-size: .8rem; display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.dot.p5 { background: var(--p5); } .dot.p4 { background: var(--p4); }
.dot.p3 { background: var(--p3); } .dot.p2 { background: var(--p2); }
.dot.p1 { background: var(--p1); }
.dot.fixed { background: transparent; border: 2px dashed var(--ink-2); }
.dot.locked { background: var(--ink-2); }

/* ---------------------------------------------------------------- 通用 */
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; align-items: start; }
.col { min-width: 0; }
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .012));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .95rem;
  margin-bottom: .85rem;
  transition: border-color .18s;
}
.card:hover { border-color: var(--line-2); }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; }
.row label { display: inline-flex; align-items: center; gap: .35rem; }
.inline-check { display: flex; align-items: center; gap: .45rem; }
.inline-check input { width: auto; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.grid-form label { display: grid; gap: .3rem; font-size: .87rem; color: var(--ink-2); }
.grid-form .full { grid-column: 1 / -1; }
.fixed-times { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem; margin: .6rem 0 0; }
legend { font-size: .84rem; color: var(--ink-2); padding: 0 .35rem; }

/* 复选框与单选框：深色下用强调色 */
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }

.banner { padding: .7rem .9rem; border-radius: var(--radius-sm); margin-bottom: .85rem; font-size: .89rem; }
.banner-warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn); }
.banner-err { background: var(--err-bg); border: 1px solid var(--err-line); color: var(--err); }
.banner-ok { background: var(--ok-soft); border: 1px solid var(--ok-line); color: var(--ok); }
.global-msg {
  padding: .7rem 1.25rem; font-size: .89rem;
  background: var(--info-soft); border-bottom: 1px solid var(--info-line); color: var(--cyan);
}
.global-msg.err { background: var(--err-bg); border-bottom-color: var(--err-line); color: var(--err); }
.global-msg.warn { background: var(--warn-bg); border-bottom-color: var(--warn-line); color: var(--warn); }
.msg { margin-top: .8rem; padding: .6rem .8rem; border-radius: var(--radius-sm); font-size: .87rem; }
.msg.err { background: var(--err-bg); color: var(--err); border: 1px solid var(--err-line); }
.msg.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok-line); }

/* ---------------------------------------------------------------- 表格 */
.table-scroll {
  overflow-x: auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 720px; }
.data-table th, .data-table td {
  padding: .6rem .75rem; border-bottom: 1px solid var(--line);
  text-align: left; vertical-align: middle;
}
.data-table th {
  background: var(--panel-2); font-weight: 600; white-space: nowrap;
  color: var(--ink-2); font-size: .82rem; letter-spacing: .02em;
}
.data-table tbody tr { transition: background .14s; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, .028); }
.data-table tr:last-child td { border-bottom: 0; }
.tag {
  display: inline-block; padding: .14rem .5rem; border-radius: var(--radius-pill);
  font-size: .76rem; background: rgba(255, 255, 255, .07);
  color: var(--ink-2); border: 1px solid var(--line-2);
}
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.tag.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.tag.err { background: var(--err-bg); color: var(--err); border-color: var(--err-line); }

/* ---------------------------------------------------------------- NLP */
.nlp-result { margin-top: .85rem; }
.nlp-item {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .8rem; margin-bottom: .6rem;
  transition: border-color .18s;
}
.nlp-item:hover { border-color: var(--line-2); }
.nlp-item.low { border-color: var(--warn-line); background: rgba(250, 214, 72, .05); }
.nlp-field { display: flex; gap: .6rem; align-items: center; margin: .35rem 0; font-size: .87rem; }
.nlp-field .label { min-width: 5.5rem; color: var(--ink-2); }
.low-flag { color: var(--warn); font-size: .77rem; }

/* ---------------------------------------------------------------- 图形与提示 */
canvas {
  width: 100%; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); cursor: crosshair;
}
.drawer { position: fixed; inset: 0; background: rgba(0, 0, 0, .68); z-index: 40; display: flex; justify-content: flex-end; backdrop-filter: blur(3px); }
.drawer-panel {
  width: min(460px, 100%); background: var(--panel-2); height: 100%;
  overflow-y: auto; padding: 1.35rem; position: relative;
  border-left: 1px solid var(--line-2); box-shadow: var(--shadow-3);
}
.drawer-close {
  position: absolute; top: .6rem; right: .7rem; border: 0; background: transparent;
  font-size: 1.5rem; cursor: pointer; line-height: 1; color: var(--ink-2);
  border-radius: var(--radius-sm); width: 2rem; height: 2rem;
}
.drawer-close:hover { background: rgba(255, 255, 255, .07); color: var(--ink); }
.toast {
  position: fixed; left: 50%; bottom: 1.75rem; transform: translateX(-50%);
  background: var(--panel-3); color: var(--ink);
  border: 1px solid var(--line-2);
  padding: .7rem 1.1rem; border-radius: var(--radius);
  z-index: 60; max-width: min(560px, 92vw); font-size: .9rem;
  box-shadow: var(--shadow-3);
}
.toast.err { background: #2a1017; border-color: var(--err-line); color: var(--err); }
.toast.ok { background: #0f2418; border-color: var(--ok-line); color: var(--ok); }
.score-bar { height: 8px; background: rgba(255, 255, 255, .08); border-radius: var(--radius-pill); overflow: hidden; margin-top: .3rem; }
.score-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--violet)); }

/* 解析引擎状态标签：必须如实反映「已配置 / 未配置」，不得写死文案 */
.engine-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .28rem .7rem; border-radius: var(--radius-pill);
  font-size: .81rem; border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .06); color: var(--ink-2);
}
.engine-chip::before { content: "●"; font-size: .68rem; line-height: 1; }
.engine-on { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.engine-off { background: rgba(255, 255, 255, .06); border-color: var(--line-2); color: var(--ink-2); }
.engine-unknown { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }

/* ---------------------------------------------------------------- 响应式 */
/* ============================== 导航与侧边栏 ============================== */
.shell { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  flex: 0 0 236px; width: 236px;
  background:
    radial-gradient(420px 260px at 0% 0%, rgba(255, 45, 96, .13), transparent 62%),
    radial-gradient(360px 300px at 100% 100%, rgba(167, 103, 229, .11), transparent 62%),
    #0e0e11;
  color: #d4d4d8; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 30;
  border-right: 1px solid var(--line);
}
.sidebar .brand { padding: 1.15rem 1rem .95rem; border-bottom: 1px solid var(--line); }
.sidebar .brand strong {
  display: block; font-size: 1.3rem; font-weight: 800; letter-spacing: -.03em;
  background: linear-gradient(96deg, #fff 10%, var(--brand) 62%, var(--violet) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--brand);
}
.sidebar .brand span { display: block; font-size: .75rem; color: var(--ink-3); margin-top: .2rem; }

.side-nav { display: flex; flex-direction: column; gap: .2rem; padding: .8rem .65rem; flex: 1; }
.side-nav .nav-btn {
  display: flex; align-items: center; gap: .65rem;
  padding: .62rem .75rem; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: #a1a1aa; cursor: pointer;
  font-size: .94rem; font-weight: 500; text-align: left; position: relative;
  transition: background .16s, color .16s;
}
.side-nav .nav-btn i {
  font-style: normal; width: 1.2rem; text-align: center;
  font-size: .95rem; opacity: .9;
}
.side-nav .nav-btn:hover { background: rgba(255, 255, 255, .06); color: var(--ink); }
.side-nav .nav-btn.active {
  background: linear-gradient(135deg, rgba(255, 45, 96, .20), rgba(167, 103, 229, .16));
  color: #fff; font-weight: 600;
  border: 1px solid var(--brand-line);
  box-shadow: 0 2px 14px rgba(255, 45, 96, .18);
}
.side-nav .nav-btn.active::before {
  content: ""; position: absolute; left: -.65rem; top: 22%; bottom: 22%;
  width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--brand), var(--violet));
  box-shadow: 0 0 10px var(--brand-glow);
}

.side-foot { padding: .8rem .65rem 1.1rem; border-top: 1px solid var(--line); }
.side-foot .btn-block {
  width: 100%; justify-content: center; margin-bottom: .6rem;
  background: linear-gradient(135deg, rgba(255, 45, 96, .16), rgba(167, 103, 229, .13));
  border-color: var(--brand-line); color: #fff; font-weight: 600;
}
.side-foot .btn-block:hover {
  background: linear-gradient(135deg, rgba(255, 45, 96, .26), rgba(167, 103, 229, .20));
}
.side-user { display: flex; align-items: center; justify-content: space-between; gap: .45rem; font-size: .87rem; }
.side-user #whoami { color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .sync-status { display: block; margin-top: .5rem; font-size: .73rem; color: var(--ink-3); }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; box-sizing: border-box; }

/* 侧边栏折叠（窄屏）：改为顶部横向，保证 360 像素可用（USR-0049） */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar {
    position: static; height: auto; width: 100%; flex: 0 0 auto;
    background: var(--panel-2); color: var(--ink);
    border-right: 0; border-bottom: 1px solid var(--line);
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: .35rem; padding: .45rem .65rem;
  }
  .sidebar .brand { border: 0; padding: .2rem .45rem .2rem 0; }
  .sidebar .brand strong {
    font-size: 1.08rem;
    -webkit-text-fill-color: var(--brand); background: none;
  }
  .sidebar .brand span { display: none; }
  .side-nav { flex-direction: row; flex-wrap: wrap; padding: 0; flex: 1 1 auto; gap: .25rem; }
  .side-nav .nav-btn { padding: .42rem .65rem; color: var(--ink-2); font-size: .87rem; border-radius: var(--radius-sm); }
  .side-nav .nav-btn i { display: none; }
  .side-nav .nav-btn.active { color: #fff; }
  .side-nav .nav-btn.active::before { display: none; }
  .side-foot { border: 0; padding: 0; display: flex; align-items: center; gap: .5rem; }
  .side-foot .btn-block { width: auto; margin: 0; background: var(--panel-3); border-color: var(--line-2); color: var(--ink); }
  .side-foot .sync-status { display: none; }
}

/* ============================== 精力画像前置卡片 ============================== */
.energy-hero {
  position: relative;
  background:
    radial-gradient(620px 200px at 6% 0%, rgba(255, 45, 96, .16), transparent 66%),
    radial-gradient(520px 220px at 94% 100%, rgba(18, 188, 254, .12), transparent 66%),
    linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .015));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: .95rem 1.1rem 1.1rem; margin-bottom: 1rem;
  box-shadow: var(--shadow-1);
}
.energy-hero-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.energy-hero-head h2 { margin: 0; font-size: 1.05rem; }
.energy-hero-body { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; }
.energy-hero-chart { flex: 1 1 340px; min-width: 240px; }
.energy-hero-chart canvas { border: 0; background: transparent; cursor: default; }
.energy-hero-meta { flex: 0 1 250px; font-size: .87rem; }
.energy-hero-meta .k { color: var(--ink-2); }
.energy-hero-meta .big {
  font-size: 1.2rem; font-weight: 700; letter-spacing: -.02em;
  background: linear-gradient(96deg, var(--brand), var(--violet));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--brand);
}
.energy-hero-meta .empty { color: var(--warn); }
.energy-hero-meta ul { margin: .35rem 0 0; padding-left: 1.15rem; }

/* ============================== 弹窗 ============================== */
.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .7); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  backdrop-filter: blur(3px);
}
.modal-panel {
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  width: min(680px, 100%);
  max-height: 88vh; overflow-y: auto; padding: 1.25rem 1.4rem 1.4rem;
  box-shadow: var(--shadow-3);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; }
.modal-close {
  border: 0; background: transparent; font-size: 1.5rem; line-height: 1;
  cursor: pointer; color: var(--ink-2);
  border-radius: var(--radius-sm); width: 2rem; height: 2rem;
}
.modal-close:hover { background: rgba(255, 255, 255, .07); color: var(--ink); }
.modal .quiz-item { padding: .6rem 0; border-bottom: 1px solid var(--line); }
.modal .quiz-item:last-child { border-bottom: 0; }
.modal .quiz-item .q-dim {
  font-size: .71rem; color: var(--violet);
  background: rgba(167, 103, 229, .14); border: 1px solid rgba(167, 103, 229, .3);
  border-radius: var(--radius-pill); padding: .06rem .45rem; margin-right: .4rem;
}
.modal .quiz-item .q-scale { display: flex; justify-content: space-between; font-size: .73rem; color: var(--ink-3); }

/* 问卷滑杆：统一浏览器默认外观为品牌色 */
.modal .quiz-item input[type="range"] { width: 100%; accent-color: var(--brand); }

/* ============================== 响应式 ============================== */
@media (max-width: 720px) {
  .grid-form, .fixed-times { grid-template-columns: 1fr; }
  .view { padding: .7rem; }
  .cal-head .day-head { font-size: .72rem; padding: .35rem .1rem; }
  .cal-wrap { font-size: .8rem; }
  .cal-head .gutter, .cal-body .gutter { width: 42px; flex: 0 0 42px; }
  .cal-body .gutter .hour { height: 48px; }
  .cal-col .slot-line { height: 24px; }
  .energy-hero-body { gap: .6rem; }

  /* 小屏必须能横向放下：工具条与指标条改为纵向堆叠，去掉会把页面撑宽的固定最小宽 */
  .shell, .content { overflow-x: hidden; }
  /* 侧边栏折叠时，其中的按钮在 360~430px 下也允许整行排列 */
  .side-foot { flex-wrap: wrap; }
  .toolbar { flex-direction: column; align-items: stretch; gap: .45rem; }
  .toolbar-group { flex-wrap: wrap; }
  .toolbar-group:last-child { justify-content: flex-start; }
  .toolbar select { max-width: 100%; width: 100%; }
  .toolbar .btn { flex: 0 1 auto; }
  .metric-strip { grid-template-columns: minmax(0, 1fr); gap: .5rem; }
  .metric { padding: .6rem .7rem; }
  .metric .k { font-size: .74rem; }
  .metric .v { font-size: 1.15rem; }
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .energy-hero { padding: .8rem .85rem .9rem; }
  .energy-hero-head h2 { font-size: .97rem; }
  .energy-hero-chart, .energy-hero-meta { flex: 1 1 100%; min-width: 0; }
  .energy-hero-chart canvas { width: 100%; }
  .modal-panel { padding: 1rem 1rem 1.1rem; }
  .side-foot .side-user { font-size: .81rem; }
  h2 { font-size: 1.02rem; }
}
/* 极窄屏（<=380px）：进一步压缩，保证 360px 可用（USR-0049） */
@media (max-width: 380px) {
  .view { padding: .5rem; }
  .seg-btn { padding: .34rem .5rem; font-size: .81rem; }
  .toolbar .btn { padding: .36rem .52rem; font-size: .81rem; }
  .energy-hero-head { flex-wrap: wrap; }
}
@media (min-width: 1920px) {
  .view { max-width: 1720px; }
  .sidebar { flex-basis: 256px; width: 256px; }
}

/* 尊重「减少动态效果」的系统设置 */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
