:root {
  color-scheme: dark;
  --bg: #080a0f;
  --panel: rgba(20, 24, 33, 0.66);
  --panel-strong: rgba(27, 32, 43, 0.82);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f4f7fb;
  --muted: #9ba7b7;
  --soft: #d6dde8;
  --blue: #5ad7ff;
  --green: #71f0bd;
  --red: #ff6b86;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 20% 12%, rgba(90, 215, 255, 0.16), transparent 32rem),
    radial-gradient(circle at 78% 72%, rgba(113, 240, 189, 0.11), transparent 30rem),
    linear-gradient(135deg, #080a0f 0%, #111620 46%, #090d13 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 38rem;
  height: 38rem;
  filter: blur(54px);
  opacity: 0.22;
  transform: translateZ(0);
}

.ambient-a {
  top: -16rem;
  left: -10rem;
  background: #40cfff;
}

.ambient-b {
  right: -14rem;
  bottom: -18rem;
  background: #42ffb8;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.glass-panel {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.045));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(24px);
}

.login-view {
  width: min(430px, 100%);
  display: grid;
  justify-items: center;
  animation: rise 620ms ease both;
}

.brand-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background: linear-gradient(150deg, rgba(90, 215, 255, 0.28), rgba(113, 240, 189, 0.16));
  box-shadow: 0 18px 56px rgba(90, 215, 255, 0.16);
  color: white;
  font-size: 30px;
  font-weight: 800;
}

h1 {
  margin: 24px 0 28px;
  font-size: 52px;
  line-height: 1;
  letter-spacing: 0;
}

.login-panel {
  width: 100%;
  display: grid;
  gap: 16px;
  padding: 24px;
  border-radius: var(--radius);
}

.input-label,
.field-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.key-field input,
.admin-field,
.upload-control {
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius);
  outline: 0;
  background: rgba(3, 6, 12, 0.54);
  color: var(--text);
  transition: border 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.key-field input {
  padding: 0 18px;
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.key-field input:focus,
.admin-field:focus {
  border-color: rgba(90, 215, 255, 0.62);
  box-shadow: 0 0 0 4px rgba(90, 215, 255, 0.12);
  background: rgba(6, 10, 18, 0.74);
}

.primary-button,
.ghost-button,
.icon-button,
.danger-button {
  min-height: 42px;
  border-radius: var(--radius);
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: #061018;
  font-weight: 800;
  box-shadow: 0 16px 40px rgba(90, 215, 255, 0.2);
}

.primary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.workspace {
  width: 100%;
  align-self: start;
  display: grid;
  gap: 20px;
  animation: rise 520ms ease both;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius);
}

.eyebrow {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h2 {
  margin-top: 4px;
  font-size: 28px;
}

h3 {
  font-size: 18px;
}

.ghost-button,
.icon-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
  color: var(--soft);
}

.ghost-button {
  padding: 0 16px;
}

.space-grid,
.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
}

.section {
  display: grid;
  gap: 14px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.file-list,
.keys-list {
  display: grid;
  gap: 10px;
}

.file-row,
.key-row,
.upload-box,
.admin-create {
  border-radius: var(--radius);
  padding: 14px;
}

.file-row,
.key-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.file-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(90, 215, 255, 0.35), rgba(113, 240, 189, 0.2)),
    rgba(255, 255, 255, 0.08);
}

.file-meta,
.key-meta {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.file-name,
.key-code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-details,
.key-details,
.empty-state {
  color: var(--muted);
  font-size: 13px;
}

.file-actions,
.key-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button,
.danger-button {
  min-width: 42px;
  padding: 0 12px;
  font-weight: 750;
}

.danger-button {
  border: 1px solid rgba(255, 107, 134, 0.35);
  background: rgba(255, 107, 134, 0.1);
  color: #ffd9e1;
}

.upload-box,
.admin-create {
  display: grid;
  gap: 12px;
}

.upload-control,
.admin-field {
  padding: 14px;
}

.compact-upload {
  width: min(260px, 100%);
  min-height: 42px;
  padding: 9px 10px;
}

.admin-create {
  position: sticky;
  top: 20px;
}

.admin-form-grid {
  display: grid;
  gap: 10px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--soft);
}

.switch-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.pill {
  display: inline-flex;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 20;
  max-width: min(420px, calc(100% - 32px));
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: rgba(14, 18, 26, 0.9);
  box-shadow: var(--shadow);
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px);
  transition: opacity 220ms ease, transform 220ms ease;
  backdrop-filter: blur(18px);
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  border-color: rgba(255, 107, 134, 0.38);
}

.hidden {
  display: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 24px, 560px);
    padding: 20px 0;
  }

  h1 {
    font-size: 42px;
  }

  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .space-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-create {
    position: static;
  }

  .file-row,
  .key-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .file-actions,
  .key-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .file-actions > *,
  .key-actions > * {
    flex: 1;
  }
}
