:root {
  --bg: #f4f1eb;
  --panel: #ffffff;
  --paper: #fffef8;
  --ink: #18212f;
  --muted: #677384;
  --line: #1c2b55;
  --soft-line: #d8dde6;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #b7791f;
  --danger: #a83b3b;
  --shadow: 0 18px 46px rgba(24, 33, 47, 0.14);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent 280px),
    var(--bg);
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  display: grid;
  gap: 14px;
  width: min(100%, 390px);
  padding: 22px;
  background: var(--panel);
  border: 1px solid rgba(24, 33, 47, 0.12);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
}

.app {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 24px;
  min-height: 100vh;
  padding: 24px;
}

.controls {
  align-self: start;
  display: grid;
  gap: 14px;
  position: sticky;
  top: 24px;
}

.controls__header {
  display: grid;
  gap: 4px;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
}

h2 {
  font-size: 16px;
  line-height: 1.3;
}

.panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid rgba(24, 33, 47, 0.1);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(24, 33, 47, 0.06);
}

.panel__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input[type="file"] {
  width: 100%;
  min-height: 42px;
  padding: 8px;
  color: var(--ink);
  background: #f8fafc;
  border: 1px dashed #aeb8c6;
  border-radius: 8px;
}

input[type="text"],
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fbfcfd;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  outline: none;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.thumb {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  background: #f5f7fa;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb__number {
  position: absolute;
  top: 6px;
  left: 6px;
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  color: #ffffff;
  background: rgba(24, 33, 47, 0.78);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.thumb__tools {
  position: absolute;
  right: 6px;
  bottom: 6px;
  left: 6px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.thumb__button {
  display: inline-grid;
  place-items: center;
  min-width: 0;
  height: 27px;
  padding: 0;
  color: #18212f;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(24, 33, 47, 0.16);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.thumb__button:hover {
  background: #ffffff;
}

.thumb__button:disabled {
  color: #a8b0bb;
  background: rgba(255, 255, 255, 0.74);
  cursor: not-allowed;
}

.rows-editor {
  display: grid;
  gap: 9px;
}

.vehicle-editor {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.editor-row {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(112px, 0.75fr) 34px;
  gap: 8px;
  align-items: center;
}

.remove-row {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 40px;
  padding: 0;
  color: var(--danger);
  background: #fff5f5;
  border: 1px solid #f0c7c7;
  border-radius: 8px;
  cursor: pointer;
}

.remove-row:disabled {
  color: #b8b8b8;
  background: #f4f4f4;
  border-color: #e1e1e1;
  cursor: not-allowed;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.button {
  min-height: 42px;
  padding: 9px 12px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.button:hover {
  border-color: #aeb8c6;
}

.button--primary {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.button--primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button--ghost {
  min-height: 34px;
  padding: 6px 10px;
  color: var(--accent-strong);
  background: #eef9f7;
  border-color: #c8ece7;
  font-size: 13px;
}

.records-list {
  display: grid;
  gap: 8px;
}

.records-empty {
  display: grid;
  min-height: 42px;
  place-items: center;
  color: var(--muted);
  background: #f8fafc;
  border: 1px dashed #c5cfdb;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.record-item {
  display: grid;
  gap: 9px;
  padding: 10px;
  background: #fbfcfd;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
}

.record-item__meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.record-item__name {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-item__detail {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.record-item__actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.record-button {
  min-height: 31px;
  padding: 4px 6px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.record-button:hover {
  border-color: #aeb8c6;
}

.record-button--danger {
  color: var(--danger);
  background: #fff5f5;
  border-color: #f0c7c7;
}

.preview {
  display: grid;
  justify-items: center;
  min-width: 0;
  padding: 12px 0 36px;
  overflow: auto;
}

.sheet {
  display: flex;
  flex-direction: column;
  gap: 5mm;
  width: 210mm;
  min-height: 297mm;
  padding: 10mm;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.print-header {
  display: grid;
  gap: 1.5mm;
  color: var(--line);
  text-align: center;
  text-transform: uppercase;
}

.print-brand {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
}

.print-subtitle {
  font-size: 15px;
  font-weight: 800;
}

.print-vehicle {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 2px solid var(--line);
  color: var(--line);
  font-size: 12px;
}

.print-vehicle div {
  display: grid;
  gap: 1mm;
  min-height: 13mm;
  padding: 2mm 3mm;
  border-right: 2px solid var(--line);
}

.print-vehicle div:last-child {
  border-right: 0;
}

.print-vehicle span {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.print-vehicle strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 900;
}

.print-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  height: 108mm;
  border: 2px solid var(--line);
}

.print-image-slot {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  color: rgba(28, 43, 85, 0.5);
  font-size: 13px;
  font-weight: 800;
}

.print-image-slot:nth-child(odd) {
  border-right: 2px solid var(--line);
}

.print-image-slot:nth-child(-n + 2) {
  border-bottom: 2px solid var(--line);
}

.print-image-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.airbag-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  color: var(--line);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.15;
}

.airbag-table th,
.airbag-table td {
  height: 13mm;
  padding: 2mm 2.5mm;
  border-right: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  text-align: center;
  vertical-align: middle;
}

.airbag-table thead th {
  height: 10mm;
  font-size: 12px;
  font-weight: 800;
}

.airbag-table tr > :last-child {
  border-right: 0;
}

.airbag-table .part-column {
  width: 36%;
  text-align: left;
}

.airbag-table tbody .part-column {
  color: #101a45;
  font-weight: 700;
}

.status-mark {
  display: inline-grid;
  place-items: center;
  width: 5mm;
  height: 5mm;
  border: 2px solid currentColor;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.status-mark--orjinal {
  background: #16a34a;
  border-color: #15803d;
}

.status-mark--degismis {
  background: #dc2626;
  border-color: #b91c1c;
}

.status-mark--islemli {
  background: #d97706;
  border-color: #b45309;
}

.status-mark--direncli {
  background: #2563eb;
  border-color: #1d4ed8;
}

.print-note {
  flex: 1;
  display: grid;
  min-height: 58mm;
  border-left: 2px solid var(--line);
  color: var(--line);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.print-note div {
  padding: 6mm 7mm;
}

@media (max-width: 1100px) {
  .app {
    grid-template-columns: 1fr;
  }

  .controls {
    position: static;
  }

  .sheet {
    width: min(100%, 210mm);
  }
}

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

  h1 {
    font-size: 26px;
  }

  .editor-row,
  .vehicle-editor,
  .actions {
    grid-template-columns: 1fr;
  }

  .remove-row {
    width: 100%;
  }

  .thumb-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@page {
  size: A4 portrait;
  margin: 0;
}

@media print {
  html,
  body {
    width: 210mm;
    min-height: 297mm;
    background: #ffffff;
  }

  .controls {
    display: none !important;
  }

  .app,
  .preview {
    display: block;
    width: 210mm;
    min-height: 297mm;
    padding: 0;
    margin: 0;
    overflow: visible;
  }

  .sheet {
    width: 210mm;
    min-height: 297mm;
    padding: 10mm;
    margin: 0;
    background: #ffffff;
    box-shadow: none;
  }

  .button {
    display: none;
  }
}
