/* ===== Biletim — Mobile-first modern theme ===== */
:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #0e1b2c;
  --ink-2: #5a6b80;
  --muted: #8997a8;
  --line: #e7ecf2;
  --brand: #0a7d68;
  --brand-2: #0c9d83;
  --accent: #0a6cff;
  --warn: #ffb020;
  --danger: #e0413a;
  --ok: #1ea96a;
  --shadow: 0 6px 18px rgba(20,30,50,.06);
  --radius: 14px;
  --radius-lg: 18px;
  --tap: 44px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.45;
  padding-bottom: calc(72px + var(--safe-bottom));
  padding-top: calc(56px + var(--safe-top));
  -webkit-font-smoothing: antialiased;
}

/* ===== Topbar ===== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  height: calc(56px + var(--safe-top));
  padding-top: var(--safe-top);
  display: flex; align-items: center; justify-content: space-between;
  padding-inline: 14px;
  background: linear-gradient(180deg, #0a7d68 0%, #0c9d83 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}
.topbar__brand { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(255,255,255,.18); font-weight: 800;
}
.iconbtn {
  background: rgba(255,255,255,.18); color: #fff; border: 0;
  width: 36px; height: 36px; border-radius: 10px; font-size: 18px;
}

/* ===== Tabbar ===== */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: #fff; border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -2px 14px rgba(0,0,0,.05);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 8px 4px;
  color: var(--muted); text-decoration: none; font-size: 11px;
  min-height: var(--tap);
}
.tabbar a b { font-weight: 600; }
.tabbar a span { font-size: 20px; line-height: 1; }
.tabbar a.active { color: var(--brand); }

/* ===== View ===== */
.view { padding: 12px; max-width: 720px; margin: 0 auto; }
.page { display: flex; flex-direction: column; gap: 12px; }

/* ===== Cards / list ===== */
.card {
  background: var(--panel); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; border: 1px solid var(--line);
}
.list { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }

