:root {
  --ink: #1d1c33;
  --muted: #6d6b82;
  --line: #e4e1ee;
  --bg: #f3f1f8;
  --card: #ffffff;
  --side: #17162c;
  --side-text: #d9d7e8;
  --violet: #5b45e6;
  --violet-dark: #3c2bb8;
  --good: #0e7a4b;
  --good-bg: #e7f7ef;
  --warn: #9a6208;
  --warn-bg: #fff4df;
  --bad: #b42318;
  --bad-bg: #fdeceb;
  --shadow: 0 10px 30px rgba(28, 24, 62, 0.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", "Noto Sans", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--violet-dark); }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, #ece7ff, transparent 36%),
    var(--bg);
}
.login-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 28px;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}
.mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--violet);
  color: white;
  font-weight: 700;
}
h1, h2, h3 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--ink);
}
input:focus, select:focus { outline: 2px solid #ddd6ff; border-color: var(--violet); }
.btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  background: var(--violet);
  color: white;
  font-weight: 650;
}
.btn.secondary { background: #efeefe; color: var(--violet-dark); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }
.stack { display: grid; gap: 10px; }

.shell { display: flex; min-height: 100vh; }
.side {
  width: 248px;
  background: var(--side);
  color: var(--side-text);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side .brand { color: white; padding: 0 8px; }
.nav-btn {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--side-text);
  border-radius: 12px;
  padding: 11px 12px;
  margin-top: 4px;
}
.nav-btn.active, .nav-btn:hover { background: rgba(255,255,255,0.08); color: white; }
.side .spacer { flex: 1; }
.main { flex: 1; padding: 22px; min-width: 0; }
.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 16px;
}
.filters { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.filters label { margin: 0 0 4px; }
.filters input { width: 160px; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.card { padding: 16px; }
.card b { display: block; font-size: 28px; margin-top: 6px; }
.panel { padding: 8px 8px 4px; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
th { color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: 0.02em; }
tr.click:hover { background: #faf9ff; cursor: pointer; }
.pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 650;
  background: #f1f0f6;
}
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.bar { height: 8px; background: #eeeafd; border-radius: 99px; overflow: hidden; width: 120px; }
.bar span { display: block; height: 100%; background: var(--violet); }
.toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: var(--ink);
  color: white;
  padding: 12px 14px;
  border-radius: 12px;
  max-width: 320px;
}
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(18, 16, 40, 0.45);
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal { width: min(460px, 100%); background: white; border-radius: 18px; padding: 18px; }
.split { display: grid; grid-template-columns: 280px 1fr; gap: 14px; }
.doc {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 18px;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.menu-toggle { display: none; }

.id-sheet { display: grid; place-items: center; min-height: 70vh; }
.id-card {
  width: 420px;
  max-width: 100%;
  min-height: 240px;
  border-radius: 18px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 132px 1fr;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.id-band {
  background: linear-gradient(180deg, var(--violet), var(--violet-dark));
  color: white;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 16px;
}
.avatar, .avatar-ph {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,0.2);
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
}
.id-body { padding: 16px 16px 14px; }
.id-body .code { margin: 8px 0; }

@media (max-width: 980px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .split { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 5; transform: translateX(-105%); }
  .side.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .main { padding: 16px; }
}
@media print {
  .no-print { display: none !important; }
  body { background: white; }
  .id-sheet { min-height: auto; }
  .id-card { box-shadow: none; }
}
