/* ============================================================
   PPWR QR Portal — Tasarım Sistemi
   Bayındır Ambalaj
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Space+Grotesk:wght@600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');
@import url('https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@latest/tabler-icons.min.css');

/* ============================================================
   1. MARKA TOKENLARI — Renk, font ve boyut değişkenleri.
      Tüm tema değişiklikleri buradan yapılır.
   ============================================================ */
:root {
  /* Ana renk — Lacivert */
  --navy:        #185FA5;
  --navy-dark:   #0C447C;
  --navy-light:  #B5D4F4;
  --navy-muted:  #E6F1FB;

  /* Vurgu rengi — PPWR Yeşil */
  --green:       #1D9E75;
  --green-dark:  #0F6E56;
  --green-light: #9FE1CB;
  --green-muted: #E1F5EE;

  /* Nötr / Mürekkep */
  --ink:         #1E2A3B;
  --ink-soft:    #4A5568;
  --ink-muted:   #718096;
  --line:        #CBD5E0;
  --line-light:  #EDF2F7;
  --paper:       #F7F9FC;
  --white:       #FFFFFF;

  /* Durum renkleri */
  --amber:       #EF9F27;
  --amber-dark:  #B7690A;
  --amber-muted: #FAEEDA;
  --red:         #E24B4A;
  --red-dark:    #B02B2A;
  --red-muted:   #FCEBEB;
  --purple:      #7C3AED;
  --purple-dark: #5B21B6;
  --purple-muted:#EDE9FE;

  /* Fontlar */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'IBM Plex Mono', monospace;

  /* Köşe yuvarlaklığı */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Gölgeler */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.06);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.05);

  /* Topnav yüksekliği */
  --nav-h: 64px;
}

/* ============================================================
   2. RESET & TEMEL
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-gutter: stable; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-wrap { flex: 1; }

a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ============================================================
   3. TOPNAV
   ============================================================ */
.topnav {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-sm);
  height: var(--nav-h);
}

.topnav-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 0;
}

/* Marka */
.topnav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 32px;
}
.topnav-brand:hover { text-decoration: none; }

.topnav-monogram {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.topnav-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.topnav-brand-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.topnav-brand-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--green);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Navigasyon linkleri */
.topnav-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.topnav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.topnav-link:hover {
  background: var(--line-light);
  color: var(--ink);
  text-decoration: none;
}
.topnav-link.active {
  background: var(--navy-muted);
  color: var(--navy);
}

/* Kullanıcı alanı (eski — geriye uyumluluk) */
.topnav-user { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-shrink: 0; }
.topnav-username { font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.topnav-logout {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--r-sm);
  color: var(--ink-muted); transition: background 0.15s, color 0.15s;
  font-size: 18px; text-decoration: none;
}
.topnav-logout:hover { background: var(--red-muted); color: var(--red); text-decoration: none; }

/* Dropdown menüler */
.topnav-dropdown { position: relative; }

.topnav-dd-trigger {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  gap: 5px;
}
.topnav-dd-arrow {
  font-size: 12px;
  transition: transform 0.2s;
  margin-left: -2px;
}
.topnav-dropdown.open .topnav-dd-arrow { transform: rotate(180deg); }

.topnav-dd-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 190px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 6px;
  z-index: 500;
}
.topnav-dd-menu--right { left: auto; right: 0; }
.topnav-dropdown.open .topnav-dd-menu { display: block; }

.topnav-dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.topnav-dd-item:hover { background: var(--line-light); color: var(--ink); text-decoration: none; }
.topnav-dd-item.active { background: var(--navy-muted); color: var(--navy); }
.topnav-dd-item--danger { color: var(--red-dark); }
.topnav-dd-item--danger:hover { background: var(--red-muted); color: var(--red-dark); }

.topnav-dd-header {
  padding: 6px 10px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--line-light);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.topnav-dd-divider {
  height: 1px;
  background: var(--line-light);
  margin: 4px 0;
}

/* Avatar dairesi */
.topnav-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.topnav-avatar:hover { opacity: 0.85; }

/* ============================================================
   4. SAYFA DÜZENİ
   ============================================================ */
