/* ============================================================
   ima 知识库 · 商业科技风设计系统（普通用户端）
   深空石墨底 / 电光蓝主色 / 辉光青点缀 / 精密网格氛围
   ============================================================ */
:root {
  /* 基底 */
  --bg: #060910;
  --bg-2: #080c15;
  --side: #080b13;
  --panel: #0c111c;
  --panel-2: #101725;
  --elev: #131b2b;

  /* 描边与分隔 */
  --line: rgba(122, 152, 200, 0.13);
  --line-2: rgba(122, 152, 200, 0.22);
  --line-strong: rgba(122, 152, 200, 0.32);

  /* 文字 */
  --text: #e7eefb;
  --text-2: #a9b6cd;
  --sub: #6d7c96;

  /* 品牌与状态 */
  --brand: #3d8bff;
  --brand-deep: #1f5fd8;
  --brand-soft: rgba(61, 139, 255, 0.12);
  --brand-line: rgba(61, 139, 255, 0.34);
  --cyan: #22e0c0;
  --cyan-soft: rgba(34, 224, 192, 0.12);
  --gold: #f0b429;
  --ok: #2fd48f;
  --ok-soft: rgba(47, 212, 143, 0.12);
  --warn: #f0b429;
  --warn-soft: rgba(240, 180, 41, 0.12);
  --err: #ff5f6d;
  --err-soft: rgba(255, 95, 109, 0.12);

  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
  --glow: 0 0 0 1px rgba(61, 139, 255, 0.28), 0 10px 34px rgba(31, 95, 216, 0.24);

  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 全站氛围层：径向光晕 + 精密网格 */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1100px 620px at 12% -10%, rgba(61, 139, 255, 0.16), transparent 62%),
    radial-gradient(900px 520px at 108% 8%, rgba(34, 224, 192, 0.08), transparent 60%),
    linear-gradient(180deg, #070b13 0%, #060910 55%, #05070d 100%);
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.5;
  background-image:
    linear-gradient(rgba(122, 152, 200, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 152, 200, 0.055) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(1400px 900px at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(1400px 900px at 50% 0%, #000 20%, transparent 78%);
}
#app, .login-wrap, .modal-mask, .toast { position: relative; z-index: 1; }

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

/* 统一滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(122, 152, 200, 0.2); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(122, 152, 200, 0.36); background-clip: content-box; }

::selection { background: rgba(61, 139, 255, 0.32); color: #fff; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 252px; flex: 0 0 252px;
  background: linear-gradient(180deg, #0a0f1b 0%, #070a12 100%);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 15px 12px 12px; gap: 10px;
  position: relative;
}
.sidebar::after {
  content: ""; position: absolute; top: 0; right: -1px; width: 1px; height: 180px;
  background: linear-gradient(180deg, var(--brand-line), transparent);
}
.brand { display: flex; align-items: center; gap: 9px; padding: 2px 4px 10px; }
.logo {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, #3d8bff 0%, #1b4fd0 55%, #22e0c0 140%);
  color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 12px;
  letter-spacing: 0.3px;
  box-shadow: 0 6px 18px rgba(31, 95, 216, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: 0.6px; color: #eaf1ff; }

.btn-primary {
  width: 100%; border: 1px solid rgba(120, 172, 255, 0.4); border-radius: 10px;
  background: linear-gradient(135deg, #3d8bff, #1f5fd8);
  color: #fff; padding: 10px 12px; font-size: 14px; cursor: pointer;
  display: flex; align-items: center; gap: 6px; justify-content: center;
  font-family: inherit; font-weight: 500; letter-spacing: 0.4px;
  box-shadow: 0 8px 22px rgba(31, 95, 216, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 12px 30px rgba(31, 95, 216, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.28); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px;
  color: var(--text-2); cursor: pointer; text-decoration: none; font-size: 14px;
  user-select: none; position: relative;
  border-left: 2px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.nav-item:hover { background: rgba(122, 152, 200, 0.08); color: var(--text); }
.nav-item:hover .ico { transform: translateY(-1px) scale(1.06); }
.nav-item:active { transform: scale(0.985); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(61, 139, 255, 0.2), rgba(61, 139, 255, 0.02));
  color: #dceaff; font-weight: 500; border-left-color: var(--brand);
}
.nav-item.active .ico { color: #8fbcff; filter: drop-shadow(0 0 7px rgba(61, 139, 255, 0.55)); }

/* 统一图标系统：所有侧栏图标同源同尺寸，随文字色继承，整块可点击反馈 */
.ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex: 0 0 18px; color: currentColor;
  transition: transform 0.15s ease, color 0.15s ease, filter 0.15s ease;
}
.ima-i { display: block; vertical-align: middle; }
.ico .ima-i { width: 100%; height: 100%; }
.btn-primary:hover .ico { transform: scale(1.14); }
/* 静态占位图标（如“新建知识库”按钮）图标为按钮直接子节点，需单独覆盖悬停反馈 */
.mini .ima-i { transition: transform 0.15s ease, color 0.15s ease; }
.mini:hover .ima-i { transform: scale(1.12); }
.nav-text { white-space: nowrap; }

.side-section { flex: 1; overflow: auto; margin-top: 4px; min-height: 0; }
.side-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: var(--sub); padding: 6px 8px; letter-spacing: 1.4px;
  text-transform: uppercase;
}
.mini {
  border: 0; background: transparent; color: var(--sub); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 2px 6px; border-radius: 6px;
  font-family: inherit; transition: 0.15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.mini:hover { background: rgba(122, 152, 200, 0.14); color: var(--text); }
.mini:hover .ima-i { color: currentColor; }

.kb-list { display: flex; flex-direction: column; gap: 2px; }
.kb-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px;
  cursor: pointer; color: var(--text-2); justify-content: space-between;
  border: 1px solid transparent; transition: 0.15s;
}
.kb-item:hover { background: rgba(122, 152, 200, 0.08); color: var(--text); }
.kb-item.active {
  background: linear-gradient(135deg, rgba(61, 139, 255, 0.16), rgba(34, 224, 192, 0.05));
  border-color: var(--brand-line); color: #eaf2ff; font-weight: 500;
}
.kb-item .kb-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-item .kb-ico { width: 15px; height: 15px; flex: 0 0 15px; color: #7f9cc9; }
.kb-item:hover .kb-ico { color: #a9c6f5; }
.kb-item.active .kb-ico { color: #8fbcff; }
.kb-item .kb-badge {
  font-size: 11px; color: #9fc0ff; background: rgba(61, 139, 255, 0.16);
  border: 1px solid rgba(61, 139, 255, 0.22); border-radius: 999px; padding: 0 7px; line-height: 16px;
}
.side-foot { border-top: 1px solid var(--line); padding-top: 9px; display: flex; flex-direction: column; gap: 2px; }
.user-box {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-top: 4px;
  border-radius: 9px; cursor: pointer; font-size: 13px; border: 1px solid transparent;
  transition: 0.15s;
}
.user-box:hover { background: rgba(122, 152, 200, 0.08); border-color: var(--line); }
.avatar {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, #3d8bff, #1f5fd8);
  color: #fff; display: grid; place-items: center; font-size: 12px; flex: 0 0 26px;
  box-shadow: 0 4px 12px rgba(31, 95, 216, 0.4);
}

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: transparent; overflow: hidden; }
.page-head {
  height: 60px; flex: 0 0 60px; display: flex; align-items: center; gap: 12px;
  padding: 0 24px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12, 17, 28, 0.9), rgba(12, 17, 28, 0.55));
  backdrop-filter: blur(10px);
}
.page-head h1 {
  font-size: 16px; margin: 0; font-weight: 600; letter-spacing: 0.5px; color: #f0f5ff;
  position: relative; padding-left: 12px;
}
.page-head h1::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 15px; border-radius: 2px;
  background: linear-gradient(180deg, var(--cyan), var(--brand));
  box-shadow: 0 0 10px rgba(61, 139, 255, 0.7);
}
.page-head .sub { color: var(--sub); font-size: 12px; }
.spacer { flex: 1; }

