:root {
  --bg: #0e0a1a;
  --panel: #17112b;
  --panel2: #1e1738;
  --line: #2c2350;
  --txt: #e9e6f5;
  --muted: #9a8fc0;
  --accent: #a855f7;
  --accent2: #7c3aed;
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--txt);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
.hidden { display: none !important; }
.brand {
  font-weight: 800; letter-spacing: .5px;
  background: linear-gradient(90deg, #c084fc, #7c3aed);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }

/* LOGIN */
.login-wrap { min-height: 100vh; display: grid; place-items: center; }
.login-card {
  width: 320px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 32px 28px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 20px 60px rgba(124,58,237,.15);
}
.login-card .brand { font-size: 30px; text-align: center; }
.login-card .sub { text-align: center; color: var(--muted); margin: -6px 0 10px; }
input, select, textarea {
  background: var(--panel2); border: 1px solid var(--line); color: var(--txt);
  border-radius: 10px; padding: 11px 12px; font-size: 14px; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
button {
  cursor: pointer; border: none; border-radius: 10px; padding: 11px 16px;
  font-size: 14px; font-weight: 600; color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
button.primary { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.error { color: var(--red); font-size: 13px; margin: 4px 0 0; }

/* APP */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand-row { display: flex; align-items: baseline; gap: 10px; }
.brand-row .brand { font-size: 22px; }
.tag { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 2px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 14px; padding: 20px 28px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.stat .n { font-size: 28px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 4px; }
.toolbar { display: flex; gap: 12px; padding: 0 28px 16px; }
.toolbar input { max-width: 360px; }
.table-wrap { padding: 0 28px 40px; }
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
tr:last-child td { border-bottom: none; }
.empty { color: var(--muted); text-align: center; padding: 30px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.active { background: rgba(52,211,153,.15); color: var(--green); }
.pill.expired { background: rgba(251,191,36,.15); color: var(--amber); }
.pill.revoked { background: rgba(248,113,113,.15); color: var(--red); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions button { padding: 6px 10px; font-size: 12px; font-weight: 600; }

/* MODAL */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; }
.modal-card { width: 380px; max-width: 92vw; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.modal-card h2 { margin: 0 0 6px; }
.modal-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.result { background: var(--panel2); border: 1px dashed var(--accent); border-radius: 10px; padding: 12px; font-size: 14px; }
.result .code { font-size: 18px; font-weight: 800; letter-spacing: 1px; }
.dev-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.dev-item .meta { font-size: 12px; color: var(--muted); }
