/* TRYLINK 生意分析 / 营销规划 / AI 提案系统 —— 原型样式 */

:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel-2: #fbfcfe;
  --ink: #16202e;
  --ink-2: #55657b;
  --ink-3: #8a99ad;
  --line: #e2e8f0;
  --line-2: #eef2f7;
  --brand: #0f766e;
  --brand-ink: #0b5d56;
  --brand-soft: #e3f3f1;
  --accent: #b45309;
  --accent-soft: #fdf2e3;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --ok: #107a4d;
  --ok-soft: #e6f5ee;
  --info: #1d4ed8;
  --info-soft: #e8eefd;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 46, .05), 0 4px 14px rgba(16, 32, 46, .05);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 0 18px; height: 56px;
  background: #0d1b2a; color: #e8eef6;
  border-bottom: 1px solid #0a1520;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
}
.topbar::-webkit-scrollbar { display: none; }
.brand {
  display: flex; align-items: baseline; gap: 8px; flex: none;
  font-weight: 700; letter-spacing: .4px; white-space: nowrap;
}
.brand b { font-size: 17px; color: #fff; }
.brand span { font-size: 11px; color: #8fa6bf; font-weight: 500; }
@media (max-width: 1080px) { .brand span { display: none; } }

.entry-switch { display: flex; gap: 4px; flex: none; background: #16293c; padding: 3px; border-radius: 8px; }
.entry-switch button {
  border: 0; background: transparent; color: #a9bdd4; font: inherit; font-size: 13px;
  padding: 6px 13px; border-radius: 6px; cursor: pointer; white-space: nowrap;
}
.entry-switch button:hover { color: #fff; }
.entry-switch button.on { background: #e8eef6; color: #0d1b2a; font-weight: 600; }

.topbar .spacer { flex: 1 0 12px; }
.who { display: flex; align-items: center; gap: 8px; flex: none; font-size: 13px; color: #b9cadd; white-space: nowrap; }
@media (max-width: 860px) { .who > span:first-child { display: none; } }
.who select {
  background: #16293c; color: #e8eef6; border: 1px solid #27405a;
  border-radius: 7px; padding: 6px 8px; font: inherit; font-size: 13px;
}
.who .role-tag {
  font-size: 11px; padding: 2px 7px; border-radius: 20px;
  background: #27405a; color: #cfe0f0; white-space: nowrap;
}
.linkbtn {
  background: transparent; border: 1px solid #2b4663; color: #b9cadd;
  border-radius: 7px; padding: 6px 10px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.linkbtn:hover { border-color: #41617f; color: #fff; }

/* ---------------- 布局 ---------------- */
.shell { display: flex; min-height: calc(100vh - 56px); align-items: flex-start; }
.nav {
  width: 218px; flex: none; padding: 16px 10px 40px;
  border-right: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 56px; max-height: calc(100vh - 56px); overflow: auto;
}
.nav h4 {
  margin: 14px 8px 6px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .7px; color: var(--ink-3); font-weight: 700;
}
.nav h4:first-child { margin-top: 0; }
.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 7px 10px; margin: 1px 0; border-radius: 7px;
  color: var(--ink-2); text-decoration: none; font-size: 13.5px; cursor: pointer;
}
.nav a:hover { background: var(--line-2); color: var(--ink); }
.nav a.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.nav a .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }

.main { flex: 1; min-width: 0; padding: 20px 24px 64px; max-width: 1180px; }

.page-h { margin: 0 0 4px; font-size: 20px; font-weight: 700; letter-spacing: -.2px; }
.page-sub { margin: 0 0 18px; color: var(--ink-2); font-size: 13px; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 16px; overflow: hidden;
}
.card > .ch {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--line-2); background: var(--panel-2);
}
.card > .ch h3 { margin: 0; font-size: 14.5px; font-weight: 650; }
.card > .ch .sub { font-size: 12px; color: var(--ink-3); }
.card > .ch .spacer { flex: 1; }
.card > .cb { padding: 14px 16px; }
.card > .cb.tight { padding: 0; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 920px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ---------------- KPI ---------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 12px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow);
}
.kpi .k { font-size: 11.5px; color: var(--ink-3); font-weight: 600; letter-spacing: .2px; }
.kpi .v { font-size: 21px; font-weight: 700; margin-top: 3px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.kpi .v.sm { font-size: 16px; }
.kpi .s { font-size: 11.5px; color: var(--ink-2); margin-top: 3px; }
.kpi.na .v { color: var(--ink-3); font-weight: 600; font-size: 15px; }
.kpi.hi { border-color: #cfe4e1; background: linear-gradient(180deg, #f3faf9, #fff); }
.kpi.warn { border-color: #f0dcb8; background: linear-gradient(180deg, #fffaf1, #fff); }
.kpi.bad { border-color: #f3cdc9; background: linear-gradient(180deg, #fff6f5, #fff); }

/* ---------------- 进度条 ---------------- */
.bar { height: 8px; background: var(--line-2); border-radius: 20px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 20px; }
.bar > i.warn { background: var(--accent); }
.bar > i.bad { background: var(--danger); }

/* ---------------- 表格 ---------------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.tbl th {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--ink-3); font-weight: 700; background: var(--panel-2); white-space: nowrap;
}
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.tbl tbody tr:hover { background: #fbfdff; }
table.tbl tr.sum td { font-weight: 700; background: var(--panel-2); border-top: 2px solid var(--line); }
table.tbl tr.dim td { color: var(--ink-3); }
.scrollx { overflow-x: auto; }

/* ---------------- 徽章 / 提示 ---------------- */
.badge {
  display: inline-block; padding: 1.5px 7px; border-radius: 20px;
  font-size: 11px; font-weight: 650; white-space: nowrap; line-height: 1.5;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--accent-soft); color: var(--accent); }
.badge.err { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.muted { background: var(--line-2); color: var(--ink-2); }
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); }

.note {
  border-radius: 8px; padding: 9px 12px; font-size: 12.5px;
  margin: 10px 0; border: 1px solid; line-height: 1.5;
}
.note.i { background: var(--info-soft); border-color: #c8d8fb; color: #1b3f9e; }
.note.w { background: var(--accent-soft); border-color: #f0dcb8; color: #86400a; }
.note.e { background: var(--danger-soft); border-color: #f3cdc9; color: #8c1b13; }
.note.g { background: var(--ok-soft); border-color: #c4e6d6; color: #0b5c3a; }
.note.m { background: var(--panel-2); border-color: var(--line); color: var(--ink-2); }
.note ul { margin: 5px 0 0 18px; padding: 0; }
.note b { font-weight: 700; }

.spec { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }

/* ---------------- 表单 ---------------- */
.frow {
  display: grid; grid-template-columns: 190px 1fr; gap: 10px;
  align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line-2);
}
.frow:last-child { border-bottom: 0; }
.frow > label { font-size: 13px; color: var(--ink-2); }
.frow > label i { display: block; font-size: 11px; color: var(--ink-3); font-style: normal; }
.fval { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

input[type=text], input[type=number], input[type=date], select, textarea {
  font: inherit; font-size: 13px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px;
  background: #fff; min-width: 0;
}
input[type=number] { width: 112px; text-align: right; font-variant-numeric: tabular-nums; }
input[type=text] { width: 190px; }
textarea { width: 100%; min-height: 64px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input.blank { background: #fffdf5; border-color: #e8d9a8; }
input:disabled, select:disabled { background: var(--line-2); color: var(--ink-3); cursor: not-allowed; }
.unit { font-size: 12px; color: var(--ink-3); }

.src-sel { font-size: 11.5px; padding: 3px 5px; border-radius: 6px; }
.chk { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.chk input { margin: 0; }

button.btn {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  border-radius: 7px; padding: 7px 13px; border: 1px solid var(--line);
  background: #fff; color: var(--ink);
}
button.btn:hover { border-color: var(--ink-3); }
button.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
button.btn.pri:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
button.btn.dan { background: #fff; border-color: #f0cbc7; color: var(--danger); }
button.btn.dan:hover { background: var(--danger-soft); }
button.btn.sm { font-size: 12px; padding: 4px 9px; }
button.btn:disabled { opacity: .45; cursor: not-allowed; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button {
  font: inherit; font-size: 13px; background: transparent; border: 0; cursor: pointer;
  padding: 8px 13px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--brand-ink); border-bottom-color: var(--brand); font-weight: 650; }

/* ---------------- 列表 ---------------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px;
  background: var(--panel); cursor: pointer;
}
.item:hover { border-color: var(--brand); }
.item.on { border-color: var(--brand); background: var(--brand-soft); }
.item .t { font-weight: 650; font-size: 13.5px; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.item .d { font-size: 12px; color: var(--ink-2); margin-top: 3px; }

/* ---------------- AI 区块 ---------------- */
.ai-sec { border-left: 3px solid var(--brand); padding: 2px 0 2px 13px; margin: 0 0 16px; }
.ai-sec h5 { margin: 0 0 6px; font-size: 13.5px; font-weight: 700; }
.factlist { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 13px; }
.factlist dt { color: var(--ink-2); white-space: nowrap; }
.factlist dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.ai-meta {
  font-family: var(--mono); font-size: 11px; color: var(--ink-3);
  border-top: 1px dashed var(--line); padding-top: 9px; margin-top: 12px; line-height: 1.7;
}
.advice {
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; overflow: hidden;
}
.advice > .ah {
  padding: 11px 14px; background: var(--brand-soft); border-bottom: 1px solid #cfe4e1;
  display: flex; gap: 9px; align-items: center; flex-wrap: wrap;
}
.advice > .ah .n { font-weight: 700; font-size: 14px; color: var(--brand-ink); }
.advice > .ab { padding: 12px 14px; }
.advice-grid { display: grid; grid-template-columns: 112px 1fr; gap: 5px 14px; font-size: 13px; }
.advice-grid > .l { color: var(--ink-3); font-weight: 650; font-size: 12px; padding-top: 1px; }
.advice-grid > .v ul { margin: 2px 0 0 17px; padding: 0; }
.advice-grid > .v { min-width: 0; }

.scen3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
@media (max-width: 760px) { .scen3 { grid-template-columns: 1fr; } }
.scen {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: var(--panel-2); font-size: 12.5px;
}
.scen h6 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-3); }
.scen .r { display: flex; justify-content: space-between; gap: 8px; padding: 1.5px 0; }
.scen .r b { font-variant-numeric: tabular-nums; }
.scen.neutral { background: #f3faf9; border-color: #cfe4e1; }

/* ---------------- Proposal 客户版 ---------------- */
.proposal {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 34px; box-shadow: var(--shadow); max-width: 820px;
}
.proposal .ph { border-bottom: 2px solid var(--ink); padding-bottom: 13px; margin-bottom: 20px; }
.proposal .ph .co { font-size: 11px; letter-spacing: 2.4px; text-transform: uppercase; color: var(--brand); font-weight: 700; }
.proposal .ph h1 { margin: 5px 0 3px; font-size: 22px; letter-spacing: -.3px; }
.proposal .ph .meta { font-size: 12px; color: var(--ink-2); display: flex; gap: 16px; flex-wrap: wrap; margin-top: 7px; }
.proposal h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--brand-ink);
  margin: 24px 0 9px; padding-bottom: 5px; border-bottom: 1px solid var(--line);
}
.proposal h2:first-of-type { margin-top: 0; }
.proposal .sig { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-top: 16px; font-size: 12px; }
.proposal .sig > div { border-top: 1px solid var(--ink-3); padding-top: 5px; color: var(--ink-2); }

/* ---------------- 测试页 ---------------- */
.test { font-size: 13px; border-bottom: 1px solid var(--line-2); padding: 6px 0; display: flex; gap: 10px; align-items: baseline; }
.test .st { font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; flex: none; }
.test .st.p { background: var(--ok-soft); color: var(--ok); }
.test .st.f { background: var(--danger-soft); color: var(--danger); }
.test .nm { flex: 1; }
.test .ms { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }
.test-sum { font-size: 15px; font-weight: 700; padding: 11px 14px; border-radius: 9px; margin-bottom: 14px; }
.test-sum.p { background: var(--ok-soft); color: var(--ok); }
.test-sum.f { background: var(--danger-soft); color: var(--danger); }
.test-grp { margin: 18px 0 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-3); }

/* ---------------- 其它 ---------------- */
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.strike { text-decoration: line-through; color: var(--ink-3); }
hr.sep { border: 0; border-top: 1px solid var(--line-2); margin: 16px 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 12px; padding: 3px 9px; border-radius: 20px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--ink-2);
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; max-width: 360px; }
.cal .cd {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; border-radius: 5px; border: 1px solid var(--line-2); cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.cal .cd.open { background: var(--brand-soft); color: var(--brand-ink); font-weight: 650; }
.cal .cd.closed { background: var(--line-2); color: var(--ink-3); }
.cal .cd.hd { border: 0; cursor: default; color: var(--ink-3); font-weight: 700; font-size: 10.5px; aspect-ratio: auto; }
.cal .cd.past { opacity: .5; }

/* ---------------- 打印 (PDF 导出) ---------------- */
@media print {
  .topbar, .nav, .no-print { display: none !important; }
  body { background: #fff; }
  .shell { display: block; }
  .main { max-width: none; padding: 0; }
  .proposal { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .proposal h2 { break-after: avoid; }
  table.tbl { break-inside: auto; }
  table.tbl tr { break-inside: avoid; }
  .card { break-inside: avoid; box-shadow: none; }
  @page { margin: 16mm 14mm; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f151c; --panel: #161e27; --panel-2: #1a232e; --ink: #e6edf5;
    --ink-2: #a3b2c4; --ink-3: #74859a; --line: #26323f; --line-2: #1f2a35;
    --brand: #2dd4bf; --brand-ink: #7fe8db; --brand-soft: #113631;
    --accent: #fbbf24; --accent-soft: #3a2d0c; --danger: #fca5a5; --danger-soft: #3a1512;
    --ok: #6ee7b7; --ok-soft: #0e3327; --info: #93b4fd; --info-soft: #14213f;
  }
  :root:not([data-theme="light"]) input, :root:not([data-theme="light"]) select,
  :root:not([data-theme="light"]) textarea { background: #10171f; color: var(--ink); }
  :root:not([data-theme="light"]) input.blank { background: #2a2410; border-color: #4a3f16; }
  :root:not([data-theme="light"]) .proposal { background: var(--panel); }
  :root:not([data-theme="light"]) button.btn { background: var(--panel-2); color: var(--ink); }
  :root:not([data-theme="light"]) button.btn.pri { background: var(--brand); color: #04201c; }
  :root:not([data-theme="light"]) .kpi.hi { background: linear-gradient(180deg, #11312c, var(--panel)); }
  :root:not([data-theme="light"]) table.tbl tbody tr:hover { background: #1b2530; }
  :root:not([data-theme="light"]) .chip { background: var(--panel-2); }
}
