/* FDE@EsunL · 橘秘 —— 沿用 JuMi 设计 token 与组件规范，新增深色皮肤与三屏大屏布局 */
:root {
  /* 交互色：电光蓝 */
  --primary: #536DFF;
  --primary-dark: #3E52D9;
  --primary-soft: #EDF0FF;
  /* 品牌色：橘 */
  --brand: #DC5A22;
  --brand-dark: #B24A1C;
  --brand-soft: #FCF0E9;
  /* 结构色 */
  --ink: #202938;
  --ink-2: #48546A;
  --ink-3: #6B768A;
  --line: #E5E8EE;
  --line-strong: #D3D9E3;
  --bg: #FFFFFF;
  --card: #FFFFFF;
  --inset: #F7F8FA;
  --nav-bg: #151B2B;
  --warn: #B56A16;
  --warn-soft: #FBEFDD;
  --danger: #C8483D;
  --danger-soft: #FBECEA;
  --ok: #2F8A68;
  --ok-soft: #E6F1EB;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(32, 41, 56, .04);
  --topbar-h: 56px;
}
html[data-theme="dark"] {
  --primary: #7D90FF;
  --primary-dark: #A5B1FF;
  --primary-soft: rgba(125, 144, 255, .17);
  --brand: #F0743C;
  --brand-dark: #F68C5E;
  --brand-soft: rgba(240, 116, 60, .18);
  --ink: #E8ECF6;
  --ink-2: #A9B3C7;
  --ink-3: #76829B;
  --line: #28303F;
  --line-strong: #3A4457;
  --bg: #0F1420;
  --card: #171E2E;
  --inset: #121828;
  --nav-bg: #0A0E18;
  --warn: #E2A85C;
  --warn-soft: rgba(226, 168, 92, .15);
  --danger: #E4756B;
  --danger-soft: rgba(228, 117, 107, .15);
  --ok: #5BB894;
  --ok-soft: rgba(91, 184, 148, .15);
  --shadow: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink); min-height: 100vh;
  font: 14px/1.6 "Inter", "Manrope", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -3px; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* ---------- 基础控件（沿用 JuMi） ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 8px 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  border-radius: 9px; cursor: pointer; white-space: nowrap; transition: .15s;
}
.btn:hover { border-color: var(--line-strong); color: var(--ink); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--inset); }
.icon-btn { background: transparent; border: 0; color: var(--ink-3); cursor: pointer; padding: 6px; border-radius: 8px; line-height: 0; }
.icon-btn:hover { background: var(--inset); color: var(--ink); }
.hint { color: var(--ink-3); font-size: 12px; line-height: 1.7; }
.msg { font-size: 12px; color: var(--danger); min-height: 18px; margin-top: 10px; }
input, textarea, select {
  display: block; width: 100%; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--ink); outline: none; transition: .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { resize: vertical; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.badge.muted { background: var(--inset); color: var(--ink-3); font-weight: 500; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--primary-soft); color: var(--primary-dark); }
.badge.brand { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- 登录屏（沿用 JuMi gate） ---------- */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.gate-card { width: 100%; max-width: 404px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: var(--shadow), 0 18px 44px rgba(32,41,56,.07); }
.gate-logo { display: block; width: 168px; height: auto; }
.gate-lead { color: var(--ink-2); font-size: 13.5px; margin-top: 16px; line-height: 1.7; }
.gate-lead span { display: block; }
.gate-card h2 { margin: 24px 0 14px; font-size: 16px; }
.gate-card .btn { width: 100%; margin-top: 10px; }

/* ---------- 顶栏：JuMi 字标 + 场景导航 ---------- */
#app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  flex: none; height: var(--topbar-h); display: flex; align-items: center; gap: 14px;
  padding: 0 18px; border-bottom: 1px solid var(--line); background: var(--card);
}
.brand-wordmark { height: 26px; width: auto; display: block; }
.wm-dark { display: none; }
html[data-theme="dark"] .wm-dark { display: block; }
html[data-theme="dark"] .wm-light { display: none; }
.brand-divider { width: 1px; height: 22px; background: var(--line-strong); }
.tabs { display: flex; gap: 4px; background: var(--inset); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tab {
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
  padding: 5px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 550; transition: .15s;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.tab b { font-weight: 700; color: var(--ink-3); }
.tab:hover { color: var(--ink); }
.tab.active { background: var(--card); color: var(--ink); font-weight: 650; box-shadow: var(--shadow); }
.tab.active b { color: var(--brand); }
.topbar .spacer { flex: 1; }
.topbar .tb-stat { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.live { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); vertical-align: middle; animation: jumi-pulse 1.6s ease-in-out infinite; }
@keyframes jumi-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .28; } }
.tb-count { font-weight: 600; color: var(--brand-dark); background: var(--brand-soft); border-radius: 20px; padding: 1px 9px; font-size: 12px; }

