:root {
  --bg: #080b11;
  --panel: #101722;
  --panel-2: #151f2d;
  --panel-3: #1a2637;
  --line: rgba(216, 224, 255, 0.14);
  --text: #f7f8fc;
  --muted: #a9b5ca;
  --primary: #7c5cff;
  --primary-2: #24d3a8;
  --danger: #ff6b85;
  --warning: #ffd166;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.38);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(124, 92, 255, 0.22), transparent 30%),
    radial-gradient(circle at 88% 10%, rgba(36, 211, 168, 0.16), transparent 28%),
    linear-gradient(180deg, #0c0d18 0%, #080b11 46%, #07090e 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }

.platform-shell {
  width: min(1440px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow {
  color: #7ff0d6;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #8a63ff, #6652ff);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 14px 34px rgba(124, 92, 255, .28);
}

.brand-mark.small {
  width: 38px;
  height: 38px;
  font-size: 13px;
}

.auth-panel {
  width: min(520px, 100%);
  margin: 8vh auto;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 23, 34, .92);
  box-shadow: var(--shadow);
}

.auth-panel h1 {
  margin: 14px 0 12px;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.02;
}

.text-link {
  display: inline-flex;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.stack {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

label {
  display: grid;
  gap: 7px;
  color: #e5e9f7;
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 44px;
  color: var(--text);
  background: #0b111a;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  padding: 11px 13px;
}

input:focus,
select:focus {
  border-color: rgba(124, 92, 255, .82);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, .14);
}

.primary,
.ghost,
.danger,
.button-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px 14px;
  color: #fff;
  font-weight: 850;
  text-decoration: none;
}

.primary {
  background: linear-gradient(135deg, #8a63ff, #6652ff);
  box-shadow: 0 12px 30px rgba(124, 92, 255, .22);
}

.ghost {
  background: rgba(255,255,255,.07);
  border-color: var(--line);
}

.danger {
  background: rgba(255, 107, 133, .12);
  border-color: rgba(255, 107, 133, .32);
  color: #ff9bad;
}

button:disabled {
  cursor: not-allowed;
  opacity: .5;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.auth-legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.auth-legal-links a,
.auth-legal-links button {
  color: #d8def2;
  font: inherit;
  text-decoration: none;
}

.auth-legal-links button {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.auth-legal-links a:hover,
.auth-legal-links button:hover,
.top-links a:hover {
  color: #8ff5dc;
}

.platform-topbar,
.hero-panel,
.card,
.project-picker-card,
.platform-sidebar,
.platform-main,
.pack-card,
.stat-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 23, 34, .86);
  box-shadow: 0 14px 50px rgba(0, 0, 0, .22);
}

.platform-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px;
  margin-bottom: 18px;
}

.brand-row,
.top-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-row span {
  display: block;
  margin-top: 2px;
}

.top-links a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: 18px;
  align-items: end;
  padding: clamp(22px, 4vw, 40px);
  margin-bottom: 16px;
  background:
    linear-gradient(135deg, rgba(124, 92, 255, .18), rgba(36, 211, 168, .10)),
    rgba(16, 23, 34, .9);
}

.hero-panel h1 {
  max-width: 850px;
  margin-bottom: 14px;
  font-size: clamp(34px, 6vw, 76px);
  line-height: .97;
}

.hero-panel p {
  max-width: 760px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.project-picker-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  background: rgba(8, 11, 17, .58);
}

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

.stat-card {
  padding: 16px;
}

.stat-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 28px;
}

.workspace {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
}

.platform-sidebar {
  align-self: start;
  display: grid;
  gap: 8px;
  padding: 10px;
  position: sticky;
  top: 18px;
}

.platform-tab {
  min-height: 44px;
  width: 100%;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px 12px;
  text-align: left;
  font-weight: 850;
}

.platform-tab.active {
  color: #fff;
  background: linear-gradient(135deg, #8a63ff, #6652ff);
}

.platform-main {
  min-width: 0;
  padding: 16px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin-bottom: 6px;
  font-size: 28px;
}

.panel-head select {
  width: min(260px, 100%);
}

.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.pack-card {
  display: grid;
  gap: 12px;
  overflow: hidden;
}

.pack-cover,
.pack-placeholder {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background:
    radial-gradient(circle at 30% 22%, rgba(36, 211, 168, .20), transparent 28%),
    linear-gradient(135deg, #171f2d, #0c111a);
}

.pack-placeholder {
  display: grid;
  place-items: center;
  color: #dccfff;
  font-size: 30px;
  font-weight: 900;
}

.pack-body {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
}

.pack-title-row,
.badges,
.card-actions,
.project-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pack-title-row {
  justify-content: space-between;
}

.pack-title-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #d7def2;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.10);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.available { color: #7ff0d6; background: rgba(36, 211, 168, .12); }
.badge.locked { color: #ffd89a; background: rgba(255, 209, 102, .12); }
.badge.purchased { color: #c7bcff; background: rgba(124, 92, 255, .16); }
.badge.requested { color: #ffb8c5; background: rgba(255, 107, 133, .12); }

.badges {
  flex-wrap: wrap;
}

.card-actions {
  align-items: stretch;
  flex-wrap: wrap;
}

.card-actions button {
  flex: 1;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 24px;
  color: var(--muted);
  border: 1px dashed rgba(216,224,255,.22);
  border-radius: var(--radius);
  background: rgba(255,255,255,.035);
}

.manage-grid {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  gap: 14px;
}

.card {
  padding: 16px;
}

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

.project-row {
  justify-content: space-between;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: var(--radius);
  background: rgba(255,255,255,.04);
}

.project-row code {
  color: #dccfff;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(420px, calc(100% - 36px));
  padding: 13px 15px;
  color: #06231d;
  background: #7ff0d6;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-weight: 850;
}

.toast.err {
  color: #fff;
  background: #d94b68;
}

@media (max-width: 980px) {
  .hero-panel,
  .workspace,
  .manage-grid {
    grid-template-columns: 1fr;
  }

  .platform-sidebar {
    position: static;
    display: flex;
    overflow-x: auto;
  }

  .platform-tab {
    width: auto;
    white-space: nowrap;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .platform-shell {
    width: min(100% - 24px, 1440px);
    padding-top: 12px;
  }

  .platform-topbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-links {
    flex-wrap: wrap;
  }

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

  .auth-panel {
    margin: 3vh auto;
    padding: 22px;
  }
}

/* Logo, auth controls, and spacing polish */
.platform-shell {
  width: min(1440px, calc(100% - clamp(24px, 5vw, 64px)));
  padding: clamp(18px, 3vw, 30px) 0 clamp(52px, 7vw, 84px);
}

.brand-logo {
  display: block;
  object-fit: contain;
}

.auth-logo {
  width: min(230px, 64vw);
  height: auto;
  margin: -6px auto 18px;
  filter: drop-shadow(0 18px 36px rgba(124,92,255,.26));
}

.topbar-logo {
  width: 82px;
  height: 82px;
  margin: -16px -8px -16px -12px;
  filter: drop-shadow(0 10px 24px rgba(124,92,255,.20));
}

.password-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.password-control input {
  min-width: 0;
}

.password-toggle {
  min-width: 70px;
  color: #f4f6fb;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 850;
}

.auth-form-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.hero-panel,
.platform-main,
.auth-panel {
  padding: clamp(22px, 3vw, 36px);
}

@media (max-width: 680px) {
  .platform-shell {
    width: min(100% - 24px, 1440px);
  }

  .password-control,
  .auth-form-actions {
    grid-template-columns: 1fr;
  }
}
