:root {
  --bg: #0e1320;
  --card: #121a2b;
  --card-strong: #0b101c;
  --text: #e9edf6;
  --muted: #b1b8c9;
  --accent: #61f4d0;
  --accent-2: #ffcc66;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "SF Pro Display", "Gill Sans", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at 15% 20%, rgba(97, 244, 208, 0.12), transparent 35%), radial-gradient(circle at 80% 10%, rgba(255, 204, 102, 0.16), transparent 40%), radial-gradient(circle at 75% 80%, rgba(97, 150, 244, 0.14), transparent 35%), var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

h1, h2 {
  margin: 6px 0;
  letter-spacing: -0.4px;
}

p {
  color: var(--muted);
  margin: 6px 0;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 26px 28px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(12, 22, 37, 0.9), rgba(10, 16, 30, 0.9));
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.hero h1 {
  font-size: 32px;
}

.lede {
  max-width: 720px;
  line-height: 1.6;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 1.4px;
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 4px;
}

.meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.workspace-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}

.workspace-stats .pill strong {
  color: var(--text);
}

#workspaceSelectForm .token-actions {
  margin-top: 8px;
}

.pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 13px;
  border: 1px solid var(--border);
}

.badge {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.badge__icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b101c;
  font-weight: 700;
  border-radius: 14px;
  font-size: 22px;
}

.badge__title {
  margin: 0;
  color: var(--text);
  font-weight: 600;
}

.badge__subtitle {
  margin: 0;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 18px;
}

.card.wide {
  grid-column: 1 / -1;
}

.card__header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.api-key {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.api-key input,
.login-form input {
  background: var(--card-strong);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
}

.api-key input:focus,
.login-form input:focus {
  outline: 1px solid var(--accent);
  border-color: transparent;
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.token-actions {
  width: 100%;
}

.token-actions button {
  min-width: 140px;
}

.login-form select {
  background: var(--card-strong);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
}

.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.small {
  font-size: 13px;
}

.dropzone {
  margin-top: 14px;
  padding: 28px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.04));
  transition: border-color 120ms ease, transform 120ms ease, background 160ms ease;
}

.dropzone.is-dragover {
  border-color: var(--accent);
  transform: translateY(-2px);
  background: linear-gradient(180deg, rgba(97, 244, 208, 0.08), rgba(255, 204, 102, 0.06));
}

.dropzone.is-uploading {
  opacity: 0.75;
  cursor: wait;
}

.dropzone__title {
  color: var(--text);
  font-weight: 600;
  font-size: 18px;
}

.dropzone__subtitle {
  margin-top: 6px;
  color: var(--muted);
}

button, .ghost {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b101c;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

button:hover {
  filter: brightness(1.05);
}

.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.ghost.danger {
  color: #ff9b9b;
  border-color: rgba(255, 155, 155, 0.3);
}

.file-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.file-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--card-strong);
  border: 1px solid var(--border);
}

.file-name {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  color: var(--muted);
  font-size: 13px;
}

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

.menu-wrap {
  position: relative;
}

.menu-toggle {
  min-width: 44px;
  padding: 10px 12px;
  font-size: 18px;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b101c;
  border: none;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(420px, calc(100vw - 64px));
  padding: 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 1200;
}

.menu-panel h3 {
  margin: 4px 0 10px;
}

.workspace-select {
  background: var(--card-strong);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--text);
  min-width: 180px;
}

.workspace-select:focus {
  outline: 1px solid var(--accent);
  border-color: transparent;
}

.actions.push-right {
  margin-left: auto;
  justify-content: flex-end;
}

.card__header .actions.push-right {
  width: auto;
}

.lock-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 204, 102, 0.15);
  color: var(--accent-2);
  font-size: 12px;
  border: 1px solid rgba(255, 204, 102, 0.35);
}

.lock-tag::before {
  content: "🔒";
}

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

.status {
  min-height: 20px;
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
}

.status.is-good {
  color: var(--accent);
}

.status.is-bad {
  color: #ff7b7b;
}

.upload-progress {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.upload-progress__meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}

.upload-progress__bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-strong);
  overflow: hidden;
}

.upload-progress__fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transition: width 120ms linear;
}

.toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 3000;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 36px));
}

.toast {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(11, 16, 28, 0.95);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 14px;
}

.toast--error {
  border-color: rgba(255, 123, 123, 0.45);
  background: rgba(45, 14, 18, 0.95);
}

.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal.hidden {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 15, 0.7);
  backdrop-filter: blur(2px);
}

.modal__panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 18px;
}

.modal--danger .modal__panel {
  border-color: rgba(255, 123, 123, 0.45);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 123, 123, 0.2) inset;
}

.modal--danger .eyebrow {
  color: #ff9b9b;
}

.modal--danger #workspaceDeleteText {
  color: #ffd0d0;
}

@media (max-width: 720px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .file-row {
    grid-template-columns: 1fr;
  }
  .actions {
    justify-content: flex-start;
  }
  .workspace-stats {
    justify-content: center;
  }
}