.page-wrap {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

.page-wrap--form {
  max-width: 920px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.page-subtitle {
  font-size: 14px;
  color: var(--ink-muted);
  margin-top: 4px;
}

.trash-section-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
  margin-top: 4px;
}

/* ============================================================
   5. KARTLAR
   ============================================================ */
.card {
  background: var(--white);
  border: 1px solid var(--line-light);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card + .card {
  margin-top: 16px;
}

.section-divider {
  height: 1px;
  background: var(--line-light);
  margin: 20px 0;
}

/* ============================================================
   6. BUTONLAR
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}
.btn-primary:hover {
  background: var(--navy-dark);
  border-color: var(--navy-dark);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(24,95,165,.25);
}

.btn-secondary {
  background: var(--white);
  color: var(--ink-soft);
  border-color: var(--line);
}
.btn-secondary:hover {
  background: var(--line-light);
  color: var(--ink);
  border-color: var(--line);
}

.btn-success {
  background: var(--green);
  color: var(--white);
  border-color: var(--green);
}
.btn-success:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: var(--white);
}

.btn-danger {
  background: var(--white);
  color: var(--red);
  border-color: var(--line);
}
.btn-danger:hover {
  background: var(--red-muted);
  border-color: var(--red);
  color: var(--red-dark);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 13px;
  gap: 4px;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* ============================================================
   7. FORMLAR
   ============================================================ */
.form-section {
  margin-bottom: 28px;
}

.form-section-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.required { color: var(--red); margin-left: 2px; }

.form-control {
  display: block;
  width: 100%;
  padding: 9px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.5;
}
.form-control:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(24,95,165,.12);
}
.form-control::placeholder { color: var(--ink-muted); }

.form-control--mono {
  font-family: var(--font-mono);
  font-size: 13px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 36px;
  appearance: none;
  cursor: pointer;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.form-hint {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 4px;
}

/* Dosya yükleme */
.file-drop {
  border: 2px dashed var(--line);
  border-radius: var(--r-md);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--ink-muted);
  font-size: 14px;
}
.file-drop:hover,
.file-drop.dragover {
  border-color: var(--navy);
  background: var(--navy-muted);
  color: var(--navy);
}
.file-drop i { font-size: 24px; margin-bottom: 6px; display: block; }
.file-drop input[type=file] { display: none; }

.file-list { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }

.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--line-light);
  border-radius: var(--r-sm);
  font-size: 13px;
}
.file-item i { color: var(--ink-muted); font-size: 16px; flex-shrink: 0; }
.file-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }
.file-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-muted);
  padding: 2px 4px;
  border-radius: var(--r-xs);
  font-size: 14px;
  transition: color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
}
.file-item-remove:hover { color: var(--red); background: var(--red-muted); }

/* Parça ekleme */
.part-block {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 12px;
  position: relative;
  background: var(--white);
}

.part-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.part-block-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
}

/* ============================================================
   8. TABLO
   ============================================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-light);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-light);
  color: var(--ink-soft);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td { background: var(--paper); }

/* ============================================================
   9. ROZETLER / BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Durum rozetleri */
.badge-active {
  background: var(--green-muted);
  color: var(--green-dark);
}
.badge-draft {
  background: var(--amber-muted);
  color: var(--amber-dark);
}
.badge-alert {
  background: var(--amber);
  color: var(--white);
}
.badge-deleted {
  background: var(--red-muted);
  color: var(--red-dark);
}

/* Genel rozetler */
.badge-navy {
  background: var(--navy-muted);
  color: var(--navy-dark);
}
.badge-green {
  background: var(--green-muted);
  color: var(--green-dark);
}
.badge-owner {
  background: linear-gradient(135deg, var(--navy), var(--green-dark));
  color: var(--white);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge-purple {
  background: var(--purple-muted);
  color: var(--purple-dark);
}

/* İzin badge listesi */
.perm-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.perm-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: var(--r-xs);
  font-size: 11px;
  font-weight: 500;
  background: var(--navy-muted);
  color: var(--navy-dark);
}

/* ============================================================
   10. REFERANS LİSTESİ (Panel)
   ============================================================ */
.ref-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: start;
}
.ref-list--1 { grid-template-columns: 1fr; }
.ref-list--2 { grid-template-columns: 1fr 1fr; }
.ref-list--3 { grid-template-columns: 1fr 1fr 1fr; }

.view-toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  flex-shrink: 0;
}
.view-btn {
  background: var(--white);
  border: none;
  padding: 0 11px;
  height: 36px;
  cursor: pointer;
  color: var(--ink-muted);
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
}
.view-btn + .view-btn { border-left: 1px solid var(--line); }
.view-btn:hover { background: var(--surface); color: var(--ink); }
.view-btn.active { background: var(--navy-muted); color: var(--navy); }

