:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c2130;
  --muted: #667085;
  --border: #e2e5ea;
  --primary: #2c5f8a;
  --primary-dark: #1f4666;
  --primary-light: #e8f0f7;
  --success: #1c7c3f;
  --success-bg: #e6f6ea;
  --warning: #9a6400;
  --warning-bg: #fff4de;
  --error: #b3261e;
  --error-bg: #fdeceb;
  --radius: 12px;
  --radius-lg: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
}

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

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 14px 90px 14px;
}

/* ---- Üst bar ---- */
.topbar {
  background: var(--primary-dark);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar .brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar .user-chip {
  font-size: 0.85rem;
  color: #dce7f0;
}
.topbar a { color: #fff; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* ---- Alt gezinme (mobil) ---- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  z-index: 40;
}
.bottom-nav a {
  flex: 1;
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  padding: 6px 2px;
  text-decoration: none;
}
.bottom-nav a.active { color: var(--primary); font-weight: 700; }
.bottom-nav .icon { display: block; font-size: 1.3rem; margin-bottom: 2px; }

@media (min-width: 720px) {
  .bottom-nav { display: none; }
  .container { padding-bottom: 40px; }
}

/* ---- Kartlar ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
}
.card h2, .card h3 { margin-top: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.stat-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-tile .num { font-size: 1.9rem; font-weight: 700; color: var(--primary-dark); }
.stat-tile .label { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

/* ---- Butonlar ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: var(--radius);
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  min-height: 48px;
}
.btn:hover { text-decoration: none; opacity: 0.95; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--error); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 2px solid var(--primary); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-block { width: 100%; }
.btn-lg { font-size: 1.15rem; padding: 18px 22px; min-height: 58px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

/* ---- Formlar ---- */
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 0.92rem; }
label .opsiyonel { font-weight: 400; color: var(--muted); font-size: 0.82rem; }
input[type=text], input[type=number], input[type=password], input[type=date],
input[type=search], input[type=file], select, textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  font-size: 1rem;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}
textarea { min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.help-text { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.radio-row { display: flex; gap: 18px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.radio-row label { display: flex; align-items: center; gap: 6px; font-weight: 500; margin: 0; }
fieldset { border: 1.5px solid var(--border); border-radius: var(--radius); padding: 14px; margin: 14px 0; }
legend { font-weight: 700; padding: 0 6px; }

/* ---- Rozetler / durumlar ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}
.badge-rafta { background: var(--success-bg); color: var(--success); }
.badge-disarida { background: var(--warning-bg); color: var(--warning); }
.badge-tukendi { background: #eceef1; color: var(--muted); }
.badge-kapali { background: var(--primary-light); color: var(--primary-dark); }
.badge-acilmis { background: #fdf0e0; color: #a35c00; }
.badge-arsiv { background: #eceef1; color: var(--muted); }

/* ---- Tablo / liste ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.02em; }
.table-wrap { overflow-x: auto; }

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .title { font-weight: 700; }
.list-item .meta { color: var(--muted); font-size: 0.85rem; }

/* ---- Flash mesajları ---- */
.flash { padding: 13px 16px; border-radius: var(--radius); margin-bottom: 14px; font-weight: 600; }
.flash-success { background: var(--success-bg); color: var(--success); }
.flash-error { background: var(--error-bg); color: var(--error); }
.flash-warning { background: var(--warning-bg); color: var(--warning); }

/* ---- Arama kutusu ---- */
.search-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.search-bar input { flex: 1; }

/* ---- Boş durum ---- */
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state .icon { font-size: 2.6rem; margin-bottom: 10px; }

/* ---- QR ---- */
.qr-box { text-align: center; }
.qr-box img { max-width: 260px; width: 100%; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; background: #fff; }

#scanner-video { width: 100%; border-radius: var(--radius); background: #000; max-height: 380px; object-fit: cover; }

.summary-box { background: var(--primary-light); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.summary-box .row { display: flex; justify-content: space-between; padding: 6px 0; }
.summary-box .row strong { font-size: 1.05rem; }

.section-title { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 10px; }
.section-title h2, .section-title h3 { margin: 0; }

.muted { color: var(--muted); }
.text-center { text-align: center; }

/* ---- Yazdırma etiketleri ---- */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .label-sheet { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .label-card { border: 1px dashed #999; padding: 10px; page-break-inside: avoid; }
}
.label-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  background: #fff;
}
.label-card .kod { font-size: 1.5rem; font-weight: 800; letter-spacing: 0.03em; }
.label-card img { width: 140px; height: 140px; }

.split-row { display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 10px; }

.big-tap {
  display: block;
  width: 100%;
  padding: 22px;
  font-size: 1.2rem;
  font-weight: 700;
  border-radius: var(--radius-lg);
  border: none;
  margin-bottom: 12px;
  text-align: center;
  min-height: 68px;
}
