:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1a1d26;
  --muted: #6b7280;
  --line: #e5e7ef;
  --brand: #3b5bdb;
  --brand-2: #4c6ef5;
  --danger: #e03131;
  --ok: #2f9e44;
  --shadow: 0 8px 24px rgba(26, 29, 38, 0.06);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 10% -10%, #dbe4ff 0%, transparent 55%),
    radial-gradient(900px 320px at 100% 0%, #e7f5ff 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 700; color: var(--ink); font-size: 1.05rem; text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; object-fit: contain; display: block; background: #111; }
.brand-text span { color: var(--brand); font-weight: 800; }
.brand span { color: var(--brand); font-weight: 800; }
.brand span { color: var(--brand); font-weight: 800; }
.links { display: flex; gap: 0.85rem; align-items: center; flex-wrap: wrap; }
.container { width: min(1100px, 100%); margin: 0 auto; padding: 1.25rem; flex: 1; }
.footer {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1rem 1.25rem; color: var(--muted); font-size: 0.85rem;
  border-top: 1px solid var(--line); background: #fff;
}
.page-head h1 { margin: 0 0 0.25rem; font-size: 1.55rem; }
.muted { color: var(--muted); }
.grid.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.metric .label { color: var(--muted); font-size: 0.85rem; }
.metric .value { font-size: 2rem; font-weight: 750; margin: 0.35rem 0; }
.metric .value.small { font-size: 1.25rem; }
.login-card { max-width: 420px; margin: 3rem auto; }
.form { display: grid; gap: 0.85rem; }
.form.row {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: end;
}
label { display: grid; gap: 0.35rem; font-size: 0.9rem; font-weight: 600; }
input, select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
}
.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 0.6rem 0.95rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.btn.primary { background: linear-gradient(180deg, var(--brand-2), var(--brand)); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #ffc9c9; background: #fff5f5; }
.btn.sm { padding: 0.35rem 0.6rem; font-size: 0.8rem; }
.inline { display: inline; margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.7rem 0.55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 650; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
code { font-size: 0.82rem; background: #f1f3f9; padding: 0.15rem 0.35rem; border-radius: 6px; }
.flash { padding: 0.75rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid var(--line); }
.flash.error { background: #fff5f5; color: #c92a2a; border-color: #ffc9c9; }
.flash.ok { background: #ebfbee; color: #2b8a3e; border-color: #b2f2bb; }
.flash.info { background: #edf2ff; color: #364fc7; }
@media (max-width: 720px) {
  .nav { flex-direction: column; align-items: flex-start; }
  .links { width: 100%; }
}

.login-hero { display:flex; flex-direction:column; align-items:center; gap:0.6rem; margin-bottom:1rem; }
.login-hero img { width:56px; height:56px; border-radius:14px; background:#111; }
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0;}

.badge { display:inline-flex; align-items:center; padding:.2rem .5rem; border-radius:999px; font-size:.72rem; font-weight:700; }
.badge.ok { color:#176b3a; background:#d8f5e3; }
.badge.muted { color:#667085; background:#eef0f3; }
.inline { display:inline; }
.actions { white-space:nowrap; }

.identity-edit { display:inline-flex; flex-wrap:wrap; gap:.35rem; margin-bottom:.35rem; }
.identity-edit input { max-width:150px; padding:.35rem; border:1px solid var(--border); border-radius:5px; }

.badge.warn { color:#9a6700; background:#fff3bf; }
.badge.danger { color:#c92a2a; background:#ffe3e3; }
.filters { display:flex; flex-wrap:wrap; gap:.75rem; align-items:end; margin-bottom:1rem; }
.filters .form.row { margin:0; flex:1; }
.identity-flash {
  display:flex; flex-wrap:wrap; align-items:center; gap:.75rem;
  padding:1rem 1.1rem; border-radius:12px; background:#edf2ff; border:1px solid #bac8ff; margin-bottom:1rem;
}
.identity-flash code.big {
  font-size:1.15rem; letter-spacing:.06em; background:#fff; padding:.45rem .7rem; border-radius:8px;
  border:1px solid #bac8ff; user-select:all;
}
.checkbox-label { display:flex; align-items:center; gap:.5rem; font-weight:650; }
.checkbox-label input { width:auto; }
.detail-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:1rem; }
.kv { display:grid; gap:.2rem; }
.kv .k { color:var(--muted); font-size:.8rem; font-weight:650; text-transform:uppercase; letter-spacing:.03em; }
.kv .v { font-size:1rem; word-break:break-word; }
.remaining { font-variant-numeric:tabular-nums; white-space:nowrap; }
.toolbar { display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; margin-top:.5rem; }
.search-bar input { min-width:200px; }
.form.row.dense { grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); }
