/* Sıfır Araç Teslim Tutanağı — arayüz stilleri (mobil öncelikli) */
:root {
  --navy: #0f2747;
  --navy-2: #1b3a66;
  --ink: #23272e;
  --ink-2: #4a515c;
  --muted: #6b7380;
  --line: #d3d9e2;
  --bg: #f2f4f7;
  --card: #ffffff;
  --ok: #157347;
  --ok-bg: #e6f4ec;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --na: #5b6370;
  --na-bg: #eceef1;
  --focus: #2f6fd6;
  --radius: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --actions-h: 140px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Üst çubuk */
.appbar {
  background: var(--navy);
  color: #fff;
  padding: calc(12px + var(--safe-t)) calc(16px + var(--safe-r)) 14px calc(16px + var(--safe-l));
}
.appbar__inner { display: flex; align-items: center; gap: 12px; max-width: 760px; margin: 0 auto; }
.appbar__logo { width: 34px; height: 34px; flex: none; fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .95; }
.appbar__title { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: .2px; }
.appbar__sub { margin: 0; font-size: 13px; color: #c3cfe0; }

/* Sayfa */
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px calc(12px + var(--safe-r)) calc(var(--actions-h) + var(--safe-b) + 24px) calc(12px + var(--safe-l));
}

.notice {
  margin: 0 0 12px;
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--ink-2);
  background: #e8edf5;
  border-left: 3px solid var(--navy-2);
  border-radius: 8px;
}

.card {
  background: var(--card);
  border: 1px solid #e3e7ed;
  border-radius: var(--radius);
  padding: 16px 14px 6px;
  margin-bottom: 12px;
}
.card__title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.card__hint { margin: -6px 0 12px; font-size: 13.5px; color: var(--muted); }

.field { margin-bottom: 14px; min-width: 0; }
.field label, .label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}
.hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.field__msg { margin: 6px 0 0; font-size: 13.5px; color: var(--ink-2); min-height: 0; }
.field__msg:empty { display: none; }

input[type="text"], input[type="tel"], input[type="date"], input[type="time"], textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 50px;
  margin: 0;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px; /* iOS otomatik yakınlaştırmayı engeller */
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  -webkit-appearance: none;
  appearance: none;
}
input[type="date"], input[type="time"] { line-height: 24px; }
input::-webkit-date-and-time-value { text-align: left; min-height: 24px; }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(47,111,214,.18); }
.upper { text-transform: uppercase; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .5px; }
::placeholder { color: #9aa2ae; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
@media (max-width: 340px) { .grid2 { grid-template-columns: 1fr; } }

.inline-actions { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: -4px 0 12px; }
.link {
  background: none; border: 0; padding: 8px 0; min-height: 40px;
  font: inherit; font-size: 14.5px; color: var(--navy-2); font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

.check { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0 14px; font-size: 14.5px; color: var(--ink-2); cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--navy); }

/* Logo */
.logo { display: flex; align-items: center; gap: 12px; }
.logo__preview {
  width: 120px; height: 60px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line); border-radius: 8px; background: #fafbfc; overflow: hidden;
}
.logo__preview img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.logo__empty { font-size: 13px; color: var(--muted); }
.logo__actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Butonlar */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px;
  font: inherit; font-size: 16px; font-weight: 600;
  border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}
