:root {
  color-scheme: dark;
  --bg: #05070d;
  --panel: #0f1520;
  --panel-2: #151d2d;
  --line: #25324a;
  --text: #f1f6ff;
  --muted: #95a2bd;
  --blue: #5c86ff;
  --cyan: #44d8c6;
  --green: #46db8d;
  --amber: #efbd52;
  --red: #ff6374;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(12, 18, 30, 0.72), rgba(5, 7, 13, 0.98)),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1360px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: white;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.muted,
.eyebrow {
  color: var(--muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav a,
.ghost-button,
.actions button,
td button {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 10px 14px;
  cursor: pointer;
}

.admin-link {
  border-color: rgba(65, 214, 195, 0.45) !important;
}

.hero,
.auth-layout,
.grid-layout,
.admin-layout {
  display: grid;
  gap: 18px;
}

.hero {
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  min-height: 70vh;
  align-items: center;
}

.hero-copy h1,
.login-card h1,
.account-panel h1 {
  margin: 8px 0 12px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.02;
}

.hero-copy p,
.login-card p {
  max-width: 620px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel,
.login-card,
.status-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(18, 25, 38, 0.96), rgba(10, 14, 22, 0.96));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

.login-card,
.panel {
  padding: 26px;
}

.status-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.status-panel div,
.license-card,
.created-key,
.log-list div {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  padding: 16px;
}

.status-panel span,
.time-block span,
.created-key span,
.log-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue), #36b7ff);
  color: white;
  font-weight: 800;
  padding: 12px 18px;
  cursor: pointer;
}

.wide {
  width: 100%;
}

.auth-layout {
  min-height: 68vh;
  place-items: center;
}

.login-card {
  width: min(540px, 100%);
}

.grid-layout {
  grid-template-columns: 1fr 1fr;
}

.full {
  grid-column: 1 / -1;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.user-row img,
.avatar-fallback {
  width: 76px;
  height: 76px;
  border-radius: 16px;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  background: var(--panel-2);
  font-size: 28px;
  font-weight: 800;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 14px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: 28px;
}

.section-title h1,
.section-title h2 {
  margin: 0;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0c111a;
  color: var(--text);
  padding: 13px 14px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--blue);
}

.redeem-form,
.create-form {
  display: grid;
  gap: 14px;
}

.create-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.license-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.license-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.license-card h3 {
  margin: 12px 0 4px;
  font-size: 20px;
}

.license-card p {
  margin: 0;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.success {
  background: rgba(66, 216, 135, 0.14);
  color: var(--green);
}

.danger {
  background: rgba(255, 95, 114, 0.14);
  color: var(--red);
}

.warning {
  background: rgba(242, 187, 74, 0.14);
  color: var(--amber);
}

.flash {
  border-radius: 12px;
  margin-bottom: 18px;
  padding: 13px 15px;
  font-weight: 700;
}

.flash.success {
  border: 1px solid rgba(66, 216, 135, 0.35);
}

.flash.error {
  border: 1px solid rgba(255, 95, 114, 0.35);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

code {
  color: #a9c8ff;
  word-break: break-all;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.danger-button {
  border-color: rgba(255, 95, 114, 0.45) !important;
  color: var(--red) !important;
}

.created-key {
  margin-bottom: 18px;
}

.muted small,
small.muted {
  color: var(--muted);
}

.created-key-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.created-key code {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.log-list {
  display: grid;
  gap: 10px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  padding: 24px;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button[data-copy] {
  white-space: nowrap;
}

@media (max-width: 780px) {
  .shell {
    width: min(100% - 20px, 1180px);
  }

  .topbar,
  .nav,
  .user-row,
  .license-card {
    align-items: stretch;
    flex-direction: column;
  }

  .hero,
  .grid-layout,
  .create-form {
    grid-template-columns: 1fr;
  }
}
