:root {
  --bg: #07090d;
  --panel: #0e121a;
  --panel-2: #131926;
  --panel-3: #18202f;
  --line: #1e2634;
  --line-2: #2b3548;
  --text: #e9eef8;
  --muted: #8b95a9;
  --muted-2: #5b6477;
  --lime: #c9f75a;
  --lime-soft: rgba(201, 247, 90, 0.12);
  --cyan: #5eead4;
  --red: #ff6b6b;
  --red-soft: rgba(255, 107, 107, 0.12);
  --amber: #ffb454;
  --radius: 14px;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(201, 247, 90, 0.07), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(94, 234, 212, 0.05), transparent 60%);
  z-index: 0;
}

.hidden { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--lime); }

code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--panel-3);
  padding: 2px 6px;
  border-radius: 6px;
  word-break: break-all;
}

/* ---------- login ---------- */

.login {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(400px, 100%);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}
.login-brand div { display: flex; flex-direction: column; line-height: 1.15; }
.login-brand strong { font-size: 18px; letter-spacing: 0.2px; }
.login-brand span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1.4px; }

.login-card h1 { margin: 0 0 6px; font-size: 24px; }
.login-hint { margin: 0 0 22px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 11px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(201, 247, 90, 0.14);
}

.form-error { color: var(--red); font-size: 12.5px; min-height: 18px; margin: 6px 0 10px; }

/* ---------- app shell ---------- */

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  height: 100dvh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: rgba(10, 13, 19, 0.7);
  backdrop-filter: blur(10px);
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 15px; letter-spacing: 0.3px; }
.brand-text span { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted-2); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav button:hover { color: var(--text); background: var(--panel-2); }
.nav button.active { color: var(--lime); background: var(--lime-soft); border-color: rgba(201, 247, 90, 0.2); }
.nav button svg { width: 18px; height: 18px; flex: none; }
.nav .badge {
  margin-left: auto;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--lime);
  color: #12160a;
  font-size: 10.5px;
  font-weight: 800;
  text-align: center;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 6px 0;
  border-top: 1px solid var(--line);
}
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.who .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px var(--lime); }

.main { overflow: auto; padding: 26px 30px 60px; }
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.titles h1 { margin: 0; font-size: 24px; letter-spacing: -0.2px; }
.titles p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.top-actions { display: flex; gap: 8px; }

.view { max-width: 1280px; margin: 0 auto; }

/* ---------- controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 650;
  font-size: 12.5px;
  transition: transform 0.05s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-3); border-color: #3a4760; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

.btn-primary { background: var(--lime); border-color: var(--lime); color: #101405; }
.btn-primary:hover { background: #d7ff74; border-color: #d7ff74; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: var(--red-soft); border-color: rgba(255, 107, 107, 0.35); color: var(--red); }
.btn-danger:hover { background: rgba(255, 107, 107, 0.2); }
.btn-sm { padding: 6px 10px; font-size: 11.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}
.icon-btn:hover { color: var(--text); background: var(--panel-2); }
.icon-btn svg { width: 16px; height: 16px; }

.input, .select, .textarea {
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 9px 11px;
  outline: none;
  min-width: 0;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(201, 247, 90, 0.12);
}
.search { position: relative; }
.search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted-2);
  pointer-events: none;
}
.search input { width: 100%; padding-left: 34px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
}
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip.active { color: #101405; background: var(--lime); border-color: var(--lime); }

/* ---------- dashboard ---------- */

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
}
.stat .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1.1px; }
.stat .value { font-family: var(--mono); font-size: 32px; font-weight: 700; line-height: 1.15; margin-top: 8px; letter-spacing: -1px; }
.stat .hint { color: var(--muted-2); font-size: 11.5px; margin-top: 4px; }
.stat::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -24px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 247, 90, 0.12), transparent 70%);
}
.stat.accent .value { color: var(--lime); }
.stat.danger .value { color: var(--red); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.panel + .panel { margin-top: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; font-size: 14px; letter-spacing: 0.2px; }
.panel-head .sub { color: var(--muted); font-size: 11.5px; }

.meter { height: 10px; border-radius: 999px; background: var(--panel-3); overflow: hidden; border: 1px solid var(--line); }
.meter > i { display: block; height: 100%; background: linear-gradient(90deg, #9be03c, var(--lime)); border-radius: inherit; transition: width 0.4s ease; }
.meter-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; margin-top: 8px; }

/* ---------- requests ---------- */

.req-list { display: flex; flex-direction: column; gap: 9px; }
.req {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
}
.req:hover { border-color: var(--line-2); }
.req .dev { display: flex; align-items: center; gap: 12px; min-width: 0; }
.req .avatar {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--panel-3);
  color: var(--lime);
  border: 1px solid var(--line-2);
}
.req .avatar svg { width: 18px; height: 18px; }
.req .name { font-weight: 650; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.req .meta .mono { font-family: var(--mono); }
.req .actions { display: flex; gap: 7px; }

.empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  font-size: 12.5px;
}
.empty strong { display: block; color: var(--text); margin-bottom: 4px; font-size: 13.5px; }

/* ---------- user slots ---------- */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 14px; }
.toolbar .left { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .search { width: min(280px, 100%); }

.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 9px;
}
.slot {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  padding: 9px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  color: var(--text);
  transition: transform 0.08s, border-color 0.15s, background 0.15s;
  overflow: hidden;
}
.slot:hover { transform: translateY(-2px); border-color: var(--line-2); background: var(--panel-3); }
.slot .num { font-family: var(--mono); font-size: 19px; font-weight: 700; letter-spacing: -0.5px; }
.slot .nm { color: var(--muted); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 13px; }
.slot .dots { display: flex; gap: 3px; align-items: center; }
.slot .d { width: 13px; height: 4px; border-radius: 999px; background: var(--line-2); }
.slot .d.on { background: var(--lime); }
.slot.is-full { border-color: rgba(201, 247, 90, 0.4); background: linear-gradient(180deg, rgba(201, 247, 90, 0.09), var(--panel-2)); }
.slot.is-off { opacity: 0.45; border-style: dashed; }
.slot.is-off .num { text-decoration: line-through; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; color: var(--muted); font-size: 12px; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th {
  text-align: left;
  padding: 11px 14px;
  font-size: 10.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted-2);
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }
td .sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.mono { font-family: var(--mono); font-size: 12px; }