.ref-card {
  background: var(--white);
  border: 1px solid var(--line-light);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s, border-color 0.15s;
  box-shadow: var(--shadow-xs);
}
.ref-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--line);
}
.ref-card--superseded {
  opacity: .45;
  transition: opacity .2s;
}
.ref-card--superseded:hover {
  opacity: .85;
}

.ref-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-light);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.ref-card-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  flex: 1;
}

.ref-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ref-card-footer {
  display: flex;
  align-items: center;
  gap: 3px 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-muted);
  padding: 7px 14px;
  background: var(--surface);
  border-top: 1px solid var(--line-light);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.ref-card-footer span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ref-card-footer i { font-size: 13px; }

.ref-qr-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--line-light);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ref-qr-thumb img {
  width: 64px;
  height: 64px;
  display: block;
}
.ref-qr-thumb--draft {
  background: var(--surface);
  color: var(--ink-muted);
  font-size: 22px;
}

.ref-id {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--navy-dark);
  background: var(--navy-muted);
  padding: 2px 8px;
  border-radius: var(--r-xs);
  white-space: nowrap;
}

.ref-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.ref-company {
  font-size: 13px;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
}

.ref-actions-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.ref-more {
  position: relative;
}
.ref-more-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  min-width: 190px;
  z-index: 200;
}
.ref-more.open .ref-more-menu { display: block; }
.ref-more-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.ref-more-item:hover { background: var(--surface); }
.ref-more-item--danger { color: var(--danger); }
.ref-more-divider { border: none; border-top: 1px solid var(--line-light); margin: 4px 0; }

.has-tip {
  position: relative;
}
.has-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--white);
  font-size: 11px;
  line-height: 1.4;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 300;
}
.has-tip:hover::after { opacity: 1; }

/* ============================================================
   11. ARAÇ ÇUBUĞU (Arama / Filtre)
   ============================================================ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar-search {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.toolbar-search i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted);
  font-size: 16px;
  pointer-events: none;
}
.toolbar-search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.toolbar-search input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(24,95,165,.10);
}

.toolbar select {
  padding: 8px 32px 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink-soft);
  background: var(--white);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.toolbar select:focus { outline: none; border-color: var(--navy); }

/* ============================================================
   12. İSTATİSTİK PANELİ (Dashboard)
   ============================================================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--line-light);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-xs);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-value--navy  { color: var(--navy); }
.stat-value--green { color: var(--green); }
.stat-value--amber { color: var(--amber-dark); }
.stats-row--6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.stat-label {
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 500;
}

/* ============================================================
   13. GİRİŞ SAYFASI
   ============================================================ */
body.theme-login {
  background: linear-gradient(135deg, #EBF4FF 0%, #E8F5F0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-wrap {
  width: 100%;
  max-width: 440px;
}

.login-card {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 48px 44px 40px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line-light);
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  height: 72px;
  margin: 0 auto 14px;
}

.login-brand-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.login-brand-sub {
  font-size: 13px;
  font-weight: 500;
  color: var(--green);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-divider {
  height: 1px;
  background: var(--line-light);
  margin: 0 0 28px;
}

/* ============================================================
   14. MODAL (QR Görüntüle)
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(30,42,59,.55);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--ink-muted);
  border-radius: var(--r-sm);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--line-light); color: var(--ink); }

.modal-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.modal-qr-id {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 0;
}

.modal-qr-url {
  font-size: 12px;
  color: var(--ink-muted);
  word-break: break-all;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: center;
}

/* ============================================================
   15. BOŞ DURUM
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--ink-muted);
}
.empty-state i {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
  color: var(--line);
}
.empty-state p {
  font-size: 15px;
  margin-bottom: 20px;
}

/* ============================================================
   16. UYARI / ALERT
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 14px;
  margin-bottom: 16px;
}
.alert i { flex-shrink: 0; margin-top: 1px; }

.alert-danger  { background: var(--red-muted);   color: var(--red-dark);   border: 1px solid #f5c6c6; }
.alert-success { background: var(--green-muted);  color: var(--green-dark); border: 1px solid var(--green-light); }
.alert-warning { background: var(--amber-muted);  color: var(--amber-dark); border: 1px solid #f5d9a8; }
.alert-info    { background: var(--navy-muted);   color: var(--navy-dark);  border: 1px solid var(--navy-light); }

/* ============================================================
   17. SAYFALAMA
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 24px;
}

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.pagination a {
  color: var(--ink-soft);
  border: 1px solid var(--line-light);
  background: var(--white);
}
.pagination a:hover { background: var(--navy-muted); color: var(--navy); border-color: var(--navy-light); }

.pagination span.current {
  background: var(--navy);
  color: var(--white);
  border: 1px solid var(--navy);
}
.pagination span.dots {
  color: var(--ink-muted);
  border: none;
  width: auto;
  padding: 0 4px;
}

/* ============================================================
   18. YARDIMCI SINIFLAR
   ============================================================ */
.text-muted  { color: var(--ink-muted); }
.text-soft   { color: var(--ink-soft); }
.text-navy   { color: var(--navy); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-mono   { font-family: var(--font-mono); }
.text-sm     { font-size: 13px; }
.text-xs     { font-size: 12px; }
.text-center { text-align: center; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* ============================================================
   19. YENİ REFERANS FORMU
   ============================================================ */

/* Kart başlığı */
.card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title i {
  color: var(--navy);
  font-size: 18px;
}

/* 4 kolonlu form satırı */
.form-row-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px;
}

/* Tekil / Takım toggle */
.type-toggle {
  display: flex;
  gap: 12px;
}

.type-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 16px;
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  font-family: var(--font-body);
}
.type-btn:hover {
  border-color: var(--navy-light);
  background: var(--navy-muted);
}
.type-btn.active {
  border-color: var(--navy);
  background: var(--navy-muted);
  box-shadow: 0 0 0 3px rgba(24,95,165,.12);
}
.type-btn i {
  font-size: 28px;
  color: var(--ink-muted);
  display: block;
}
.type-btn.active i { color: var(--navy); }

.type-btn-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  display: block;
}
.type-btn-sub {
  font-size: 12px;
  color: var(--ink-muted);
  display: block;
}

