:root {
  --bg: #0c1118;
  --bg-raised: #111821;
  --border: #243041;
  --border-soft: rgba(148, 174, 204, 0.12);
  --text: #e8eef6;
  --dim: #8fa3b8;
  --mute: #5c7086;
  --accent: #3dffa8;
  --ai: #6ec8ff;
  --font: "Sora", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --bar-h: 52px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
}

a {
  color: inherit;
  text-decoration: none;
}

.pdf-app {
  display: grid;
  grid-template-rows: var(--bar-h) 1fr;
  height: 100%;
  background:
    radial-gradient(900px 400px at 80% -10%, rgba(110, 200, 255, 0.07), transparent 50%),
    linear-gradient(180deg, #0e141d, var(--bg));
}

.pdf-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(12, 17, 24, 0.85);
  backdrop-filter: blur(10px);
}

.pdf-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdf-brand__mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: url("/static/img/logo.png") center / contain no-repeat;
  flex-shrink: 0;
}

.pdf-brand__name {
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 13px;
}

.pdf-brand__tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--ai);
  color: #0c1118;
}

.pdf-bar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pdf-filename {
  width: 140px;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  font-size: 12px;
}

.pdf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}

.pdf-btn--ghost {
  color: var(--dim);
  border: 1px solid var(--border-soft);
}

.pdf-btn--ghost:hover {
  background: #1c2735;
  color: var(--text);
}

.pdf-btn--primary {
  background: var(--accent);
  color: #0c1118;
}

.pdf-btn--primary:hover {
  filter: brightness(1.05);
}

.pdf-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pdf-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 1.1fr);
  min-height: 0;
}

.pdf-editor,
.pdf-preview-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 18px;
}

.pdf-editor {
  border-right: 1px solid var(--border-soft);
  gap: 12px;
}

.pdf-editor__head,
.pdf-preview__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
}

.pdf-editor__head h2,
.pdf-preview__head h2 {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
}

.pdf-hint {
  font-size: 11px;
  color: var(--mute);
}

.pdf-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pdf-field span {
  font-size: 12px;
  color: var(--dim);
  font-weight: 500;
}

.pdf-field input,
.pdf-field textarea,
.pdf-ai__form textarea {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  outline: none;
  resize: vertical;
}

.pdf-field textarea {
  min-height: 220px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  flex: 1;
}

.pdf-field--grow {
  flex: 1;
  min-height: 0;
}

.pdf-field--grow textarea {
  height: 100%;
  min-height: 180px;
}

.pdf-field input:focus,
.pdf-field textarea:focus,
.pdf-ai__form textarea:focus {
  border-color: rgba(110, 200, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(110, 200, 255, 0.1);
}

.pdf-ai {
  border-top: 1px solid var(--border-soft);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pdf-ai__head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
}

.pdf-ai__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ai);
  box-shadow: 0 0 10px rgba(110, 200, 255, 0.5);
}

.pdf-ai__form {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: end;
}

.pdf-ai__form textarea {
  min-height: 64px;
  resize: none;
}

.pdf-ai {
  border-radius: 10px;
}

.pdf-ai.ai-panel--drop {
  outline: 2px dashed rgba(110, 200, 255, 0.55);
  outline-offset: 2px;
}

.pdf-ai .ai-attach-row {
  margin-bottom: 4px;
}

.pdf-ai__meta {
  font-size: 11px;
  color: var(--mute);
  min-height: 1.2em;
}

.pdf-preview-wrap {
  background: rgba(10, 16, 24, 0.65);
}

.pdf-preview-scroll {
  flex: 1;
  overflow: auto;
  padding: 12px 8px 24px;
  display: flex;
  justify-content: center;
}

.pdf-page {
  width: min(100%, 720px);
  min-height: 980px;
  padding: 56px 52px;
  background: #f7f4ef;
  color: #1a1f26;
  border-radius: 2px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.6;
}

.pdf-page__title {
  font-family: var(--font);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
  color: #12171e;
}

.pdf-page__body h1,
.pdf-page__body h2,
.pdf-page__body h3 {
  font-family: var(--font);
  margin: 1.1em 0 0.4em;
  line-height: 1.25;
}

.pdf-page__body p,
.pdf-page__body ul,
.pdf-page__body ol {
  margin-bottom: 0.85em;
}

.pdf-page__body code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.pdf-page__body pre {
  background: #1c2430;
  color: #e8eef6;
  padding: 12px 14px;
  border-radius: 8px;
  overflow: auto;
  margin-bottom: 1em;
}

.pdf-page__body pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.pdf-page__body a {
  color: #0b6bcb;
}

@media (max-width: 900px) {
  .pdf-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(180px, 40%) minmax(0, 1fr);
  }

  .pdf-editor {
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
  }

  .pdf-page {
    min-height: 0;
    padding: 24px 18px;
  }

  .pdf-filename {
    width: 100px;
  }

  .pdf-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
  }

  .pdf-bar .icon-btn,
  .pdf-bar button {
    min-height: 40px;
  }
}

@media (max-width: 640px) {
  .pdf-workspace {
    grid-template-rows: minmax(140px, 36%) minmax(0, 1fr);
  }

  .pdf-page {
    padding: 18px 14px;
    font-size: 15px;
  }
}
