:root {
  --navy: #0b2545;
  --navy-2: #123a66;
  --accent: #2f6fb0;
  --accent-soft: #e8f0fa;
  --bg: #eef2f7;
  --surface: #ffffff;
  --text: #1b2430;
  --muted: #5c6b7a;
  --line: #dde5ee;
  --ok: #0f7a4d;
  --ok-soft: #e6f4ec;
  --warn: #9a6700;
  --warn-soft: #fff8e1;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 35, 60, 0.07);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 18px; margin: 0 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 15px; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt { margin-top: 20px; }

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  flex: 0 0 250px;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #e8eef6;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.brand b { display: block; font-size: 16px; letter-spacing: 0.06em; }
.brand small { display: block; color: #9fb6cf; font-size: 12px; letter-spacing: 0.04em; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #ffffff;
  color: var(--navy);
  font-weight: 800;
  font-size: 18px;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  color: #cfdced;
  padding: 9px 12px;
  border-radius: 8px;
  border-left: 3px solid transparent;
  font-size: 14px;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.08); text-decoration: none; }
.nav-link.active {
  background: rgba(255, 255, 255, 0.12);
  border-left-color: #6aa6e0;
  color: #ffffff;
  font-weight: 600;
}

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 14px;
  font-size: 13px;
}
.who { margin-bottom: 10px; }
.who-name { font-weight: 600; color: #ffffff; }
.who-role { color: #9fb6cf; font-size: 12px; }
.side-link {
  display: block;
  color: #cfdced;
  padding: 4px 0;
  font-size: 13px;
}
.side-link:hover { color: #ffffff; }
.side-link-btn {
  background: none;
  border: 0;
  padding: 4px 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 30px 38px 40px;
  max-width: 1320px;
}
.main-anon { margin: 0 auto; display: flex; flex-direction: column; justify-content: center; max-width: 720px; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.page-head p { margin: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.card.narrow { max-width: 620px; }
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.card-head h2 { margin: 0; }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}
.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.stat { margin: 0; }
.stat-label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; margin: 6px 0 2px; }
.stat-value span { font-size: 18px; color: var(--muted); font-weight: 500; }
.stat-value.small { font-size: 22px; }
.stat-note { color: var(--muted); font-size: 13px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: #eef2f7;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary { background: var(--navy); color: #ffffff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: #b9c8d8; background: #f7fafc; }
.btn-danger { background: var(--danger); color: #ffffff; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }

.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.actions form { display: inline; margin: 0; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.table td { padding: 10px; border-bottom: 1px solid #eef2f7; vertical-align: top; }
.table tbody tr:hover { background: #f9fbfd; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .details { max-width: 420px; word-break: break-word; color: var(--muted); }
.ellipsis { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #eef2f7;
  color: var(--muted);
}
.badge-admin { background: var(--accent-soft); color: var(--navy); }
.badge-user { background: #f1f3f5; color: #495057; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-off { background: var(--danger-soft); color: var(--danger); }
.badge-wip { background: var(--warn-soft); color: var(--warn); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px dashed #c9d6e3;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
}

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.input {
  width: 100%;
  border: 1px solid #c9d6e3;
  border-radius: 9px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  background: #ffffff;
  color: var(--text);
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 176, 0.15);
}
.field input[type="text"],
.field input[type="password"],
.field input[type="email"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #c9d6e3;
  border-radius: 9px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  background: #ffffff;
  color: var(--text);
}
.field input[type="text"]:focus,
.field input[type="password"]:focus,
.field input[type="email"]:focus,
.field input[type="number"]:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 176, 0.15);
}
.file-input { padding: 8px; background: #f7fafc; }
.checkbox { width: 18px; height: 18px; accent-color: var(--navy); }
.help { color: var(--muted); font-size: 12px; margin-top: 5px; }
.err { color: var(--danger); font-size: 13px; margin-top: 5px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 22px; }

.alerts { margin-bottom: 18px; }
.alert {
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  margin-bottom: 10px;
  border: 1px solid transparent;
}
.alert-success { background: var(--ok-soft); color: var(--ok); border-color: #bfe3cf; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: #f3c6c2; }
.alert-warning { background: var(--warn-soft); color: var(--warn); border-color: #f0dfa8; }
.alert-info { background: var(--accent-soft); color: var(--navy); border-color: #c8dcf3; }

.list { margin: 0 0 14px; padding-left: 20px; }
.list li { margin-bottom: 6px; }

.empty { color: var(--muted); text-align: center; padding: 30px; }

.filter { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.filter .input { width: 260px; }

.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }

.foot { color: #93a3b5; font-size: 12px; margin-top: 28px; }

.login-body {
  min-height: 100vh;
  background:
    radial-gradient(900px 600px at 15% 0%, rgba(65, 132, 202, 0.35), transparent 60%),
    linear-gradient(135deg, #081a30 0%, #0b2545 55%, #123a66 100%);
}
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 18px;
  padding: 30px 30px 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; color: var(--text); }
.login-brand b { display: block; font-size: 16px; letter-spacing: 0.06em; }
.login-brand small { display: block; color: var(--muted); font-size: 12px; }
.login-brand .brand-mark { background: var(--navy); color: #ffffff; }
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card p.muted { font-size: 13px; }
.login-foot { margin: 18px 0 0; color: var(--muted); font-size: 12px; text-align: center; line-height: 1.6; }

.error-card { text-align: center; }
.error-code { font-size: 56px; font-weight: 800; color: var(--navy); letter-spacing: -0.04em; }

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .layout { display: block; }
  .sidebar {
    width: auto;
    height: auto;
    position: static;
    flex-direction: column;
    padding: 16px;
  }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin-top: 12px; }
  .main { padding: 22px 18px 32px; }
  .page-head { flex-direction: column; }
}
