/* Feline1 管理平台 — 终端风暗色主题 v2（炭黑 + 蓝绿，克制发光，8px 间距体系） */
:root {
  /* 背景层：炭黑，不用死黑（避免 halation） */
  --bg:        #0c1016;
  --bg-elev:   #141a22;   /* 卡片 */
  --bg-elev2:  #1a212b;   /* 顶栏/侧栏/抬升 */
  --bg-input:  #0e131a;
  --border:    #232c38;
  --border-hi: #303d4e;

  /* 文字 */
  --text:      #dce5ef;
  --text-mut:  #7c8fa3;
  --text-dim:  #56657a;

  /* 主色：蓝 */
  --accent:    #3b9eff;
  --accent-h:  #62b4ff;
  --accent-dim:#15263a;

  /* 终端荧光绿：在线/成功/代码/数字 */
  --term:      #36e07f;
  --term-dim:  #123524;

  --ok:        #36e07f;
  --warn:      #f5b544;
  --danger:    #ff5d6c;

  --radius:    8px;
  --radius-lg: 12px;
  --shadow:    0 8px 30px rgba(0,0,0,.45);

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  /* 8px 间距体系 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, "PingFang SC", "Segoe UI", sans-serif;
  background-color: var(--bg);
  background-image: url("/assets/bg.svg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(59,158,255,.32); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); background-clip: padding-box; }

/* 数字/代码/时间戳用等宽（终端感的核心） */
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* 按钮 */
.btn {
  background: var(--accent); color: #04121f; border: none;
  border-radius: var(--radius); padding: 9px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .14s, transform .05s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--accent-h); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost {
  background: transparent; color: var(--text-mut); font-weight: 500;
  border: 1px solid var(--border-hi);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-dim); background: rgba(255,255,255,.03); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid #43242a; font-weight: 500; }
.btn-danger:hover { background: var(--danger); color: #1a0405; }
.btn-sm { padding: 5px 11px; font-size: 13px; }

/* 输入框 */
.input, input.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px;
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; transition: border-color .14s, box-shadow .14s;
  font-family: var(--mono);
}
.input::placeholder { color: var(--text-dim); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,158,255,.12); }
label { display: block; font-size: 13px; color: var(--text-mut); margin-bottom: 6px; }

/* 卡片 */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--s5);
}

/* 表格 */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--text-dim); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
tbody tr:last-child td { border-bottom: none; }
tr { transition: background .1s; }
tbody tr:hover td { background: rgba(59,158,255,.045); }
td.mono, td .key { font-family: var(--mono); }

/* 状态徽章 */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active  { background: rgba(54,224,127,.1);  color: var(--ok); border-color: rgba(54,224,127,.25); }
.badge-working { background: rgba(59,158,255,.1); color: var(--accent-h); border-color: rgba(59,158,255,.28); }
.badge-paused  { background: rgba(245,181,68,.1); color: var(--warn); border-color: rgba(245,181,68,.25); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(6,9,13,.66); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--bg-elev); border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg); padding: 26px; width: 420px;
  box-shadow: var(--shadow); max-width: calc(100vw - 32px);
  animation: pop .16s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal h3 { margin: 0 0 18px; font-size: 16px; }