.chip-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
}
.chip-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-active { color: var(--lime); background: var(--lime-soft); border-color: rgba(201, 247, 90, 0.25); }
.st-pending { color: var(--amber); background: rgba(255, 180, 84, 0.1); border-color: rgba(255, 180, 84, 0.25); }
.st-revoked, .st-rejected { color: var(--red); background: var(--red-soft); border-color: rgba(255, 107, 107, 0.25); }
.st-disabled { color: var(--muted); background: var(--panel-3); border-color: var(--line-2); }

/* ---------- drawer ---------- */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 8, 0.6);
  backdrop-filter: blur(2px);
  z-index: 40;
  opacity: 0;
  transition: opacity 0.2s;
}
.drawer-overlay.open { opacity: 1; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(460px, 100%);
  background: var(--panel);
  border-left: 1px solid var(--line);
  z-index: 41;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}
.drawer-head .code { font-family: var(--mono); font-size: 26px; font-weight: 700; letter-spacing: -1px; }
.drawer-head .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.drawer-body { padding: 18px 20px 40px; overflow: auto; display: flex; flex-direction: column; gap: 18px; }
.drawer-section h3 {
  margin: 0 0 10px;
  font-size: 10.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted-2);
}
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }

.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1;
  padding: 8px 0;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--bg);
  color: var(--muted);
  font-family: var(--mono);
  font-weight: 700;
}
.seg button.on { background: var(--lime); border-color: var(--lime); color: #101405; }

.dev-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--panel-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dev-card .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dev-card .info { min-width: 0; }
.dev-card .info strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-card .info span { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.dev-card .actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 7, 0.7);
  backdrop-filter: blur(3px);
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  animation: pop 0.16s ease;
}
@keyframes pop { from { transform: translateY(6px) scale(0.99); opacity: 0; } }
.modal header { padding: 18px 20px 0; }
.modal header h2 { margin: 0; font-size: 16px; }
.modal header p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.modal .body { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 18px; }

/* ---------- toasts ---------- */

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
  max-width: min(360px, 90vw);
}
.toast {
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--lime);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 12.5px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  animation: slidein 0.18s ease;
}
.toast.error { border-left-color: var(--red); }
@keyframes slidein { from { transform: translateX(12px); opacity: 0; } }

/* ---------- skeleton ---------- */

.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-row { height: 62px; margin-bottom: 9px; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto; height: 100dvh; }
  .sidebar {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }
  .brand { padding: 0; }
  .brand-text span { display: none; }
  .nav { flex-direction: row; gap: 4px; flex: 1; }
  .nav button { padding: 8px 10px; }
  .nav button span { display: none; }
  .nav .badge { margin-left: 0; }
  .sidebar-foot { margin: 0; padding: 0; border: none; }
  .who { display: none; }
  .main { padding: 18px 14px 80px; }
  .titles h1 { font-size: 20px; }
  .slots { grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); }
  .req { grid-template-columns: 1fr; }
  .req .actions { justify-content: flex-end; }
  .drawer { width: 100%; }
}

/* ---------- extras ---------- */

.sk-stat { height: 104px; }
.sk-panel { height: 180px; }
.mt { margin-top: 14px; }
.grow { min-width: 0; }
.hint { color: var(--muted); font-size: 11.5px; line-height: 1.5; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.form-actions { display: flex; justify-content: flex-end; grid-column: 1 / -1; }

.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--lime); }

.device-stack { display: flex; flex-direction: column; gap: 9px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.preview {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  font-size: 12px;
  color: var(--muted);
}
.preview strong { color: var(--text); font-size: 12.5px; }
.preview.is-full { border-color: rgba(255, 107, 107, 0.35); color: var(--red); }

.slot { font-family: inherit; font-size: inherit; }

.settings-danger { border-color: rgba(255, 107, 107, 0.3); }
