/* Vangölü Emanet Takip — mobil öncelikli arayüz */

:root {
  --bg: #eef2f6;
  --card: #ffffff;
  --ink: #16212b;
  --ink-soft: #5d6b7a;
  --line: #d8e0e8;
  --brand: #0f3d5c;
  --brand-2: #17628f;
  --ok: #1a7f4b;
  --ok-bg: #e4f5ec;
  --warn: #9a6100;
  --warn-bg: #fdf1dc;
  --danger: #b3261e;
  --danger-bg: #fdeceb;
  --info-bg: #e7f0f8;
  --radius: 12px;
  --tabbar-h: 62px;
  --shadow: 0 1px 3px rgba(16,33,43,.09), 0 1px 2px rgba(16,33,43,.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 10px);
}

a { color: var(--brand-2); text-decoration: none; }

/* ---------- Üst bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: var(--brand); color: #fff;
  box-shadow: 0 2px 8px rgba(15,61,92,.25);
}
.brand { display: flex; align-items: center; gap: 9px; color: #fff; min-width: 0; }
.brand-mark {
  flex: none; width: 34px; height: 34px; border-radius: 9px;
  background: rgba(255,255,255,.16);
  display: grid; place-items: center;
  font-weight: 800; font-size: 14px; letter-spacing: .5px;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: 11.5px; opacity: .78; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex: none; }
.user-chip {
  font-size: 12.5px; background: rgba(255,255,255,.14);
  padding: 5px 10px; border-radius: 999px; white-space: nowrap;
  max-width: 42vw; overflow: hidden; text-overflow: ellipsis;
}
.user-chip .tag { font-size: 10px; opacity: .8; font-weight: 700; }
.btn-icon {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-size: 17px;
  background: rgba(255,255,255,.14); color: #fff; border: 0;
}
.btn-icon:active { background: rgba(255,255,255,.28); }

/* ---------- Yerleşim ---------- */
.wrap { max-width: 960px; margin: 0 auto; padding: 14px; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 2px 0 12px;
}
.page-head h1 { font-size: 19px; margin: 0; }
.page-head .sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 12px;
}
.card > h2 { font-size: 15px; margin: 0 0 12px; color: var(--brand); }