.modal .row { margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* 工具类 */
.muted { color: var(--text-mut); }
.dim { color: var(--text-dim); }
.empty { text-align: center; color: var(--text-mut); padding: 52px 24px; }
.empty .big { font-size: 32px; opacity: .5; display: block; margin-bottom: 12px; }
.code-box {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; font-family: var(--mono); font-size: 13px;
  word-break: break-all; color: var(--term); margin: 8px 0; line-height: 1.6;
}
code {
  font-family: var(--mono); font-size: .9em;
  background: rgba(59,158,255,.1); color: var(--accent-h);
  padding: 2px 6px; border-radius: 4px;
}

/* ===== 看板：统计卡 / 柱状图 / 日志 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: var(--s4); margin-bottom: var(--s5); }
.stat {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 20px; position: relative; overflow: hidden;
}
.stat .k { font-size: 12px; color: var(--text-mut); display: flex; align-items: center; gap: 7px; }
.stat .k .ico { opacity: .8; }
.stat .v { font-size: 30px; font-weight: 700; margin-top: 10px; font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--text); line-height: 1; }
.stat .sub { font-size: 12px; color: var(--text-dim); margin-top: 8px; }
.stat.accent .v { color: var(--accent-h); }
.stat.term .v { color: var(--term); }

.chart-card .bars { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: var(--s2); }
.chart-card .bar { flex: 1; background: linear-gradient(180deg, var(--accent), var(--accent-dim)); border-radius: 5px 5px 0 0; position: relative; min-height: 6px; transition: opacity .12s; }
.chart-card .bar:hover { opacity: .8; }
.chart-card .bar .val { position: absolute; top: -20px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--text-mut); font-family: var(--mono); }
.chart-card .xlabels { display: flex; gap: 10px; margin-top: 8px; }
.chart-card .xlabels span { flex: 1; text-align: center; font-size: 11px; color: var(--text-dim); }

.log-list { font-family: var(--mono); font-size: 13px; }
.log-line { padding: 8px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 14px; align-items: baseline; }
.log-line:last-child { border-bottom: none; }
.log-line:hover { background: rgba(59,158,255,.04); }
.log-line .t { color: var(--text-dim); white-space: nowrap; }
.log-line .lvl { font-weight: 700; white-space: nowrap; width: 56px; }
.log-line .lvl.ok { color: var(--term); }
.log-line .lvl.info { color: var(--accent-h); }
.log-line .lvl.warn { color: var(--warn); }
.log-line .msg { color: var(--text); }

.section-title { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; margin: 0 0 14px; }

/* ===== 评论管理：抖音式评论流 ===== */
.cmt-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.cmt-tab { padding: 6px 14px; border-radius: 20px; font-size: 13px; cursor: pointer; border: 1px solid var(--border); color: var(--text-mut); background: transparent; transition: all .12s; }
.cmt-tab:hover { color: var(--text); border-color: var(--text-dim); }
.cmt-tab.active { color: var(--accent-h); border-color: var(--accent); background: rgba(59,158,255,.08); }
.cmt-tab .n { font-family: var(--mono); opacity: .8; }

/* 单条评论 */
.cmt { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.cmt:last-child { border-bottom: none; }
.cmt-av { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--bg-elev2); }
.cmt-body { flex: 1; min-width: 0; }
.cmt-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cmt-name { font-size: 13px; font-weight: 600; color: var(--text); }
.cmt-time { font-size: 12px; color: var(--text-dim); font-family: var(--mono); }
.cmt-from { font-size: 12px; color: var(--text-dim); margin-left: auto; }
.cmt-text { font-size: 14px; color: var(--text); line-height: 1.6; word-break: break-word; }
.cmt-text.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cmt-more { font-size: 12px; color: var(--accent-h); cursor: pointer; margin-top: 2px; display: inline-block; }
/* 操作行：点赞图标+数字、回复 */
.cmt-actions { display: flex; align-items: center; gap: 18px; margin-top: 8px; }
.cmt-like { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-mut); }
.cmt-like .heart { color: var(--danger); font-size: 14px; }
.cmt-reply-btn { font-size: 12px; color: var(--text-mut); cursor: pointer; background: none; border: none; padding: 0; }
.cmt-reply-btn:hover { color: var(--accent-h); }
.cmt-badge-replied { font-size: 11px; color: var(--ok); border: 1px solid rgba(54,224,127,.3); background: rgba(54,224,127,.08); padding: 1px 7px; border-radius: 10px; }
/* 折叠的子回复 */
.cmt-replies-toggle { font-size: 12px; color: var(--accent-h); cursor: pointer; margin-top: 8px; display: inline-flex; align-items: center; gap: 4px; }
.cmt-replies { margin-top: 10px; padding-left: 14px; border-left: 2px solid var(--border); }
.cmt-reply { display: flex; gap: 10px; padding: 8px 0; }
.cmt-reply .cmt-av { width: 28px; height: 28px; }
.cmt-reply .cmt-text { font-size: 13px; }
.cmt-reply.mine .cmt-name { color: var(--accent-h); }
.cmt-reply.mine::after { content: "我"; font-size: 10px; color: var(--accent); border: 1px solid var(--accent-dim); padding: 0 4px; border-radius: 4px; align-self: flex-start; }
/* 回复输入框 */
.cmt-replybox { margin-top: 10px; display: flex; gap: 8px; }
.cmt-replybox textarea { flex: 1; min-height: 60px; resize: vertical; }
/* 无限滚动哨兵 */
.cmt-sentinel { text-align: center; padding: 18px; color: var(--text-dim); font-size: 13px; }

@media (max-width: 720px) {
  .cmt-from { display: none; }
}

/* ===== AI 聊天 ===== */
.chat-card { display: flex; flex-direction: column; height: calc(100vh - 160px); padding: 0; overflow: hidden; }
.chat-log { flex: 1; overflow-y: auto; padding: var(--s5); display: flex; flex-direction: column; gap: 4px; }
.chat-row { display: flex; }
.chat-row.me { justify-content: flex-end; }
.chat-row.ai { justify-content: flex-start; }
.chat-bubble {
  max-width: 72%; padding: 10px 14px; border-radius: var(--radius-lg);
  font-size: 14px; line-height: 1.6; word-break: break-word; margin: 6px 0;
}
.chat-bubble.me { background: var(--accent); color: #04121f; border-bottom-right-radius: 4px; }
.chat-bubble.ai { background: var(--bg-elev2); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-bubble.ai.muted { color: var(--text-dim); font-style: italic; }
.chat-input-row {
  display: flex; gap: 10px; align-items: flex-end;
  padding: var(--s4) var(--s5); border-top: 1px solid var(--border); background: rgba(20,26,34,.5);
}
.chat-input-row textarea.input { resize: none; max-height: 160px; font-family: inherit; }
.chat-input-row .btn { flex-shrink: 0; }

/* 响应式 */
@media (max-width: 720px) {
  .sidebar { width: 100% !important; display: flex !important; overflow-x: auto; border-right: none !important; border-bottom: 1px solid var(--border) !important; padding: 0 !important; }
  .sidebar a { border-left: none !important; border-bottom: 2px solid transparent; white-space: nowrap; padding: 13px 16px !important; }
  .sidebar a.active { border-left: none !important; border-bottom-color: var(--accent) !important; }
  .layout { flex-direction: column !important; }
  .content { padding: 20px 16px !important; }
  th, td { padding: 9px 10px; }
}