/* Parça bloku başlık numarası */
.part-block-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
}

/* Parçalar bölüm başlığı */
.parts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.parts-header h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

/* ============================================================
   20. DUYARLI TASARIM
   ============================================================ */

/* Orta ekran: form-row-3/4 ikili kolona düşer */
@media (max-width: 960px) {
  .form-row-3,
  .form-row-4 { grid-template-columns: 1fr 1fr; }
  .docs-layout { grid-template-columns: 1fr !important; }
}

@media (max-width: 768px) {
  .topnav-brand-text { display: none; }
  .topnav-nav { gap: 2px; }
  .topnav-link span { display: none; }

  .page-wrap { padding: 16px 16px 48px; }

  .page-header { flex-direction: column; align-items: flex-start; }

  .form-row-2,
  .form-row-3,
  .form-row-4 { grid-template-columns: 1fr; }

  .type-toggle { flex-direction: column; }

  .ref-list,
  .ref-list--1,
  .ref-list--2,
  .ref-list--3 { grid-template-columns: 1fr; }

  .view-toggle { display: none; }

  .ref-qr-thumb { display: none; }

  .ref-card-main { gap: 0; }
  .ref-actions-row .btn { flex: 1; }

  .stats-row { grid-template-columns: 1fr 1fr; }

  .login-card { padding: 32px 24px; }

  .modal-box { padding: 24px 20px; }
}

@media (max-width: 480px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-search { min-width: unset; }
  .stats-row { grid-template-columns: 1fr; }
}

/* ============================================================
   LABEL / COMPLIANCE PAGE (public QR page)
   ============================================================ */

.theme-label { background: var(--paper); }

.label-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.label-brand { display: flex; align-items: center; gap: 10px; }
.label-brand-logo { height: 32px; width: auto; }
.label-topbar-right { display: flex; align-items: center; gap: 12px; }

.ppwr-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--green-dark);
  background: var(--green-muted);
  border: 1px solid var(--green-light);
  padding: 4px 12px;
  border-radius: 20px;
}

.lang-toggle-sm {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.lang-toggle-sm .lang-btn {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--white);
  border: none;
  cursor: pointer;
  color: var(--ink-soft);
  transition: background .15s;
}
.lang-toggle-sm .lang-btn.active { background: var(--navy); color: var(--white); }

.label-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.label-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.label-stamp {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.stamp-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 2px;
}
.stamp-id {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
  color: var(--navy-dark);
}
.label-qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.label-qr-box svg { border-radius: var(--r-sm); }
.label-qr-id {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-muted);
  letter-spacing: .04em;
}

.label-product-name {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.02em;
  margin-bottom: 6px;
  line-height: 1.2;
}

.label-company-info {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.7;
  margin-bottom: 20px;
}
.label-company-info strong { color: var(--ink); }

.section-divider { height: 1px; background: var(--line); margin: 24px 0; }

.section-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--navy-dark);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.section-heading .ti { font-size: 15px; color: var(--navy); }

