/* 睿歌项目统筹平台 —— 原生 CSS 设计系统 */
:root {
  --ink: #12233b;
  --ink-2: #2c425c;
  --ink-3: #526980;
  --muted: #7a8ba0;
  --line: #e3e9f1;
  --line-strong: #cdd8e6;
  --bg: #f3f6fa;
  --card: #ffffff;
  --soft: #f7f9fc;
  --brand: #1f5f8b;
  --brand-2: #2f7ea8;
  --brand-soft: #e8f2f8;
  --accent: #e8763a;
  --accent-soft: #fdf0e8;
  --green: #16866a;
  --green-soft: #e6f6f1;
  --amber: #b7791f;
  --amber-soft: #fdf5e5;
  --red: #c64747;
  --red-soft: #fdecec;
  --purple: #6554c0;
  --purple-soft: #efedfb;
  --shadow-sm: 0 2px 8px rgba(18, 35, 59, .05);
  --shadow: 0 12px 34px rgba(18, 35, 59, .09);
  --shadow-lg: 0 28px 70px rgba(18, 35, 59, .18);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 250px;
  --topbar-h: 70px;
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
::selection { background: #cfe6f2; color: var(--ink); }

/* ---------- boot ---------- */
.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  color: var(--muted);
}
.boot-mark { display: flex; gap: 8px; }
.boot-mark span {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--brand-2);
  animation: pulse 1.2s infinite ease-in-out;
}
.boot-mark span:nth-child(2) { animation-delay: .15s; background: var(--accent); }
.boot-mark span:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 100% { transform: translateY(0); opacity: .45; } 50% { transform: translateY(-8px); opacity: 1; } }

/* ---------- login ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(480px, .95fr);
  background: #fff;
}
.login-brand {
  position: relative;
  overflow: hidden;
  padding: 52px 58px;
  color: #f7fbff;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(70, 160, 200, .45), transparent 60%),
    radial-gradient(700px 500px at 110% 100%, rgba(232, 118, 58, .32), transparent 55%),
    linear-gradient(145deg, #0d1f35 0%, #143754 58%, #1b4a6b 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-brand::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, #000, transparent 88%);
}
.login-brand::after {
  content: "";
  position: absolute;
  width: 540px; height: 540px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  right: -250px; top: 18%;
  box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 140px rgba(255,255,255,.018);
}
.brand-line { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; }
.brand-glyph {
  width: 48px; height: 48px; border-radius: 14px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.16);
  display: grid; place-items: center;
  backdrop-filter: blur(8px);
}
.brand-glyph svg { width: 30px; height: 30px; }
.brand-line strong { font-size: 21px; letter-spacing: .04em; font-weight: 700; }
.brand-line small { display: block; font-size: 13.5px; letter-spacing: .18em; color: rgba(255,255,255,.55); }
.login-hero { position: relative; z-index: 1; max-width: 590px; margin: 48px 0; }
.login-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14.5px; letter-spacing: .12em; text-transform: uppercase;
  color: #9fd3e6; margin-bottom: 20px;
}
.login-eyebrow::before { content: ""; width: 26px; height: 1px; background: #9fd3e6; }
.login-hero h1 {
  font-size: clamp(34px, 3.5vw, 52px);
  line-height: 1.18;
  letter-spacing: -.02em;
  margin: 0 0 20px;
  font-weight: 750;
}
.login-hero h1 em { font-style: normal; color: #ffb98f; }
.login-hero p { color: rgba(239, 247, 255, .72); font-size: 17px; line-height: 1.85; max-width: 500px; margin: 0; }
.login-features { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.login-features span {
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 14.5px;
  color: rgba(255,255,255,.82);
}
.login-foot { position: relative; z-index: 1; color: rgba(255,255,255,.4); font-size: 13.5px; letter-spacing: .04em; }
.login-form-side {
  display: grid;
  place-items: center;
  padding: 48px;
  background:
    radial-gradient(600px 300px at 100% 0%, #eef6fb, transparent 65%),
    #fff;
}
.login-card { width: min(420px, 100%); }
.login-card h2 { margin: 0 0 6px; font-size: 29px; letter-spacing: -.01em; }
.login-card > p { margin: 0 0 28px; color: var(--muted); }
.login-card .field { margin-bottom: 16px; }
.login-submit { width: 100%; height: 46px; margin-top: 6px; }
.login-switch { margin-top: 14px; text-align: center; font-size: 14px; color: var(--muted); }
.login-switch button { border: 0; background: none; color: var(--brand); font-size: 14px; padding: 0 2px; }
.login-switch button:hover { text-decoration: underline; }
.register-panel { border-top: 1px dashed var(--line-strong); margin-top: 22px; padding-top: 18px; }
.register-head { margin-bottom: 14px; }
.register-head .linklike { font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.register-head h3 { margin: 0 0 4px; font-size: 20px; }
.register-head p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.register-panel .field { margin-bottom: 12px; }
.register-panel .login-submit { margin-top: 4px; }
.register-success { text-align: center; padding: 18px 4px 4px; }
.register-success-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; margin: 0 auto 12px; }
.register-success-icon svg { width: 21px; height: 21px; }
.register-success h3 { margin: 0 0 7px; font-size: 19px; }
.register-success p { color: var(--muted); font-size: 14px; line-height: 1.8; margin: 0 auto 16px; max-width: 320px; }
.demo-panel { margin-top: 28px; border-top: 1px dashed var(--line-strong); padding-top: 20px; }
.demo-panel h3 { font-size: 14.5px; color: var(--muted); font-weight: 500; letter-spacing: .08em; margin: 0 0 12px; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-chip {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: 10px;
  padding: 9px 11px;
  color: var(--ink-2);
  transition: .15s ease;
}
.demo-chip:hover { border-color: var(--brand-2); background: var(--brand-soft); transform: translateY(-1px); }
.demo-chip b { display: block; font-size: 14.5px; font-weight: 600; }
.demo-chip span { font-size: 12.5px; color: var(--muted); }
.login-note { margin-top: 20px; font-size: 13.5px; line-height: 1.7; color: var(--muted); }

/* ---------- app shell ---------- */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
  color: #eaf3fa;
  background:
    radial-gradient(420px 260px at -20% 0%, rgba(61, 153, 194, .35), transparent 60%),
    linear-gradient(180deg, #0e2037 0%, #132f4c 100%);
  overflow: hidden auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; }
