/* style.css —— 甘特待办 全部样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #4f8ef7;
  --primary-dark: #3a76d8;
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #8f959e;
  --border: #e5e7eb;
  --bg: #f5f6f8;
  --danger: #e5484d;
  --radius: 10px;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--text); background: var(--bg); font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.flex1 { flex: 1; }

/* ---------- 通用控件 ---------- */
.btn {
  border: none; border-radius: 8px; padding: 8px 16px; font-size: 14px;
  cursor: pointer; transition: all .15s; font-family: inherit; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger-ghost { background: #fff; color: var(--danger); border: 1px solid #f2c4c5; }
.btn-danger-ghost:hover { background: #fef2f2; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn {
  background: none; border: 1px solid transparent; border-radius: 6px;
  font-size: 15px; cursor: pointer; padding: 4px 7px; color: var(--text-2);
}
.icon-btn:hover { background: #f0f2f5; }

/* ---------- 登录页 ---------- */
.auth-view {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(800px 400px at 15% 10%, rgba(79,142,247,.14), transparent 60%),
    radial-gradient(700px 380px at 85% 85%, rgba(34,197,94,.12), transparent 60%),
    var(--bg);
  padding: 24px;
}
.auth-card {
  width: 400px; max-width: 100%; background: #fff; border-radius: 16px;
  padding: 36px 34px 30px; box-shadow: 0 12px 40px rgba(15, 23, 42, .10);
}
.auth-logo { text-align: center; margin-bottom: 22px; }
.auth-logo h1 { font-size: 24px; margin-top: 8px; letter-spacing: 1px; }
.auth-sub { color: var(--text-3); font-size: 13px; margin-top: 4px; }
.auth-tabs {
  display: flex; background: #f0f2f5; border-radius: 9px; padding: 3px; margin-bottom: 20px;
}
.auth-tab {
  flex: 1; border: none; background: none; padding: 8px 0; border-radius: 7px;
  font-size: 14px; cursor: pointer; color: var(--text-2); font-family: inherit;
}
.auth-tab.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.auth-form label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 13px; }
.auth-form input {
  display: block; width: 100%; margin-top: 5px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit;
  outline: none; transition: border .15s;
}
.auth-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,142,247,.12); }
.code-row { display: flex; gap: 8px; margin-top: 5px; }
.code-row input { flex: 1; margin-top: 0; }
.btn-code { white-space: nowrap; min-width: 96px; }
.auth-links { text-align: right; margin: -4px 0 12px; }
.auth-links a { color: var(--primary); font-size: 13px; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }
.auth-msg {
  margin-top: 12px; padding: 9px 12px; border-radius: 8px; font-size: 13px;
  background: #fef3f2; color: var(--danger);
}

