:root {
  --bg: #0a0f1a;
  --bg-soft: #0e1626;
  --panel: #111b2d;
  --panel-2: #162238;
  --panel-3: #1b2a44;
  --text: #e7eefb;
  --muted: #8aa0bd;
  --faint: #5f7391;
  --border: rgba(255, 255, 255, 0.085);
  --border-strong: rgba(255, 255, 255, 0.14);
  --cyan: #4cc9f0;
  --purple: #8b7cff;
  --green: #36d399;
  --red: #fb7185;
  --amber: #fbbf24;
  --pink: #f472b6;
  --blue: #60a5fa;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --radius-sm: 10px;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 88% -10%, rgba(76, 201, 240, 0.10), transparent 60%),
    radial-gradient(900px 600px at -10% 20%, rgba(139, 124, 255, 0.10), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
[v-cloak] { display: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: rgba(76, 201, 240, 0.3); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

.mono { font-family: var(--mono); font-size: 0.86em; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { max-width: 430px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spin {
  width: 14px; height: 14px; display: inline-block; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.22); border-top-color: var(--cyan);
  animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ */
/* login                                                               */
/* ------------------------------------------------------------------ */

.login-page {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; position: relative; overflow: hidden;
}
.login-glow {
  position: absolute; width: 640px; height: 640px; border-radius: 50%;
  background: radial-gradient(circle, rgba(76,201,240,.18), transparent 62%);
  filter: blur(20px); pointer-events: none;
}
.login-card {
  width: min(420px, 100%); position: relative; z-index: 1;
  background: linear-gradient(160deg, rgba(22,34,56,.96), rgba(13,21,36,.98));
  border: 1px solid var(--border-strong); border-radius: 22px;
  padding: 34px 30px 26px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px;
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  font-weight: 800; letter-spacing: -0.04em; color: #06101f;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  box-shadow: 0 6px 20px rgba(76,201,240,.25);
}
.brand-mark.big { width: 56px; height: 56px; border-radius: 17px; font-size: 20px; margin-bottom: 6px; }
.login-head h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.login-head p { margin: 4px 0 8px; color: var(--muted); font-size: 13px; }
.field-label { font-size: 12px; color: var(--muted); margin-top: 8px; }
.login-hint, .login-foot { color: var(--faint); font-size: 12px; line-height: 1.6; }
.login-hint code { color: var(--cyan); background: rgba(76,201,240,.08); padding: 1px 5px; border-radius: 5px; }
.login-foot { position: relative; z-index: 1; margin-top: 22px; }
.form-error { color: var(--red); font-size: 13px; margin: 2px 0 0; }

/* ------------------------------------------------------------------ */
/* shell                                                               */
/* ------------------------------------------------------------------ */

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 22px 16px 18px; border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(13,21,36,.92), rgba(9,14,24,.96));
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px 22px; }
.brand strong { display: block; font-size: 15px; letter-spacing: -0.01em; }
.brand small { display: block; color: var(--faint); font-size: 11px; margin-top: 2px; letter-spacing: .08em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  background: transparent; color: var(--muted); border: 1px solid transparent;
  border-radius: 11px; padding: 10px 11px; text-align: left; font-size: 14px;
  transition: .18s ease;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.035); }
.nav-item.active {
  color: var(--text); background: linear-gradient(90deg, rgba(76,201,240,.15), rgba(139,124,255,.10));
  border-color: rgba(76,201,240,.18); box-shadow: inset 0 0 0 1px rgba(255,255,255,.02);
}
.nav-icon { width: 20px; height: 20px; display: grid; place-items: center; flex: 0 0 20px; }
.nav-icon svg { width: 20px; height: 20px; }
.nav-count {
  margin-left: auto; font-size: 10px; color: var(--cyan); background: rgba(76,201,240,.1);
  border: 1px solid rgba(76,201,240,.18); padding: 1px 6px; border-radius: 20px;
}
.sidebar-footer {
  display: flex; align-items: center; gap: 10px; padding: 13px 10px 4px;
  border-top: 1px solid var(--border); margin-top: 12px;
}
.conn-meta strong { display: block; font-size: 12px; }
.conn-meta small { display: block; color: var(--faint); font-size: 11px; margin-top: 2px; max-width: 155px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; background: var(--faint); box-shadow: 0 0 0 4px rgba(255,255,255,.03); }
.conn-dot.status-online { background: var(--green); box-shadow: 0 0 0 4px rgba(54,211,153,.11), 0 0 16px rgba(54,211,153,.45); }
.conn-dot.status-warn { background: var(--amber); box-shadow: 0 0 0 4px rgba(251,191,36,.11); }
.conn-dot.status-offline { background: var(--red); box-shadow: 0 0 0 4px rgba(251,113,133,.10); }

.main { min-width: 0; padding: 22px 30px 70px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.topbar-title h2 { margin: 0; font-size: 24px; letter-spacing: -0.02em; }
.topbar-title p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: rgba(255,255,255,.025); color: var(--muted); font-size: 12px;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.status-online { color: var(--green); border-color: rgba(54,211,153,.2); background: rgba(54,211,153,.06); }
.pill.status-warn { color: var(--amber); border-color: rgba(251,191,36,.2); background: rgba(251,191,36,.06); }
.pill.status-offline { color: var(--red); border-color: rgba(251,113,133,.2); background: rgba(251,113,133,.06); }
.switch { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch-track { width: 34px; height: 19px; border-radius: 999px; background: rgba(255,255,255,.1); position: relative; transition: .18s; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 13px; height: 13px; border-radius: 50%; background: #c9d7ea; transition: .18s; }
.switch input:checked + .switch-track { background: rgba(76,201,240,.35); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(15px); background: var(--cyan); }

.content { max-width: 1600px; margin: 0 auto; }
.page-stack { display: flex; flex-direction: column; gap: 16px; }

/* ------------------------------------------------------------------ */
/* buttons / inputs                                                    */
/* ------------------------------------------------------------------ */

.btn {
  border: 1px solid var(--border); background: rgba(255,255,255,.04); color: var(--text);
  border-radius: 9px; padding: 8px 13px; font-size: 13px; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: .16s ease; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: rgba(255,255,255,.08); border-color: var(--border-strong); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, rgba(76,201,240,.95), rgba(96,165,250,.95)); color: #06101f; border-color: transparent; font-weight: 700; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger-ghost { color: var(--red); border-color: rgba(251,113,133,.22); background: rgba(251,113,133,.04); }
.btn.danger-ghost:hover:not(:disabled) { background: rgba(251,113,133,.10); }
.btn.tiny { padding: 4px 8px; font-size: 11px; border-radius: 7px; }
.btn.block { width: 100%; padding: 11px 14px; border-radius: 11px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--border);
  background: rgba(255,255,255,.03); color: var(--muted); display: grid; place-items: center; font-size: 14px;
}
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,.08); }
.input {
  background: rgba(0,0,0,.18); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 8px 11px; font-size: 13px; outline: none; min-width: 0;
  transition: border-color .16s;
}
.input:focus { border-color: rgba(76,201,240,.45); box-shadow: 0 0 0 3px rgba(76,201,240,.08); }
.input::placeholder { color: var(--faint); }
select.input { color-scheme: dark; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .grow { flex: 1 1 220px; }
.toolbar .date { width: 145px; }

/* ------------------------------------------------------------------ */
/* cards / stats                                                       */
/* ------------------------------------------------------------------ */

.stat-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.stat-card {
  position: relative; overflow: hidden; padding: 15px 16px 14px;
  background: linear-gradient(155deg, rgba(22,34,56,.92), rgba(13,21,36,.94));
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  display: flex; flex-direction: column; gap: 5px; min-height: 108px;
}
.stat-card::before {
  content: ""; position: absolute; inset: 0 auto auto 0; width: 100%; height: 2px;
  background: var(--accent, var(--cyan)); opacity: .85;
}
.stat-card::after {
  content: ""; position: absolute; right: -30px; bottom: -45px; width: 120px; height: 120px;
  border-radius: 50%; background: var(--accent, var(--cyan)); opacity: .07; filter: blur(8px);
}
.stat-card.accent-cyan { --accent: var(--cyan); }
.stat-card.accent-purple { --accent: var(--purple); }
.stat-card.accent-green { --accent: var(--green); }
.stat-card.accent-amber { --accent: var(--amber); }
.stat-card.accent-blue { --accent: var(--blue); }
.stat-card.accent-pink { --accent: var(--pink); }
.stat-card.status-online { --accent: var(--green); }
.stat-card.status-warn { --accent: var(--amber); }
.stat-card.status-offline { --accent: var(--red); }
.stat-label { color: var(--muted); font-size: 12px; letter-spacing: .02em; }
.stat-card strong { font-size: 25px; letter-spacing: -0.03em; line-height: 1.15; }
.stat-card small { color: var(--faint); font-size: 11px; margin-top: auto; }

.panel {
  background: linear-gradient(160deg, rgba(18,29,48,.92), rgba(12,20,34,.94));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 17px; min-width: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h3 { margin: 0; font-size: 14px; letter-spacing: -0.01em; }
.panel-head .muted { font-size: 11px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.chart-grid .span-2 { grid-column: span 2; }
.chart-box { height: 235px; position: relative; }
.chart-box.small { height: 175px; }
.chart-note { color: var(--faint); font-size: 11px; line-height: 1.6; margin: 10px 0 0; }
.empty { color: var(--faint); font-size: 12px; padding: 18px 6px; text-align: center; }
.empty-cell { color: var(--faint); font-size: 12px; text-align: center; padding: 26px 8px !important; }
.alert { border-radius: 10px; padding: 10px 12px; font-size: 13px; border: 1px solid var(--border); background: rgba(255,255,255,.03); }
.alert.error { color: #ffd5db; border-color: rgba(251,113,133,.28); background: rgba(251,113,133,.08); }
.notice { color: var(--muted); font-size: 12px; line-height: 1.6; border-left: 2px solid rgba(76,201,240,.4); padding: 3px 0 3px 10px; }
.skeleton-grid { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 12px; }
.skeleton { min-height: 108px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: linear-gradient(90deg, rgba(255,255,255,.025), rgba(255,255,255,.055), rgba(255,255,255,.025)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ------------------------------------------------------------------ */
/* tables                                                              */
/* ------------------------------------------------------------------ */

.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 11px; }
.table-wrap.compact table { min-width: 0; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
thead th {
  position: sticky; top: 0; z-index: 1; text-align: left; font-size: 11px; font-weight: 600;
  color: var(--muted); letter-spacing: .04em; text-transform: uppercase;
  background: rgba(12,20,34,.96); padding: 9px 11px; border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
tbody td { padding: 9px 11px; border-bottom: 1px solid rgba(255,255,255,.045); font-size: 12.5px; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: rgba(76,201,240,.045); }
.user-name { font-weight: 600; color: #d7e6fb; }
.message-preview { color: #c7d5e8; line-height: 1.55; word-break: break-word; }
.type-badge { margin-right: 3px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 11px; font-size: 12px; }

/* ------------------------------------------------------------------ */
/* badges / ranks / lists                                              */
/* ------------------------------------------------------------------ */

.badge {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px;
  padding: 2px 7px; font-size: 10.5px; line-height: 1.6; border: 1px solid transparent;
  white-space: nowrap;
}
.badge-green, .status-online.badge { color: var(--green); background: rgba(54,211,153,.08); border-color: rgba(54,211,153,.2); }
.badge-red { color: var(--red); background: rgba(251,113,133,.08); border-color: rgba(251,113,133,.2); }
.badge-muted { color: var(--muted); background: rgba(255,255,255,.04); border-color: var(--border); }
.badge-blue { color: var(--blue); background: rgba(96,165,250,.08); border-color: rgba(96,165,250,.2); }
.badge-purple { color: var(--purple); background: rgba(139,124,255,.09); border-color: rgba(139,124,255,.2); }
.badge-amber { color: var(--amber); background: rgba(251,191,36,.08); border-color: rgba(251,191,36,.2); }
.badge.status-warn { color: var(--amber); background: rgba(251,191,36,.08); border-color: rgba(251,191,36,.2); }
.source-curated { color: var(--amber); background: rgba(251,191,36,.07); border-color: rgba(251,191,36,.18); }
.source-auto { color: var(--cyan); background: rgba(76,201,240,.07); border-color: rgba(76,201,240,.18); }
.source-manual { color: var(--green); background: rgba(54,211,153,.07); border-color: rgba(54,211,153,.18); }

.rank-list { display: flex; flex-direction: column; gap: 9px; }
.rank-item { display: grid; grid-template-columns: 22px 110px 1fr 44px; align-items: center; gap: 9px; font-size: 12px; }
.rank-index { color: var(--faint); font-family: var(--mono); font-size: 11px; }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,.055); overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--purple)); }
.rank-count { text-align: right; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.error-list { display: flex; flex-direction: column; gap: 8px; }
.error-item { display: flex; gap: 10px; align-items: flex-start; font-size: 12px; color: #ffd5db; }

/* ------------------------------------------------------------------ */
/* stickers                                                            */
/* ------------------------------------------------------------------ */

.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 12px; }
.sticker-card {
  border: 1px solid var(--border); border-radius: 13px; overflow: hidden;
  background: rgba(255,255,255,.018); display: flex; flex-direction: column;
  transition: .16s ease;
}
.sticker-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.sticker-thumb { height: 145px; background: radial-gradient(circle at 50% 20%, rgba(76,201,240,.08), rgba(0,0,0,.18)); display: grid; place-items: center; overflow: hidden; border-bottom: 1px solid var(--border); }
.sticker-thumb .auth-image, .sticker-thumb .media-frame, .sticker-thumb img { width: 100%; height: 100%; }
.sticker-thumb img { object-fit: contain; display: block; }
.sticker-body { padding: 11px 12px 12px; display: flex; flex-direction: column; gap: 5px; }
.sticker-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sticker-title strong { font-size: 13px; }
.sticker-body p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.55; min-height: 34px; }
.sticker-body small { color: var(--faint); font-size: 10.5px; line-height: 1.5; }
.sticker-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--faint); font-size: 10.5px; font-family: var(--mono); margin-top: 2px; }
.sticker-actions { display: flex; justify-content: flex-end; margin-top: 3px; }
.readonly-note { color: var(--faint); font-size: 10.5px; }
.span-all { grid-column: 1 / -1; }

/* ------------------------------------------------------------------ */
/* drawer / modal                                                      */
/* ------------------------------------------------------------------ */

.drawer-overlay, .modal-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(3, 7, 14, .66);
  backdrop-filter: blur(3px); display: flex; justify-content: flex-end;
  animation: fadeIn .16s ease;
}
.modal-overlay { align-items: center; justify-content: center; padding: 20px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  width: min(760px, 100vw); height: 100vh; background: linear-gradient(180deg, #101a2c, #0b1322);
  border-left: 1px solid var(--border-strong); box-shadow: -30px 0 80px rgba(0,0,0,.4);
  display: flex; flex-direction: column; animation: slideIn .22s cubic-bezier(.2,.8,.2,1);
}
.drawer.wide { width: min(980px, 100vw); }
@keyframes slideIn { from { transform: translateX(30px); opacity: .4; } to { transform: translateX(0); opacity: 1; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 22px 14px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.drawer-head p { margin: 6px 0 0; color: var(--faint); font-size: 11px; }
.tabs { display: flex; gap: 4px; padding: 10px 22px 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button {
  background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--muted);
  padding: 8px 10px 9px; font-size: 12.5px; white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--cyan); border-bottom-color: var(--cyan); }
.drawer-body { flex: 1; overflow: auto; padding: 18px 22px 28px; }
.drawer-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 22px; border-top: 1px solid var(--border); }
.meta-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; margin-bottom: 16px; }
.meta-grid > div { background: rgba(255,255,255,.025); border: 1px solid var(--border); border-radius: 9px; padding: 9px 10px; min-width: 0; }
.meta-grid span { display: block; color: var(--faint); font-size: 10.5px; margin-bottom: 4px; }
.meta-grid strong { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-section { margin-top: 18px; }
.detail-section h4 { margin: 0 0 9px; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.answer-body { background: rgba(255,255,255,.02); border: 1px solid var(--border); border-radius: 11px; padding: 14px 15px; }
.quote-box { border-left: 2px solid rgba(76,201,240,.45); background: rgba(76,201,240,.045); border-radius: 0 9px 9px 0; padding: 9px 12px; margin: 6px 0; font-size: 12.5px; }
.quote-head { color: var(--muted); font-size: 11px; margin-bottom: 5px; display: flex; gap: 8px; }
.forward-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 8px 0; background: rgba(255,255,255,.02); }
.forward-head { color: var(--muted); font-size: 11px; margin-bottom: 8px; }
.forward-msg { border-top: 1px dashed var(--border); padding: 8px 0 4px; }
.forward-msg:first-of-type { border-top: 0; }
.forward-meta { color: var(--faint); font-size: 10.5px; margin-bottom: 4px; }
.file-chip { display: inline-flex; gap: 5px; align-items: center; background: rgba(255,255,255,.04); border: 1px solid var(--border); border-radius: 7px; padding: 4px 8px; font-size: 12px; }
.raw-part, .json-view { background: #080e18; border: 1px solid var(--border); border-radius: 9px; padding: 11px 12px; overflow: auto; font-family: var(--mono); font-size: 11.5px; line-height: 1.65; color: #c9d7ea; white-space: pre-wrap; word-break: break-word; }
.json-view.small { max-height: 220px; }
.parts-list { display: flex; flex-direction: column; gap: 10px; }
.part { min-width: 0; }

.media-image, .auth-image { min-width: 0; }
.media-frame { position: relative; display: inline-block; max-width: 100%; }
.media-frame img { max-width: 100%; max-height: 520px; border-radius: 10px; border: 1px solid var(--border); display: block; }
.media-label { position: absolute; left: 7px; bottom: 7px; font-family: var(--mono); font-size: 10px; background: rgba(0,0,0,.62); border: 1px solid var(--border); color: #d7e6fb; padding: 2px 6px; border-radius: 5px; }
.media-loading, .media-error { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--faint); font-size: 11.5px; background: rgba(255,255,255,.025); border: 1px dashed var(--border); border-radius: 9px; padding: 12px; }
.media-error a { font-size: 11px; }

.tool-summary { display: flex; flex-wrap: wrap; gap: 7px; }
.tool-pill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(54,211,153,.2); background: rgba(54,211,153,.05); color: #c9f7e5; border-radius: 8px; padding: 5px 9px; font-size: 11px; }
.tool-pill.failed { border-color: rgba(251,113,133,.25); background: rgba(251,113,133,.06); color: #ffd5db; }
.tool-list { display: flex; flex-direction: column; gap: 12px; }
.tool-card { border: 1px solid var(--border); border-radius: 11px; padding: 12px; background: rgba(255,255,255,.02); }
.tool-card.failed { border-color: rgba(251,113,133,.25); }
.tool-card header { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; flex-wrap: wrap; }
.tool-section { margin-top: 8px; }
.tool-section > span { display: block; color: var(--faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }

.prompt-log { display: flex; flex-direction: column; gap: 12px; }
.prompt-msg { border: 1px solid var(--border); border-left: 3px solid var(--border-strong); border-radius: 0 11px 11px 0; padding: 11px 13px; background: rgba(255,255,255,.02); }
.prompt-msg.role-system { border-left-color: var(--purple); }
.prompt-msg.role-user { border-left-color: var(--cyan); }
.prompt-msg.role-assistant { border-left-color: var(--green); }
.prompt-msg.role-tool { border-left-color: var(--amber); }
.prompt-role { font-family: var(--mono); font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.prompt-content { min-width: 0; }
.prompt-image-note { color: var(--faint); font-size: 11.5px; border: 1px dashed var(--border); border-radius: 7px; padding: 7px 9px; margin: 4px 0; word-break: break-all; }
.prompt-kind { color: var(--faint); font-size: 10.5px; font-family: var(--mono); letter-spacing: .04em; margin: 0 0 6px; }
.prompt-plain, .xml-view { margin: 0; background: #080e18; border: 1px solid var(--border); border-radius: 9px; padding: 11px 12px; overflow: auto; font-family: var(--mono); color: #c9d7ea; font-size: 11.5px; line-height: 1.65; }
.prompt-plain { white-space: pre-wrap; word-break: break-word; max-height: 360px; }
.xml-view { white-space: pre; max-height: 560px; tab-size: 2; }
.reasoning { margin-top: 8px; }
.reasoning summary { color: var(--faint); font-size: 11px; cursor: pointer; }
.reasoning pre { margin: 6px 0 0; max-height: 260px; overflow: auto; background: #080e18; border: 1px solid var(--border); border-radius: 8px; padding: 9px; font-family: var(--mono); font-size: 11px; white-space: pre-wrap; color: #b8c9e0; }

/* ------------------------------------------------------------------ */
/* status / meta                                                       */
/* ------------------------------------------------------------------ */

.bot-card { border: 1px solid var(--border); border-radius: 11px; padding: 11px 12px; margin-bottom: 9px; background: rgba(255,255,255,.018); }
.bot-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.bot-line strong { font-size: 13px; }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 4px 0; border-top: 1px dashed rgba(255,255,255,.055); font-size: 12px; }
.kv span { color: var(--faint); flex: 0 0 auto; }
.kv strong { text-align: right; font-weight: 500; color: #d7e6fb; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row { display: grid; grid-template-columns: minmax(0, 1fr) 70px 60px 120px; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px dashed rgba(255,255,255,.055); font-size: 11.5px; }
.file-row strong { display: block; font-size: 12px; }
.file-row small { display: block; color: var(--faint); font-size: 10px; margin-top: 2px; }
.file-row > span { color: var(--muted); text-align: right; }
.preset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.preset-card { border: 1px solid var(--border); border-radius: 12px; padding: 10px; background: rgba(255,255,255,.018); display: flex; flex-direction: column; gap: 6px; }
.preset-card .auth-image, .preset-card .media-frame { width: 100%; }
.preset-card img { width: 100%; max-height: 420px; object-fit: contain; background: rgba(0,0,0,.18); border-radius: 8px; }
.preset-card strong { font-size: 12px; }
.preset-card small { color: var(--faint); font-size: 11px; }
.version-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.version-grid > div { background: rgba(255,255,255,.025); border: 1px solid var(--border); border-radius: 9px; padding: 9px 10px; }
.version-grid span { display: block; color: var(--faint); font-size: 10.5px; margin-bottom: 4px; }
.version-grid strong { font-size: 12px; font-family: var(--mono); }

/* ------------------------------------------------------------------ */
/* markdown                                                            */
/* ------------------------------------------------------------------ */

.md-body { font-size: 13px; line-height: 1.72; color: #d8e5f7; word-break: break-word; }
.md-body > :first-child { margin-top: 0; }
.md-body > :last-child { margin-bottom: 0; }
.md-body p { margin: 0.5em 0; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { margin: 1em 0 .45em; line-height: 1.3; letter-spacing: -0.01em; }
.md-body h1 { font-size: 1.45em; }
.md-body h2 { font-size: 1.28em; }
.md-body h3 { font-size: 1.12em; }
.md-body ul, .md-body ol { padding-left: 1.5em; margin: .55em 0; }
.md-body li { margin: .2em 0; }
.md-body blockquote { margin: .7em 0; padding: .2em 0 .2em 1em; border-left: 2px solid rgba(76,201,240,.45); color: #b8c9e0; background: rgba(76,201,240,.04); }
.md-body code { font-family: var(--mono); font-size: .9em; background: rgba(255,255,255,.08); padding: 1px 5px; border-radius: 4px; color: #9be3ff; }
.md-body pre { background: #080e18 !important; border: 1px solid var(--border); border-radius: 10px; padding: 12px 13px; overflow: auto; margin: .7em 0; }
.md-body pre code { background: transparent; padding: 0; color: inherit; font-size: 12px; }
.md-body table { width: 100%; border-collapse: collapse; margin: .7em 0; }
.md-body th, .md-body td { border: 1px solid var(--border); padding: 6px 8px; font-size: 12px; }
.md-body th { background: rgba(255,255,255,.04); text-align: left; }
.md-body hr { border: 0; border-top: 1px solid var(--border); margin: 1em 0; }
.md-body img { max-width: 100%; border-radius: 8px; }
.md-body a { color: var(--cyan); }

/* ------------------------------------------------------------------ */
/* toasts                                                              */
/* ------------------------------------------------------------------ */

.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  min-width: 210px; max-width: 380px; border-radius: 10px; padding: 10px 13px; font-size: 12.5px;
  border: 1px solid var(--border-strong); background: rgba(17, 27, 45, .96); color: var(--text);
  box-shadow: var(--shadow); animation: toastIn .2s ease;
}
.toast-success { border-color: rgba(54,211,153,.3); color: #c9f7e5; }
.toast-error { border-color: rgba(251,113,133,.35); color: #ffd5db; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ------------------------------------------------------------------ */
/* responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 1280px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-grid .span-2 { grid-column: span 2; }
  .skeleton-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { padding-bottom: 12px; }
  .nav { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .nav-item { width: auto; white-space: nowrap; }
  .sidebar-footer { display: none; }
  .main { padding: 18px 16px 50px; }
  .topbar { flex-direction: column; }
  .topbar-actions { justify-content: flex-start; }
  .grid-2 { grid-template-columns: 1fr; }
  .version-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 640px) {
  .stat-grid, .skeleton-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .chart-grid { grid-template-columns: 1fr; }
  .chart-grid .span-2 { grid-column: auto; }
  .preset-grid { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .toolbar .date { width: 100%; }
  .table-wrap { border-radius: 9px; }
  .drawer-body { padding: 15px 14px 24px; }
  .drawer-head, .tabs { padding-left: 14px; padding-right: 14px; }
  .drawer-foot { padding: 10px 14px; }
  .truncate { max-width: 220px; }
}
