:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --border: #e6e9f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #6366f1;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 30px rgba(15, 23, 42, .07);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ----- Header ------------------------------------------------------------ */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.app-logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  font-size: 18px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  box-shadow: 0 8px 18px rgba(239, 68, 68, .30);
}

.app-titles h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.app-titles p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.app-titles p a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.app-titles p a:hover {
  text-decoration: underline;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}

.btn-ghost {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: #f8fafc;
  border-color: #d5dae6;
}

.btn-primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(99, 102, 241, .28);
}

.btn-primary:hover {
  background: #5457e5;
}

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

/* ----- Layout ------------------------------------------------------------ */

.content {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  align-items: start;
  gap: 22px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.card-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.card-body {
  padding: 20px 22px;
}

/* ----- Form -------------------------------------------------------------- */

.fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: #fbfcff;
}

textarea.input {
  resize: vertical;
  line-height: 1.6;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}

/* ----- Preview ----------------------------------------------------------- */

.preview {
  height: 620px;
}

.pdf-frame {
  width: 100%;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfcff;
}

/* ----- Responsive -------------------------------------------------------- */

@media (max-width: 820px) {
  .content {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 16px;
  }

  .preview {
    height: 480px;
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 14px 16px;
  }

  .app-titles p {
    display: none;
  }

  .card-body {
    padding: 16px;
  }
}
