:root {
  --bg: #0f1115; --panel: #171a21; --panel-2: #1e222b; --line: #2a2f3a;
  --fg: #e7eaf0; --muted: #8b93a3; --accent: #4f8cff; --ok: #35c26a;
  --warn: #e5a13a; --bad: #e5484d;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 14px/1.55 -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--bad); min-height: 1.2em; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

.login { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-card { width: 340px; display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { font-size: 20px; margin: 0; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px;
}

label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  background: var(--panel-2); color: var(--fg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font: inherit; width: 100%;
}
textarea { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; }
button {
  background: var(--panel-2); color: var(--fg); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 14px; cursor: pointer; font: inherit;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.link { background: none; border: none; color: var(--muted); padding: 0; }
button.link:hover { color: var(--accent); }

.app { display: grid; grid-template-columns: 220px 1fr; height: 100vh; }
.sidebar {
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px 12px; gap: 16px;
}
.brand { font-size: 17px; font-weight: 600; }
.brand span { color: var(--muted); font-weight: 400; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav button { text-align: left; border: none; background: none; }
.sidebar nav button.active { background: var(--panel-2); color: var(--accent); }
.sidebar-footer {
  margin-top: auto; display: flex; justify-content: space-between;
  align-items: center; font-size: 12px; color: var(--muted);
}

.main { overflow: auto; padding: 20px 24px; }
.view-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.view-head h2 { margin: 0; font-size: 18px; }
.filters { display: flex; gap: 8px; align-items: center; }
.filters select { width: auto; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 18px; }
.metric { background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; }
.metric .label { color: var(--muted); font-size: 12px; }
.metric .value { font-size: 20px; font-weight: 600; margin-top: 4px; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: var(--panel-2); color: var(--muted); font-weight: 500; }
tr:last-child td { border-bottom: none; }
td .row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.tag { padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); }
.tag.ok { color: var(--ok); border-color: var(--ok); }
.tag.warn { color: var(--warn); border-color: var(--warn); }
.tag.bad { color: var(--bad); border-color: var(--bad); }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.settings-grid label { background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; }

.toast {
  position: fixed; right: 20px; bottom: 20px; background: var(--panel);
  border: 1px solid var(--accent); border-radius: 10px; padding: 12px 16px;
  max-width: 360px; box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.toast.bad { border-color: var(--bad); }
.inline-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px; align-items: end; margin-bottom: 8px; }
.inline-form label { font-size: 12px; }
h3 { margin: 22px 0 10px; font-size: 15px; font-weight: 500; color: var(--muted); }
