:root {
  --bg: #0e1620;
  --surface: #16202c;
  --surface-2: #1d2a38;
  --line: #2a3a4c;
  --line-soft: #223141;
  --text: #e8eef4;
  --text-dim: #8aa0b4;
  --text-faint: #5b7188;
  --amber: #f5b125;
  --amber-soft: #3a2f12;
  --green: #36c98e;
  --green-soft: #16332a;
  --red: #ff6b5e;
  --red-soft: #3a1d1c;
  --blue: #4ea3f0;
  --radius: 12px;
  --tap: 48px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100dvh; }

#app { max-width: 720px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

h1, h2, h3, .display { font-family: 'Archivo', sans-serif; letter-spacing: -0.01em; }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  display: flex; align-items: center; gap: 12px;
}
.topbar .brand { font-family: 'Archivo'; font-weight: 800; font-size: 18px; letter-spacing: 0.02em; }
.topbar .brand b { color: var(--amber); }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 12px; color: var(--text-dim); text-align: right; line-height: 1.3; }
.topbar .who b { color: var(--text); display: block; font-weight: 600; }

/* tab strip */
.tabs { display: flex; gap: 4px; padding: 8px 12px 0; background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 57px; z-index: 19; }
.tab {
  flex: 1; text-align: center; padding: 10px 8px; font-size: 13px; font-weight: 600;
  color: var(--text-dim); border: none; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; font-family: inherit;
}
.tab.active { color: var(--amber); border-bottom-color: var(--amber); }

main { flex: 1; padding: 16px; padding-bottom: 40px; }

/* ---- cards ---- */
.card {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
}
.card-row { display: flex; align-items: center; gap: 12px; }

.plate {
  font-family: 'Archivo'; font-weight: 700; letter-spacing: 0.05em;
  background: #f4f6f8; color: #0e1620; padding: 4px 9px; border-radius: 5px;
  font-size: 14px; white-space: nowrap; border: 2px solid #c7ced6;
  position: relative; padding-left: 16px;
}
.plate::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 8px; background: #0b3d91; border-radius: 3px 0 0 3px; }

.veh-meta { flex: 1; min-width: 0; }
.veh-meta .name { font-weight: 600; font-size: 15px; }
.veh-meta .sub { font-size: 13px; color: var(--text-dim); }

.badge { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 20px; letter-spacing: 0.03em; white-space: nowrap; }
.badge.bosta { background: var(--green-soft); color: var(--green); }
.badge.zimmetli { background: var(--amber-soft); color: var(--amber); }
.badge.kapali { background: var(--surface-2); color: var(--text-faint); }
.badge.aktif { background: var(--green-soft); color: var(--green); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font-family: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer; width: 100%;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--amber); color: #1a1405; border-color: var(--amber); }
.btn.danger { background: var(--red-soft); color: var(--red); border-color: #5a2a28; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 38px; font-size: 13px; padding: 0 12px; width: auto; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { width: auto; flex: 1; }

/* ---- forms ---- */
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
input, select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 12px; font-family: inherit; font-size: 15px; min-height: var(--tap);
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--amber); outline-offset: -1px; border-color: var(--amber); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---- equipment checklist ---- */
.checklist { display: grid; gap: 8px; }
.check {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: var(--tap);
  background: var(--bg); border: 1px solid var(--line); border-radius: 9px; cursor: pointer; font-weight: 500;
}
.check input { width: 22px; height: 22px; min-height: 0; flex: 0 0 auto; accent-color: var(--amber); }
.check.on { border-color: var(--green); background: var(--green-soft); }

