/* Halı Saha ve Kort Rezervasyon Yönetimi — önce mobil, sade ve okunaklı. */
:root {
  --bg: #f4f6f2;
  --card: #ffffff;
  --ink: #17231b;
  --muted: #55645a;
  --line: #d9e0d6;
  --line-soft: #e8ede6;
  --brand: #0d6a39;
  --brand-ink: #ffffff;
  --brand-soft: #e3f1e8;
  --warn: #8a4b00;
  --warn-soft: #fdf0d2;
  --bad: #a3261d;
  --bad-soft: #fbe3e0;
  --info: #1d4f91;
  --info-soft: #e2edfb;
  --radius: 12px;
  --tab-h: 62px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111713; --card: #19211c; --ink: #e8efe9; --muted: #a7b6ab; --line: #2c3a30; --line-soft: #243028;
    --brand: #4cc27e; --brand-ink: #08170e; --brand-soft: #163423;
    --warn: #f1b95a; --warn-soft: #3a2a0e; --bad: #ff8d84; --bad-soft: #3d1b18; --info: #8fb9f2; --info-soft: #172a45;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--brand); }
h1 { font-size: 1.4rem; margin: 0 0 .75rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 0 0 .4rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid #1d6fd6; outline-offset: 2px; }

/* ---- iskelet ---- */
.app { min-height: 100vh; padding-bottom: calc(var(--tab-h) + 8px); }
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-in { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; max-width: 1200px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: .55rem; min-height: 44px; font-weight: 700; color: var(--ink); text-decoration: none; min-width: 0; }
.brand svg { flex: none; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .who { margin-left: auto; display: flex; align-items: center; gap: .5rem; font-size: .875rem; color: var(--muted); }
.top .who form { margin: 0; }
.demo-banner { background: var(--info-soft); color: var(--info); border-bottom: 1px solid var(--line); font-size: .85rem; padding: .45rem 1rem; text-align: center; }
.demo-banner b { color: inherit; }
.demo-banner a { display: inline-block; padding: .75rem .4rem; margin: -.4rem 0; }
main { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.side { display: none; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--tab-h); background: var(--card);
  border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); z-index: 30;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none;
  color: var(--muted); font-size: .75rem; position: relative; min-height: 48px;
}
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a[aria-current="page"] { color: var(--brand); font-weight: 700; }
.badge { background: var(--bad); color: #fff; border-radius: 999px; font-size: .7rem; min-width: 18px; height: 18px; line-height: 18px; text-align: center; padding: 0 5px; font-weight: 700; }
.tabbar .badge { position: absolute; top: 4px; left: calc(50% + 8px); }
@media (min-width: 900px) {
  /* 1.2.3: üst çubuklar (başlık, demo şeridi, kurulum çubuğu, telefona ekle kutusu) tam genişlikte kendi satırında; menü sol, içerik sağ sütunda AYNI satırda.
     Satır şablonu sabit değil: hangi çubuk görünürse görünsün (ya da gizliyse) yerleşim bozulmaz. */
  .app { display: grid; grid-template-columns: 230px 1fr; grid-auto-rows: auto; padding-bottom: 0; }
  .top, .demo-banner, .setupbar, .a2hs { grid-column: 1 / -1; }
  .side { grid-column: 1; }
  main { grid-column: 2; }
  .side { display: block; padding: 1rem .75rem; border-right: 1px solid var(--line); background: var(--card); min-height: calc(100vh - 60px); }
  .side a { display: flex; justify-content: space-between; align-items: center; padding: .55rem .75rem; border-radius: 8px; color: var(--ink); text-decoration: none; margin-bottom: 2px; }
  .side a:hover { background: var(--line-soft); }
  .side a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
  .side .sep { margin: .75rem .75rem .25rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
  .tabbar { display: none; }
  main { width: 100%; margin: 0; max-width: none; padding: 1.25rem 1.5rem; }
}

/* ---- kartlar, düğmeler, formlar ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.card.tight { padding: .75rem; }
.card h2:first-child { margin-top: 0; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: .75rem; }
.grid2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid3 { display: grid; gap: 1rem; grid-template-columns: repeat(3, 1fr); } }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-bottom: 1rem; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.tile .n { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.tile .l { font-size: .8rem; color: var(--muted); }
.tile.alert { border-color: var(--warn); background: var(--warn-soft); }
.tile.alert .n, .tile.alert .l { color: var(--warn); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .5rem 1rem;
  border-radius: 10px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost.danger { background: transparent; color: var(--bad); }
.btn.sm { min-height: 36px; padding: .25rem .7rem; font-size: .9rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .2rem; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; min-height: 44px; padding: .5rem .65rem; border: 1px solid #8a9a8e; border-radius: 8px; background: var(--card); color: var(--ink); font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; vertical-align: middle; margin-right: .35rem; }
.field { margin-bottom: .85rem; }
.hint { font-size: .82rem; color: var(--muted); margin-top: .2rem; }
.fields { display: grid; gap: .85rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .fields.c2 { grid-template-columns: 1fr 1fr; } .fields.c3 { grid-template-columns: repeat(3, 1fr); } .fields.c4 { grid-template-columns: repeat(4, 1fr); } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
form.inline { display: inline; margin: 0; }
.days-pick label { display: inline-flex; align-items: center; margin: 0 .75rem .25rem 0; font-weight: 500; min-height: 44px; }
label:has(> input[type=checkbox]) { display: flex; align-items: center; min-height: 44px; }

.flash { padding: .7rem .9rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: var(--brand-soft); border-color: var(--brand); color: var(--ink); }
.flash.error { background: var(--bad-soft); border-color: var(--bad); color: var(--ink); }
.flash.info { background: var(--info-soft); border-color: var(--info); color: var(--ink); }

/* ---- rozetler ---- */
.chip { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
.chip-confirmed { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.chip-done { background: var(--line-soft); color: var(--muted); border-color: var(--line); }
.chip-pending { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.chip-rejected, .chip-cancelled, .chip-expired { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.chip-noshow { background: #efe3f6; color: #5a2a7a; border-color: #5a2a7a; }
.pay { font-size: .78rem; font-weight: 700; white-space: nowrap; }
.pay-ok { color: var(--brand); }
.pay-part { color: var(--warn); }
.pay-none { color: var(--bad); }
.pill { display: inline-block; padding: .05rem .5rem; border-radius: 999px; background: var(--line-soft); font-size: .78rem; color: var(--muted); }

/* ---- tablolar ---- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: .55rem .6rem; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
table.list th { font-size: .8rem; color: var(--muted); font-weight: 700; white-space: nowrap; }
table.list td.num, table.list th.num { text-align: right; white-space: nowrap; }
table.list tr.total td { font-weight: 800; border-top: 2px solid var(--line); }
.bk-list { list-style: none; margin: 0; padding: 0; }
.bk-list li { border-bottom: 1px solid var(--line-soft); }
.bk-list li:last-child { border-bottom: 0; }
.bk-item { display: grid; grid-template-columns: 108px minmax(0, 1fr) auto; gap: .6rem; align-items: center; padding: .7rem .25rem; text-decoration: none; color: inherit; }
.bk-item:hover { background: var(--line-soft); }
.bk-time { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bk-time small { display: block; font-weight: 500; color: var(--muted); }
.bk-main b { display: block; }
.bk-side { text-align: right; font-size: .85rem; }
/* 1.2.4: dar telefonda (390 px) satır sayfayı yatayda taşırmasın: durum/ödeme alt satıra iner */
main { min-width: 0; }
@media (max-width: 520px) { .bk-item { grid-template-columns: 92px minmax(0, 1fr); } .bk-side { grid-column: 1 / -1; text-align: left; display: flex; flex-wrap: wrap; gap: .25rem .5rem; } }

/* ---- takvim ---- */
.cal-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .75rem; }
.cal-bar .title { font-weight: 800; font-size: 1.05rem; flex: 1 1 auto; min-width: 150px; }
.seg { display: inline-flex; border: 1px solid var(--brand); border-radius: 10px; overflow: hidden; }
.seg a { padding: .45rem .85rem; text-decoration: none; color: var(--brand); font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.seg a[aria-current="true"] { background: var(--brand); color: var(--brand-ink); }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; margin-bottom: .6rem; }
.chips a { white-space: nowrap; padding: .35rem .8rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink); background: var(--card); min-height: 44px; display: inline-flex; align-items: center; }
.chips a[aria-current="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: .75rem; font-size: .8rem; color: var(--muted); margin: .25rem 0 .75rem; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: .3rem; border: 1px solid var(--line); }
.lg-free { background: var(--card); border-style: dashed !important; }
.lg-conf { background: var(--brand-soft); border-color: var(--brand) !important; }
.lg-pend { background: repeating-linear-gradient(45deg, var(--warn-soft), var(--warn-soft) 4px, #fff 4px, #fff 8px); border-color: var(--warn) !important; }
.lg-block { background: repeating-linear-gradient(45deg, #d6dbd6, #d6dbd6 4px, #eef1ee 4px, #eef1ee 8px); }
.cal-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); max-height: 78vh; }
.cal {
  display: grid; position: relative;
  grid-template-columns: 52px repeat(var(--cols), minmax(var(--colw, 128px), 1fr));
  grid-template-rows: 44px repeat(var(--rows), 14px);
  min-width: calc(52px + var(--cols) * var(--colw, 128px));
}
.cal .hd { position: sticky; top: 0; z-index: 6; background: var(--brand-soft); border-bottom: 1px solid var(--line); border-left: 1px solid var(--line-soft); padding: .3rem .5rem; font-size: .85rem; font-weight: 700; display: flex; flex-direction: column; justify-content: center; line-height: 1.2; }
.cal .hd small { font-weight: 500; color: var(--muted); }
.cal .hd.corner { left: 0; z-index: 8; border-left: 0; }
.cal .hd.today { background: var(--brand); color: var(--brand-ink); }
.cal .hd.today small { color: var(--brand-ink); opacity: .85; }
.cal .tm { position: sticky; left: 0; z-index: 5; background: var(--card); font-size: .72rem; color: var(--muted); padding: 2px 6px 0 0; text-align: right; border-right: 1px solid var(--line-soft); }
.cal .gl { grid-column: 1 / -1; border-top: 1px solid var(--line-soft); pointer-events: none; z-index: 0; }
.cal .cell { z-index: 1; margin: 1px; border-radius: 6px; padding: 3px 6px; font-size: .78rem; line-height: 1.25; overflow: hidden; text-decoration: none; color: var(--ink); display: block; }
.cal a.free { border: 1px dashed var(--line); background: var(--card); color: var(--muted); display: flex; align-items: flex-start; justify-content: space-between; gap: .35rem; }
.cal div.free { border: 1px solid var(--line-soft); background: var(--line-soft); color: var(--muted); display: flex; justify-content: space-between; gap: .35rem; opacity: .6; }
.cal a.free:hover, .cal a.free:focus-visible { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.cal .free.past { background: var(--line-soft); }
.cal .free .pr { opacity: .85; }
.cal a.bk { border: 1px solid var(--brand); border-left-width: 5px; background: var(--brand-soft); }
.cal a.bk.pending { border-color: var(--warn); background: repeating-linear-gradient(45deg, var(--warn-soft), var(--warn-soft) 6px, var(--card) 6px, var(--card) 12px); }
.cal a.bk.noshow { border-color: #5a2a7a; background: #efe3f6; }
.cal a.bk.past { opacity: .8; }
.cal a.bk b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .82rem; }
.cal a.bk .st { font-size: .72rem; font-weight: 700; }
.cal a.bk .due { font-size: .72rem; color: var(--bad); font-weight: 700; }
.cal .blk { border: 1px solid #aeb7ae; background: repeating-linear-gradient(45deg, #d6dbd6, #d6dbd6 6px, #eef1ee 6px, #eef1ee 12px); color: #3a463d; font-weight: 600; }
.cal .rec { font-weight: 800; }

/* ---- herkese açık sayfa ---- */
body.pub { background: var(--bg); }
.pub-wrap { max-width: 760px; margin: 0 auto; padding: 1rem; }
.pub-head { background: var(--brand); color: var(--brand-ink); padding: 1.25rem 1rem 1.5rem; }
.pub-head .in { max-width: 760px; margin: 0 auto; }
.pub-head h1 { margin: 0 0 .25rem; font-size: 1.5rem; }
.pub-head a { color: var(--brand-ink); }
.pub-head p { margin: 0; opacity: .95; }
.court-card h2 small { font-weight: 500; color: var(--muted); font-size: .85rem; margin-left: .35rem; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: .5rem; }
.slot { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 58px; border-radius: 10px; border: 1px solid var(--brand); text-decoration: none; background: var(--card); color: var(--ink); padding: .3rem; text-align: center; }
.slot b { font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.slot span { font-size: .8rem; color: var(--muted); }
a.slot:hover, a.slot:focus-visible { background: var(--brand-soft); }
.slot.off { border-color: var(--line); background: var(--line-soft); color: var(--muted); }
.slot.off b { text-decoration: line-through; }
.slot.off span { color: var(--muted); }
.status-hero { text-align: center; padding: 1.25rem 1rem; }
.status-hero .big { font-size: 1.3rem; font-weight: 800; margin-bottom: .35rem; }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .35rem 1rem; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.msgbox { white-space: pre-wrap; background: var(--line-soft); border: 1px solid var(--line); border-radius: 10px; padding: .75rem; font-family: inherit; font-size: .95rem; margin: 0 0 .75rem; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.timeline li { padding: .35rem 0 .35rem .9rem; border-left: 3px solid var(--line); margin-left: .25rem; }
.timeline time { color: var(--muted); font-size: .8rem; display: block; }
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 1.5rem 1rem 2rem; }
.bar { height: 10px; background: var(--line-soft); border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); }
@media print {
  .top, .tabbar, .side, .demo-banner, .btn, .cal-bar, .noprint { display: none !important; }
  body { background: #fff; }
  .app { display: block; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* 1.1.0: açılır ayrıntı başlıkları dokunma hedefi (>= 44 px) */
details > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.flash .btn { margin-left: .4rem; }
.demo-warn { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn); border-radius: 8px; padding: .6rem .8rem; margin-bottom: 1rem; font-size: .9rem; }

/* 1.1.2: müşteri listesini Excel/CSV'den alma */
.help { padding: .25rem 1rem; }
.help summary { font-weight: 700; color: var(--brand); }
.import-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .75rem; margin: .5rem 0; }
.import-columns select { width: 100%; min-height: 44px; font-size: 1rem; }
.import-counts .chip { font-size: .95rem; padding: .3rem .75rem; margin-right: .35rem; }
.import-scroll { margin: .6rem 0; }
.import-table { min-width: 640px; }
.import-table input[type="checkbox"] { width: 24px; height: 24px; }
.import-table tr.import-error td { background: var(--bad-soft); }
.import-table tr.import-exists td, .import-table tr.import-dup td { color: var(--muted); background: var(--line-soft); }
.import-good { color: var(--brand); }
.import-bad { color: var(--bad); }
#import-form .btn { min-height: 48px; font-size: 1.05rem; }

/* ---- 1.2.0: kurulum rehberi, telefona ekle, müşteri bağlantısı ve afiş ---- */
.setupbar { background: var(--brand-soft); border-bottom: 1px solid var(--line); padding: .5rem 1rem; }
.setupbar .in { max-width: 1100px; margin: 0 auto; }
.setupbar a { display: block; text-decoration: none; margin-bottom: .35rem; padding: .35rem 0; }
.progress { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: .35rem 0; }
.progress span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.a2hs { background: var(--warn-soft); border-bottom: 1px solid var(--warn); padding: .6rem 1rem; }
.a2hs .in { max-width: 1100px; margin: 0 auto; }
.a2hs ol { margin: .5rem 0 0 1.2rem; }
.step.next { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.step .row { margin-top: .5rem; }
.demo-box { background: var(--info-soft); }
.poster { border: 3px solid var(--ink); border-radius: 16px; padding: 2rem 1rem; text-align: center; margin: 1rem 0; }
.poster h3 { font-size: 2rem; margin: 0 0 .5rem; }
.posterlink { font-size: 1.3rem; font-weight: 800; word-break: break-all; }
.posterqr { display: flex; justify-content: center; margin: 1rem 0; }
.posterqr svg { width: 240px; height: 240px; max-width: 100%; }
.card.big { font-size: 1.1rem; }
.btn.full { display: flex; width: 100%; justify-content: center; margin-bottom: .6rem; }
#shareLink, #installLink { width: 100%; }
@media print {
  .top, .side, .tabbar, .demo-banner, .setupbar, .a2hs, .help, .row, .btn, .flash, .pub-head { display: none !important; }
  main > h1, main > p, main > .card:not(.print-card), main > form { display: none !important; }
  .print-card h2, .print-card > p.small { display: none; }
  .posterqr svg { width: 9cm; height: 9cm; }
  body { background: #fff; }
}
