:root {
  --bg: #020617;
  --panel: rgba(15, 23, 42, 0.72);
  --panel-strong: #0f172a;
  --panel-soft: rgba(15, 23, 42, 0.48);
  --line: rgba(51, 65, 85, 0.8);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --accent-strong: #122560;
  --shadow: 0 24px 70px rgba(2, 6, 23, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(18, 37, 96, 0.55), transparent 30%),
    radial-gradient(circle at bottom right, rgba(96, 165, 250, 0.12), transparent 28%),
    linear-gradient(180deg, #020617, #020617 45%, #030712);
}

button,
select,
input {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0.5rem 0 2rem;
}

.topbar {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 0;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 1rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  text-decoration: none;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(51, 65, 85, 0.7);
}

.brand-mark img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
}

.hero {
  margin-bottom: 1.25rem;
}

.eyebrow,
.panel-label {
  margin: 0 0 0.35rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
}

.hero h1,
.panel-header h2 {
  margin: 0;
}

.hero h1 {
  font-size: clamp(1.45rem, 2.6vw, 2.2rem);
  line-height: 1.12;
  max-width: none;
  color: #ffffff;
  letter-spacing: -0.04em;
}

.hero-copy {
  margin: 0.6rem 0 0;
  max-width: 52rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 360px) 1fr;
  gap: 1rem;
}

.panel {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.panel-header h2 {
  font-size: 1.12rem;
  color: #ffffff;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.file-meta,
.progress-head,
.page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.file-meta,
.progress-head,
#page-indicator,
.status-message {
  color: var(--muted);
  font-size: 0.84rem;
}

.subtle-status {
  margin: -0.4rem 0 0;
  font-size: 0.82rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field.disabled {
  opacity: 0.6;
}

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

select {
  width: 100%;
  border: 1px solid rgba(51, 65, 85, 0.9);
  border-radius: 16px;
  padding: 0.65rem 0.8rem;
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
}

input[type="text"] {
  width: 100%;
  border: 1px solid rgba(51, 65, 85, 0.9);
  border-radius: 16px;
  padding: 0.65rem 0.8rem;
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
}

input[type="text"]:disabled {
  opacity: 0.6;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.85rem;
  border-radius: 16px;
  border: 1px solid rgba(51, 65, 85, 0.85);
  background: var(--panel-soft);
}

.checkbox-row input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.checkbox-row.disabled {
  opacity: 0.5;
}

.button-stack {
  display: grid;
  gap: 0.55rem;
}

.ghost-button,
.solid-button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 0.58rem 0.9rem;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.ghost-button {
  background: rgba(15, 23, 42, 0.7);
  color: var(--text);
  border: 1px solid rgba(51, 65, 85, 0.9);
}

.solid-button,
.file-button {
  background: rgba(15, 23, 42, 0.88);
  color: var(--text);
  border: 1px solid rgba(51, 65, 85, 0.95);
}

.alt-button {
  background: rgba(18, 37, 96, 0.9);
  border-color: rgba(96, 165, 250, 0.35);
}

.ghost-button:hover,
.solid-button:hover,
.file-button:hover {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.55);
  color: #ffffff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.progress-block {
  display: grid;
  gap: 0.35rem;
}

progress {
  width: 100%;
  height: 0.7rem;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
}

progress::-webkit-progress-bar {
  background: rgba(15, 23, 42, 0.95);
}

progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}

progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}

.preview-panel {
  display: flex;
  flex-direction: column;
  min-height: 31rem;
}

.preview-frame {
  position: relative;
  min-height: 23rem;
  flex: 1;
  display: grid;
  place-items: center;
  padding: 0.75rem;
  border-radius: 18px;
  border: 1px solid rgba(51, 65, 85, 0.85);
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.92));
  overflow: hidden;
}

#preview-canvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(37, 24, 7, 0.18);
  background: white;
}

.pdf-fallback {
  width: 100%;
  height: 100%;
  min-height: 22rem;
  border: 0;
  border-radius: 10px;
  background: white;
  box-shadow: 0 20px 50px rgba(37, 24, 7, 0.12);
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 2rem;
}

.empty-state.hidden {
  display: none;
}

.hidden {
  display: none;
}

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

  .preview-panel {
    min-height: 30rem;
  }
}

@media (max-width: 640px) {
  .topbar {
    width: min(100% - 1rem, 100%);
    padding-top: 1rem;
  }

  .page-shell {
    width: min(100% - 1rem, 100%);
    padding-top: 1.2rem;
  }

  .panel-header,
  .file-meta,
  .progress-head,
  .page-nav {
    flex-direction: column;
    align-items: stretch;
  }
}
