:root {
  --bg: #f4f6fa; --card: #fff; --ink: #14231f; --muted: #5d6f6a; --line: #dde6e3;
  --brand: #0a4a93; --brand-2: #1565c0; --brand-soft: #e6effa; --accent: #f2b01e;
  --danger: #c0392b; --danger-soft: #fdecea; --warn: #b7791f; --warn-soft: #fff6e0;
  --ok: #1e8449; --ok-soft: #e6f6ec; --info: #2563eb; --info-soft: #e8f0fe;
  --r: 14px; --shadow: 0 1px 2px rgba(16,40,34,.06), 0 4px 16px rgba(16,40,34,.06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { min-height: 100vh; padding-bottom: calc(76px + env(safe-area-inset-bottom)); -webkit-text-size-adjust: 100%; }
body.admin { padding-bottom: 0; }
a { color: var(--brand-2); }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; line-height: 1.5; }
small, .muted { color: var(--muted); }
main { max-width: 720px; margin: 0 auto; padding: 16px; outline: none; }
body.admin main { max-width: 1280px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* Üst bar */
#topbar { position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff; }
#topbar .in { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 16px; min-height: 54px; }
#topbar .logo { font-weight: 800; letter-spacing: .2px; color: #fff; text-decoration: none; display: flex; align-items: center; gap: 8px; font-size: 1rem; }
#topbar .logo img { width: 28px; height: 28px; }
#topbar .sp { flex: 1; }
#topbar .ib { position: relative; background: rgba(255,255,255,.12); border: 0; color: #fff; border-radius: 10px; padding: 8px 10px; font-size: .9rem; cursor: pointer; text-decoration: none; }
#topbar .badge { position: absolute; top: -4px; right: -4px; background: var(--accent); color: #2b1d00; border-radius: 99px; font-size: .7rem; padding: 1px 6px; font-weight: 700; }

/* Alt menü */
#bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
#bottomnav a { flex: 1; text-align: center; text-decoration: none; color: var(--muted); font-size: .7rem; padding: 4px 2px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
#bottomnav a .i { font-size: 1.25rem; line-height: 1; }
#bottomnav a.on { color: var(--brand); font-weight: 700; }
#bottomnav a.cta .i { background: var(--accent); color: #2b1d00; border-radius: 50%; width: 44px; height: 44px; display: grid; place-items: center; margin-top: -22px; box-shadow: var(--shadow); font-size: 1.5rem; }

/* Kartlar */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 640px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.stat { background: var(--card); border-radius: 12px; padding: 12px; border: 1px solid var(--line); }
.stat b { display: block; font-size: 1.25rem; margin-top: 2px; }
.stat small { font-size: .78rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* Butonlar */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 12px; padding: 11px 16px; font-size: .95rem; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 44px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #2b1d00; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; min-height: 34px; font-size: .85rem; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.wa { background: #25d366; border-color: #25d366; color: #fff; }
.hero-cta { display: block; width: 100%; text-align: center; background: var(--accent); color: #2b1d00; font-weight: 900; font-size: 1.35rem;
  letter-spacing: .5px; border-radius: 18px; padding: 22px 16px; text-decoration: none; box-shadow: 0 8px 24px rgba(242,169,59,.35); border: 0; cursor: pointer; }
.hero-cta small { display: block; font-weight: 600; font-size: .85rem; color: #4a3500; margin-top: 4px; letter-spacing: 0; }

/* Formlar */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=tel], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 11px 12px; border: 1px solid #c9d6d2; border-radius: 11px; background: #fff; color: var(--ink); }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); outline-offset: 1px; border-color: var(--brand-2); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: .92rem; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.check input { width: 20px; height: 20px; margin-top: 1px; flex: none; }
.err { color: var(--danger); font-size: .88rem; margin-top: 6px; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice button { border: 2px solid var(--line); background: #fff; border-radius: 16px; padding: 22px 10px; font-size: 1.15rem; font-weight: 800; cursor: pointer; color: var(--ink); }
.choice button.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.choice button span { display: block; font-size: 1.8rem; margin-bottom: 6px; }
.otp { letter-spacing: 10px; text-align: center; font-size: 1.5rem !important; font-weight: 700; }
.phone-wrap { display: flex; align-items: stretch; }
.phone-wrap span { display: grid; place-items: center; padding: 0 12px; background: #eef3f1; border: 1px solid #c9d6d2; border-right: 0; border-radius: 11px 0 0 11px; font-weight: 600; }
.phone-wrap input { border-radius: 0 11px 11px 0; }

/* Adımlar */
.steps { display: flex; gap: 6px; margin-bottom: 14px; }
.steps i { flex: 1; height: 5px; border-radius: 9px; background: var(--line); }
.steps i.on { background: var(--brand-2); }

/* Rozetler */
.tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: #eef2f1; color: var(--muted); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--danger-soft); color: var(--danger); }
.tag.info { background: var(--info-soft); color: var(--info); }
.tag.brand { background: var(--brand-soft); color: var(--brand); }

/* Listeler */
.list { list-style: none; margin: 0; padding: 0; }
.list > li, .list > a { display: block; padding: 12px 2px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.list > li:last-child, .list > a:last-child { border-bottom: 0; }
.item-title { font-weight: 700; }
.unread { border-left: 4px solid var(--accent); padding-left: 10px !important; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 12px 16px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand-2); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 10px; font-size: .92rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.empty .i { font-size: 2.2rem; display: block; margin-bottom: 6px; }

/* Tablolar */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th, .tbl td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: .75rem; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); background: #f7faf9; position: sticky; top: 0; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover { background: #f4faf8; }
.tbl tr.overdue td { background: #fff4f2; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }

/* Admin */
.admin-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: start; }
.admin-nav { position: sticky; top: 70px; background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 8px; }
.admin-nav a { display: flex; justify-content: space-between; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: .92rem; }
.admin-nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
@media (max-width: 900px) {
  .admin-layout { grid-template-columns: minmax(0, 1fr); }
  .admin-nav { position: static; display: flex; overflow-x: auto; gap: 4px; }
  .admin-nav a { white-space: nowrap; }
}
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar > * { flex: 0 1 auto; width: auto; }
.toolbar input[type=search] { flex: 1 1 220px; }
.cmp { display: grid; grid-template-columns: 150px 1fr 1fr 90px; gap: 0; font-size: .9rem; }
.cmp > div { padding: 8px; border-bottom: 1px solid var(--line); }
.cmp .h { font-weight: 700; background: #f7faf9; }
.cmp .m { color: var(--ok); font-weight: 700; } .cmp .x { color: var(--muted); } .cmp .c { color: var(--danger); font-weight: 700; }
@media (max-width: 640px) { .cmp { grid-template-columns: 100px 1fr 1fr 54px; font-size: .8rem; } }

/* Modal ve toast */
.modal-bg { position: fixed; inset: 0; background: rgba(10,25,21,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .modal-bg { align-items: center; } .modal { border-radius: 18px; } }
.modal.wide { max-width: 980px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; }
.modal-head h2 { margin: 0; }
.x-btn { background: #eef2f1; border: 0; border-radius: 50%; width: 36px; height: 36px; font-size: 1.1rem; cursor: pointer; flex: none; }
.legal-body { white-space: pre-wrap; font-size: .9rem; line-height: 1.55; background: #f7faf9; border-radius: 10px; padding: 12px; max-height: 50vh; overflow: auto; }
#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: #13241f; color: #fff;
  padding: 11px 16px; border-radius: 12px; font-size: .92rem; max-width: 92vw; opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.on { opacity: 1; } #toast.bad { background: var(--danger); }
.banner { border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: .92rem; }
.banner.warn { background: var(--warn-soft); color: #6b4a0f; } .banner.info { background: var(--info-soft); color: #1e3a8a; }
.banner.ok { background: var(--ok-soft); color: #14532d; } .banner.bad { background: var(--danger-soft); color: #7f1d1d; }

/* Karşılama */
.hero { background: linear-gradient(160deg, var(--brand) 0%, #1a73d9 100%); color: #fff; border-radius: 20px; padding: 22px 18px; margin-bottom: 16px; }
.hero h1 { font-size: 1.7rem; font-weight: 900; margin-bottom: 6px; }
.hero p { color: #dbe8fa; }
.how { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.how li { counter-increment: s; position: relative; padding: 0 0 14px 44px; }
.how li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 800; display: grid; place-items: center; }
.tier { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: .93rem; }
.tier:last-child { border-bottom: 0; } .tier b { color: var(--brand); }
.big-amount { font-size: 2rem; font-weight: 900; color: var(--brand); }
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.menu-grid a { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 14px 6px; text-align: center; text-decoration: none; color: var(--ink); font-size: .82rem; font-weight: 600; }
.menu-grid a .i { display: block; font-size: 1.5rem; margin-bottom: 4px; }
.footer { text-align: center; font-size: .78rem; color: var(--muted); padding: 18px 0 6px; }
.footer a { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tier b { white-space: nowrap; margin-left: 10px; }
@media (max-width: 560px) { .g2.collapse { grid-template-columns: 1fr; } }
#bottomnav[hidden] { display: none; }
.tbl select { min-width: 92px; } .tbl input { min-width: 110px; }
.hero .slogan { font-weight: 700; font-size: 1.05rem; margin: -4px 0 8px; opacity: .95; }
.feed-btn { margin-bottom: 14px; }
.tag.sample { background: #eceff4; color: #4b5563; border: 1px dashed #9ca3af; }
