/* 美业诊断工具 - 样式 */
:root {
  --primary: #4c9aff;
  --primary-dark: #2f7fe0;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --violet: #8b5cf6;
  --pink: #f472b6;
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #e8edf3;
  --text: #1e293b;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --shadow: 0 2px 10px rgba(30, 41, 59, 0.06);
  --shadow-lg: 0 8px 30px rgba(30, 41, 59, 0.10);
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
  background: linear-gradient(180deg, #0f172a, #1e293b);
  color: #cbd5e1; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 6px 20px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 20px; flex-shrink: 0;
}
.brand h1 { font-size: 15px; color: #f1f5f9; font-weight: 700; line-height: 1.25; }
.brand small { display: block; font-size: 11px; color: #7c8aa0; font-weight: 400; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.nav .group { font-size: 11px; color: #64748b; padding: 14px 10px 6px; text-transform: uppercase; letter-spacing: .06em; }
.nav a {
  display: flex; align-items: center; gap: 10px; color: #94a3b8; text-decoration: none;
  padding: 10px 12px; border-radius: 10px; font-size: 13.5px; transition: .15s; cursor: pointer;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #e2e8f0; }
.nav a.active { background: linear-gradient(135deg, rgba(76,154,255,.25), rgba(139,92,246,.18)); color: #fff; }
.nav a .ico { width: 18px; text-align: center; font-size: 15px; }

.sidebar-foot { margin-top: auto; padding: 12px; font-size: 11px; color: #64748b; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot .tag { display: inline-block; background: rgba(76,154,255,.15); color: #7cc0ff; padding: 3px 8px; border-radius: 6px; }

/* ===== Main ===== */
.main { min-width: 0; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--border); padding: 16px 28px;
  display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10;
}
.topbar .page-title { font-size: 19px; font-weight: 700; }
.topbar .page-sub { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
.topbar .action { display: flex; gap: 10px; align-items: center; }

.content { padding: 24px 28px 40px; }
.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ===== Cards & grid ===== */
.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card.span-2 { grid-column: span 2; }
.chart { width: 100%; height: 300px; overflow: hidden; }
.grid > .card { min-width: 0; }
.chart.sm { height: 240px; }
.chart.lg { height: 340px; }

/* stat cards */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .lbl { color: var(--text-2); font-size: 12.5px; }
.stat .val { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.stat .sub { font-size: 12px; color: var(--text-3); }
.stat .val.good { color: var(--success); }
.stat .val.warn { color: var(--accent); }
.stat .val.bad { color: var(--danger); }
.stat .val.blue { color: var(--primary); }
.stat .val.violet { color: var(--violet); }

/* ===== Badge / pill ===== */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.green { background: #e7f8f0; color: #0f9d6a; }
.pill.amber { background: #fef3d9; color: #b97d06; }
.pill.red { background: #fdeaea; color: #d64545; }
.pill.blue { background: #e8f1ff; color: #2f7fe0; }
.pill.violet { background: #f1e9ff; color: #7c4dff; }
.pill.gray { background: #f1f5f9; color: #64748b; }

/* ===== Form ===== */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field label .req { color: var(--danger); }
.field input, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 14px;
  background: #fbfcfe; color: var(--text); transition: .15s; font-family: inherit;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(76,154,255,.15); }
.field .hint { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.section-title { font-size: 14px; font-weight: 700; margin: 26px 0 14px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ''; width: 4px; height: 16px; background: linear-gradient(var(--primary), var(--violet)); border-radius: 2px; }
.section-title:first-child { margin-top: 0; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: 10px;
  border: none; font-size: 14px; font-weight: 600; cursor: pointer; transition: .15s; font-family: inherit;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 4px 14px rgba(76,154,255,.35); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(76,154,255,.45); }
.btn-ghost { background: #fff; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

/* ===== Problem list ===== */
.problem { display: flex; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #fbfcfe; }
.problem .dot { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; font-size: 18px; }
.problem .dot.high { background: #fdeaea; }
.problem .dot.medium { background: #fef3d9; }
.problem .dot.low { background: #e8f1ff; }
.problem h4 { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.problem p { font-size: 13px; color: var(--text-2); margin-top: 4px; }

/* ===== Solution / scheme ===== */
.scheme { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.scheme .badge { flex-shrink: 0; }
.scheme h4 { font-size: 14px; font-weight: 700; }
.scheme p { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.scheme .dose { font-size: 12px; color: var(--text-3); margin-top: 6px; background: #f8fafc; padding: 6px 9px; border-radius: 8px; }

/* ===== KPI row ===== */
.kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi .box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.kpi .box .k { font-size: 12px; color: var(--text-2); }
.kpi .box .v { font-size: 22px; font-weight: 800; margin-top: 4px; }
.kpi .box .s { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ===== Banner ===== */
.banner { background: linear-gradient(135deg, #eef5ff, #f3f0ff); border: 1px solid #dbe7ff; border-radius: var(--radius); padding: 16px 18px; display: flex; gap: 12px; align-items: flex-start; margin-bottom: 20px; }
.banner .ico { font-size: 20px; }
.banner h3 { font-size: 14px; font-weight: 700; }
.banner p { font-size: 13px; color: var(--text-2); margin-top: 3px; }

/* month plan table */
.plan-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.plan-table th { text-align: left; padding: 8px 10px; color: var(--text-2); font-weight: 600; border-bottom: 1px solid var(--border); background: #f8fafc; }
.plan-table td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; }
.plan-table tr:hover td { background: #fbfcfe; }

.meter { height: 8px; border-radius: 999px; background: #eef2f7; overflow: hidden; margin-top: 8px; }
.meter > span { display: block; height: 100%; border-radius: 999px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { display: none; }
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
  .kpi { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .two-col { grid-template-columns: 1fr; }
}

/* ===== 认证页 ===== */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a, #1e293b, #312e81); padding: 20px; }
.auth-card { background: #fff; border-radius: 18px; padding: 32px 30px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand .logo { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(135deg, #4c9aff, #8b5cf6); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 22px; }
.auth-brand h1 { font-size: 18px; color: #1e293b; }
.auth-brand small { display: block; font-size: 12px; color: #94a3b8; font-weight: 400; }
.auth-tabs { display: flex; gap: 6px; background: #f1f5f9; border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.auth-tab { flex: 1; padding: 9px; border: none; background: transparent; border-radius: 8px; font-size: 14px; font-weight: 600; color: #64748b; cursor: pointer; }
.auth-tab.active { background: #fff; color: #1e293b; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.auth-err { color: #ef4444; font-size: 12.5px; min-height: 20px; margin: 6px 0; }


/* ===== 侧边栏 项目列表 ===== */
.proj-section { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 10px; border-top: 1px solid rgba(255,255,255,.08); }
.proj-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.proj-title { font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: .06em; }
.proj-add { width: 22px; height: 22px; border-radius: 6px; border: none; background: rgba(76,154,255,.22); color: #7cc0ff; cursor: pointer; font-size: 15px; line-height: 1; }
.proj-add:hover { background: rgba(76,154,255,.4); }
.proj-list { display: flex; flex-direction: column; gap: 3px; }
.proj-item { display: flex; align-items: center; justify-content: space-between; padding: 7px 9px; border-radius: 8px; cursor: pointer; color: #94a3b8; gap: 6px; }
.proj-item:hover { background: rgba(255,255,255,.06); color: #e2e8f0; }
.proj-item.active { background: linear-gradient(135deg, rgba(76,154,255,.28), rgba(139,92,246,.2)); color: #fff; }
.proj-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.proj-actions { display: none; gap: 2px; flex-shrink: 0; }
.proj-item:hover .proj-actions, .proj-item.active .proj-actions { display: flex; }
.proj-actions button { background: transparent; border: none; cursor: pointer; font-size: 12px; padding: 1px 3px; border-radius: 4px; line-height: 1; }
.proj-actions button:hover { background: rgba(255,255,255,.18); }
.proj-empty { font-size: 11.5px; color: #64748b; padding: 4px 6px; }

/* ===== 汉堡菜单 / 抽屉侧边栏（手机端） ===== */
.hamburger { display: none; background: transparent; border: none; color: var(--text-2); font-size: 22px; cursor: pointer; padding: 4px 8px; margin-right: 6px; flex-shrink: 0; }
.drawer-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 65; }
.drawer-backdrop.show { display: block; }

/* ===== 弹窗控制台 ===== */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 100; align-items: flex-start; justify-content: center; padding: 30px 16px; overflow-y: auto; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 760px; box-shadow: 0 24px 70px rgba(0,0,0,.3); display: flex; flex-direction: column; max-height: 90vh; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-3); line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 16px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }


/* ===== 经营动作路径流水线 ===== */
.pipe { display: flex; align-items: stretch; gap: 8px; flex-wrap: nowrap; }
.pipe-stage { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: #fbfcfe; display: flex; flex-direction: column; }
.pipe-stage.hot { border-color: #ffd9d9; background: #fff7f7; box-shadow: inset 0 0 0 1px rgba(239,68,68,.08); }
.pipe-head { display: flex; align-items: center; gap: 5px; font-weight: 700; font-size: 13.5px; margin-bottom: 8px; }
.pipe-icon { font-size: 16px; }
.pipe-name { white-space: nowrap; }
.pipe-body { display: flex; flex-direction: column; gap: 5px; overflow: hidden; }
.pipe-chip { border: 1px solid; border-radius: 8px; padding: 4px 8px; font-size: 11.5px; background: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipe-none { font-size: 11.5px; color: var(--text-3); padding: 4px 0; }
.pipe-arrow { display: flex; align-items: center; color: var(--text-3); font-size: 20px; font-weight: 700; flex-shrink: 0; }
@media (max-width: 1100px) { .pipe { flex-wrap: wrap; } .pipe-arrow { transform: rotate(90deg); } }

/* ===== 对症下药 处方卡 ===== */
.rx-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; border-top: 3px solid var(--primary); }
.rx-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rx-badge { color: #fff; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.rx-title { font-size: 15.5px; font-weight: 800; }
.rx-line { font-size: 13px; color: var(--text-2); }
.rx-line b { color: var(--text); }
.rx-label { font-size: 11.5px; font-weight: 700; color: var(--text-2); letter-spacing: .04em; margin-top: 2px; }
.rx-steps { display: flex; flex-direction: column; gap: 5px; }
.rx-step { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text-2); background: #f8fafc; border-radius: 8px; padding: 6px 8px; }
.rx-n { flex-shrink: 0; width: 19px; height: 19px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #8b5cf6); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; margin-top: 1px; }
.rx-foot { display: flex; flex-direction: column; gap: 5px; background: #fefdf8; border: 1px dashed #f3d9a4; border-radius: 9px; padding: 8px 10px; margin-top: 4px; }
.rx-dose { font-size: 12.5px; color: #92600a; }
.rx-metric { font-size: 12px; color: var(--text-3); }

/* ===== 全部方案库 ===== */
.lib-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.lib-tab { padding: 7px 18px; border-radius: 999px; border: 1px solid var(--border); background: #fff; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: .15s; }
.lib-tab:hover { border-color: var(--primary); color: var(--primary); }
.lib-tab.active { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border-color: transparent; }
.lib-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 13px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; transition: .15s; }
.lib-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: #c9daf5; }
.lib-top { display: flex; align-items: center; justify-content: space-between; }
.lib-title { font-size: 14px; font-weight: 700; }
.lib-summary { font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.lib-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }


/* ===== 阶段目标与复盘 ===== */
.rx-stages { display: flex; flex-direction: column; gap: 7px; }
.rx-stage { border: 1px solid #e6edf6; border-left: 3px solid var(--primary); border-radius: 9px; padding: 7px 9px; background: #fbfdff; }
.rx-stage-top { display: flex; align-items: center; gap: 8px; }
.rx-stage-period { flex-shrink: 0; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.rx-stage-target { font-size: 13px; font-weight: 700; color: var(--text); }
.rx-stage-check { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.rx-stage-fail { font-size: 12px; color: #b45309; margin-top: 3px; }


/* ===== 手机端适配（768px / 480px） ===== */
@media (max-width: 768px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr !important; }
  .grid > .span-2, .span-2 { grid-column: auto !important; }
  .chart, .chart.sm, .chart.lg { height: 220px; }
  .app { display: flex; flex-direction: column; }
  .main { flex: 1; min-width: 0; }
  .topbar { position: sticky; top: 0; z-index: 55; background: rgba(255,255,255,.96); backdrop-filter: blur(4px); }
  .hamburger { display: inline-flex; color: var(--text); }
  /* 侧边栏 → 左侧滑出抽屉 */
  .sidebar { position: fixed; top: 0; left: 0; height: 100vh; width: 250px; z-index: 70; padding: 16px 14px; transform: translateX(-100%); transition: transform .28s ease; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
  .sidebar.sidebar-open { transform: translateX(0); }
  .sidebar .footer { display: none; }
  .brand { padding: 0 0 6px; gap: 8px; }
  .brand .logo { width: 30px; height: 30px; border-radius: 8px; font-size: 15px; }
  .brand h1 { font-size: 14px; }
  .brand small { display: none; }
  .nav { margin-top: 10px; }
  .proj-section { padding: 10px 0 0; border-top: 1px solid rgba(255,255,255,.1); }
  .proj-head { margin-bottom: 6px; }
  .proj-list { gap: 4px; }
  .topbar { padding: 10px 14px; flex-wrap: wrap; gap: 8px; flex: 0 0 auto; }
  .topbar .page-title { font-size: 15px; }
  .topbar .page-sub { font-size: 11px; }
  .topbar .action { margin-left: auto; }
  .topbar .action .btn { padding: 8px 14px; font-size: 13px; }
  .content { padding: 12px 14px; }
  .kpi { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi .box { padding: 12px; }
  .kpi .box .v { font-size: 19px; }
  .banner { padding: 12px 14px; }
  .card { padding: 14px; }
  .chart { height: 220px; }
  .chart.sm { height: 200px; }
  .pipe { flex-wrap: wrap; }
  .pipe-stage { flex: 1 1 100%; }
  .pipe-arrow { transform: rotate(90deg); }
  .section-title { margin: 20px 0 12px; }
  .plan-table { font-size: 11.5px; }
  .plan-table th, .plan-table td { padding: 6px 7px; }
  .rx-card { padding: 13px; }
  /* 弹窗全屏化 */
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal { max-width: none; max-height: 100vh; height: 100vh; border-radius: 0; }
  .modal-head { padding: 14px 16px; }
  .modal-body { padding: 12px 14px; flex: 1; }
  .modal-foot { padding: 12px 14px; position: sticky; bottom: 0; background: #fff; }
}

@media (max-width: 480px) {
  .kpi { grid-template-columns: 1fr; }
  .topbar .action { width: 100%; }
  .topbar .action .btn { flex: 1; justify-content: center; }
  .chart { height: 220px; }
  .rx-title { font-size: 14px; }
}