* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0; color: #1a1a1a; background: #f7f7f9;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px; background: white; border-bottom: 1px solid #e5e7eb;
}
.topbar .brand { font-weight: 700; font-size: 18px; color: #1f2a44; text-decoration: none; }
.topbar nav a { margin-left: 16px; color: #444; text-decoration: none; }
.topbar nav a:hover { color: #1f2a44; }
main { max-width: 960px; margin: 0 auto; padding: 24px; }
h1 { margin-top: 0; }
.muted { color: #666; }
.banner { padding: 10px 14px; border-radius: 6px; margin: 12px 0; }
.banner.ok { background: #e6f7ec; color: #226e3f; }
.banner.warn { background: #fff4e0; color: #8a5a1c; }

.btn {
  display: inline-block; padding: 8px 14px; border-radius: 6px;
  background: #f0f0f3; color: #1a1a1a; text-decoration: none;
  border: 1px solid #d8d8df; cursor: pointer; font-size: 14px;
}
.btn.primary { background: #1f2a44; color: white; border-color: #1f2a44; }
.btn:hover { opacity: 0.9; }

.hero { padding: 40px 0; text-align: center; }
.hero h1 { font-size: 32px; }
.hero p { max-width: 600px; margin: 0 auto 16px; color: #444; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { background: white; padding: 18px; border-radius: 8px; border: 1px solid #e5e7eb; }

fieldset {
  background: white; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 16px; margin-bottom: 16px;
}
legend { padding: 0 6px; font-weight: 600; }
label { display: block; margin-bottom: 10px; font-size: 14px; }
input[type=text], input[type=email], input[type=file], input:not([type]),
textarea, select {
  width: 100%; padding: 8px 10px; border-radius: 6px; border: 1px solid #d0d0d6;
  font-size: 14px; font-family: inherit;
}
textarea { min-height: 100px; }

.row {
  display: grid; grid-template-columns: repeat(2, 1fr) auto; gap: 8px;
  padding: 10px; background: #fafafc; border-radius: 6px; margin-bottom: 8px;
  align-items: start;
}
.row .bullets { grid-column: 1 / -1; }
.row button { align-self: start; background: #fbeaea; color: #8a1a1a; border-color: #f0c9c9; }

.radio { display: inline-block; margin-right: 16px; }

.actions { margin: 14px 0; display: flex; gap: 8px; }

.import-box {
  background: #eef4ff; border: 1px dashed #6b8acb; border-radius: 8px;
  padding: 14px 16px; margin-bottom: 18px;
}
.import-box input[type=file] { width: auto; margin: 6px 8px 6px 0; }

.template-grid {
  display: grid; grid-template-columns: repeat(auto-fit, 240px);
  gap: 14px; margin-top: 4px;
}
.template-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px; border: 1px solid #d8d8df; border-radius: 8px;
  background: #fafafc; cursor: pointer; position: relative;
}
.template-card:has(input:checked) { border-color: #1f2a44; background: white; box-shadow: 0 0 0 2px #1f2a44 inset; }
.template-card input[type=radio] {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  accent-color: #1f2a44;
}
.template-thumb {
  width: 220px;
  aspect-ratio: 210 / 297;        /* A4 */
  background: white; border: 1px solid #e3e3ea; border-radius: 4px;
  overflow: hidden; pointer-events: none;
  position: relative;
  align-self: center;
}
.template-thumb iframe {
  width: 794px;                   /* A4 width @ 96dpi */
  height: 1123px;                 /* A4 height @ 96dpi */
  border: 0;
  transform: scale(0.277);        /* 220 / 794 */
  transform-origin: top left;
}
.template-info { display: flex; justify-content: space-between; align-items: baseline; }
.template-card .name { font-weight: 600; }
.template-card .preview-link { font-size: 12px; color: #4566a3; text-decoration: none; }
.template-card .preview-link:hover { text-decoration: underline; }

.improvements {
  background: #f3f7ff; border: 1px solid #c8d6f0; border-radius: 8px;
  padding: 14px 18px; margin: 14px 0;
}
.improvements ol { margin: 4px 0 0 18px; }
.improvements li { margin-bottom: 4px; }

.cover-letter {
  background: #fbfaf6; border: 1px solid #e7e2cf; border-left: 4px solid #f0a82c;
  padding: 14px 16px; border-radius: 6px;
  white-space: pre-wrap; font-family: Georgia, serif; font-size: 11pt;
  line-height: 1.55; color: #222; max-height: 1100px; overflow: auto;
}