.btn {
  border: 1px solid var(--line-2); background: rgba(122, 152, 200, 0.06);
  border-radius: 9px; padding: 7px 13px; cursor: pointer; font-size: 13px;
  color: var(--text-2); transition: 0.15s; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
/* 动作按钮内的图标与文字基线对齐，悬停时轻微放大形成交互反馈 */
.btn .ico { width: 15px; height: 15px; flex: 0 0 15px; }
.btn:hover .ico { color: inherit; }
.btn:hover { background: rgba(122, 152, 200, 0.13); border-color: var(--line-strong); color: var(--text); }
.btn.primary {
  background: linear-gradient(135deg, #3d8bff, #1f5fd8);
  border-color: rgba(120, 172, 255, 0.42); color: #fff; font-weight: 500;
  box-shadow: 0 6px 18px rgba(31, 95, 216, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.danger { color: #ff8b95; border-color: rgba(255, 95, 109, 0.32); background: rgba(255, 95, 109, 0.08); }
.btn.danger:hover { background: rgba(255, 95, 109, 0.16); border-color: rgba(255, 95, 109, 0.5); color: #ffb3ba; }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }

.content { flex: 1; overflow: auto; padding: 22px 24px 44px; min-height: 0; }
.empty { text-align: center; color: var(--sub); padding: 76px 20px; font-size: 13px; }
/* 空态插图统一为线性 SVG：缩放不失真，随主题色自适应 */
.empty .big {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px; color: #6f8bb5; opacity: 0.9;
}
.empty .big .ima-i { width: 40px; height: 40px; stroke-width: 1.35; }

/* ---------- Cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 14px; }
.card {
  position: relative; border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(16, 23, 37, 0.9), rgba(12, 17, 28, 0.85));
  padding: 16px; cursor: pointer; transition: 0.18s;
  display: flex; flex-direction: column; gap: 8px; overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity 0.22s;
  background: radial-gradient(420px 160px at 100% 0%, rgba(61, 139, 255, 0.16), transparent 70%);
  pointer-events: none;
}
.card::after {
  content: ""; position: absolute; top: 0; left: 16px; right: 16px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(61, 139, 255, 0.55), transparent);
  opacity: 0; transition: opacity 0.22s;
}
.card:hover { border-color: var(--brand-line); transform: translateY(-2px); box-shadow: var(--glow); }
.card:hover::before, .card:hover::after { opacity: 1; }
.card .title { font-weight: 600; font-size: 14px; color: #eef4ff; letter-spacing: 0.2px; }
.card .desc { color: var(--sub); font-size: 12px; line-height: 1.65; min-height: 34px; }
.card .meta { display: flex; gap: 10px; color: var(--sub); font-size: 12px; }

/* ---------- File list ---------- */
.file-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 11px;
  background: linear-gradient(160deg, rgba(16, 23, 37, 0.72), rgba(11, 16, 26, 0.7));
  margin-bottom: 8px; cursor: pointer; transition: 0.16s;
}
.file-row:hover { border-color: var(--brand-line); background: rgba(61, 139, 255, 0.07); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32); }
.file-ico {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(61, 139, 255, 0.22), rgba(34, 224, 192, 0.1));
  border: 1px solid rgba(61, 139, 255, 0.24);
  color: #9fc4ff; font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
  font-family: var(--mono);
}
.file-main { flex: 1; min-width: 0; }
.file-name { font-size: 14px; color: #e9f0fc; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { color: var(--sub); font-size: 12px; margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.tag {
  font-size: 11px; border-radius: 999px; padding: 1px 8px;
  background: rgba(122, 152, 200, 0.12); color: var(--text-2);
  border: 1px solid rgba(122, 152, 200, 0.16); white-space: nowrap;
}
.tag.ready { background: var(--ok-soft); color: var(--ok); border-color: rgba(47, 212, 143, 0.28); }
.tag.failed { background: var(--err-soft); color: var(--err); border-color: rgba(255, 95, 109, 0.3); }
.tag.parsing, .tag.indexing { background: var(--warn-soft); color: var(--warn); border-color: rgba(240, 180, 41, 0.3); }

/* ---------- Drop zone ---------- */
.drop {
  position: relative; border: 1px dashed rgba(122, 152, 200, 0.34); border-radius: var(--radius);
  padding: 28px; text-align: center; color: var(--text-2);
  background: linear-gradient(160deg, rgba(16, 23, 37, 0.6), rgba(11, 16, 26, 0.5));
  margin-bottom: 16px; transition: 0.18s; cursor: pointer; overflow: hidden;
}
.drop:hover { border-color: var(--brand-line); color: #cfe0ff; }
.drop-ico {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px; color: #7f9cc9; transition: 0.18s;
}
.drop:hover .drop-ico, .drop.hover .drop-ico { color: var(--brand); }
.drop.hover .drop-ico .ima-i { transform: translateY(-2px); }
.drop-ico .ima-i { transition: transform 0.18s ease; }
.drop.hover {
  border-color: var(--brand); color: #dceaff;
  background: rgba(61, 139, 255, 0.1); box-shadow: var(--glow);
}

/* ---------- Chat ---------- */
.chat-wrap { display: flex; height: 100%; min-height: 0; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-scroll { flex: 1; overflow: auto; padding: 24px 28px; }
.msg { display: flex; gap: 12px; margin-bottom: 22px; max-width: 880px; animation: msgIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg .who {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 9px; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: 0.4px;
  background: rgba(122, 152, 200, 0.12); color: var(--text-2);
  border: 1px solid var(--line-2); font-family: var(--mono);
}
.msg.me .who {
  background: linear-gradient(135deg, #3d8bff, #1f5fd8); color: #fff; border-color: rgba(120, 172, 255, 0.4);
  box-shadow: 0 6px 16px rgba(31, 95, 216, 0.4);
}
.msg .bubble {
  background: linear-gradient(160deg, rgba(18, 26, 42, 0.92), rgba(13, 19, 32, 0.9));
  border: 1px solid var(--line); border-radius: 4px 12px 12px 12px;
  padding: 12px 16px; line-height: 1.8; white-space: pre-wrap; word-break: break-word;
  color: #dde7f7; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}
.msg.me .bubble {
  background: linear-gradient(160deg, rgba(61, 139, 255, 0.16), rgba(31, 95, 216, 0.1));
  border-color: var(--brand-line); border-radius: 12px 4px 12px 12px; color: #e8f1ff;
}
.msg .bubble h3 { margin: 0 0 6px; font-size: 14px; }

.composer { border-top: 1px solid var(--line); padding: 14px 24px 18px; background: rgba(8, 12, 20, 0.55); }
.composer-inner {
  border: 1px solid var(--line-2); border-radius: 14px; padding: 10px 12px;
  display: flex; gap: 10px; align-items: flex-end;
  background: linear-gradient(160deg, rgba(16, 23, 37, 0.95), rgba(12, 17, 28, 0.95));
  box-shadow: var(--shadow); transition: 0.18s;
}
.composer-inner:focus-within { border-color: var(--brand-line); box-shadow: var(--glow); }
.composer textarea {
  flex: 1; border: 0; resize: none; outline: none; font-family: inherit; font-size: 14px;
  line-height: 1.6; max-height: 140px; min-height: 24px; background: transparent; color: var(--text);
}
.composer textarea::placeholder { color: var(--sub); }
.composer .send {
  border: 1px solid rgba(120, 172, 255, 0.4); border-radius: 9px; padding: 8px 16px; cursor: pointer;
  background: linear-gradient(135deg, #3d8bff, #1f5fd8); color: #fff;
  font-family: inherit; font-size: 13px; font-weight: 500;
  box-shadow: 0 6px 16px rgba(31, 95, 216, 0.32);
  transition: 0.16s;
}
.composer .send:hover:not(:disabled) { filter: brightness(1.08); }
.composer .send:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Refs panel ---------- */
.refs {
  width: 330px; flex: 0 0 330px; border-left: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(9, 13, 22, 0.95), rgba(7, 10, 17, 0.95));
  overflow: auto; padding: 20px; display: none;
}
.refs.show { display: block; }
.refs h3 {
  font-size: 11px; margin: 0 0 14px; color: var(--sub); letter-spacing: 1.4px;
  text-transform: uppercase;
}
.ref-card {
  background: linear-gradient(160deg, rgba(16, 23, 37, 0.8), rgba(12, 17, 28, 0.78));
  border: 1px solid var(--line); border-radius: 11px; padding: 12px;
  margin-bottom: 10px; cursor: pointer; transition: 0.16s;
}
.ref-card:hover { border-color: var(--brand-line); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3); }
.ref-card .rh {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: #9fc4ff;
  margin-bottom: 7px; font-weight: 600;
}
.ref-card .rt { font-size: 13px; line-height: 1.7; color: var(--text-2); }
.ref-idx {
  background: linear-gradient(135deg, #3d8bff, #1f5fd8); color: #fff;
  border-radius: 5px; font-size: 10px; padding: 0 6px; line-height: 17px;
  font-family: var(--mono); font-weight: 700;
}

/* ---------- Reader ---------- */
.reader { max-width: 840px; margin: 0 auto; }
.reader h2 { font-size: 21px; margin: 0 0 8px; color: #f0f5ff; letter-spacing: 0.3px; }
.reader .rmeta { color: var(--sub); font-size: 12px; margin-bottom: 22px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.reader .rmeta a { color: #7fb0ff; text-decoration: none; }
.reader .rmeta a:hover { text-decoration: underline; }
.reader .rtext { line-height: 1.95; font-size: 15px; white-space: pre-wrap; word-break: break-word; color: #d3ddee; }
.chunk {
  border-left: 2px solid var(--brand-line); padding: 9px 15px; margin: 10px 0;
  background: rgba(61, 139, 255, 0.05); border-radius: 0 9px 9px 0;
  font-size: 14px; line-height: 1.8; color: var(--text-2);
}
.chunk .ci { font-size: 11px; color: var(--sub); margin-bottom: 5px; font-family: var(--mono); letter-spacing: 0.4px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--line); }
th {
  color: var(--sub); font-weight: 600; font-size: 11px; letter-spacing: 1px;
  text-transform: uppercase; background: rgba(122, 152, 200, 0.05);
}
td { color: var(--text-2); }
tr:hover td { background: rgba(61, 139, 255, 0.05); }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; margin-bottom: 7px; color: var(--text-2); letter-spacing: 0.3px; }
.field input[type=text], .field input[type=password], .field textarea, .field select {
  width: 100%; border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 12px;
  font-size: 14px; font-family: inherit; outline: none;
  background: rgba(9, 13, 22, 0.8); color: var(--text); transition: 0.15s;
}
.field input::placeholder, .field textarea::placeholder { color: var(--sub); }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.field input[type=checkbox] { accent-color: var(--brand); width: 15px; height: 15px; cursor: pointer; }
.field select option { background: #101725; color: var(--text); }

.search {
  border: 1px solid var(--line-2); border-radius: 9px; padding: 8px 13px; font-size: 13px;
  outline: none; width: 230px; background: rgba(9, 13, 22, 0.8); color: var(--text);
  font-family: inherit; transition: 0.15s;
}
.search::placeholder { color: var(--sub); }
.search:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }

/* ---------- Modal & Toast ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(3, 5, 10, 0.72);
  backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; z-index: 100;
}
.modal-mask.show { display: flex; animation: maskIn 0.18s ease both; }
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: linear-gradient(160deg, #131b2b 0%, #0c111c 100%);
  border: 1px solid var(--line-2);
  border-radius: 16px; padding: 24px; width: 460px; max-width: calc(100vw - 40px);
  box-shadow: var(--shadow-lg); max-height: 82vh; overflow: auto;
  animation: modalIn 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal h3 {
  margin: 0 0 18px; font-size: 16px; color: #f0f5ff; letter-spacing: 0.4px;
  padding-bottom: 13px; border-bottom: 1px solid var(--line);
}
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.toast {
  position: fixed; left: 50%; top: 24px; transform: translate(-50%, -22px);
  background: linear-gradient(160deg, #1a2336, #121a29); color: #eaf1ff;
  border: 1px solid var(--line-2); border-left: 3px solid var(--brand);
  padding: 10px 18px; border-radius: 10px; font-size: 13px; opacity: 0;
  transition: 0.24s cubic-bezier(0.22, 1, 0.36, 1); pointer-events: none; z-index: 200;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-left-color: var(--err); background: linear-gradient(160deg, #2a1620, #1b1018); }

/* ---------- Login ---------- */
.login-wrap {
  height: 100%; display: grid; place-items: center;
  background: transparent;
}
.login-card {
  position: relative; background: linear-gradient(160deg, rgba(19, 27, 43, 0.96), rgba(10, 14, 24, 0.96));
  border: 1px solid var(--line-2); border-radius: 18px;
  padding: 36px 34px; width: 384px;
  box-shadow: var(--shadow-lg);
  animation: cardIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.login-card::before {
  content: ""; position: absolute; top: 0; left: 24px; right: 24px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(61, 139, 255, 0.75), transparent);
}
.login-card::after {
  content: ""; position: absolute; inset: 0; border-radius: 18px; pointer-events: none;
  background: radial-gradient(520px 240px at 50% -20%, rgba(61, 139, 255, 0.14), transparent 68%);
}
.login-card .logo { margin: 0 auto 16px; width: 46px; height: 46px; font-size: 15px; border-radius: 13px; }
.login-card h2 { text-align: center; margin: 0 0 6px; font-size: 20px; color: #f0f5ff; letter-spacing: 0.6px; }
.login-card p.tip { text-align: center; color: var(--sub); font-size: 12px; margin: 0 0 26px; letter-spacing: 0.4px; }

.tabs { display: flex; gap: 4px; background: rgba(9, 13, 22, 0.8); border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin-bottom: 22px; }
.tabs div {
  flex: 1; text-align: center; padding: 7px; border-radius: 8px; cursor: pointer;
  font-size: 13px; color: var(--sub); transition: 0.15s;
}
.tabs div.on {
  background: linear-gradient(135deg, rgba(61, 139, 255, 0.24), rgba(31, 95, 216, 0.14));
  color: #eaf1ff; font-weight: 500; border: 1px solid var(--brand-line);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.code {
  background: rgba(6, 9, 15, 0.9); border: 1px solid var(--line);
  border-radius: 9px; padding: 12px 14px; font-family: var(--mono);
  font-size: 12px; line-height: 1.7; white-space: pre-wrap; word-break: break-all;
  color: #8fe8d5;
}
.hint { color: var(--sub); font-size: 12px; line-height: 1.7; }
.hint code { background: rgba(122, 152, 200, 0.12); padding: 1px 6px; border-radius: 5px; font-family: var(--mono); color: #9fc4ff; }
.hint a { color: #7fb0ff; text-decoration: none; }
.hint a:hover { text-decoration: underline; }

.spin {
  width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, 0.25); border-top-color: #fff;
  border-radius: 50%; display: inline-block; animation: sp 0.7s linear infinite; vertical-align: -2px;
}
@keyframes sp { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, rgba(122, 152, 200, 0.08) 25%, rgba(122, 152, 200, 0.18) 37%, rgba(122, 152, 200, 0.08) 63%);
  background-size: 400% 100%; animation: sk 1.4s ease-in-out infinite;
  border-radius: 8px; height: 14px;
}
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- 普通用户端：个人信息 / 通知 / 设置 ---------- */
.input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 9px;
  font-size: 13px; font-family: inherit; color: var(--text);
  background: rgba(9, 13, 22, 0.8); outline: none; transition: 0.15s;
}
.input::placeholder { color: var(--sub); }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
select.input { cursor: pointer; }
select.input option { background: #101725; color: var(--text); }
textarea.input { resize: vertical; }

.panel {
  position: relative; background: linear-gradient(160deg, rgba(16, 23, 37, 0.82), rgba(11, 16, 26, 0.8));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 14px;
}
.panel h3 {
  font-size: 13px; margin: 0 0 14px; color: #e6eefc; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
}
.panel h3::before {
  content: ""; width: 3px; height: 13px; border-radius: 2px;
  background: linear-gradient(180deg, var(--cyan), var(--brand));
}
.panel .field input, .panel .field textarea, .panel .field select { width: 100%; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } }

.kv-list > div {
  display: flex; justify-content: space-between; gap: 12px; padding: 9px 0;
  border-bottom: 1px dashed var(--line); font-size: 13px;
}
.kv-list > div:last-child { border-bottom: none; }
.kv-list span { color: var(--sub); }
.kv-list b { color: #e2ebfa; font-weight: 600; text-align: right; word-break: break-all; }

.sec-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 0; border-bottom: 1px dashed var(--line);
}
.sec-row:last-child { border-bottom: none; }
.sec-row b { display: block; font-size: 13px; font-weight: 600; color: #e6eefc; }
.sec-row .dim { font-size: 12px; color: var(--sub); }
.sec-row > div > span { display: block; margin-top: 3px; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 0;
  font-size: 13px; cursor: pointer; border-bottom: 1px dashed var(--line); color: var(--text-2);
}
.switch-row:last-of-type { border-bottom: none; }
.switch-row input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

/* 侧边栏用户信息 */
.user-box .user-meta {
  flex: 1; overflow: hidden; text-overflow: ellipsis; display: flex; flex-direction: column;
  gap: 3px; cursor: pointer;
}
.user-box .user-meta b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #e6eefc; }
.role-badge {
  display: inline-block; font-size: 10px; padding: 0 7px; border-radius: 999px;
  background: rgba(122, 152, 200, 0.13); color: var(--sub); width: fit-content;
  letter-spacing: 0.4px; border: 1px solid rgba(122, 152, 200, 0.16);
}
.role-badge.admin {
  background: var(--brand-soft); color: #9fc4ff; border-color: var(--brand-line);
}
.nav-item .badge {
  display: inline-block; min-width: 17px; padding: 0 5px; margin-left: 4px;
  background: linear-gradient(135deg, #ff5f6d, #e0244a); color: #fff;
  border-radius: 999px; font-size: 11px; line-height: 17px; text-align: center;
  box-shadow: 0 3px 10px rgba(224, 36, 74, 0.45);
}

.announce-bar {
  background: linear-gradient(160deg, rgba(240, 180, 41, 0.13), rgba(240, 180, 41, 0.05));
  border: 1px solid rgba(240, 180, 41, 0.3); color: #f3c95e;
  border-radius: 11px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; line-height: 1.65;
}

/* 消息通知 */
.notice-list { display: flex; flex-direction: column; gap: 10px; }
.notice-item {
  position: relative; background: linear-gradient(160deg, rgba(16, 23, 37, 0.8), rgba(11, 16, 26, 0.78));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px;
  cursor: pointer; transition: 0.16s;
}
.notice-item:hover { border-color: var(--line-strong); }
.notice-item.unread {
  border-color: var(--brand-line);
  background: linear-gradient(160deg, rgba(61, 139, 255, 0.13), rgba(12, 17, 28, 0.85));
}
.notice-item .notice-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.notice-item .notice-head b { font-size: 13px; color: #e9f0fc; }
.notice-item .notice-head .dim { margin-left: auto; font-size: 12px; color: var(--sub); }
.notice-item .notice-body { font-size: 13px; color: var(--text-2); line-height: 1.7; }
.notice-item .dot {
  position: absolute; top: 14px; right: 14px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--err); box-shadow: 0 0 10px rgba(255, 95, 109, 0.8);
}

.chip {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  background: var(--brand-soft); color: #9fc4ff; font-size: 11px;
  border: 1px solid var(--brand-line);
}
.code.small { font-size: 11px; }

.login-foot { text-align: center; margin-top: 16px; }
.login-card .hint a { color: #7fb0ff; text-decoration: none; }
.login-card #loginForgot textarea { width: 100%; }

@media (max-width: 900px) {
  .sidebar { width: 68px; flex: 0 0 68px; padding: 12px 8px; }
  /* 仅隐藏用户名文本，保留退出按钮（span.mini），避免窄屏无法退出 */
  .brand-name, .side-section, .user-box .user-meta { display: none; }
  /* 窄屏：隐藏文字块，图标居中放大并追加 tooltip，避免图标条中文字竖排溢出 */
  .nav-item { justify-content: center; padding: 10px 0; gap: 0; }
  .nav-item .nav-text { display: none; }
  .nav-item .ico { width: 20px; height: 20px; flex: 0 0 20px; }
  .nav-item .badge { font-size: 10px; margin-left: 0; position: absolute; top: 2px; right: 4px; }
  .btn-primary { padding: 10px 0; gap: 0; }
  .btn-primary .nav-text { display: none; }
  .btn-primary .ico { width: 20px; height: 20px; flex: 0 0 20px; }
  .refs { width: 268px; flex: 0 0 268px; }
  .page-head { padding: 0 16px; }
  .content { padding: 18px 16px 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