/* ---------- 整体布局 ---------- */
.app-view { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 232px; background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.side-logo {
  display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 700;
  padding: 18px 18px 14px; letter-spacing: .5px;
}
.side-section { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.side-title {
  font-size: 12px; color: var(--text-3); font-weight: 600; padding: 8px 6px;
  text-transform: uppercase; letter-spacing: 1px;
}
.cat-list { list-style: none; margin-bottom: 10px; }
.cat-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 8px; border-radius: 8px;
  cursor: pointer; color: var(--text); position: relative;
}
.cat-item:hover { background: #f0f2f5; }
.cat-item.active { background: rgba(79, 142, 247, .12); color: var(--primary-dark); font-weight: 600; }
.cat-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.cat-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-count {
  font-size: 12px; color: var(--text-3); background: #f0f2f5; border-radius: 9px;
  padding: 1px 7px; min-width: 20px; text-align: center;
}
.cat-item.active .cat-count { background: rgba(79,142,247,.18); color: var(--primary-dark); }
.cat-ops { display: none; gap: 2px; }
.cat-item:hover .cat-ops { display: flex; }
.cat-item:hover .cat-count { display: none; }
.cat-ops button {
  border: none; background: none; cursor: pointer; font-size: 12px; padding: 2px 4px;
  border-radius: 4px; color: var(--text-2);
}
.cat-ops button:hover { background: #e2e5ea; }
.side-user {
  border-top: 1px solid var(--border); padding: 12px 14px; display: flex;
  align-items: center; gap: 10px;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #4f8ef7, #22c55e);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; flex-shrink: 0;
}
.user-meta { flex: 1; overflow: hidden; }
.user-name { font-weight: 600; font-size: 13px; }
.user-email {
  font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-ops { display: flex; gap: 2px; }

/* ---------- 顶栏 ---------- */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; background: #fff; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: flex; background: #f0f2f5; border-radius: 8px; padding: 2px; }
.seg button {
  border: none; background: none; padding: 6px 14px; border-radius: 6px; cursor: pointer;
  font-size: 13px; color: var(--text-2); font-family: inherit;
}
.seg button.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.09); }
.seg-sm button { padding: 4px 10px; font-size: 12px; }
.chips { display: flex; gap: 6px; }
.chip {
  border: 1px solid var(--border); background: #fff; border-radius: 999px;
  padding: 4px 13px; font-size: 13px; cursor: pointer; color: var(--text-2); font-family: inherit;
}
.chip.active { background: rgba(79,142,247,.1); border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }

/* ---------- 快速录入条 ---------- */
.quickbar {
  display: flex; align-items: center; gap: 10px; padding: 9px 18px;
  background: #fff; border-bottom: 1px solid var(--border); transition: box-shadow .15s;
}
.quickbar:focus-within { box-shadow: inset 0 -2px 0 var(--primary); }
.qb-icon { color: var(--text-3); font-size: 15px; }
#quick-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 14px; font-family: inherit; color: var(--text); min-width: 120px;
}
#quick-input::placeholder { color: #b6bcc6; }
.batch-legend {
  font-size: 12px; color: var(--text-2); line-height: 1.9; margin-bottom: 12px;
  background: #f7f8fa; border-radius: 8px; padding: 9px 13px;
}
.batch-legend b { color: var(--primary-dark); }
.batch-legend i {
  font-style: normal; background: #eef2fb; color: var(--primary-dark);
  border-radius: 5px; padding: 1px 6px; margin-right: 4px; white-space: nowrap;
}
#batch-text {
  width: 100%; min-height: 150px; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13.5px; font-family: inherit; outline: none; resize: vertical;
  line-height: 1.8;
}
#batch-text:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,142,247,.12); }