.sidebar-logo {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}
.sidebar-logo svg { width: 25px; height: 25px; }
.sidebar-brand strong { font-size: 17px; letter-spacing: .03em; display: block; }
.sidebar-brand small { font-size: 12px; letter-spacing: .15em; color: rgba(255,255,255,.42); }
.nav-group { margin-top: 14px; }
.nav-label {
  font-size: 12.5px; letter-spacing: .14em; color: rgba(255,255,255,.35);
  padding: 0 12px 8px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 10px;
  color: rgba(235,245,252,.7);
  font-size: 16px;
  transition: .15s ease;
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; opacity: .8; flex: none; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.11); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.nav-item.active::before {
  content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-badge {
  margin-left: auto;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 600; line-height: 1;
}
.sidebar-foot { margin-top: auto; padding-top: 20px; }
.sidebar-model {
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.05);
  border-radius: 11px;
  padding: 11px 12px;
  margin-bottom: 12px;
  font-size: 13px;
  color: rgba(255,255,255,.55);
}
.sidebar-model b { display: block; color: rgba(255,255,255,.88); font-size: 13.5px; font-weight: 600; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 11px;
  background: rgba(255,255,255,.06);
}
.sidebar-user .avatar { background: rgba(255,255,255,.14); color: #fff; }
.sidebar-user strong { font-size: 15px; display: block; line-height: 1.3; }
.sidebar-user small { font-size: 12.5px; color: rgba(255,255,255,.45); }
.sidebar-user .logout-btn { margin-left: auto; color: rgba(255,255,255,.55); background: none; border: 0; padding: 4px 6px; border-radius: 6px; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 1; }
.sidebar-user .logout-btn svg { width: 15px; height: 15px; }
.sidebar-user .logout-btn:hover { color: #fff; background: rgba(255,255,255,.08); }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 32px;
  background: rgba(255,255,255,.85);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 19px; margin: 0; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.avatar-btn { border: 0; background: none; padding: 0; border-radius: 50%; line-height: 0; }
.avatar-btn:hover { box-shadow: 0 0 0 3px rgba(47,126,168,.12); }
.global-search {
  position: relative; width: 300px; max-width: 30vw; flex: none;
}
.global-search > svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted); pointer-events: none;
}
.global-search input {
  width: 100%; height: 36px; padding: 0 12px 0 34px;
  border: 1px solid var(--line); border-radius: 9px;
  background: #fbfcfd; color: var(--ink); font-size: 13.5px;
}
.global-search input:focus { outline: none; border-color: var(--brand-2); background: #fff; box-shadow: 0 0 0 3px rgba(47,126,168,.1); }
.search-summary { color: var(--ink-3); font-size: 13.5px; margin: 0 0 14px; }
.search-group + .search-group { margin-top: 18px; }
.search-group h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.search-group h4 span { margin-left: 7px; font-size: 12px; color: var(--muted); }
.search-result {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 11px; border-radius: 9px; color: var(--ink);
  border: 1px solid transparent;
}
.search-result:hover { background: var(--brand-soft); border-color: #d2e6f2; }
.search-result-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-meta { flex: 1; min-width: 0; color: var(--ink-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.search-result > svg { width: 14px; height: 14px; color: var(--muted); flex: none; }
.notif-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-3);
  display: grid; place-items: center; position: relative; flex: none;
}
.notif-btn:hover { border-color: var(--brand-2); color: var(--brand); background: var(--brand-soft); }
.notif-btn > svg { width: 18px; height: 18px; }
.notif-count {
  position: absolute; top: -6px; right: -6px;
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; border: 2px solid #fff;
  background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700; line-height: 1;
  display: grid; place-items: center;
}
.notif-count[hidden] { display: none; }
.notif-list { display: grid; gap: 8px; padding: 10px; }
.notif-item {
  width: 100%; text-align: left;
  display: flex; align-items: flex-start; gap: 12px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #fff; padding: 14px 15px; color: var(--ink);
  transition: .15s ease;
}
.notif-item:hover { border-color: #c4d9e8; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.notif-item.unread { background: #f8fcff; border-color: #d2e6f2; }
.notif-item.read { opacity: .92; }
.notif-item-icon {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.notif-item-icon > svg { width: 17px; height: 17px; }
.notif-item-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.notif-item-main strong { font-size: 15px; font-weight: 600; }
.notif-item-body { font-size: 13.5px; color: var(--ink-3); line-height: 1.6; }
.notif-item-main small { font-size: 12px; color: var(--muted); }
.notif-item-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 5px; flex: none; }
.activity-list { display: grid; }
.activity-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; padding-bottom: 0; }
.activity-icon {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.activity-icon > svg { width: 16px; height: 16px; }
.activity-main { min-width: 0; flex: 1; }
.activity-main strong { font-size: 14px; font-weight: 600; }
.activity-user { margin-left: 8px; color: var(--muted); font-size: 12px; }
.activity-main p { margin: 3px 0 2px; color: var(--ink-3); font-size: 13.5px; line-height: 1.6; word-break: break-word; }
.activity-main small { color: var(--muted); font-size: 12px; }
.attention-panel {
  margin-top: 18px; border: 1px solid #eed7bd; border-radius: var(--radius);
  background: #fffaf3; padding: 14px 16px;
}
.attention-head { display: flex; align-items: center; gap: 8px; color: #8a5a20; font-size: 14px; }
.attention-head svg { width: 17px; height: 17px; }
.attention-head span { color: #a87a42; font-size: 12px; }
.attention-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px 18px; margin-top: 8px; }
.attention-item {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 7px 0; color: var(--ink); border-radius: 6px;
}
.attention-item:hover { background: rgba(232,118,58,.06); }
.attention-dot { width: 7px; height: 7px; border-radius: 50%; background: #d6a25b; flex: none; }
.attention-item.high .attention-dot { background: var(--danger); }
.attention-item > span:nth-child(2) { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.attention-item strong { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attention-item small { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attention-item > svg { width: 14px; height: 14px; color: var(--muted); flex: none; }
.list-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px 10px;
}
.list-toolbar .search-box { flex: 1; min-width: 220px; max-width: 440px; }
.list-toolbar .select { width: auto; min-width: 160px; }
.load-more-wrap { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 18px 16px; }
.load-more-wrap .btn[hidden] { display: none; }
.payment-milestone { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; min-width: 180px; }
.payment-milestone > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.payment-milestone .t-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.payment-milestone .t-right strong { font-size: 13.5px; }
.mention-list { display: grid; gap: 6px; max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; padding: 8px; background: #fbfcfd; }
.mention-option { display: flex; align-items: flex-start; gap: 9px; padding: 7px 8px; border-radius: 7px; cursor: pointer; }
.mention-option:hover { background: var(--brand-soft); }
.mention-option input { margin-top: 3px; accent-color: var(--brand); }
.mention-option span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mention-option small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.delivery-context { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: #f7fbfd; }
.delivery-context b { font-size: 14px; }
.delivery-context span { font-size: 12.5px; color: var(--muted); }
.delivery-history { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.delivery-history h4 { margin: 0 0 9px; font-size: 14px; }
.delivery-history-item { padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfd; margin-bottom: 8px; }
.delivery-history-item p { margin: 0 0 5px; font-size: 13.5px; line-height: 1.65; color: var(--ink-3); white-space: pre-wrap; }
.delivery-history-item small { color: var(--muted); font-size: 12px; line-height: 1.6; }
.batch-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 20px 10px; color: var(--ink-3);
}
.batch-bar .spacer { flex: 1; }
.check-line { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-3); cursor: pointer; }
.check-line input, .reg-check { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.select-sm { height: 32px; padding: 0 28px 0 10px; font-size: 13px; flex: none; }
.batch-bar .select-sm { width: auto; min-width: 170px; padding: 0 28px 0 10px; }
@media (max-width: 700px) { .attention-list { grid-template-columns: 1fr; } }
.model-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 11px;
  background: #fff;
  max-width: 260px;
}
.model-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; }
.model-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page { padding: 28px 32px 64px; max-width: 1500px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 25px; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.page-head .spacer { flex: 1; }
.section-head { display: flex; align-items: center; gap: 12px; margin: 26px 0 12px; }
.section-head h3 { margin: 0; font-size: 17px; }
.section-head .spacer { flex: 1; }
.section-head small { color: var(--muted); }

/* ---------- buttons / badges ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  transition: .15s ease;
  white-space: nowrap;
  background: var(--soft);
  color: var(--ink-2);
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(31,95,139,.22); }
.btn-primary:hover { background: #174e74; }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(232,118,58,.24); }
.btn-accent:hover { background: #d5642b; }
.btn-outline { background: #fff; border-color: var(--line-strong); color: var(--ink-2); }
.btn-outline:hover { border-color: var(--brand-2); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--ink-3); }
.btn-ghost:hover { background: var(--soft); color: var(--ink); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: #f9dada; }
.btn-sm { padding: 5px 10px; font-size: 14px; border-radius: 7px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; }
.btn-block { width: 100%; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 13px;
  font-weight: 500;
  background: var(--soft);
  color: var(--ink-3);
  white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.no-dot::before { display: none; }
.badge-active, .badge-doing, .badge-ready, .badge-normal { background: var(--green-soft); color: var(--green); }
.badge-planning, .badge-todo, .badge-processing { background: var(--brand-soft); color: var(--brand); }
.badge-review, .badge-risk, .badge-warning { background: var(--amber-soft); color: var(--amber); }
.badge-paused, .badge-blocked, .badge-delayed, .badge-failed { background: var(--red-soft); color: var(--red); }
.badge-completed, .badge-done { background: #edf1f5; color: #5d7186; }
.badge-archived { background: #f0f0f2; color: #8b8b93; }
.badge-level1 { background: var(--purple-soft); color: var(--purple); }
.badge-level2 { background: var(--brand-soft); color: var(--brand); }
.badge-level3 { background: var(--green-soft); color: var(--green); }
.badge-owner { background: var(--accent-soft); color: var(--accent); }
.badge-manager { background: var(--brand-soft); color: var(--brand); }
.badge-admin { background: #1d2b3d; color: #fff; }
.badge-unknown { background: var(--amber-soft); color: var(--amber); }

/* ---------- cards / stats ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-sm);
}
.stat-card::after {
  content: "";
  position: absolute; right: -22px; top: -28px;
  width: 100px; height: 100px; border-radius: 50%;
  background: var(--brand-soft); opacity: .55;
}
.stat-card.accent::after { background: var(--accent-soft); }
.stat-card.green::after { background: var(--green-soft); }
.stat-card.purple::after { background: var(--purple-soft); }
.stat-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
  margin-bottom: 13px;
}
.stat-card.accent .stat-icon { background: var(--accent-soft); color: var(--accent); }
.stat-card.green .stat-icon { background: var(--green-soft); color: var(--green); }
.stat-card.purple .stat-icon { background: var(--purple-soft); color: var(--purple); }
.stat-icon svg { width: 18px; height: 18px; }
.stat-label { color: var(--muted); font-size: 14px; }
.stat-value { font-size: 29px; font-weight: 700; letter-spacing: -.04em; margin-top: 2px; line-height: 1.2; }
.stat-value small { font-size: 14.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 3px; }
.stat-foot { margin-top: 8px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-foot b { color: var(--green); font-weight: 600; }
.stat-foot .warn { color: var(--amber); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .8fr); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-2 > *, .grid-3 > *, .stack, .card, .page { min-width: 0; }
.stack { display: grid; gap: 16px; }
.mt-0 { margin-top: 0 !important; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ---------- progress ---------- */
.progress { height: 7px; border-radius: 99px; background: #edf1f6; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-2), #59a6c4); transition: width .4s ease; }
.progress.green > span { background: linear-gradient(90deg, #1a997a, #50c3a6); }
.progress.amber > span { background: linear-gradient(90deg, #d49a37, #e7ba66); }
.progress.red > span { background: linear-gradient(90deg, #c64747, #df8181); }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress { flex: 1; }
.progress-num { font-size: 13.5px; color: var(--muted); width: 34px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- table ---------- */
.table-wrap { overflow: auto; border-radius: var(--radius); max-width: 100%; }
table.table { width: 100%; border-collapse: collapse; min-width: 620px; }
.table th {
  font-size: 13px; font-weight: 500; letter-spacing: .06em;
  color: var(--muted); text-transform: uppercase;
  text-align: left; padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
  white-space: nowrap;
}
.table td { padding: 13px 14px; border-bottom: 1px solid #eef2f7; font-size: 15px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: #fbfdff; }
.table .t-strong { font-weight: 600; color: var(--ink); }
.table .t-sub { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.table .t-right { text-align: right; }
.table .t-nowrap { white-space: nowrap; }
.table .cell-actions { display: flex; gap: 5px; justify-content: flex-end; flex-wrap: wrap; }
.table .empty-row td { padding: 38px 16px; text-align: center; color: var(--muted); }

/* ---------- project cards ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.project-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: .18s ease;
  overflow: hidden;
}
.project-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--brand-2); opacity: 0; transition: .18s ease;
}
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #cbd9e8; }
.project-card:hover::before { opacity: 1; }
.project-card .pc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.project-card .pc-code { font-size: 12.5px; letter-spacing: .08em; color: var(--muted); font-variant-numeric: tabular-nums; }
.project-card h4 { margin: 6px 0 7px; font-size: 17.5px; letter-spacing: -.01em; }
.project-card .pc-desc { color: var(--ink-3); font-size: 14px; line-height: 1.7; min-height: 39px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.project-card .pc-meta { display: flex; align-items: center; gap: 12px; margin: 13px 0 12px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.project-card .pc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.project-card .pc-meta svg { width: 12px; height: 12px; }
.project-card .pc-foot { display: flex; align-items: center; gap: 10px; margin-top: 11px; }
.project-card .pc-foot .progress { flex: 1; }
.project-card .pc-owner { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 11px;
  min-width: 240px;
}
.search-box svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.search-box input { border: 0; outline: 0; background: transparent; width: 100%; color: var(--ink); font-size: 15px; }
.search-box input::placeholder { color: #a4b1c1; }
.segmented { display: inline-flex; padding: 3px; background: #e9eff5; border-radius: 9px; gap: 2px; }
.segmented button {
  border: 0; background: transparent; color: var(--ink-3);
  padding: 6px 11px; border-radius: 7px; font-size: 14px;
}
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(18,35,59,.1); }

/* ---------- detail ---------- */
.detail-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 26px;
  color: #fff;
  background:
    radial-gradient(700px 260px at 100% 0%, rgba(232,118,58,.28), transparent 55%),
    linear-gradient(120deg, #12304c, #1d5375);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.detail-hero::after {
  content: ""; position: absolute; right: -80px; bottom: -160px;
  width: 340px; height: 340px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 0 0 60px rgba(255,255,255,.03), 0 0 0 120px rgba(255,255,255,.02);
}
.detail-hero .dh-top { display: flex; align-items: flex-start; gap: 18px; position: relative; z-index: 1; }
.detail-hero .dh-back { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15); color: #fff; }
.detail-hero h2 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.detail-hero .dh-code { color: rgba(255,255,255,.5); font-size: 13px; letter-spacing: .1em; margin-bottom: 7px; }
.detail-hero .dh-desc { color: rgba(255,255,255,.66); max-width: 720px; margin: 10px 0 0; font-size: 15px; line-height: 1.75; }
.detail-hero .dh-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; position: relative; z-index: 2; }
.detail-hero .dh-stats { display: flex; gap: 26px; margin-top: 24px; position: relative; z-index: 1; flex-wrap: wrap; }
.detail-hero .dh-stat small { display: block; color: rgba(255,255,255,.45); font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; }
.detail-hero .dh-stat b { font-size: 21px; font-weight: 650; }
.detail-hero .dh-progress { margin-top: 20px; max-width: 520px; position: relative; z-index: 1; }
.detail-hero .dh-progress .progress { background: rgba(255,255,255,.14); height: 8px; }
.detail-hero .dh-progress .progress > span { background: linear-gradient(90deg, #ffb98f, #ffd9c2); }
.detail-hero .dh-progress .progress-num { color: rgba(255,255,255,.7); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; color: var(--muted);
  padding: 10px 16px; font-size: 15px; position: relative; white-space: nowrap;
}
.tabs button.active { color: var(--ink); font-weight: 600; }
.tabs button.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.meta-grid > div { background: #fff; padding: 14px 16px; }
.meta-grid small { display: block; color: var(--muted); font-size: 12.5px; margin-bottom: 3px; }
.meta-grid b { font-size: 15px; font-weight: 600; }

.work-list { display: grid; gap: 10px; }
.work-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: .15s ease;
}
.work-row:hover { border-color: #cbd9e8; box-shadow: var(--shadow-sm); }
.work-row .wr-main { min-width: 0; flex: 1; }
.work-row h4 { margin: 0 0 3px; font-size: 15.5px; }
.work-row .wr-desc { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-row .wr-people { display: flex; gap: 12px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.work-row .wr-people b { color: var(--ink-2); font-weight: 500; }
.work-row .wr-progress { width: 120px; flex: none; }
.work-row .wr-actions { display: flex; gap: 4px; flex: none; }

.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.member-card { display: flex; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
  font-size: 14.5px; font-weight: 600; flex: none;
  text-transform: uppercase;
}
.avatar.lg { width: 44px; height: 44px; font-size: 17px; }
.avatar.accent { background: var(--accent-soft); color: var(--accent); }
.member-card .mc-main { min-width: 0; }
.member-card strong { display: block; font-size: 15px; }
.member-card small { color: var(--muted); font-size: 12.5px; display: block; }

/* ---------- knowledge ---------- */
.kb-banner {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid #d7e8f1;
  background: linear-gradient(100deg, #f1f9fd, #fbfdff);
  border-radius: 12px;
  padding: 13px 16px;
  margin-bottom: 16px;
}
.kb-banner .kb-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.kb-banner strong { font-size: 15px; display: block; }
.kb-banner small { color: var(--muted); font-size: 13px; }
.kb-banner .spacer { flex: 1; }
.dropzone {
  border: 1.5px dashed #bfd2e2;
  border-radius: 14px;
  background: #fbfdff;
  padding: 26px;
  text-align: center;
  transition: .15s ease;
  cursor: pointer;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand-2); background: var(--brand-soft); }
.dropzone svg { width: 30px; height: 30px; color: var(--brand-2); margin-bottom: 8px; }
.dropzone b { display: block; font-size: 15.5px; }
.dropzone small { color: var(--muted); font-size: 13px; }
.upload-progress { margin-top: 12px; display: none; }
.upload-progress.show { display: block; }
.doc-status { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.doc-status .progress { width: 70px; }
.doc-status small { color: var(--muted); font-size: 12.5px; }
.doc-title { display: flex; align-items: center; gap: 8px; }
.file-icon {
  width: 28px; height: 28px; border-radius: 7px; flex: none;
  display: grid; place-items: center;
  background: var(--soft); color: var(--ink-3);
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.file-icon.pdf { background: #fdeeee; color: #c64747; }
.file-icon.docx, .file-icon.doc { background: #eef2fb; color: #4b64b8; }
.file-icon.xlsx, .file-icon.xls, .file-icon.csv { background: #e8f6ef; color: #1f8a63; }
.file-icon.png, .file-icon.jpg, .file-icon.jpeg, .file-icon.webp { background: #fdf3e8; color: #b7791f; }
.kb-result { padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.kb-result + .kb-result { margin-top: 8px; }
.kb-result .kbr-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.kb-result .kbr-top b { font-size: 14.5px; }
.kb-result .kbr-top small { color: var(--muted); font-size: 12.5px; }
.kb-result p { margin: 0; color: var(--ink-3); font-size: 14px; line-height: 1.7; }
.score-tag { margin-left: auto; font-size: 12.5px; color: var(--green); background: var(--green-soft); border-radius: 99px; padding: 2px 8px; }
.doc-preview-image { max-width: 100%; max-height: 340px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); object-fit: contain; }
.chunk-list { display: grid; gap: 8px; margin-top: 16px; }
.chunk-item { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: #fbfcfe; }
.chunk-head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.chunk-head b { font-size: 13.5px; color: var(--ink); }
.chunk-head span { font-size: 12px; color: var(--brand); background: var(--brand-soft); border-radius: 99px; padding: 1px 7px; }
.chunk-head small { margin-left: auto; font-size: 12px; color: var(--muted); }
.chunk-item pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: var(--font); font-size: 13.5px; line-height: 1.7; color: var(--ink-3); max-height: 180px; overflow: auto; }

/* ---------- chat ---------- */
.chat-page { padding: 0; max-width: none; height: calc(100vh - var(--topbar-h)); }
.chat-layout { display: grid; grid-template-columns: 268px minmax(0, 1fr); height: 100%; min-height: 0; }
.chat-sidebar { border-right: 1px solid var(--line); background: #fbfcfe; display: flex; flex-direction: column; min-height: 0; }
.chat-sidebar-head { padding: 16px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.chat-sidebar-head b { font-size: 15px; white-space: nowrap; flex: none; }
.chat-clear-btn { color: var(--muted); padding: 6px 8px; }
.chat-clear-btn:hover { color: var(--red); background: var(--red-soft); }
.chat-threads { overflow: auto; padding: 8px; flex: 1; }
.thread-row {
  display: flex; align-items: center; gap: 2px;
  border-radius: 9px; margin-bottom: 2px; transition: .12s ease;
}
.thread-row:hover { background: #eef4f9; }
.thread-row.active { background: #e6f1f8; }
.thread-item {
  flex: 1 1 0; min-width: 0; width: auto; text-align: left; border: 0; background: transparent;
  border-radius: 9px; padding: 10px 11px;
}
.thread-item strong { display: block; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-item small { color: var(--muted); font-size: 12px; display: block; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-delete {
  width: 27px; height: 27px; flex: none; margin-right: 4px;
  border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  display: grid; place-items: center; opacity: .38; transition: .12s ease;
}
.thread-delete svg { width: 14px; height: 14px; }
.thread-row:hover .thread-delete, .thread-row.active .thread-delete { opacity: 1; }
.thread-delete:hover { background: var(--red-soft); color: var(--red); }
@media (hover: none) { .thread-delete { opacity: .6; } }
.chat-main { display: flex; flex-direction: column; min-height: 0; background: #fff; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--line); min-height: 58px; }
.chat-head strong { font-size: 15.5px; }
.chat-head small { color: var(--muted); font-size: 13px; }
.chat-head .spacer { flex: 1; }
.chat-scope { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.chat-scope select { border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; background: #fff; font-size: 13px; color: var(--ink-2); max-width: 220px; }
.chat-messages { flex: 1; overflow: auto; padding: 24px 7%; scroll-behavior: smooth; }
.chat-empty { max-width: 680px; margin: 6vh auto 0; text-align: center; }
.chat-empty .ce-mark { width: 58px; height: 58px; border-radius: 18px; background: linear-gradient(135deg, var(--brand-soft), var(--accent-soft)); display: grid; place-items: center; margin: 0 auto 16px; }
.chat-empty .ce-mark svg { width: 30px; height: 30px; color: var(--brand); }
.chat-empty h3 { margin: 0 0 7px; font-size: 22px; letter-spacing: -.02em; }
.chat-empty p { color: var(--muted); font-size: 14.5px; margin: 0 auto 20px; max-width: 480px; line-height: 1.8; }
.suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: left; }
.suggestion {
  border: 1px solid var(--line); background: #fff; border-radius: 11px;
  padding: 12px 13px; font-size: 14px; color: var(--ink-2); text-align: left;
  transition: .15s ease;
}
.suggestion:hover { border-color: var(--brand-2); background: #fbfdff; transform: translateY(-1px); }
.suggestion span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.msg { display: flex; gap: 11px; margin-bottom: 22px; max-width: 860px; margin-left: auto; margin-right: auto; }
.msg .msg-avatar { width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center; font-size: 12.5px; }
.msg.user .msg-avatar { background: #e9eef4; color: var(--ink-3); }
.msg.agent .msg-avatar { background: var(--brand); color: #fff; }
.msg .msg-body { min-width: 0; flex: 1; }
.msg .msg-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.msg .msg-meta b { font-size: 14px; }
.msg .msg-meta small { color: var(--muted); font-size: 12px; }
.msg.user .bubble {
  display: inline-block;
  background: #f2f6fa; border: 1px solid #e6edf5;
  border-radius: 4px 12px 12px 12px;
  padding: 11px 14px; font-size: 15px; line-height: 1.75; max-width: 100%;
}
.msg.agent .bubble { font-size: 15.5px; line-height: 1.8; color: var(--ink-2); }
.bubble p { margin: 0 0 9px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 4px 0 10px; padding-left: 21px; }
.bubble li { margin: 3px 0; }
.bubble h1, .bubble h2, .bubble h3 { font-size: 16.5px; margin: 12px 0 6px; color: var(--ink); }
.bubble code { background: #eef2f7; border-radius: 4px; padding: 1px 4px; font-size: 14px; font-family: ui-monospace, Consolas, monospace; }
.bubble pre { background: #12233b; color: #e9f1f8; border-radius: 9px; padding: 12px; overflow: auto; font-size: 13.5px; }
.bubble pre code { background: none; padding: 0; }
.bubble blockquote { margin: 8px 0; border-left: 3px solid var(--accent); padding: 2px 12px; color: var(--ink-3); }
.unknown-banner {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--amber-soft); color: var(--amber);
  border: 1px solid #f1dfb7; border-radius: 8px;
  padding: 7px 11px; font-size: 13.5px; margin-top: 3px;
}
.citations { margin-top: 12px; display: grid; gap: 7px; }
.citation {
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px;
  background: #fbfcfe; display: flex; gap: 10px; align-items: flex-start;
}
.citation .cite-index { width: 20px; height: 20px; border-radius: 6px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.citation .cite-main { min-width: 0; }
.citation b { display: block; font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.citation small { color: var(--muted); font-size: 12px; }
.citation p { margin: 3px 0 0; color: var(--ink-3); font-size: 13px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.trace-toggle { margin-top: 8px; border: 0; background: none; color: var(--muted); font-size: 12.5px; padding: 3px 0; display: inline-flex; align-items: center; gap: 5px; }
.trace-toggle:hover { color: var(--brand); }
.trace-toggle > svg { width: 13px; height: 13px; flex: none; }
.trace { margin-top: 8px; border-left: 2px solid var(--line); padding-left: 12px; display: grid; gap: 7px; }
.trace-step { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.trace-step .ts-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-top: 5px; flex: none; }
.trace-step.error .ts-dot { background: var(--red); }
.trace-step.denied .ts-dot { background: var(--amber); }
.trace-step b { color: var(--ink-2); font-weight: 500; }
.chat-compose { padding: 12px 7% 16px; border-top: 1px solid var(--line); background: #fff; }
.compose-box {
  display: flex; align-items: flex-end; gap: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 14px; padding: 8px 8px 8px 14px;
  background: #fff; box-shadow: 0 4px 18px rgba(18,35,59,.05);
  transition: .15s ease;
}
.compose-box:focus-within { border-color: var(--brand-2); box-shadow: 0 4px 20px rgba(47,126,168,.12); }
.compose-box textarea { border: 0; outline: 0; resize: none; flex: 1; min-height: 24px; max-height: 160px; padding: 7px 0; font-size: 15.5px; line-height: 1.6; color: var(--ink); background: transparent; }
.compose-box textarea::placeholder { color: #a4b1c1; }
.send-btn { width: 38px; height: 38px; border-radius: 11px; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.send-btn:hover { background: #174e74; }
.send-btn:disabled { opacity: .4; }
.send-btn svg { width: 17px; height: 17px; }
.compose-hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: 7px; }
.typing { display: inline-flex; gap: 4px; padding: 5px 0; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-2); animation: typing 1.1s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-5px); opacity: 1; } }

/* ---------- admin ---------- */
.admin-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 16px; margin-bottom: 16px; }
.model-card {
  border: 1px solid var(--line); border-radius: 14px; background: #fff;
  padding: 18px; position: relative;
}
.model-card.active { border-color: #9ec9dd; box-shadow: 0 0 0 3px rgba(47,126,168,.08); }
.model-card h4 { margin: 0 0 2px; font-size: 16.5px; }
.model-card .mc-url { color: var(--muted); font-size: 13px; word-break: break-all; }
.model-card .mc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 13px 0; }
.model-card .mc-grid small { display: block; color: var(--muted); font-size: 12px; }
.model-card .mc-grid b { font-size: 13.5px; font-weight: 500; word-break: break-all; }
.model-card .mc-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.key-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); background: var(--soft); border-radius: 7px; padding: 7px 9px; margin-top: 8px; word-break: break-all; }
.job-bar { margin-top: 13px; }
.job-bar .job-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.job-bar .job-meta .spacer { flex: 1; }
.role-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 16px; }
.role-tile { border: 1px solid var(--line); border-radius: 11px; padding: 12px; background: #fff; }
.role-tile small { color: var(--muted); font-size: 12.5px; display: block; }
.role-tile b { font-size: 23px; letter-spacing: -.03em; }

/* ---------- forms / modal ---------- */
.field { display: grid; gap: 6px; }
.field > label { font-size: 13.5px; color: var(--ink-3); font-weight: 500; }
.field .hint { font-size: 12.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  outline: none;
  transition: .15s ease;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(47,126,168,.1); }
.textarea { min-height: 86px; resize: vertical; line-height: 1.6; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #8093a8 50%), linear-gradient(135deg, #8093a8 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 24, 40, .48);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 24px;
  animation: fadeIn .15s ease;
}
.modal {
  width: min(600px, 100%);
  max-height: min(88vh, 900px);
  background: #fff;
  border-radius: 17px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: modalIn .2s cubic-bezier(.2,.8,.3,1);
  overflow: hidden;
}
.modal.wide { width: min(820px, 100%); }
.modal.small { width: min(440px, 100%); }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.modal > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}
.modal-head { flex: 0 0 auto; display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 14px; }
.modal-head h3 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.modal-head p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }
.modal-head .modal-close { margin-left: auto; border: 0; background: var(--soft); color: var(--muted); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.modal-head .modal-close:hover { background: #e9eff5; color: var(--ink); }
.modal-body { flex: 1 1 auto; min-height: 0; padding: 4px 22px 20px; overflow: auto; }
.modal-foot { flex: 0 0 auto; padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: #fbfcfe; }
.modal-error { background: var(--red-soft); color: var(--red); border-radius: 8px; padding: 9px 11px; font-size: 13.5px; margin-bottom: 12px; display: none; }
.modal-error.show { display: block; }
.toast-root { position: fixed; right: 24px; bottom: 24px; z-index: 200; display: grid; gap: 8px; }
.toast {
  min-width: 240px; max-width: 380px;
  background: #12233b; color: #fff;
  border-radius: 10px; padding: 11px 15px;
  font-size: 14.5px; box-shadow: var(--shadow-lg);
  animation: toastIn .2s ease;
  display: flex; align-items: center; gap: 9px;
}
.toast.success { background: #10604c; }
.toast.error { background: #8f3030; }
.toast.warn { background: #7a5516; }
.toast > svg { width: 17px; height: 17px; flex: none; }
.key-line > svg { width: 14px; height: 14px; flex: none; }
.kb-banner .kb-icon > svg { width: 18px; height: 18px; }
.msg .msg-avatar > svg { width: 15px; height: 15px; }
.empty .empty-icon > svg { width: 22px; height: 22px; }
.modal-close > svg { width: 15px; height: 15px; }
.model-card .key-line { align-items: center; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .empty-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--soft); display: grid; place-items: center; margin: 0 auto 10px; color: var(--muted); }
.empty h4 { margin: 0 0 4px; color: var(--ink-2); font-size: 15.5px; }
.empty p { margin: 0; font-size: 13.5px; }
.skeleton { background: linear-gradient(90deg, #eef2f7 25%, #f7f9fc 37%, #eef2f7 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.text-muted { color: var(--muted); }
.text-sm { font-size: 13.5px; }
.text-right { text-align: right; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.wrap { flex-wrap: wrap; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.linklike { border: 0; background: none; color: var(--brand); padding: 0; font-size: inherit; }
.linklike:hover { text-decoration: underline; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .admin-hero { grid-template-columns: 1fr; }
  .role-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .chat-layout { grid-template-columns: 230px minmax(0, 1fr); }
}
@media (max-width: 1200px) {
  .global-search { width: 230px; max-width: 25vw; }
  .topbar-actions .model-pill { display: none; }
}
@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-form-side { padding: 28px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative; height: auto; width: 100%; max-width: 100vw; min-width: 0;
    padding: 12px 14px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 8px;
    overflow: visible;
  }
  .sidebar-brand { padding: 0 8px 0 0; flex: none; order: 1; }
  .sidebar-brand small, .nav-label, .sidebar-model { display: none; }
  .nav-group {
    display: flex; flex: 1 0 100%; flex-wrap: wrap; order: 3;
    margin: 2px 0 0; gap: 2px;
  }
  .nav-item { white-space: nowrap; padding: 8px 10px; }
  .nav-item.active::before { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; flex: 0 0 auto; order: 2; }
  .sidebar-user { padding: 5px; background: transparent; }
  .sidebar-user .user-meta { display: none; }
  .topbar { padding: 0 18px; height: auto; min-height: 60px; align-items: center; }
  .topbar-title { min-width: 0; }
  .topbar-title h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-title p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .global-search { display: none; }
  .page { padding: 18px 16px 48px; }
  .page.chat-page { padding: 0; height: calc(100dvh - 60px); }
  .page-head h2 { font-size: 22px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 24px; }
  .chat-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .chat-sidebar { display: flex; max-height: 148px; border-right: 0; border-bottom: 1px solid var(--line); }
  .chat-sidebar-head { padding: 8px 12px; }
  .chat-threads { padding: 4px 8px 8px; }
  .chat-messages { padding: 18px 16px; }
  .chat-compose { padding: 10px 14px 12px; }
  .detail-hero { padding: 20px; }
  .detail-hero .dh-actions { width: 100%; justify-content: flex-start; margin-left: 0; }
  .detail-hero .dh-top { flex-wrap: wrap; }
  .work-row { flex-wrap: wrap; }
  .work-row .wr-progress { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .modal-backdrop { padding: 10px; }
  .modal { max-height: 94vh; }
  .project-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr; }
  .login-form-side { padding: 20px; }
  .demo-grid { grid-template-columns: 1fr; }
  .suggestions { grid-template-columns: 1fr; }
  .topbar-actions .model-pill { display: none; }
  .chat-head { padding: 10px 14px; }
  .chat-scope { display: none; }
  .role-grid { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: 1fr; }
}
