:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-alt: #f0f2f7;
  --border: #e0e3ea;
  --text: #1c2130;
  --text-dim: #6b7280;
  --primary: #3457e8;
  --primary-hover: #2a46c4;
  --primary-soft: rgba(52, 87, 232, 0.1);
  --success: #158a4c;
  --success-soft: rgba(21, 138, 76, 0.12);
  --danger: #d0342c;
  --danger-soft: rgba(208, 52, 44, 0.1);
  --warning: #b06a00;
  --warning-soft: rgba(176, 106, 0, 0.12);
  --radius: 10px;
  --shadow: 0 8px 24px rgba(28, 33, 48, 0.08), 0 2px 6px rgba(28, 33, 48, 0.05);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0 0 4px; letter-spacing: -0.01em; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 700; font-size: 18px; color: var(--primary); display: flex; align-items: center; gap: 10px; }
.topbar .brand small { display: block; font-weight: 400; color: var(--text-dim); font-size: 11px; }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
  padding: 8px 14px;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-weight: 500;
}
.topbar nav a.active, .topbar nav a:hover { background: var(--primary-soft); color: var(--primary); }

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card h2 { font-size: 16px; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
th { color: var(--text-dim); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: var(--surface-alt); }

.btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 14px;
  font-weight: 500;
  cursor: pointer;
  font-size: 13px;
}
.btn:hover { border-color: var(--primary); background: var(--surface-alt); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
label { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.flex { display: flex; gap: 8px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.grow { flex: 1; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }

.text-dim { color: var(--text-dim); }
.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; }

.login-screen { height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { width: 340px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 32px; }
.login-box h1 { font-size: 20px; color: var(--primary); }
.login-box p { color: var(--text-dim); margin: 0 0 20px; font-size: 13px; }

.error-text { color: var(--danger); font-size: 13px; margin: 8px 0; }
.hidden { display: none !important; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 18, 25, 0.5);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; width: 420px; max-height: 85vh; overflow-y: auto; }