/* ---------- 三屏切换 ---------- */
.screens { flex: 1; min-height: 0; position: relative; }
.screen { position: absolute; inset: 0; padding: 14px; display: none; }
.screen.active { display: block; }
.screen-grid { height: 100%; display: grid; gap: 12px; min-height: 0; }
.g1 { grid-template-columns: 400px minmax(0, 1fr) 380px; }
.g2 { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.g3 { grid-template-columns: 380px minmax(0, 1.4fr) 340px; }

/* ---------- Pane（屏内分区） ---------- */
.pane { min-height: 0; display: flex; flex-direction: column; background: var(--inset); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.pane-head { flex: none; padding: 13px 15px 6px; display: flex; align-items: flex-start; gap: 9px; }
.pane-tick { flex: none; width: 3px; height: 26px; border-radius: 2px; margin-top: 3px; background: var(--primary); }
.pane-tick.brand { background: var(--brand); }
.pane-tick.ok { background: var(--ok); }
.pane-head h2 { font-size: 15px; font-weight: 650; line-height: 1.4; }
.pane-head .head-extra { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.pane-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 9px; padding: 8px 14px 14px; overflow: hidden; }
.block-label { font-size: 11px; font-weight: 600; color: var(--ink-2); letter-spacing: .4px; display: flex; align-items: center; gap: 5px; }
.scroll { min-height: 0; overflow-y: auto; scrollbar-width: thin; }

/* ---------- 屏① KPI ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; flex: none; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.kpi b { display: block; font-size: 18px; font-weight: 650; letter-spacing: -.3px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi span { display: block; font-size: 10.5px; color: var(--ink-3); margin-top: 1px; white-space: nowrap; }
.kpi.alert b { color: var(--danger); }
.kpi.brand b { color: var(--brand); }

/* ---------- 屏① 投喂 ---------- */
.feed-box { flex: none; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; }
.feed-box textarea { font-size: 12.5px; line-height: 1.6; min-height: 64px; border-radius: 8px; }
.feed-foot { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.feed-foot .hint { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bias-row { display: flex; gap: 6px; flex: none; flex-wrap: wrap; }
.bias-row .badge { font-size: 11.5px; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.card.accent-brand { border-left: 2px solid var(--brand); }
.card.accent-info { border-left: 2px solid var(--primary); }
.card.accent-warn { border-left: 2px solid var(--warn); }
.card.accent-danger { border-left: 2px solid var(--danger); }
.card.accent-ok { border-left: 2px solid var(--ok); }
.opp-line { display: flex; align-items: center; gap: 7px; }
.opp-line h3 { font-size: 13px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp-line .amount { font-size: 12.5px; font-weight: 650; color: var(--brand-dark); white-space: nowrap; }
.opp-meta { display: flex; align-items: center; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.opp-meta .badge { font-size: 10.5px; padding: 1px 7px; }
.opp-sub { margin-top: 5px; font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp-sub.warn { color: var(--warn); }
#opp-list .card { cursor: pointer; transition: .15s; }
#opp-list .card:hover { border-color: var(--line-strong); }
#opp-list .card + .card { margin-top: 8px; }

/* 草稿卡 */
.draft-card { border-left: 2px solid var(--brand); }
.draft-card.task { border-left-color: var(--primary); }
.draft-card.uncertain { border-left-color: var(--warn); }
.draft-card + .draft-card { margin-top: 8px; }
.draft-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.draft-top h3 { font-size: 12.5px; font-weight: 650; flex: 1; min-width: 0; }
.draft-sub { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.draft-digest { margin-top: 6px; font-size: 11.5px; color: var(--ink-2); background: var(--inset); border-radius: 8px; padding: 7px 9px; line-height: 1.65; max-height: 66px; overflow: hidden; }
.draft-actions { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.draft-actions .spacer { flex: 1; }

/* ---------- 屏① 阶段漏斗 ---------- */
.funnel { flex: none; display: flex; flex-direction: column; gap: 4px; }
.funnel-row { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.funnel-row .f-label { flex: none; width: 92px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.funnel-row .f-barwrap { flex: 1; height: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.funnel-row .f-bar { height: 100%; background: var(--primary); border-radius: 3px; min-width: 2px; }
.funnel-row.total .f-bar { background: var(--brand); }
.funnel-row .f-val { flex: none; width: 74px; text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.funnel-row.total .f-val { color: var(--brand-dark); font-weight: 600; }

/* 日志 */
.log-box { flex: none; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow-y: auto; scrollbar-width: thin; }
.log-row { display: flex; gap: 8px; align-items: baseline; padding: 5px 10px; font-size: 11px; border-bottom: 1px dashed var(--line); }
.log-row:last-child { border-bottom: 0; }
.log-row .ts { color: var(--ink-3); font-family: ui-monospace, Menlo, monospace; flex: none; font-size: 10.5px; }
.log-row .what { color: var(--ink-2); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#alert-list .card { padding: 8px 10px; }
#alert-list .card + .card { margin-top: 6px; }
.alert-line { display: flex; align-items: center; gap: 7px; font-size: 11.5px; }
.alert-line h3 { font-size: 11.5px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-line .why { flex: none; font-size: 10.5px; }

/* ---------- 屏② 项目台账 ---------- */
.proj-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-content: start; overflow-y: auto; scrollbar-width: thin; flex: 1; min-height: 0; padding-right: 2px; }
.proj-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 15px; display: flex; flex-direction: column; gap: 8px; }
.proj-top { display: flex; align-items: center; gap: 9px; }
.proj-top .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.proj-top .dot.ok { background: var(--ok); }
.proj-top .dot.warn { background: var(--warn); }
.proj-top .dot.muted { background: var(--ink-3); }
.proj-top h3 { font-size: 14px; font-weight: 650; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-card .proj-desc { font-size: 12px; color: var(--ink-2); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.proj-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.proj-tags .badge { font-size: 10.5px; padding: 1px 7px; }
.proj-meta { display: flex; align-items: center; gap: 6px; margin-top: auto; font-size: 11px; color: var(--ink-3); }
.proj-meta .stage { margin-left: auto; }
#svc-list .card + .card, #fde-next .card + .card, #edu-tasks .card + .card { margin-top: 8px; }

/* ---------- 屏③ 作品库 / 孩子入口 ---------- */
.work-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-content: start; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.work-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 15px; display: flex; flex-direction: column; gap: 9px; min-height: 0; }
.work-visual { height: 72px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; letter-spacing: 2px; }
.work-visual.brand { background: var(--brand-soft); color: var(--brand-dark); }
.work-visual.info { background: var(--primary-soft); color: var(--primary-dark); }
.work-visual.ok { background: var(--ok-soft); color: var(--ok); }
.work-card h3 { font-size: 13.5px; font-weight: 650; }
.work-card .work-desc { font-size: 11.5px; color: var(--ink-3); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.work-foot { margin-top: auto; display: flex; align-items: center; gap: 6px; }
.work-foot .spacer { flex: 1; }
.kid-col { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.kid-btn { border: 1px solid var(--line); border-radius: 12px; padding: 22px 0; text-align: center; font-size: 16px; font-weight: 650; cursor: pointer; background: var(--card); color: var(--ink-2); transition: .15s; }
.kid-btn.brand { background: var(--brand-soft); color: var(--brand-dark); border-color: transparent; }
.kid-btn.info { background: var(--primary-soft); color: var(--primary-dark); border-color: transparent; }
.kid-btn.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.kid-btn:hover { transform: translateY(-2px); }
.kid-btn small { display: block; font-size: 11px; font-weight: 500; margin-top: 3px; opacity: .75; }

/* ---------- 详情抽屉（沿用 JuMi drawer） ---------- */
.drawer-scrim { position: fixed; inset: 0; background: rgba(21, 27, 43, .38); z-index: 40; }
html[data-theme="dark"] .drawer-scrim { background: rgba(5, 8, 15, .55); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(468px, 100vw); background: var(--card); z-index: 41;
  display: flex; flex-direction: column; box-shadow: -20px 0 60px rgba(21, 27, 43, .16); animation: drawer-in .18s ease-out;
}
@keyframes drawer-in { from { transform: translateX(16px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.drawer-head h2 { font-size: 16px; }
.drawer-body { padding: 6px 20px 32px; overflow: auto; flex: 1; }
.drawer-foot { border-top: 1px solid var(--line); padding: 12px 20px; display: flex; gap: 8px; justify-content: flex-end; background: var(--inset); }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 4px 0; color: var(--ink-2); }
.kv span:last-child { color: var(--ink); text-align: right; word-break: break-all; }
.drawer-note { background: var(--inset); border-radius: 9px; padding: 10px 12px; font-size: 11.5px; color: var(--ink-3); line-height: 1.7; margin: 14px 0 2px; }

/* 确认框 / toast（沿用 JuMi） */
.modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(21, 27, 43, .44); }
.modal[hidden] { display: none; }
.modal-card { width: 100%; max-width: 420px; background: var(--card); border-radius: 14px; padding: 22px 24px 18px; box-shadow: 0 24px 60px rgba(21, 27, 43, .28); }
.modal-card h3 { margin: 0 0 8px; font-size: 15px; }
.modal-card .modal-text { margin: 0 0 18px; color: var(--ink-2); font-size: 13px; line-height: 1.7; white-space: pre-line; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--nav-bg); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 13px; z-index: 60; box-shadow: 0 10px 30px rgba(21,27,43,.22); max-width: 90vw; }
.toast[hidden] { display: none; }

.btn.danger { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }

/* 兜底：窄屏转单列滚动 */
@media (max-width: 1280px) {
  #app { height: auto; overflow: visible; }
  .screens { overflow: visible; }
  .screen { position: static; display: none; padding: 12px; }
  .screen.active { display: block; }
  .screen-grid { grid-template-columns: minmax(0, 1fr) !important; height: auto; }
  .pane-body { overflow: visible; }
  .scroll, .proj-grid, .work-grid { overflow: visible; }
  .pane { min-height: auto; }
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; row-gap: 8px; }
}