/* ---------- Flash ---------- */
.flash {
  margin: 10px 14px -2px; padding: 11px 14px; border-radius: 10px;
  font-size: 14px; font-weight: 600; border: 1px solid transparent;
}
.flash-success { background: var(--ok-bg); color: var(--ok); border-color: #b9e3cc; }
.flash-error   { background: var(--danger-bg); color: var(--danger); border-color: #f3c9c6; }
.flash-warning { background: var(--warn-bg); color: var(--warn); border-color: #f0dcb4; }
.flash-info    { background: var(--info-bg); color: var(--brand-2); border-color: #c5dcee; }

/* ---------- Form ---------- */
.field { margin-bottom: 13px; }
.field > label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--ink-soft); margin-bottom: 5px;
}
.field .hint { font-size: 11.5px; color: var(--ink-soft); margin-top: 4px; }
.req { color: var(--danger); }

input[type=text], input[type=tel], input[type=number], input[type=password],
input[type=date], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: 12px 13px;
  font-size: 16px; /* iOS zoom engeli */
  font-family: inherit; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line);
  border-radius: 10px; outline: none; appearance: none;
}
select {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d6b7a' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 18px;
  padding-right: 38px;
}
textarea { min-height: 78px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(23,98,143,.14);
}
input[readonly] { background: #f4f7fa; color: var(--ink-soft); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }

/* Dokunmatik seçim grupları (eşya tipi, ödeme) */
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
  flex: 1 1 auto; min-width: 88px; text-align: center;
  padding: 11px 12px; font-size: 14px; font-weight: 600;
  background: #fff; border: 1.5px solid var(--line);
  border-radius: 10px; color: var(--ink-soft); cursor: pointer;
  user-select: none;
}
.choice input:checked + label {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.choice input:focus-visible + label { box-shadow: 0 0 0 3px rgba(23,98,143,.25); }

/* Adet sayacı */
.stepper { display: flex; align-items: stretch; gap: 0; }
.stepper button {
  width: 52px; flex: none; font-size: 22px; font-weight: 700;
  background: #fff; border: 1.5px solid var(--line); color: var(--brand);
  cursor: pointer;
}
.stepper button:first-child { border-radius: 10px 0 0 10px; }
.stepper button:last-child  { border-radius: 0 10px 10px 0; }
.stepper button:active { background: var(--info-bg); }
.stepper input {
  border-radius: 0; text-align: center; font-weight: 700; font-size: 18px;
  border-left: 0; border-right: 0;
}

/* ---------- Butonlar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 13px 18px; min-height: 48px;
  font-size: 15px; font-weight: 700; font-family: inherit;
  border: 1.5px solid transparent; border-radius: 10px;
  cursor: pointer; text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-success { background: var(--ok); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-ghost   { background: #fff; color: var(--brand); border-color: var(--line); }
.btn-block   { width: 100%; }
.btn-sm      { padding: 8px 13px; min-height: 38px; font-size: 13.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-group { display: flex; gap: 9px; flex-wrap: wrap; }
.btn-group > * { flex: 1 1 auto; }

/* ---------- Panel kutucukları ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; margin-bottom: 14px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 14px; box-shadow: var(--shadow);
}
.stat .lbl { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.stat .val { font-size: 23px; font-weight: 800; color: var(--brand); margin-top: 3px; line-height: 1.1; }
.stat .val.sm { font-size: 18px; }
.stat.warn .val { color: var(--warn); }
.stat.ok .val   { color: var(--ok); }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-bottom: 14px; }
.quick a {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 18px 10px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  font-weight: 700; font-size: 14px; color: var(--ink);
}
.quick a .ico { font-size: 25px; }
.quick a.accent { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Emanet kartı (mobil liste) ---------- */
.item-card {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--radius); padding: 12px 13px; margin-bottom: 10px;
  box-shadow: var(--shadow); color: var(--ink);
}
.item-card.s-beklemede { border-left-color: var(--brand-2); }
.item-card.s-teslim    { border-left-color: var(--ok); }
.item-card.s-iptal     { border-left-color: #9aa6b2; }
.item-card.overdue     { border-left-color: var(--warn); background: #fffdf7; }

.item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.item-no { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px; font-weight: 700; color: var(--brand-2); }
.item-name { font-weight: 700; font-size: 16px; margin: 4px 0 2px; }
.item-meta { font-size: 12.5px; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.item-route {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px;
  margin-top: 6px; font-size: 13.5px; font-weight: 700; color: var(--brand-2);
}
.item-route .muted { font-weight: 600; color: var(--ink-soft); font-size: 12.5px; }

.item-card .item-meta + .item-meta { margin-top: 3px; }

.item-bottom {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--line);
}
.item-amount { font-weight: 800; font-size: 15px; }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.b-beklemede { background: var(--info-bg); color: var(--brand-2); }
.b-teslim    { background: var(--ok-bg); color: var(--ok); }
.b-iptal     { background: #eceff2; color: #667381; }
.b-overdue   { background: var(--warn-bg); color: var(--warn); }
.b-unpaid    { background: var(--danger-bg); color: var(--danger); }

/* ---------- Filtre çubuğu ---------- */
.filters { display: flex; flex-direction: column; gap: 9px; margin-bottom: 12px; }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; }
.chips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 3px; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: #fff; border: 1.5px solid var(--line); color: var(--ink-soft); white-space: nowrap;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Detay ---------- */
.dl { display: grid; grid-template-columns: 116px 1fr; gap: 9px 12px; font-size: 14.5px; }
.dl dt { color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.dl dd { margin: 0; font-weight: 600; word-break: break-word; }
.photo-view { width: 100%; border-radius: 10px; border: 1px solid var(--line); margin-top: 6px; }

/* ---------- Tablo (rapor) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -14px; padding: 0 14px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 520px; }
table.tbl th, table.tbl td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); }
table.tbl th { background: #f5f8fa; font-size: 12px; color: var(--ink-soft); font-weight: 700; white-space: nowrap; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.empty { text-align: center; padding: 36px 16px; color: var(--ink-soft); }
.empty .ico { font-size: 42px; display: block; margin-bottom: 8px; opacity: .55; }

.pager { display: flex; justify-content: center; align-items: center; gap: 9px; margin: 14px 0 4px; }
.pager span { font-size: 13px; color: var(--ink-soft); }

/* ---------- Alt sekme çubuğu ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 12px rgba(16,33,43,.07);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; height: var(--tabbar-h); font-size: 10.5px; font-weight: 700;
  color: var(--ink-soft);
}
.tab .ico { font-size: 20px; line-height: 1; }
.tab.active { color: var(--brand); }
.tab.active .ico { transform: translateY(-1px); }

/* ---------- Giriş ekranı ---------- */
.login-page {
  min-height: 100dvh; display: grid; place-items: center;
  padding: 24px 18px; background: linear-gradient(160deg, #0f3d5c, #17628f);
}
.login-box {
  width: 100%; max-width: 380px; background: #fff;
  border-radius: 16px; padding: 26px 22px;
  box-shadow: 0 12px 40px rgba(6,26,40,.3);
}
.login-box .logo { text-align: center; margin-bottom: 20px; }
.login-box .logo .emoji { font-size: 40px; }
.login-box .logo h1 { font-size: 18px; margin: 6px 0 2px; color: var(--brand); }
.login-box .logo p { font-size: 13px; color: var(--ink-soft); margin: 0; }

/* ---------- Yazdırma fişi ---------- */
.receipt {
  width: 76mm; margin: 0 auto; padding: 4mm 3mm;
  font-family: ui-monospace, "Courier New", monospace; font-size: 12px; color: #000; background: #fff;
}
.receipt .r-center { text-align: center; }
.receipt h2 { font-size: 15px; margin: 0 0 2px; }
.receipt .r-no { font-size: 20px; font-weight: 800; letter-spacing: 1px; margin: 5px 0; }
.receipt hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
.receipt .r-line { display: flex; justify-content: space-between; gap: 8px; margin: 2px 0; }
.receipt .r-line b { text-align: right; }
.receipt .r-total { font-size: 15px; font-weight: 800; }
.receipt .r-foot { font-size: 10px; line-height: 1.35; margin-top: 6px; }
.receipt .barcode { margin: 6px 0 2px; }
.receipt .barcode svg { display: block; margin: 0 auto; }

.print-actions { max-width: 380px; margin: 14px auto; display: flex; gap: 9px; padding: 0 14px; }
.print-actions > * { flex: 1; }

@media print {
  body { background: #fff; padding: 0; }
  .topbar, .tabbar, .print-actions, .flash, .no-print { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  .receipt { width: auto; max-width: 76mm; }
  @page { margin: 3mm; }
}

/* ---------- Geniş ekran ---------- */
@media (min-width: 720px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
  .quick { grid-template-columns: repeat(4, 1fr); }
  .wrap { padding: 20px 16px; }
  .page-head h1 { font-size: 22px; }
  .tabbar { justify-content: center; }
  .tab {
    flex: 0 1 170px; height: 56px; font-size: 13px;
    flex-direction: row; gap: 8px;
  }
  .tab .ico { font-size: 17px; }
  .filters { flex-direction: row; align-items: center; }
  .filters .search-row { flex: 1; }
}