/* ===== Ticket card ===== */
.ticket__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ticket__tour { font-weight: 700; font-size: 15px; }
.ticket__sub { color: var(--muted); font-size: 12px; }
.ticket__row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 8px; }
.ticket__row.muted { color: var(--ink-2); }
.ticket__customer { font-weight: 600; }
.ticket__date { font-weight: 600; color: var(--brand); }
.money { font-weight: 800; font-size: 17px; }
.ticket__actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
  background: #eef3f8; color: var(--ink-2);
}
.badge.pending   { background: #fff5dc; color: #8a6300; }
.badge.partial   { background: #ffe5d9; color: #a8430a; }
.badge.paid      { background: #d8f5e6; color: #0c7a45; }
.badge.completed { background: #dcecff; color: #0a4ea3; }
.badge.cancelled { background: #fde0e0; color: #a3211c; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; border: 1px solid var(--line); background: #fff;
  color: var(--ink); padding: 10px 14px; border-radius: 10px;
  font-weight: 600; font-size: 14px; min-height: var(--tap);
  cursor: pointer; transition: transform .04s ease, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #f4c8c5; }
.btn.small { padding: 6px 10px; font-size: 12.5px; min-height: 34px; }

/* ===== Forms ===== */
.form .grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field.span2 { grid-column: 1 / -1; }
.field span { font-size: 12px; color: var(--ink-2); font-weight: 600; }
input, select, textarea {
  width: 100%; font-family: inherit; font-size: 15px;
  padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  min-height: var(--tap);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(10,125,104,.25); border-color: var(--brand);
}
textarea { min-height: 80px; resize: vertical; }
.form__actions { display: flex; gap: 8px; margin-top: 14px; }
.form h2, .form h3, .page h2, .page h3 { margin: 0; }

/* ===== Filter bar ===== */
.filterbar {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  background: #fff; padding: 10px; border-radius: var(--radius);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.filterbar input[type="search"] { grid-column: 1 / -1; }
.filterbar .btn { grid-column: span 1; }

/* ===== Detail grid ===== */
.detail__grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px;
}
.detail__grid > div { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.detail__grid > div:last-child { border: 0; }
.detail__grid b { display: block; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }

/* ===== Checkbox ===== */
.checkbox { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.checkbox input { width: 20px; height: 20px; min-height: 20px; }

/* ===== Segmented control ===== */
.seg {
  display: flex; gap: 4px; padding: 4px;
  background: #eef3f8; border-radius: 10px; margin-bottom: 10px;
}
.seg__btn {
  flex: 1; border: 0; background: transparent;
  padding: 8px 10px; border-radius: 8px;
  font-weight: 600; font-size: 13px; color: var(--ink-2);
  cursor: pointer; min-height: 38px;
}
.seg__btn.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ===== Modal ===== */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15,20,30,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
  animation: modalFade .15s ease;
}
.modal__panel {
  width: 100%; max-width: 480px; max-height: 90vh; overflow: auto;
  position: relative;
  animation: modalUp .18s ease;
}
.modal__close {
  position: absolute; top: 8px; right: 10px;
  width: 36px; height: 36px; border-radius: 999px;
  background: #f1f4f8; border: 0; color: var(--ink);
  font-size: 22px; line-height: 1; cursor: pointer; z-index: 2;
}
.modal__close:active { background: #e3e8ee; }
@keyframes modalFade { from { opacity:0 } to { opacity:1 } }
@keyframes modalUp { from { transform: translateY(12px); opacity:0 } to { transform: translateY(0); opacity:1 } }

/* mobil: aşağıdan açılan sheet */
@media (max-width: 600px) {
  .modal { align-items: flex-end; padding-bottom: calc(12px + var(--safe-bottom)); }
  .modal__panel { border-radius: 18px 18px var(--radius) var(--radius); }
}

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(80px + var(--safe-bottom)); z-index: 80;
  background: #0e1b2c; color: #fff; padding: 10px 14px;
  border-radius: 10px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: all .25s;
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #a31a14; }
.toast.ok  { background: #0c7a45; }

/* ===== Reports ===== */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.kpi b { display: block; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.kpi span { font-size: 22px; font-weight: 800; color: var(--ink); }
.report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-table th, .report-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.report-table th { color: var(--muted); font-weight: 600; }

/* ===== Empty ===== */
.empty {
  text-align: center; padding: 40px 20px; color: var(--muted);
  background: #fff; border-radius: var(--radius); border: 1px dashed var(--line);
}
.empty h3 { color: var(--ink); margin: 0 0 4px; }

/* ===== Off-screen PDF stage ===== */
#pdfStage {
  position: fixed; left: -10000px; top: 0;
  width: 794px; /* A4 width at 96dpi */
  background: #fff; color: #000;
}

/* PDF içerik şablonu */
.pdf-doc {
  font-family: Arial, Helvetica, sans-serif; color: #111;
  padding: 36px 40px; width: 794px; box-sizing: border-box; background:#fff;
}
.pdf-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid #0a7d68; padding-bottom: 12px; margin-bottom: 18px; }
.pdf-head h1 { margin: 0; font-size: 24px; color: #0a7d68; }
.pdf-head .meta { text-align: right; font-size: 12px; color: #444; }
.pdf-title { font-size: 18px; font-weight: 700; margin: 6px 0 14px; }
.pdf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; font-size: 13px; }
.pdf-grid div { padding: 6px 0; border-bottom: 1px dashed #d6d6d6; }
.pdf-grid b { display: block; color: #777; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; }
.pdf-price-block { background: #f3faf7; border: 1px solid #0a7d68; padding: 12px; border-radius: 8px; margin-top: 16px; }
.pdf-price-block .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.pdf-price-block .total { font-size: 18px; font-weight: 800; color: #0a7d68; border-top: 1px solid #0a7d68; padding-top: 8px; margin-top: 6px; }
.pdf-foot { margin-top: 24px; font-size: 11px; color: #555; text-align: center; border-top: 1px solid #ddd; padding-top: 12px; }
.pdf-stamp { display: inline-block; padding: 4px 12px; border: 2px solid #0a7d68; color: #0a7d68; font-weight: 800; transform: rotate(-3deg); margin-top: 8px; }

/* iPad / desktop */
@media (min-width: 700px) {
  .view { padding: 18px; }
  .filterbar { grid-template-columns: 2fr 1fr 1fr 1fr; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
}
