/* smaroot 项目管理系统 - 样式 */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --sidebar-bg: #1e1b2e;
  --sidebar-hover: #2d2a44;
  --sidebar-active: #4f46e5;
  --bg: #f5f6fa;
  --card: #ffffff;
  --border: #e8eaf0;
  --text: #1f2333;
  --text-sub: #6b7280;
  --text-muted: #9ca3af;
  --green: #10b981;
  --green-bg: #ecfdf5;
  --amber: #f59e0b;
  --amber-bg: #fffbeb;
  --red: #ef4444;
  --red-bg: #fef2f2;
  --blue: #3b82f6;
  --blue-bg: #eff6ff;
  --gray-bg: #f3f4f6;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.app { display: flex; height: 100vh; overflow: hidden; }

/* ===== 侧边栏 ===== */
.sidebar {
  width: 230px;
  background: var(--sidebar-bg);
  color: #c7c9d6;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width .22s ease;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px 20px;
}
.brand-logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff; font-weight: 800; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .4);
}
.brand-name { color: #fff; font-weight: 700; font-size: 16px; }
.brand-sub { color: #8b8da3; font-size: 12px; }

.nav { padding: 8px 12px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px; border-radius: 8px;
  color: #b4b6c8; text-decoration: none; cursor: pointer;
  font-size: 14px; margin-bottom: 2px; transition: all .15s;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav-ico { width: 18px; display: inline-flex; justify-content: center; font-size: 15px; opacity: .85; }

.sidebar-foot { padding: 16px; }
.pipeline-hint {
  background: rgba(255,255,255,.05); border-radius: 10px; padding: 14px;
}
.pipeline-title { color: #8b8da3; font-size: 11px; margin-bottom: 10px; letter-spacing: .5px; }
.pipeline-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 12px; color: #d4d6e2; }
.pipeline-flow i { color: #6366f1; font-style: normal; }
.pipeline-flow span { background: rgba(99,102,241,.15); padding: 2px 7px; border-radius: 5px; }

/* ===== 侧边栏折叠 ===== */
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .brand { justify-content: center; padding: 22px 0 20px; }
.sidebar.collapsed .brand-text { display: none; }
.sidebar.collapsed .nav { padding: 8px 8px; }
.sidebar.collapsed .nav-item { justify-content: center; gap: 0; padding: 11px 0; }
.sidebar.collapsed .nav-label { display: none; }
.sidebar.collapsed .sidebar-foot { display: none; }
.nav-item, .brand { transition: padding .18s ease, gap .18s ease, justify-content .18s ease; }

/* ===== 顶栏左侧 + 折叠按钮 ===== */
.topbar-left { display: flex; align-items: center; gap: 14px; }
.sidebar-toggle {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); cursor: pointer; display: inline-flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; padding: 0; transition: all .15s;
}
.sidebar-toggle:hover { background: var(--gray-bg); border-color: #d4d7e0; }
.toggle-bar {
  display: block; width: 16px; height: 2px; background: var(--text-sub); border-radius: 1px;
  transition: background .15s, transform .18s;
}
.sidebar-toggle:hover .toggle-bar { background: var(--text); }

/* ===== 主内容 ===== */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 64px; background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; flex-shrink: 0;
}
.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-actions { display: flex; gap: 10px; }

.content { flex: 1; overflow-y: auto; padding: 24px 28px 40px; }

/* ===== 按钮 ===== */
.btn {
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 13px; cursor: pointer;
  font-weight: 500; transition: all .15s; display: inline-flex; align-items: center; gap: 5px;
}
.btn:hover { background: var(--gray-bg); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-danger { color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: var(--red-bg); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--primary); padding: 4px 8px; }
.btn-ghost:hover { background: var(--primary-light); }

/* ===== 仪表盘 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.stat-label { color: var(--text-sub); font-size: 13px; margin-bottom: 8px; }
.stat-value { font-size: 30px; font-weight: 800; color: var(--text); }
.stat-trend { font-size: 12px; margin-top: 6px; }
.stat-trend.up { color: var(--green); }
.stat-trend.down { color: var(--red); }
.stat-ico {
  width: 40px; height: 40px; border-radius: 10px; float: right;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}

.dash-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.panel {
  background: var(--card); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-title { font-weight: 700; font-size: 15px; }

/* 进度条 */
.bar { height: 7px; background: var(--gray-bg); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width .4s; }

/* 漏斗 */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-row { display: flex; align-items: center; gap: 12px; }
.funnel-label { width: 90px; color: var(--text-sub); font-size: 13px; }
.funnel-bar-wrap { flex: 1; }
.funnel-bar { height: 26px; border-radius: 6px; display: flex; align-items: center; padding: 0 10px; color: #fff; font-size: 12px; font-weight: 600; min-width: 36px; }

/* 表格 */
.table-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.table-tools { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap; }
.search-input {
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 13px; width: 240px; outline: none; transition: border .15s;
}
.search-input:focus { border-color: var(--primary); }
.filter-select {
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; background: var(--card); cursor: pointer;
}
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 16px; font-size: 12px; color: var(--text-sub); font-weight: 600; background: #fafbfd; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbff; }
.td-main { font-weight: 600; color: var(--text); }
.td-sub { color: var(--text-sub); font-size: 12px; }

/* 标签/徽章 */
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.tag-green { background: var(--green-bg); color: #047857; }
.tag-amber { background: var(--amber-bg); color: #b45309; }
.tag-red { background: var(--red-bg); color: #b91c1c; }
.tag-blue { background: var(--blue-bg); color: #1d4ed8; }
.tag-gray { background: var(--gray-bg); color: #4b5563; }
.tag-purple { background: #f5f3ff; color: #6d28d9; }

/* 空状态 */
.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-ico { font-size: 42px; margin-bottom: 12px; opacity: .5; }

/* ===== 模态框 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .5);
  display: none; align-items: center; justify-content: center; z-index: 100;
  backdrop-filter: blur(2px);
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--card); border-radius: 14px; width: 560px; max-width: 92vw;
  max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-title { font-weight: 700; font-size: 16px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-label .req { color: var(--red); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: inherit; outline: none; transition: border .15s; background: var(--card); color: var(--text);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-textarea { resize: vertical; min-height: 76px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--border); }

/* 详情面板 */
.detail-section { margin-bottom: 20px; }
.detail-section-title { font-size: 13px; font-weight: 700; color: var(--text-sub); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .5px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; }
.detail-item { display: flex; flex-direction: column; gap: 3px; }
.detail-key { font-size: 12px; color: var(--text-muted); }
.detail-val { font-size: 14px; color: var(--text); font-weight: 500; }

.req-item {
  background: var(--gray-bg); border-radius: 8px; padding: 12px 14px; margin-bottom: 8px;
}
.req-item-name { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.req-item-detail { font-size: 12px; color: var(--text-sub); }

.followup-item {
  padding: 10px 0; border-bottom: 1px dashed var(--border); display: flex; gap: 12px;
}
.followup-item:last-child { border-bottom: none; }
.followup-date { color: var(--primary); font-size: 12px; font-weight: 600; white-space: nowrap; min-width: 92px; }

.milestone { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.ms-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; }
.ms-dot.done { background: var(--green); border-color: var(--green); }
.ms-dot.todo { background: var(--card); }
.ms-name { flex: 1; font-size: 13px; }
.ms-name.done { color: var(--text-sub); text-decoration: line-through; }
.ms-date { font-size: 12px; color: var(--text-muted); }

.team-chip { display: inline-block; background: var(--primary-light); color: var(--primary-dark); padding: 4px 11px; border-radius: 20px; font-size: 12px; margin: 0 5px 5px 0; font-weight: 500; }

.link-btn { color: var(--primary); cursor: pointer; font-weight: 600; }
.link-btn:hover { text-decoration: underline; }

/* Toast */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1f2333; color: #fff; padding: 12px 22px; border-radius: 8px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 200;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 响应式 */
@media (max-width: 960px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-row { grid-template-columns: 1fr; }
  .sidebar:not(.collapsed) { width: 64px; }
  .sidebar:not(.collapsed) .brand-text,
  .sidebar:not(.collapsed) .nav-label,
  .sidebar:not(.collapsed) .sidebar-foot { display: none; }
  .sidebar:not(.collapsed) .brand { justify-content: center; padding: 22px 0 20px; }
  .sidebar:not(.collapsed) .nav-item { justify-content: center; gap: 0; }
}
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .search-input { width: 100%; }
}
