/* 蓝鲸AI办公 · 工作台 样式 */

:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #16203a;
  --ink-2: #47536b;
  --muted: #7b879c;
  --line: #e3e8f0;
  --line-2: #eef1f6;
  --brand: #0b63f6;
  --brand-2: #2f86ff;
  --brand-soft: #eaf2ff;
  --nav: #101a2e;
  --nav-2: #18233c;
  --ok: #14a06a;
  --ok-soft: #e6f7f0;
  --warn: #d98212;
  --warn-soft: #fdf3e3;
  --bad: #d9483f;
  --bad-soft: #fdecea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 32, 58, .05), 0 6px 20px rgba(20, 32, 58, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font: 14px/1.65 "Microsoft YaHei UI", "Microsoft YaHei", -apple-system, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------- 布局 */
.app { display: flex; height: 100vh; overflow: hidden; }

.side {
  width: 216px; flex: none; background: var(--nav); color: #c9d4e8;
  display: flex; flex-direction: column; padding: 18px 0 12px;
}
.brand { padding: 0 18px 16px; }
.brand b { display: block; color: #fff; font-size: 16px; letter-spacing: .3px; }
.brand span { display: block; color: #6d7f9e; font-size: 11.5px; margin-top: 2px; letter-spacing: .5px; }

.nav { flex: 1; padding: 4px 10px; }
.nav button {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: none; border: 0; color: #b7c5dd; text-align: left;
  padding: 10px 12px; border-radius: 8px; cursor: pointer; margin-bottom: 2px;
  font-size: 14px; transition: background .12s, color .12s;
}
.nav button:hover { background: var(--nav-2); color: #fff; }
.nav button.on { background: var(--brand); color: #fff; font-weight: 600; }
.nav button i { font-style: normal; font-size: 15px; width: 18px; text-align: center; }

.nav a.navbtn {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: none; border: 0; color: #b7c5dd; text-align: left; text-decoration: none;
  padding: 10px 12px; border-radius: 8px; cursor: pointer; margin-bottom: 2px;
  font-size: 14px; transition: background .12s, color .12s;
}
.nav a.navbtn:hover { background: var(--nav-2); color: #fff; text-decoration: none; }
.nav a.navbtn i { font-style: normal; font-size: 15px; width: 18px; text-align: center; }

.side-foot { padding: 10px 18px 0; border-top: 1px solid #223052; margin: 0 10px; font-size: 11.5px; color: #64748f; }
.side-foot .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 6px; }
.side-foot .dot.bad { background: var(--bad); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.top {
  height: 56px; flex: none; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 22px; gap: 14px;
}
.top h1 { font-size: 16px; margin: 0; font-weight: 600; }
.top .sub { color: var(--muted); font-size: 12.5px; }
.top .grow { flex: 1; }

.view { flex: 1; overflow-y: auto; padding: 20px 22px 40px; }
.view[hidden] { display: none; }

/* ---------------------------------------------------------- 通用块 */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card > h3 {
  margin: 0; padding: 13px 16px; font-size: 13.5px; font-weight: 600;
  border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 8px;
}
.card > h3 .grow { flex: 1; }
.card > h3 small { font-weight: 400; color: var(--muted); font-size: 12px; }
.card .body { padding: 14px 16px; }
.card .body.tight { padding: 8px 10px; }
.card .body.flush { padding: 0; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1180px) { .g3, .g4, .g-2-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) { .g2, .g3, .g4, .g-2-1 { grid-template-columns: 1fr; } }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 6px 13px; border-radius: 7px; cursor: pointer; white-space: nowrap;
  transition: .12s; font-size: 13px;
}
.btn:hover { border-color: #c9d4e6; background: #fafcff; color: var(--ink); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #0a58dc; border-color: #0a58dc; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: #f0f3f9; color: var(--ink); }
.btn.danger { color: var(--bad); border-color: #f3d3d0; background: #fff; }
.btn.danger:hover { background: var(--bad-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 3px 9px; font-size: 12px; }

.pill {
  display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11.5px;
  background: var(--line-2); color: var(--ink-2); white-space: nowrap;
}
.pill.b { background: var(--brand-soft); color: #0a51c9; }
.pill.g { background: var(--ok-soft); color: #0d7a50; }
.pill.y { background: var(--warn-soft); color: #a5610a; }
.pill.r { background: var(--bad-soft); color: #b3352d; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }

/* ---------------------------------------------------------- 统计 */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px; }
.kpi .k { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.kpi .v { font-size: 23px; font-weight: 600; margin-top: 3px; letter-spacing: -.3px; }
.kpi .v small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 3px; }
.kpi .d { font-size: 11.5px; color: var(--muted); }

/* ---------------------------------------------------------- 库卡片 */
.lib { display: flex; flex-direction: column; }
.lib .lb-top { display: flex; align-items: center; gap: 9px; }
.lib .ico {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center; font-size: 17px; background: var(--brand-soft);
}
.lib h4 { margin: 0; font-size: 14.5px; }
.lib .q { color: var(--muted); font-size: 12.5px; margin: 8px 0 10px; }
.lib .meta { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.lib .meta b { font-weight: 600; color: var(--ink); }
.lib .acts { display: flex; gap: 7px; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }

/* ---------------------------------------------------------- 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; background: #fafbfd; position: sticky; top: 0; z-index: 1; }
tbody tr:hover { background: #fafcff; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scroll { overflow: auto; }
.scroll.y { max-height: 360px; }

/* ---------------------------------------------------------- 看板 */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
@media (max-width: 1100px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .board { grid-template-columns: 1fr; } }

.col { background: #eef1f7; border-radius: var(--radius); padding: 9px; min-height: 130px; border: 1px solid transparent; }
.col.drop { background: var(--brand-soft); border-color: #b8d3ff; border-style: dashed; }
.col > header { display: flex; align-items: center; gap: 7px; padding: 2px 4px 9px; font-size: 13px; font-weight: 600; }
.col > header .n { color: var(--muted); font-weight: 400; font-size: 12px; }
.col > header .bar { width: 8px; height: 8px; border-radius: 50%; }

.tk {
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; margin-bottom: 8px; cursor: grab; transition: .12s;
}
.tk:hover { border-color: #c4d4ee; box-shadow: 0 2px 8px rgba(20,32,58,.07); }
.tk.dragging { opacity: .4; }
.tk .t { font-size: 13.5px; font-weight: 600; line-height: 1.45; }
.tk .tags { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; align-items: center; }
.tk .note { color: var(--muted); font-size: 12px; margin-top: 6px; white-space: pre-wrap; word-break: break-word; }
.tk .ops { display: flex; gap: 4px; margin-top: 8px; opacity: 0; transition: .12s; }
.tk:hover .ops { opacity: 1; }
.tk .due.over { color: var(--bad); font-weight: 600; }
.tk .due.soon { color: var(--warn); font-weight: 600; }

.empty { color: var(--muted); text-align: center; padding: 26px 10px; font-size: 13px; }

/* ---------------------------------------------------------- 表单 */
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px; font-weight: 500; }
label.f > span em { color: var(--bad); font-style: normal; }
input[type=text], input[type=date], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; outline: none; transition: .12s;
}
textarea { resize: vertical; min-height: 74px; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(47,134,255,.13); }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

/* ---------------------------------------------------------- 助手 */
.assist { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 980px) { .assist { grid-template-columns: 1fr; } }

.tpl {
  display: block; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; margin-bottom: 7px; cursor: pointer; transition: .12s;
}
.tpl:hover { border-color: #c4d4ee; }
.tpl.on { border-color: var(--brand); background: var(--brand-soft); }
.tpl .n { font-weight: 600; font-size: 13.5px; }
.tpl .d { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.tpl .c { font-size: 11px; color: var(--brand); }

.out {
  white-space: pre-wrap; word-break: break-word; line-height: 1.8; font-size: 14px;
  min-height: 300px; padding: 16px 18px;
}
.out.md { font-family: inherit; }
.out table { margin: 10px 0; }

.spin { display: inline-block; width: 13px; height: 13px; border: 2px solid #cfe0ff; border-top-color: var(--brand); border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

.hint { background: var(--warn-soft); border: 1px solid #f2ddb8; color: #7a4d09; padding: 9px 12px; border-radius: 8px; font-size: 12.5px; }
.hint.bad { background: var(--bad-soft); border-color: #f3d3d0; color: #8f2b24; }
.hint.ok { background: var(--ok-soft); border-color: #bfe8d6; color: #0b6644; }
.hint pre { margin: 6px 0 0; white-space: pre-wrap; font-size: 12px; }

/* ---------------------------------------------------------- 弹窗 */
.mask { position: fixed; inset: 0; background: rgba(16,26,46,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.mask[hidden] { display: none; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; box-shadow: 0 20px 60px rgba(16,26,46,.3); }
.modal > h3 { margin: 0; padding: 15px 18px; border-bottom: 1px solid var(--line-2); font-size: 15px; display: flex; align-items: center; }
.modal > h3 .grow { flex: 1; }
.modal .body { padding: 16px 18px; }
.modal .foot { padding: 13px 18px; border-top: 1px solid var(--line-2); display: flex; gap: 9px; justify-content: flex-end; background: #fafbfd; border-radius: 0 0 12px 12px; }

/* ---------------------------------------------------------- 图表 */
.chart { width: 100%; }
.chart .bl { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; font-size: 12.5px; }
.chart .bl .lab { width: 88px; flex: none; color: var(--ink-2); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart .bl .track { flex: 1; background: #f0f3f9; border-radius: 5px; height: 19px; overflow: hidden; }
.chart .bl .fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--brand-2), var(--brand)); transition: width .5s cubic-bezier(.2,.7,.3,1); }
.chart .bl .val { width: 54px; flex: none; color: var(--ink); font-variant-numeric: tabular-nums; font-size: 12px; }
.chart svg { display: block; overflow: visible; }

.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 12.5px; }
.legend div { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px;
  cursor: pointer; color: var(--muted); font-size: 13.5px; margin-bottom: -1px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

.bar-mini { display: inline-block; height: 6px; border-radius: 3px; background: var(--brand-2); vertical-align: middle; }
