:root {
  --bg: #0f1115;
  --panel: #171a21;
  --border: #262b35;
  --text: #e6e9ef;
  --muted: #98a2b3;
  --accent: #4f8cff;
  --danger: #ff5c5c;
  --ok: #38c172;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}
.hidden { display: none !important; }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
}
.login-card { width: 320px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font-size: 18px; margin: 0 0 6px; }
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
input, select, textarea {
  background: #0e1014;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
  width: 100%;
}
textarea { min-height: 80px; resize: vertical; }
button {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font: inherit;
}
button.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
button.danger { background: var(--danger); }
button:hover { filter: brightness(1.1); }
.error { color: var(--danger); font-size: 13px; margin: 0; min-height: 18px; }

header {
  display: flex; align-items: center; gap: 20px;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  background: var(--panel);
}
header h1 { font-size: 16px; margin: 0; }
header nav { display: flex; gap: 6px; flex: 1; }
header nav button { background: transparent; border: 1px solid transparent; color: var(--muted); }
header nav button.active { color: var(--text); border-color: var(--border); background: #0e1014; }
header .user { display: flex; align-items: center; gap: 10px; color: var(--muted); }

main { padding: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel-head h2 { font-size: 15px; margin: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
td .row-actions { display: flex; gap: 8px; }
td .row-actions button { padding: 4px 8px; font-size: 12px; }

.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: 460px;
  background: var(--panel); border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px; border-bottom: 1px solid var(--border); }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { padding: 10px 12px; border-radius: 8px; white-space: pre-wrap; word-break: break-word; }
.msg.user { background: #1d2b45; align-self: flex-end; max-width: 85%; }
.msg.assistant { background: #101319; border: 1px solid var(--border); }
.msg.tool { color: var(--muted); font-size: 12px; font-family: monospace; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 10;
}
.modal .card { width: 520px; max-height: 85vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal h3 { margin: 0; font-size: 15px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; border: 1px solid var(--border); color: var(--muted); }
.badge.ok { color: var(--ok); border-color: var(--ok); }