/* ---------- 甘特图区 ---------- */
.content { flex: 1; overflow: hidden; position: relative; display: flex; }
.gantt-scroll {
  flex: 1; overflow: auto; background: #fff; position: relative;
}
.gt-head {
  position: sticky; top: 0; z-index: 7; width: max-content;
  display: flex; align-items: stretch;
}
.gt-body { width: max-content; display: flex; align-items: stretch; }
.gt-narrow .gt-head, .gt-narrow .gt-body { margin-left: auto; margin-right: auto; }
.gt-head svg, .gt-body svg { display: block; }
/* 表头冻结角：与正文左列同宽，保证表头日期与任务条对齐 */
.gt-hl {
  position: sticky; left: 0; z-index: 8; width: 190px; flex-shrink: 0;
  background: #fff; border-right: 1px solid #e6e9ee;
  box-shadow: 6px 0 10px -8px rgba(15, 23, 42, .18);
}
/* 左侧固定列：分类标题随横向滚动钉在左边 */
.gt-leftcol {
  position: sticky; left: 0; z-index: 6; width: 190px; flex-shrink: 0;
  background: #fff; border-right: 1px solid #e6e9ee;
  box-shadow: 6px 0 10px -8px rgba(15, 23, 42, .18);
}
.gl-sec { display: flex; align-items: center; gap: 7px; padding: 0 10px 0 12px; }
.gl-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.gl-name {
  font-size: 13px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gl-meta { margin-left: auto; font-size: 11px; color: var(--text-3); white-space: nowrap; }
.gl-empty {
  display: flex; align-items: center; padding: 0 12px;
  font-size: 12px; color: var(--text-3);
}
.gt-month-label { font-size: 12.5px; font-weight: 600; fill: var(--text-2); }
.gt-day-label { font-size: 10.5px; fill: var(--text-3); }
.gt-wk-label { font-size: 9.5px; fill: var(--text-3); }
.gt-day-today { fill: var(--danger); font-weight: 700; }
.gt-today-tag-text { font-size: 9.5px; fill: #fff; font-weight: 600; }
.gt-section { cursor: default; }
.gt-bar { cursor: pointer; }
.gt-bar-rect { stroke: rgba(15,23,42,.10); stroke-width: 1; transition: filter .12s; }
.gt-bar:hover .gt-bar-rect { filter: brightness(.97); }
.gt-bar-rect.gt-overdue-rect { stroke: var(--danger); stroke-dasharray: 4 2.5; stroke-width: 1.4; }
.gt-bar-title {
  font-size: 12px; font-weight: 600; fill: #fff; pointer-events: none;
  paint-order: stroke; stroke: rgba(15, 23, 42, .38); stroke-width: 3px; stroke-linejoin: round;
}
.gt-bar-dur { font-size: 10.5px; fill: var(--text-3); pointer-events: none; }
.gt-bar-dur.gt-dur-in {
  fill: rgba(255,255,255,.92); paint-order: stroke;
  stroke: rgba(15,23,42,.30); stroke-width: 2.5px; stroke-linejoin: round;
}
.gt-bar-pct { font-size: 10px; fill: var(--text-2); font-weight: 600; pointer-events: none; }
.gt-bar-knob {
  fill: #fff; stroke: var(--c, #4f8ef7); stroke-width: 2; cursor: ew-resize; opacity: 0;
  transition: opacity .12s;
}
.gt-bar:hover .gt-bar-knob { opacity: 1; }
.gt-handle { cursor: ew-resize; }

/* ---------- 列表视图 ---------- */
.list-view { flex: 1; overflow: auto; background: #fff; padding: 18px; }
.lv-cat-title { font-size: 14px; font-weight: 700; margin: 16px 0 8px; display: flex; align-items: center; gap: 8px; }
.lv-cat-title::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--c, #4f8ef7); }
table.lv-table { width: 100%; border-collapse: collapse; }
.lv-table th, .lv-table td {
  text-align: left; padding: 9px 10px; border-bottom: 1px solid #f0f1f4; font-size: 13px;
}
.lv-table th { color: var(--text-3); font-weight: 600; font-size: 12px; }
.lv-table tr:hover td { background: #fafbfc; }
.lv-prog { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.lv-prog-bar { flex: 1; height: 6px; border-radius: 3px; background: #eef0f3; overflow: hidden; }
.lv-prog-bar i { display: block; height: 100%; background: var(--c, #4f8ef7); border-radius: 3px; }
.lv-status {
  font-size: 12px; padding: 2px 9px; border-radius: 999px;
}
.lv-status.todo { background: #f0f2f5; color: var(--text-2); }
.lv-status.doing { background: rgba(79,142,247,.12); color: var(--primary-dark); }
.lv-status.done { background: rgba(34,197,94,.13); color: #15803d; }
.lv-prio { font-size: 12px; }
.lv-prio.urgent { color: var(--danger); font-weight: 700; }
.lv-prio.high { color: #ea8a0c; font-weight: 600; }
.lv-overdue { color: var(--danger); font-size: 12px; }
.lv-ops button {
  border: none; background: none; cursor: pointer; color: var(--text-3); font-size: 13px;
  padding: 2px 6px; border-radius: 4px; font-family: inherit;
}
.lv-ops button:hover { background: #f0f2f5; color: var(--text); }

/* ---------- 笔记 / 账号密码 ---------- */
.notes-view { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: #fff; }
.notes-toolbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px;
  border-bottom: 1px solid var(--border);
}
.notes-search {
  flex: 1; max-width: 360px; padding: 7px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px; font-family: inherit; outline: none;
}
.notes-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,142,247,.12); }
.notes-body { flex: 1; display: flex; overflow: hidden; }
.notes-side {
  width: 240px; flex-shrink: 0; border-right: 1px solid var(--border);
  overflow-y: auto; background: #fafbfc;
}
.notes-list { list-style: none; padding: 8px; }
.note-item {
  padding: 9px 11px; border-radius: 8px; cursor: pointer; margin-bottom: 2px;
}
.note-item:hover { background: #f0f2f5; }
.note-item.active { background: rgba(79,142,247,.12); }
.ni-title {
  font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ni-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.note-item-empty { padding: 14px 11px; font-size: 12.5px; color: var(--text-3); line-height: 1.8; }
.note-item { position: relative; padding-right: 30px; }
.ni-ops { display: none; gap: 2px; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.note-item:hover .ni-ops { display: flex; }
.note-item:hover .ni-meta { display: none; }
.ni-ops button {
  border: none; background: none; cursor: pointer; font-size: 12px; padding: 2px 4px;
  border-radius: 4px; color: var(--text-2);
}
.ni-ops button:hover { background: #e2e5ea; }
/* 笔记文件夹：下拉 + 折叠菜单 */
.nf-dd { position: relative; margin: 8px; }
.nf-dd-btn {
  display: flex; align-items: center; gap: 7px; width: 100%;
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 8px 10px; cursor: pointer; font-family: inherit; font-size: 13px; color: var(--text);
  transition: border-color .15s;
}
.nf-dd-btn:hover { border-color: var(--primary); }
.nf-dd.open .nf-dd-btn { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,142,247,.12); }
.nf-dd-icon { font-size: 12px; }
.nf-dd-label {
  flex: 1; text-align: left; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nf-dd-count { font-size: 11.5px; color: var(--text-3); background: #f0f2f5; border-radius: 9px; padding: 1px 7px; }
.nf-dd-caret { color: var(--text-3); font-size: 11px; transition: transform .15s; }
.nf-dd.open .nf-dd-caret { transform: rotate(180deg); }
.nf-dd-menu {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .16); padding: 6px;
  max-height: 320px; overflow-y: auto;
}
.nf-dd-new {
  width: 100%; text-align: left; border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: 13px; color: var(--primary-dark);
  padding: 7px 9px; border-radius: 6px; font-weight: 600;
}
.nf-dd-new:hover { background: #f0f2f5; }
.nf-item {
  display: flex; align-items: center; gap: 7px; padding: 7px 9px; border-radius: 8px;
  cursor: pointer; position: relative; color: var(--text);
}
.nf-item:hover { background: #f0f2f5; }
.nf-item.active { background: rgba(79, 142, 247, .12); color: var(--primary-dark); font-weight: 600; }
.nf-check { width: 14px; font-size: 12px; color: var(--primary-dark); flex-shrink: 0; }
.nf-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.nf-count { font-size: 11.5px; color: var(--text-3); background: #f0f2f5; border-radius: 9px; padding: 1px 7px; }
.nf-item.active .nf-count { background: rgba(79,142,247,.18); color: var(--primary-dark); }
.nf-ops { display: none; gap: 2px; }
.nf-item:hover .nf-ops { display: flex; }
.nf-item:hover .nf-count { display: none; }
.nf-ops button {
  border: none; background: none; cursor: pointer; font-size: 12px; padding: 2px 4px;
  border-radius: 4px; color: var(--text-2);
}
.nf-ops button:hover { background: #e2e5ea; }
.notes-main { flex: 1; overflow-y: auto; scrollbar-gutter: stable; padding: 16px 20px; }
.note-empty { color: var(--text-3); font-size: 13.5px; line-height: 2; padding-top: 40px; text-align: center; }

/* 富文本编辑器 */
.ed-toolbar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 8px 10px; background: #f7f8fa; border: 1px solid var(--border);
  border-bottom: none; border-radius: 10px 10px 0 0;
}
.ed-toolbar button {
  border: none; background: none; cursor: pointer; font-family: inherit;
  font-size: 13px; color: var(--text); padding: 4px 8px; border-radius: 6px; min-width: 26px;
}
.ed-toolbar button:hover { background: #e8ebf0; }
.ed-toolbar button.active { background: rgba(79,142,247,.18); color: var(--primary-dark); }
.ed-toolbar select {
  border: 1px solid var(--border); border-radius: 6px; padding: 3px 4px; font-size: 12.5px;
  font-family: inherit; background: #fff; color: var(--text); outline: none; max-width: 110px;
}
.ed-toolbar input[type=color] {
  width: 26px; height: 24px; padding: 0; border: 1px solid var(--border);
  border-radius: 6px; background: #fff; cursor: pointer;
}
.ed-sep { width: 1px; height: 18px; background: #dcdfe5; margin: 0 4px; }
.ed-status {
  font-size: 12px; color: var(--text-3); margin-right: 8px;
  display: inline-block; min-width: 150px; text-align: right; /* 定宽防工具栏抖动 */
}
/* 表格操作菜单 */
.ed-tablewrap { position: relative; }
.ed-table-menu {
  position: absolute; top: 32px; left: 0; z-index: 40; min-width: 150px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .16); padding: 6px;
  display: flex; flex-direction: column;
}
.ed-table-menu button {
  text-align: left; padding: 6px 10px; border-radius: 6px; min-width: 0;
}
.ed-table-menu button:hover { background: #f0f2f5; }
.ed-table-menu button.disabled { opacity: .38; pointer-events: none; }
.ed-menu-sep { height: 1px; background: #eef0f3; margin: 4px 6px; }
.ed-content.resizing { user-select: none; -webkit-user-select: none; }
.ed-status.dirty { color: #b45309; }
.ed-status.saving { color: var(--primary-dark); }
.ed-status.ok { color: #15803d; }
.ed-status.err { color: var(--danger); }
#ed-title {
  display: block; width: 100%; padding: 12px 14px 6px; border: 1px solid var(--border);
  border-bottom: none; border-top: none; font-size: 20px; font-weight: 700; font-family: inherit;
  outline: none; color: var(--text); background: #fff;
}
#ed-title::placeholder { color: #c3c9d2; font-weight: 600; }
.ed-content {
  min-height: 420px; padding: 10px 14px 18px; border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 10px 10px; outline: none; font-size: 14.5px; line-height: 1.9;
  color: var(--text); background: #fff; overflow-y: auto;
}
.ed-content:focus { border-color: var(--primary); }
.ed-content img { max-width: 100%; }
.ed-content table { border-collapse: collapse; margin: 6px 0; }
.ed-content td, .ed-content th {
  border: 1px solid #cdd3db; padding: 4px 10px; min-width: 32px; font-size: 13.5px;
}
.ed-content blockquote {
  border-left: 3px solid var(--primary); margin: 6px 0; padding: 4px 12px;
  background: #f4f7fd; color: var(--text-2);
}
/* 复选待办项 */
.ed-content .todo-item { margin: 3px 0; }
.ed-content .cb {
  display: inline-block; width: 15px; height: 15px; margin-right: 7px;
  border: 1.5px solid #9aa3ad; border-radius: 4px; background: #fff;
  vertical-align: -2px; cursor: pointer; position: relative;
}
.ed-content .cb:hover { border-color: var(--primary); }
.ed-content .cb.on { background: var(--primary); border-color: var(--primary); }
.ed-content .cb.on::after {
  content: '✓'; position: absolute; left: 2.5px; top: -4px;
  color: #fff; font-size: 12px; font-weight: 700;
}
.ed-content .todo-item.checked { color: rgba(31, 35, 41, .6); text-decoration: line-through; }
.ed-content h1, .ed-content h2, .ed-content h3 { margin: 12px 0 6px; line-height: 1.4; }
.ed-content h1 { font-size: 22px; }
.ed-content h2 { font-size: 18px; }
.ed-content h3 { font-size: 16px; }
.ed-content ul, .ed-content ol { padding-left: 26px; margin: 4px 0; }
#ed-content font[size="1"] { font-size: 12px; }
#ed-content font[size="2"] { font-size: 13px; }
#ed-content font[size="3"] { font-size: 15px; }
#ed-content font[size="4"] { font-size: 17px; }
#ed-content font[size="5"] { font-size: 20px; }
#ed-content font[size="6"] { font-size: 24px; }
#ed-content font[size="7"] { font-size: 32px; }
.ed-foot { margin-top: 10px; font-size: 12px; color: var(--text-3); }

/* ---------- 运营数据看板 ---------- */
.dlg.dlg-admin {
  width: 1040px; max-width: 96vw; max-height: 92vh;
  display: flex; flex-direction: column; padding: 22px 24px;
}
.dlg.dlg-admin .ad-kpi-v { font-size: 22px; }
.ad-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ad-head h3 { margin: 0; }
.ad-sub { font-size: 12px; color: var(--text-3); }
.ad-body { overflow-y: auto; padding-right: 4px; }
.ad-loading, .ad-empty { text-align: center; color: var(--text-3); padding: 30px 0; font-size: 13px; }
.ad-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
.ad-kpi {
  background: #fafbfc; border: 1px solid #eef0f3; border-radius: 10px;
  padding: 12px 14px; border-left: 3px solid #ccd3dd;
}
.ad-kpi.blue { border-left-color: #4f8ef7; }
.ad-kpi.violet { border-left-color: #8b5cf6; }
.ad-kpi.green { border-left-color: #22c55e; }
.ad-kpi.amber { border-left-color: #f59e0b; }
.ad-kpi.red { border-left-color: #e5484d; }
.ad-kpi-v { font-size: 22px; font-weight: 700; letter-spacing: -.5px; }
.ad-kpi-l { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.ad-kpi-s { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.ad-card {
  border: 1px solid #eef0f3; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: #fff;
}
.ad-card-t { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--text); }
.ad-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ad-scroll { max-height: 220px; overflow-y: auto; }
.ad-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ad-table th, .ad-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #f2f3f6; white-space: nowrap; }
.ad-table th { color: var(--text-3); font-weight: 600; position: sticky; top: 0; background: #fff; }
.ad-tag {
  font-size: 10.5px; background: rgba(79,142,247,.14); color: var(--primary-dark);
  border-radius: 4px; padding: 1px 5px; font-weight: 600;
}
/* 迷你柱状图 */
.ad-legend-wrap { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 8px; }
.ad-legend { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.ad-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.ad-legend b { color: var(--text); }
.ad-bars { display: flex; align-items: flex-end; gap: 2px; height: 110px; }
.ad-bar-col {
  flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end;
  position: relative; min-width: 0;
}
.ad-bar-stack {
  height: 100%; display: flex; flex-direction: column-reverse; gap: 1px;
  justify-content: flex-start; border-radius: 2px; overflow: hidden;
}
.ad-bar-stack i { display: block; width: 100%; border-radius: 1px; }
.ad-bar-x {
  position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%);
  font-size: 9.5px; color: var(--text-3); white-space: nowrap;
}
.ad-chart { padding-bottom: 16px; }
/* 分布条 */
.ad-dist-row { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; font-size: 12.5px; }
.ad-dist-n { width: 92px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.ad-dist-bar { flex: 1; height: 8px; background: #f0f2f5; border-radius: 4px; overflow: hidden; }
.ad-dist-bar i { display: block; height: 100%; border-radius: 4px; }
.ad-dist-v { width: 66px; text-align: right; color: var(--text-3); font-size: 11.5px; }

@media (max-width: 860px) {
  .ad-kpis { grid-template-columns: repeat(2, 1fr); }
  .ad-2col { grid-template-columns: 1fr; }
}

/* ---------- 空状态引导 ---------- */
.empty-onboard {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; background: #fff; text-align: center; padding: 20px;
}
.empty-onboard h2 { font-size: 19px; }
.empty-onboard ol { color: var(--text-2); line-height: 2; text-align: left; }
.empty-onboard b { color: var(--primary-dark); }

/* ---------- 弹窗 ---------- */
.dlg {
  border: none; border-radius: 14px; padding: 24px; width: 480px; max-width: 92vw;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .22);
}
.dlg-sm { width: 380px; }
.dlg::backdrop { background: rgba(15, 23, 42, .35); }
.dlg h3 { margin-bottom: 16px; font-size: 17px; }
.dlg .fld { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 12px; flex: 1; }
.fld-label { display: block; margin-bottom: 5px; }
.dlg input, .dlg select, .dlg textarea {
  display: block; width: 100%; margin-top: 5px; padding: 8px 11px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit;
  outline: none; transition: border .15s; resize: vertical;
}
.dlg input:focus, .dlg select:focus, .dlg textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,142,247,.12);
}
.fld-row { display: flex; gap: 12px; }
.dlg-foot { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.prog-wrap { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.prog-wrap input[type=range] { flex: 1; margin: 0; accent-color: var(--primary); padding: 0; border: none; }
.prog-wrap b { min-width: 42px; text-align: right; color: var(--text); }
.color-row { display: flex; gap: 8px; margin-top: 7px; flex-wrap: wrap; }
.color-swatch {
  width: 26px; height: 26px; border-radius: 8px; cursor: pointer; border: 2px solid transparent;
  transition: transform .1s;
}
.color-swatch:hover { transform: scale(1.12); }
.color-swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px #fff inset; }

/* ---------- Tooltip / Toast ---------- */
.tooltip {
  position: fixed; z-index: 99; background: rgba(28, 32, 38, .94); color: #fff;
  border-radius: 9px; padding: 10px 13px; font-size: 12.5px; line-height: 1.75;
  pointer-events: none; max-width: 320px; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.tooltip b { font-size: 13px; }
.tooltip .tt-row { color: #cfd6df; }
.tooltip .tt-note { color: #9fb3c8; border-top: 1px solid rgba(255,255,255,.14); margin-top: 5px; padding-top: 5px; }
.toast {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%); z-index: 100;
  background: rgba(28, 32, 38, .92); color: #fff; padding: 10px 20px; border-radius: 9px;
  font-size: 13.5px; box-shadow: 0 8px 24px rgba(0,0,0,.25); transition: opacity .2s;
}
.toast.err { background: rgba(190, 40, 45, .95); }
.toast.ok { background: rgba(21, 128, 61, .93); }

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .sidebar { width: 64px; }
  .side-logo span, .side-title, .user-meta, .cat-name, .cat-count, .cat-ops { display: none; }
  .cat-item { justify-content: center; }
  .side-user { flex-direction: column; }
}
