:root {
  --bg: #0b0e12;
  --bg-2: #11161d;
  --panel: rgba(17, 23, 31, 0.88);
  --panel-2: rgba(21, 28, 37, 0.96);
  --line: rgba(165, 184, 204, 0.16);
  --line-strong: rgba(251, 191, 36, 0.28);
  --text: #f4f7fb;
  --muted: #9ba9bb;
  --brand: #f4b942;
  --brand-2: #ffdf8b;
  --danger: #ff6d6d;
  --ok: #65d39a;
  --shadow: 0 28px 72px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--text);
  font-family: "Chakra Petch", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(244, 185, 66, 0.12), transparent 30%),
    radial-gradient(circle at bottom right, rgba(88, 128, 255, 0.12), transparent 32%),
    linear-gradient(180deg, #0a0d11 0%, #0f141a 100%);
  overflow-x: hidden;
}

.noise,
.mesh {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.noise {
  opacity: 0.06;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 22px 22px;
}

.mesh {
  background:
    linear-gradient(120deg, transparent 0 58%, rgba(244, 185, 66, 0.06) 58% 62%, transparent 62%),
    linear-gradient(180deg, transparent 0 72%, rgba(255, 255, 255, 0.02) 72% 100%);
}

.hidden {
  display: none !important;
}

.page-shell {
  width: min(1400px, calc(100vw - 32px));
  margin: 18px auto 28px;
}

.auth-card {
  width: min(480px, 100%);
  margin: 9vh auto 0;
  background: linear-gradient(180deg, rgba(14, 19, 26, 0.94), rgba(10, 14, 19, 0.98));
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-mark,
.eyebrow,
.panel-kicker {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--brand-2);
}

.auth-card h1,
.topbar h1,
.panel h2 {
  margin: 10px 0 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.95;
}

.auth-card p,
.topbar p,
.hint {
  color: var(--muted);
}

.auth-form,
.stack-form {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
  font-weight: 600;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(8, 11, 15, 0.82);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
}

textarea {
  resize: vertical;
  min-height: 88px;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(244, 185, 66, 0.16);
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease, box-shadow 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: progress;
  transform: none;
}

.btn-primary {
  color: #1f1600;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 14px 36px rgba(244, 185, 66, 0.25);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid var(--line);
}

.app-view {
  display: grid;
  gap: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 22px 24px;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(18, 24, 32, 0.92), rgba(11, 15, 20, 0.96));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.top-actions {
  display: flex;
  gap: 10px;
}

.dashboard {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 14px;
}

.left-rail,
.right-stage {
  display: grid;
  gap: 14px;
  align-content: start;
}

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.stats-grid {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.stat {
  border-radius: 18px;
  border: 1px solid rgba(244, 185, 66, 0.12);
  background: rgba(255, 255, 255, 0.025);
  padding: 14px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 1.32rem;
}

.public-url {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.public-url code,
.file-meta code,
.file-link {
  font-family: "IBM Plex Mono", monospace;
}

.public-url code {
  display: block;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
}

.files-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.search-wrap {
  min-width: min(340px, 100%);
}

.files-grid {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.file-card {
  display: grid;
  gap: 14px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(120deg, rgba(244, 185, 66, 0.06), transparent 24%),
    rgba(6, 10, 14, 0.42);
  padding: 18px;
}

.file-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.file-head h3 {
  margin: 0;
  font-size: 1.26rem;
}

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

.badge {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  color: var(--muted);
}

.badge.version {
  color: var(--brand-2);
  border-color: rgba(244, 185, 66, 0.22);
}

.file-link-row,
.file-meta {
  display: grid;
  gap: 8px;
}

.file-link {
  display: block;
  color: var(--brand-2);
  text-decoration: none;
  word-break: break-all;
}

.file-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.meta-box {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  padding: 10px 12px;
}

.meta-box span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.meta-box strong,
.meta-box code {
  display: block;
  margin-top: 8px;
  font-size: 0.92rem;
}

.file-note {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(244, 185, 66, 0.18);
  color: var(--muted);
}

.file-actions {
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 14px;
}

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

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

.inline-form-head h4 {
  margin: 0;
  font-size: 0.98rem;
}

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

.empty {
  border-radius: 22px;
  border: 1px dashed var(--line);
  background: rgba(255, 255, 255, 0.03);
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 28px));
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(16, 22, 29, 0.96);
  box-shadow: var(--shadow);
}

.toast.ok {
  border-color: rgba(101, 211, 154, 0.34);
}

.toast.err {
  border-color: rgba(255, 109, 109, 0.34);
}

@media (max-width: 1080px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .file-actions,
  .file-meta-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 740px) {
  .page-shell {
    width: min(100vw - 18px, 100%);
    margin-top: 10px;
  }

  .topbar,
  .panel,
  .auth-card {
    padding: 18px;
    border-radius: 22px;
  }

  .topbar {
    flex-direction: column;
  }

  .top-actions,
  .action-row {
    width: 100%;
  }

  .top-actions .btn,
  .action-row .btn {
    flex: 1 1 0;
  }
}