/* ---- vehicle diagram ---- */
.diagram-wrap { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.diagram-hint { font-size: 12px; color: var(--text-dim); text-align: center; margin-bottom: 10px; }
.car-svg { width: 100%; max-width: 280px; display: block; margin: 0 auto; touch-action: manipulation; }
.zone { fill: var(--surface-2); stroke: var(--line); stroke-width: 2; cursor: pointer; transition: fill .12s; }
.zone:active { fill: var(--surface); }
.zone.dmg { fill: var(--red-soft); stroke: var(--red); }
.zone.dmg-mevcut { fill: #4a1512; stroke: var(--red); stroke-dasharray: 4 3; }
.dmg-item.mevcut { background: #2a1513; border-color: #5a2a28; }
.dmg-item.mevcut .lock { font-size: 14px; opacity: .7; padding: 0 4px; }
.zone-label { fill: var(--text-faint); font-size: 9px; font-family: 'Inter'; pointer-events: none; text-anchor: middle; }
.dmg-marker { fill: var(--red); pointer-events: none; }

/* damage list */
.dmg-list { margin-top: 12px; display: grid; gap: 8px; }
.dmg-item { display: flex; gap: 8px; align-items: flex-start; background: var(--red-soft); border: 1px solid #5a2a28; border-radius: 8px; padding: 8px 10px; }
.dmg-item .zn { font-weight: 700; color: var(--red); font-size: 13px; white-space: nowrap; }
.dmg-item input { background: transparent; border: none; min-height: 28px; padding: 0; color: var(--text); font-size: 13px; }
.dmg-item .x { background: none; border: none; color: var(--text-faint); font-size: 20px; cursor: pointer; line-height: 1; padding: 0 4px; }

/* photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; margin-top: 10px; }
.photo-grid img, .photo-add {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; border: 1px solid var(--line);
}
.photo-add { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 3px; background: var(--bg); color: var(--text-dim); cursor: pointer; font-size: 11px; font-weight: 600; }
.photo-add svg { width: 22px; height: 22px; }
.photo-thumb { position: relative; }
.photo-thumb .x { position: absolute; top: 3px; right: 3px; background: rgba(0,0,0,.7); border: none; color: #fff; width: 22px; height: 22px; border-radius: 50%; font-size: 14px; cursor: pointer; line-height: 1; }

/* ---- section headings ---- */
.sec-head { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; }
.sec-head .eyebrow { font-size: 11px; font-weight: 700; color: var(--amber); letter-spacing: 0.12em; text-transform: uppercase; }
.sec-head h2 { font-size: 20px; font-weight: 700; }
.muted { color: var(--text-dim); font-size: 13px; }
.empty { text-align: center; color: var(--text-faint); padding: 40px 20px; font-size: 14px; }

/* ---- modal ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(6,11,17,.8); z-index: 50; display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(3px); }
.modal { background: var(--surface); width: 100%; max-width: 720px; max-height: 92dvh; overflow-y: auto; border-radius: 16px 16px 0 0; border: 1px solid var(--line); border-bottom: none; padding: 20px 16px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.modal-head h2 { font-size: 19px; flex: 1; }
.modal-head .close { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); width: 36px; height: 36px; border-radius: 50%; font-size: 20px; cursor: pointer; }
@media (min-width: 600px) { .modal-bg { align-items: center; } .modal { border-radius: 16px; border-bottom: 1px solid var(--line); } }

/* compare result */
.compare { border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.compare.warn { background: var(--red-soft); border: 1px solid #5a2a28; }
.compare.ok { background: var(--green-soft); border: 1px solid #1f4d3c; }
.compare h3 { font-size: 14px; margin-bottom: 6px; }
.compare ul { margin-left: 18px; font-size: 13px; }

/* login */
.login-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 380px; margin: 0 auto; width: 100%; }
.login-logo { font-family: 'Archivo'; font-weight: 800; font-size: 30px; text-align: center; margin-bottom: 4px; letter-spacing: 0.02em; }
.login-logo b { color: var(--amber); }
.login-sub { text-align: center; color: var(--text-dim); font-size: 13px; margin-bottom: 28px; }
.err { background: var(--red-soft); color: var(--red); border: 1px solid #5a2a28; border-radius: 9px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--line); color: var(--text); padding: 12px 18px; border-radius: 10px; font-size: 14px; z-index: 100; box-shadow: 0 8px 30px rgba(0,0,0,.4); max-width: 90%; }
.toast.err { background: var(--red-soft); border-color: #5a2a28; color: var(--red); }

.history-line { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.history-line:last-child { border-bottom: none; }
.history-line .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: 0 0 auto; }
.history-line .dot.aktif { background: var(--green); }
.history-line .dot.kapali { background: var(--text-faint); }
.history-line .meta { flex: 1; }
.history-line .meta .top { font-weight: 600; }
.history-line .meta .sub { color: var(--text-dim); font-size: 12px; }
.tag-dmg { color: var(--red); font-weight: 600; }
.tag-ok { color: var(--green); font-weight: 600; }

/* gecmis fotograflari */
.hist-foto { margin-top: 8px; }
.hist-foto-lbl { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; margin-bottom: 4px; }
.hist-foto-grid { display: flex; gap: 6px; flex-wrap: wrap; }
.hist-foto-grid img { width: 56px; height: 56px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); cursor: pointer; }
.hist-foto-grid img:active { transform: scale(.96); }

/* lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 8px; }
.lightbox .lb-close { position: absolute; top: max(16px, env(safe-area-inset-top)); right: 16px; width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.15); border: none; color: #fff; font-size: 24px; cursor: pointer; }

/* hasar kartlari */
.hasar-card.acik { border-left: 3px solid var(--red); }
.hasar-card.giderildi { border-left: 3px solid var(--green); opacity: .85; }
.hasar-top { display: flex; align-items: center; gap: 10px; }
.zn-pill { font-size: 12px; font-weight: 700; background: var(--red-soft); color: var(--red); padding: 4px 10px; border-radius: 20px; white-space: nowrap; }
.zn-pill.ok { background: var(--green-soft); color: var(--green); }
.fab-note { font-size: 12px; color: var(--text-faint); text-align: center; margin-top: 16px; }

/* ---- uyari seritleri ---- */
.alert {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 600; margin-bottom: 6px;
}
.alert:last-child { margin-bottom: 0; }
.alert.yaklasti { background: var(--amber-soft); color: var(--amber); border: 1px solid #5a4a1a; }
.alert.gecti { background: var(--red-soft); color: var(--red); border: 1px solid #5a2a28; }
.alert .ico { flex: 0 0 auto; font-size: 15px; }
.alert-stack { margin: 10px 0 2px; }

/* dashboard uyari ozeti */
.dash-alert {
  background: var(--surface); border: 1px solid var(--line-soft); border-left: 3px solid var(--amber);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; display: flex; gap: 12px; align-items: center;
}
.dash-alert.gecti { border-left-color: var(--red); }
.dash-alert .meta { flex: 1; min-width: 0; }
.dash-alert .meta .top { font-weight: 600; font-size: 14px; }
.dash-alert .meta .sub { font-size: 12px; }

/* ---- belge alani ---- */
.doc-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft);
}
.doc-row:last-child { border-bottom: none; }
.doc-row .doc-ico { width: 38px; height: 38px; border-radius: 8px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; color: var(--text-dim); }
.doc-row .doc-meta { flex: 1; min-width: 0; }
.doc-row .doc-meta .top { font-weight: 600; font-size: 14px; }
.doc-row .doc-meta .sub { font-size: 12px; color: var(--text-dim); }
.doc-row .doc-meta .sub.yaklasti { color: var(--amber); font-weight: 600; }
.doc-row .doc-meta .sub.gecti { color: var(--red); font-weight: 600; }
.doc-link { color: var(--blue); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.doc-link.none { color: var(--text-faint); font-weight: 400; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 12px; }
.info-cell { background: var(--bg); border: 1px solid var(--line-soft); border-radius: 9px; padding: 10px 12px; }
.info-cell .lbl { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.info-cell .val { font-weight: 600; font-size: 15px; margin-top: 2px; }
.info-cell .val.yaklasti { color: var(--amber); }
.info-cell .val.gecti { color: var(--red); }

/* DATALAB logo */
.login-logo { text-align: center; margin-bottom: 14px; }
.login-logo img { width: 220px; max-width: 70%; height: auto; display: inline-block; }
.topbar .brand { display: flex; align-items: center; }
.topbar .brand img { height: 30px; width: auto; display: block; background: #fff; padding: 4px 8px; border-radius: 7px; }