.label-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 4px;
}
.label-meta-key {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 2px;
}
.label-meta-val {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

/* Parça kartı (multi-part için) */
.label-part-block {
  border: 1px solid var(--line-light);
  border-radius: var(--r-lg);
  margin-bottom: 12px;
  overflow: hidden;
}
.label-part-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line-light);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.label-part-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
}
.label-part-body { padding: 16px; }

/* Ölçü chipler */
.label-dims {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.label-dim-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line-light);
  border-radius: var(--r-sm);
  padding: 4px 10px;
}
.label-dim-chip i { font-size: 13px; color: var(--ink-muted); }

/* Kalite kodu chip */
.label-quality-code {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--navy-muted);
  color: var(--navy);
  border-radius: var(--r-sm);
  padding: 3px 10px;
  margin-bottom: 10px;
}

/* Belge listesi */
.label-doc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.label-doc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
  transition: border-color .15s;
}
.label-doc-item:hover { border-color: var(--navy-light); }
.label-doc-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.label-doc-icon--cert { background: var(--red-muted);   color: #A32D2D; }
.label-doc-icon--test { background: var(--navy-muted);  color: var(--navy-dark); }
.label-doc-icon--other { background: var(--paper); color: var(--ink-muted); border: 1px solid var(--line); }
.label-doc-name {
  flex: 1;
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.label-doc-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.label-doc-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.label-doc-btn:hover { background: var(--paper); text-decoration: none; }
.label-doc-btn--view { border-color: var(--navy-light); color: var(--navy); }
.label-doc-btn--view:hover { background: var(--navy-muted); }
.label-doc-btn--dl   { border-color: var(--green-light); color: var(--green-dark); }
.label-doc-btn--dl:hover { background: var(--green-muted); }

/* Galeri */
.label-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.label-gallery-item {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  aspect-ratio: 4/3;
  cursor: zoom-in;
  background: var(--line-light);
  position: relative;
  transition: border-color .15s, box-shadow .15s;
}
.label-gallery-item:hover { border-color: var(--navy-light); box-shadow: var(--shadow-md); }
.label-gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.label-gallery-zoom {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,.45);
  color: #fff;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11px;
  opacity: 0;
  transition: opacity .15s;
}
.label-gallery-item:hover .label-gallery-zoom { opacity: 1; }

/* Lightbox */
.label-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15,20,30,.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.label-lightbox.active { opacity: 1; pointer-events: all; }
.label-lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--r-md);
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  object-fit: contain;
}
.label-lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.label-lightbox-close:hover { background: rgba(255,255,255,.3); }

/* PDF Modal */
.label-pdf-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.label-pdf-modal.active { opacity: 1; pointer-events: all; }
.label-pdf-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #1a1a2e;
  flex-shrink: 0;
  gap: 12px;
}
.label-pdf-title { color: #fff; font-size: 13px; font-weight: 500; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label-pdf-actions { display: flex; gap: 8px; flex-shrink: 0; }
.label-pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--r-sm);
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.label-pdf-btn--close { background: rgba(255,255,255,.15); color: #fff; }
.label-pdf-btn--close:hover { background: rgba(255,255,255,.25); }
.label-pdf-btn--dl { background: var(--green-dark); color: #fff; }
.label-pdf-btn--dl:hover { opacity: .9; text-decoration: none; }
.label-pdf-modal iframe { flex: 1; border: none; width: 100%; background: #525659; }

/* Footer */
.label-footer {
  margin-top: 32px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper);
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.label-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.label-footer-legal { font-size: 11px; }
.label-footer-corp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  border: 1px solid var(--navy-light);
  padding: 6px 14px;
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: background .15s;
}
.label-footer-corp:hover { background: var(--navy-muted); text-decoration: none; }

/* ─── App Footer (panel sayfaları) ─── */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  margin-top: 40px;
  border-top: 1px solid var(--line-light);
  font-size: 12px;
  color: var(--ink-muted);
}
.app-footer-version {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  background: var(--navy-muted);
  color: var(--navy);
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 4px;
}

/* Responsive */
@media (max-width: 680px) {
  .label-card { padding: 20px; }
  .label-meta-grid { grid-template-columns: 1fr 1fr; }
  .label-gallery { grid-template-columns: repeat(2, 1fr); }
  .label-doc-item { flex-wrap: wrap; }
  .label-doc-name { width: 100%; }
  .label-doc-actions { width: 100%; justify-content: flex-end; }
  .label-stamp { flex-direction: column-reverse; }
}
