@font-face {
  font-family: "DocSans";
  src: url("../assets/fonts/LiberationSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DocSans";
  src: url("../assets/fonts/LiberationSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DocCondensed";
  src: url("../assets/fonts/RobotoCondensed-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

:root {
  --navy: #263a7d;
  --green: #006d41;
  --text: #1a2230;
  --panel: #0f172a;
  --panel-2: #1e293b;
  --accent: #0d9488;
  --sel: #0ea5e9;
  --font: "DocSans", "Liberation Sans", Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, sans-serif;
  background: #e8edf2;
  min-height: 100vh;
}

.app {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

.panel {
  background: linear-gradient(180deg, var(--panel), #0b1220);
  color: #e2e8f0;
  padding: 22px 18px 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.panel h1 { margin: 0 0 4px; font-size: 17px; }
.panel .hint { margin: 0 0 16px; font-size: 12px; color: #94a3b8; line-height: 1.45; }
.panel label {
  display: block; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: #94a3b8; margin: 12px 0 6px;
}
.panel textarea {
  width: 100%; border-radius: 8px; border: 1px solid #334155;
  background: var(--panel-2); color: #f8fafc; font-size: 13px;
  padding: 10px 12px; resize: vertical; font-family: inherit; line-height: 1.4;
}
.sel-box {
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.35);
  border-radius: 10px; padding: 12px; margin-bottom: 8px;
}
.sel-label { font-size: 10px; text-transform: uppercase; color: #7dd3fc; letter-spacing: 0.06em; }
.sel-name { margin: 4px 0 8px; font-size: 13px; font-weight: 700; color: #e0f2fe; }
.row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.actions { display: grid; gap: 8px; margin-top: 18px; }
.btn {
  appearance: none; border: 0; border-radius: 8px;
  padding: 11px 12px; font-size: 13px; font-weight: 650; cursor: pointer;
}
.btn-primary { background: var(--accent); color: #042f2e; }
.btn-secondary { background: #334155; color: #f1f5f9; }

.preview-wrap {
  padding: 28px;
  display: flex;
  justify-content: center;
}

.page {
  position: relative;
  width: 210mm;
  height: 297mm;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  font-family: var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.page-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.t {
  position: absolute;
  z-index: 2;
  margin: 0;
  padding: 0;
  line-height: 1.25;
  border-radius: 2px;
  /* f.pdf görsel ölçümüne göre — scaleY yok, gerçek font boyutu */
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

/*
 * Tipografi: f.pdf / ornek ile aynı raster (gömülü font YOK).
 * Ölçüm 1786×2526 görselinden — kalınlık stroke, boyut cap-height, konum %.
 * Regular (stroke~3–4): body, dept, fin label, sign dir
 * Bold (stroke~5–11): title, company, sayi, salutation, fin value, closing, sign org
 */
.t-company {
  left: 8%; right: 8%; top: 12.66%;
  text-align: center;
  font-family: "DocCondensed", system-ui, sans-serif;
  font-size: 20.6px;
  font-weight: 700;
  color: #263a7d;
  letter-spacing: normal;
}
.t-dept {
  left: 8%; right: 8%; top: 15.40%;
  text-align: center;
  font-size: 10.26px;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.03em;
}
.t-sayi {
  left: 7.78%; top: 18.52%;
  font-size: 11.2px;
  font-weight: 700;
  color: #1f2937;
}
.t-tarih {
  right: 7.61%; top: 18.52%;
  text-align: right;
  font-size: 11.2px;
  font-weight: 700;
  color: #1f2937;
}
.t-title {
  left: 8%; right: 8%; top: 22.45%;
  text-align: center;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 23px;
  font-weight: 900;
  color: #006d41;
  letter-spacing: 0.02em;
}
.t-salutation {
  left: 7.84%; top: 29.10%;
  width: 55%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  font-weight: 900;
  color: #1f2937;
}
.t-para1 {
  left: 7.8%; top: 32.30%;
  width: 84.4%;
  font-size: 12.2px;
  font-weight: 400;
  line-height: 1.55;
  text-align: justify;
  color: #1f2937;
}
.t-fin-title {
  left: 10.86%; top: 42.95%;
  font-size: 12.4px;
  font-weight: 700;
  color: #006d41;
  letter-spacing: 0.02em;
}
.t-fin-k1, .t-fin-k2, .t-fin-k3, .t-fin-k4 {
  left: 10.81%;
  width: 26%;
  font-size: 12.2px;
  font-weight: 400;
  color: #64748b;
}
.t-fin-v1, .t-fin-v2, .t-fin-v3, .t-fin-v4 {
  left: 39.0%;
  width: 48%;
  font-size: 12.2px;
  font-weight: 700;
  color: #1f2937;
}
.t-fin-k1 { top: 46.75%; }
.t-fin-v1 { top: 46.75%; }
.t-fin-k2 { top: 50.00%; }
.t-fin-v2 { top: 50.00%; font-weight: 800; }
.t-fin-k3 { top: 53.25%; }
.t-fin-v3 { top: 53.25%; }
.t-fin-k4 { top: 56.65%; }
.t-fin-v4 { top: 56.65%; }

.t-para2 {
  left: 7.8%; top: 61.10%;
  width: 84.4%;
  font-size: 12.2px;
  font-weight: 400;
  line-height: 1.55;
  text-align: justify;
  color: #1f2937;
}
.t-para3 {
  left: 7.8%; top: 68.70%;
  width: 84.4%;
  font-size: 12.2px;
  font-weight: 400;
  line-height: 1.55;
  text-align: justify;
  color: #1f2937;
}
.t-closing {
  left: 7.84%; top: 74.03%;
  font-size: 13.0px;
  font-weight: 900;
  color: #1f2937;
}
.t-sign-org {
  left: 7.84%; top: 90.10%;
  font-size: 13.0px;
  font-weight: 700;
  color: #1f2937;
}
.t-sign-dir {
  left: 7.84%; top: 92.20%;
  font-size: 12.0px;
  font-weight: 400;
  color: #6b7390;
}
.t-footer {
  left: 10%; right: 10%; top: 95.85%;
  text-align: center;
  font-size: 10.5px;
  font-weight: 400;
  color: #9aa3b5;
}

.ed-text {
  cursor: text;
  outline: none;
  transition: box-shadow 0.12s ease, background 0.12s ease;
}
.ed-text:hover { box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.4); }
.ed-text.is-selected,
.ed-text:focus {
  box-shadow: inset 0 0 0 2px var(--sel);
  background: rgba(14, 165, 233, 0.07);
}
.word-mark {
  background: rgba(14, 165, 233, 0.22);
  box-shadow: inset 0 0 0 1px var(--sel);
  border-radius: 2px;
}

@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  .panel, .no-print { display: none !important; }
  .app { display: block; }
  .preview-wrap { padding: 0; }
  .page { box-shadow: none; margin: 0; }
  .ed-text:hover, .ed-text.is-selected, .ed-text:focus, .word-mark {
    box-shadow: none !important;
    background: transparent !important;
  }
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .panel { position: relative; height: auto; }
}