.btn--sm { min-height: 44px; padding: 0 14px; font-size: 15px; }
.btn--xl { width: 100%; min-height: 56px; font-size: 18px; }
.btn--primary { background: var(--navy); color: #fff; }
.btn--primary:active { background: var(--navy-2); }
.btn--ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn--ghost:active { background: #eef1f5; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .65; cursor: progress; }
.btn svg, .act svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Kontrol listesi */
.checklist { list-style: none; margin: 0; padding: 0; }
.ck { padding: 12px 0; border-top: 1px solid #edf0f4; }
.ck:first-child { border-top: 0; padding-top: 2px; }
.ck__label { display: flex; gap: 8px; margin-bottom: 8px; font-size: 15.5px; font-weight: 600; color: var(--ink); }
.ck__no { color: var(--muted); font-weight: 600; min-width: 22px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg button {
  min-height: 46px; padding: 4px 4px;
  font: inherit; font-size: 14.5px; font-weight: 600; line-height: 1.15;
  color: var(--ink-2); background: #fff;
  border: 1.5px solid var(--line); border-radius: 9px;
  cursor: pointer; touch-action: manipulation;
}
.seg button[aria-pressed="true"][data-v="ok"]  { color: #fff; background: var(--ok);  border-color: var(--ok); }
.seg button[aria-pressed="true"][data-v="bad"] { color: #fff; background: var(--bad); border-color: var(--bad); }
.seg button[aria-pressed="true"][data-v="na"]  { color: #fff; background: var(--na);  border-color: var(--na); }
@media (hover: hover) {
  .seg button:hover { border-color: #aab4c2; }
}
@media (min-width: 640px) {
  .ck { display: grid; grid-template-columns: 1fr 330px; align-items: center; gap: 12px; }
  .ck__label { margin: 0; }
}

/* İmza */
.sig { margin-bottom: 16px; }
.sig__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.sig__head .label { margin: 0; }
.sig__pad {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 2;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  touch-action: none;
}
.sig__pad::after { /* imza çizgisi */
  content: ""; position: absolute; left: 6%; right: 6%; bottom: 22%;
  border-bottom: 1px dashed #c4ccd7; pointer-events: none;
}
.sig__pad canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none; cursor: crosshair;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.sig__ph { position: absolute; left: 6%; bottom: 8%; font-size: 13px; color: #9aa2ae; pointer-events: none; }
.sig__pad.has-ink .sig__ph { display: none; }
.fineprint { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }

/* Bilgi */
.info { padding: 6px 4px 0; font-size: 13px; color: var(--muted); }
.info__title { font-size: 13px; margin: 0 0 4px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .5px; }
.info ul { margin: 0 0 8px; padding-left: 18px; }
.info li { margin-bottom: 4px; }
.info a { color: var(--navy-2); }
.info__ver { margin: 0; }

/* Alt işlem çubuğu */
.actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(255,255,255,.97);
  border-top: 1px solid #dfe3ea;
  box-shadow: 0 -4px 16px rgba(15,39,71,.06);
  padding: 10px calc(12px + var(--safe-r)) calc(8px + var(--safe-b)) calc(12px + var(--safe-l));
}
.actions > * { max-width: 736px; margin-left: auto; margin-right: auto; }
.actions__row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 6px; }
.act {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; padding: 4px 2px;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--navy);
  background: none; border: 0; border-radius: 10px; cursor: pointer; touch-action: manipulation;
}
.act:active { background: #eef1f5; }
.act[disabled] { opacity: .5; }

/* Klavye açıkken (dokunmatik) alt çubuğu gizle */
body.kbd .actions, body.kbd .result { display: none; }

/* Sonuç paneli */
.result {
  position: fixed; left: 10px; right: 10px; z-index: 21;
  bottom: calc(var(--actions-h) + var(--safe-b));
  max-width: 736px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px;
  background: #fff; border: 1px solid #cfe3d8; border-left: 4px solid var(--ok);
  border-radius: 12px; box-shadow: 0 6px 24px rgba(15,39,71,.14);
}
.result__text { flex: 1 1 160px; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.result__name { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.result__actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Uyarı */
.toast {
  position: fixed; left: 10px; right: 10px; z-index: 22;
  top: calc(10px + var(--safe-t));
  max-width: 736px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; font-size: 14.5px;
  background: #fff; color: var(--ink);
  border: 1px solid #f0c9c4; border-left: 4px solid var(--bad);
  border-radius: 12px; box-shadow: 0 6px 24px rgba(15,39,71,.14);
}
.toast.is-info { border-color: #cdd8e8; border-left-color: var(--navy-2); }
.toast > span { flex: 1 1 200px; }
.toast__close { background: none; border: 0; font-size: 18px; min-width: 44px; min-height: 44px; color: var(--muted); cursor: pointer; }

/* Önizleme */
.preview {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column;
  background: #5d6470;
}
.preview__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(8px + var(--safe-t)) calc(10px + var(--safe-r)) 8px calc(10px + var(--safe-l));
  background: var(--navy); color: #fff;
}
.preview__title { margin: 0; font-size: 16px; font-weight: 700; }
.preview__pages {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 14px calc(10px + var(--safe-r)) calc(20px + var(--safe-b)) calc(10px + var(--safe-l));
}
.preview__pages img {
  display: block; width: 100%; max-width: 820px; height: auto;
  margin: 0 auto 14px; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.3);
}
body.no-scroll { overflow: hidden; }

/* Yazdırma: yalnızca A4 sayfa görüntüleri basılır */
.print-pages { display: none; }
@page { size: A4 portrait; margin: 0; }
@media print {
  html, body { background: #fff !important; }
  body > *:not(.print-pages) { display: none !important; }
  .print-pages { display: block !important; }
  .print-pages img {
    display: block; width: 210mm; height: 297mm;
    page-break-after: always; break-after: page;
  }
  .print-pages img:last-child { page-break-after: auto; break-after: auto; }
}

.logo__actions label.btn { display: inline-flex; margin: 0; color: var(--navy); font-size: 15px; }

/* Ekipman (Var/Yok) ve parça (Hasarlı/Eksik) seçenekleri */
.seg--2 { grid-template-columns: repeat(2, 1fr); }
.seg button[aria-pressed="true"][data-v="var"] { color: #fff; background: var(--ok);  border-color: var(--ok); }
.seg button[aria-pressed="true"][data-v="yok"] { color: #fff; background: var(--bad); border-color: var(--bad); }
.seg button[aria-pressed="true"][data-f="h"]   { color: #fff; background: var(--bad); border-color: var(--bad); }
.seg button[aria-pressed="true"][data-f="e"]   { color: #fff; background: #b54708; border-color: #b54708; }
.ck--part .part__note { margin-top: 8px; min-height: 46px; padding: 10px 12px; }
@media (min-width: 640px) {
  .checklist .ck { grid-template-columns: 1fr 240px; }
  .ck--part .part__note { grid-column: 1 / -1; margin-top: 0; }
}
