:root {
  --bg: #08111f;
  --bg2: #0b1727;
  --panel: rgba(15, 28, 46, .78);
  --panel-strong: rgba(18, 34, 56, .94);
  --border: rgba(150, 186, 235, .14);
  --border-strong: rgba(112, 177, 255, .28);
  --text: #eff6ff;
  --muted: #91a4bc;
  --blue: #45a2ff;
  --blue2: #7cc5ff;
  --green: #64e2a0;
  --orange: #ffbd6b;
  --red: #ff7a88;
  --shadow: 0 28px 70px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% -10%, rgba(56, 149, 255, .26), transparent 31rem),
    radial-gradient(circle at 95% 15%, rgba(69, 96, 255, .14), transparent 28rem),
    linear-gradient(180deg, var(--bg2), var(--bg));
}

body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.015) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.015) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, black, transparent 90%);
}

button, input, textarea { font: inherit; }
button { color: inherit; }
code { color: var(--blue2); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; line-height: 1.55; }

.shell { width: min(1440px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 56px; }
.glass {
  background: linear-gradient(180deg, rgba(23, 41, 65, .84), rgba(12, 25, 42, .84));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(130%);
}

.login-wrap { min-height: calc(100vh - 56px); display: grid; place-items: center; }
.login-card { width: min(470px, 100%); border-radius: 26px; padding: 34px; }
.brand-mark {
  width: 54px; height: 54px; border-radius: 17px; display: grid; place-items: center;
  font-size: 24px; font-weight: 900; margin-bottom: 26px;
  background: linear-gradient(145deg, #8bd0ff, #2f8fff 55%, #2563eb);
  box-shadow: 0 14px 34px rgba(47, 143, 255, .3), inset 0 1px rgba(255,255,255,.5);
}
.brand-mark.small { width: 38px; height: 38px; border-radius: 12px; font-size: 18px; margin: 0; }
.eyebrow, .section-kicker { font-size: 11px; letter-spacing: .16em; color: var(--blue2); font-weight: 800; }
h1, h2, h3 { margin: 0; letter-spacing: -.03em; }
h1 { font-size: 31px; margin-top: 7px; }
h2 { font-size: clamp(28px, 4vw, 46px); max-width: 760px; }
h3 { font-size: 22px; margin-top: 5px; }
.login-card > div:nth-child(2) p { margin: 8px 0 26px; }

.form-stack { display: grid; gap: 14px; margin-top: 28px; }
label { display: grid; gap: 7px; }
label > span { color: #bdcce0; font-size: 12px; font-weight: 700; }
input, textarea {
  width: 100%; color: var(--text); background: rgba(5, 13, 24, .72); border: 1px solid var(--border);
  border-radius: 12px; outline: none; padding: 12px 13px; transition: .18s ease;
}
input:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(69, 162, 255, .12); }
textarea { resize: vertical; }

.btn {
  appearance: none; border: 1px solid var(--border); background: rgba(255,255,255,.04); border-radius: 11px;
  padding: 10px 14px; font-weight: 750; cursor: pointer; transition: transform .14s ease, border-color .14s ease, background .14s ease, opacity .14s ease;
}
.btn:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.btn:disabled { opacity: .48; cursor: wait; transform: none; }
.btn.primary { background: linear-gradient(180deg, #4ca8ff, #267cef); border-color: #60b5ff; box-shadow: 0 10px 24px rgba(38,124,239,.22); }
.btn.ghost { background: rgba(255,255,255,.035); }
.btn.danger { color: #ffd3d7; border-color: rgba(255, 122, 136, .25); }
.btn.wide { width: 100%; padding: 12px; }
.form-error { min-height: 18px; margin: 0; color: var(--red); font-size: 12px; }
.form-message { margin: 0; min-height: 18px; font-size: 12px; }

.dashboard { display: grid; gap: 24px; }
.topbar { border-radius: 18px; min-height: 70px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; }
.brand-inline, .top-actions { display: flex; align-items: center; gap: 12px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 7px 10px; font-size: 11px; font-weight: 750; color: #bed3e9; background: rgba(255,255,255,.05); border: 1px solid var(--border); }
.badge.success::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-right: 7px; box-shadow: 0 0 12px rgba(100,226,160,.7); }

.hero-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: stretch; padding: 20px 2px 4px; }
.hero-copy { padding: 14px 0; }
.hero-copy p { max-width: 760px; line-height: 1.65; font-size: 15px; }
.current-release { border-radius: 20px; padding: 22px; display: flex; flex-direction: column; justify-content: center; }
.release-version { font-size: 40px; font-weight: 850; letter-spacing: -.04em; margin: 7px 0 5px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card { border-radius: 18px; padding: 20px; display: grid; gap: 5px; }
.stat-card span { color: #bfd0e4; font-size: 12px; font-weight: 700; }
.stat-card strong { font-size: 33px; letter-spacing: -.04em; }
.stat-card small { color: var(--muted); }

.panel { border-radius: 22px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px; border-bottom: 1px solid var(--border); }
.panel-actions { display: flex; gap: 10px; align-items: center; }
.search-wrap { min-width: 300px; display: flex; align-items: center; gap: 8px; background: rgba(5,13,24,.58); border: 1px solid var(--border); border-radius: 11px; padding-left: 10px; }
.search-wrap input { border: 0; background: transparent; padding: 9px 10px 9px 0; box-shadow: none; }
.search-wrap span { color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1040px; }
th, td { padding: 14px 18px; text-align: left; border-bottom: 1px solid rgba(150, 186, 235, .085); vertical-align: middle; }
th { color: #8fa5bf; font-size: 10px; text-transform: uppercase; letter-spacing: .11em; font-weight: 800; background: rgba(3, 11, 20, .2); }
td { font-size: 12px; color: #d8e6f6; }
tr:hover td { background: rgba(75, 154, 255, .035); }
.key-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: #dcecff; }
.status-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 9px; font-weight: 800; font-size: 10px; border: 1px solid var(--border); }
.status-pill.active { color: #a8f4c9; background: rgba(73, 199, 131, .09); border-color: rgba(100,226,160,.18); }
.status-pill.unused { color: #acd7ff; background: rgba(69,162,255,.09); border-color: rgba(69,162,255,.18); }
.status-pill.revoked { color: #ffc0c7; background: rgba(255,122,136,.09); border-color: rgba(255,122,136,.18); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.mini-btn { border: 1px solid var(--border); background: rgba(255,255,255,.035); color: #cde0f5; border-radius: 8px; padding: 6px 8px; cursor: pointer; font-size: 11px; }
.mini-btn:hover { border-color: var(--border-strong); }
.empty { padding: 42px; text-align: center; color: var(--muted); }

.update-panel { padding-bottom: 4px; }
.update-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 24px; }
.wide-field { grid-column: 1 / -1; }
.drop-zone { min-height: 170px; border: 1px dashed rgba(124,197,255,.42); border-radius: 16px; background: rgba(56, 137, 224, .055); display: grid; place-items: center; align-content: center; gap: 8px; text-align: center; cursor: pointer; transition: .16s ease; }
.drop-zone:hover, .drop-zone.dragging { background: rgba(56, 137, 224, .095); border-color: var(--blue); }
.upload-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 22px; color: var(--blue2); background: rgba(69,162,255,.12); }
.publish-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.publish-row p { margin: 0; }
.progress-wrap { height: 7px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.05); }
.progress-bar { width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), #86d4ff); transition: width .25s ease; }

.modal { color: var(--text); width: min(520px, calc(100% - 30px)); border-radius: 22px; padding: 24px; border: 1px solid var(--border-strong); }
.modal::backdrop { background: rgba(0, 6, 14, .7); backdrop-filter: blur(7px); }
.modal form { display: grid; gap: 16px; }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255,255,255,.04); cursor: pointer; font-size: 21px; }
.generated-box { min-height: 220px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.8; }

.toast { position: fixed; right: 22px; bottom: 22px; max-width: 380px; padding: 12px 15px; border-radius: 12px; color: #ecf7ff; background: #122840; border: 1px solid var(--border-strong); box-shadow: var(--shadow); z-index: 100; }

@media (max-width: 900px) {
  .shell { width: min(100% - 20px, 1440px); }
  .hero-grid, .stats-grid { grid-template-columns: 1fr 1fr; }
  .hero-copy { grid-column: 1 / -1; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .panel-actions, .search-wrap { width: 100%; }
  .search-wrap { min-width: 0; }
}

@media (max-width: 620px) {
  .stats-grid, .hero-grid, .update-grid { grid-template-columns: 1fr; }
  .wide-field { grid-column: auto; }
  .topbar, .publish-row { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; justify-content: space-between; }
  .panel-actions { flex-direction: column; }
  .panel-actions .btn { width: 100%; }
}
