/* Lindenpark — mobil öncelikli, açık/koyu tema */
:root {
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #17201e;
  --muted: #64716d;
  --line: #dde3e1;
  --primary: #0f766e;
  --primary-ink: #ffffff;
  --good: #15803d;
  --good-bg: #e8f6ec;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --warn: #9a6700;
  --warn-bg: #fff6dc;
  --info-bg: #e8f1fb;
  --cell: #ffffff;
  --cell-empty: #eef1f0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04);
  --nav-h: 64px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101514;
    --card: #19201e;
    --text: #e6ecea;
    --muted: #93a19c;
    --line: #2a3431;
    --primary: #2bb5a7;
    --primary-ink: #04201d;
    --good: #4ade80;
    --good-bg: #12301f;
    --bad: #f87171;
    --bad-bg: #3a1716;
    --warn: #fbbf24;
    --warn-bg: #3a2e0c;
    --info-bg: #142538;
    --cell: #1f2826;
    --cell-empty: #151b1a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
h1 { font-size: 1.35rem; margin: .2rem 0 .8rem; }
h2 { font-size: 1.2rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 0 0 .6rem; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.bad { color: var(--bad); }
.good { color: var(--good); }
[hidden] { display: none !important; }

/* ── Kabuk ── */
header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: var(--primary); color: var(--primary-ink);
}
.brand { color: inherit; font-weight: 700; text-decoration: none; font-size: 1.05rem; }
.status {
  border: 0; border-radius: 999px; padding: 4px 10px; font-size: .8rem; font-weight: 600;
  background: rgba(255, 255, 255, .18); color: inherit;
}
.status::before { content: "●"; margin-right: 5px; }
.status.ok::before { color: #86efac; }
.status.busy::before { color: #fde68a; }
.status.off { background: #7f1d1d; color: #fff; }
.status.off::before { color: #fca5a5; }

main { max-width: 640px; margin: 0 auto; padding: 14px 16px 24px; }
.boot { padding: 40px 0; text-align: center; color: var(--muted); }

nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: .75rem;
}
nav a .ico { font-size: 1.25rem; line-height: 1; }
nav a.active { color: var(--primary); font-weight: 700; }

/* ── Kart, satır ── */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin: 0 0 12px; border: 1px solid var(--line);
}
.card.warn { background: var(--warn-bg); border-color: transparent; color: var(--text); }
.card.ok { background: var(--good-bg); border-color: transparent; }
.card.error { background: var(--bad-bg); border-color: transparent; }
.card.info { background: var(--info-bg); border-color: transparent; }
.card.hero { text-align: center; padding: 22px 16px; }
.link-card { display: block; color: inherit; text-decoration: none; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.grow { flex: 1; }
.title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.title-row h1, .title-row h3 { margin-bottom: .6rem; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); color: inherit; text-decoration: none; }
.kv:last-child { border-bottom: 0; }
.kv.total { font-size: 1.08rem; border-top: 2px solid var(--line); border-bottom: 0; margin-top: 4px; padding-top: 8px; }
.kv.bad strong { color: var(--bad); }
.note { padding: 8px 10px; border-radius: 10px; margin: 8px 0; font-size: .9rem; }
.note.warn { background: var(--warn-bg); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.quick .btn { flex: 1; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; margin: 0 0 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px; text-align: center; }
.stat .v { display: block; font-weight: 700; font-size: 1.15rem; white-space: nowrap; }
.stat .l { display: block; font-size: .75rem; color: var(--muted); }
.stat.bad .v { color: var(--bad); }
.stats.compact .stat { padding: 6px; }
.stats.compact .stat .v { font-size: 1rem; }

.steps { display: flex; list-style: none; padding: 0; margin: 0 0 12px; gap: 4px; counter-reset: s; }
.steps li {
  flex: 1; text-align: center; font-size: .75rem; padding: 6px 2px; border-radius: 8px;
  background: var(--cell-empty); color: var(--muted); counter-increment: s;
}
.steps li::before { content: counter(s) ". "; }
.steps li.done { background: var(--good-bg); color: var(--good); }
.steps li.current { background: var(--primary); color: var(--primary-ink); font-weight: 700; }

/* ── Düğmeler, form ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; touch-action: manipulation;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; }
.btn.block { display: flex; width: 100%; margin: 8px 0; }
.btn.big { min-height: 54px; font-size: 1.05rem; }
.btn.small { min-height: 34px; padding: 0 10px; font-size: .85rem; }
.btn.round { width: 48px; height: 48px; padding: 0; border-radius: 50%; font-size: 1.5rem; }

label { display: block; margin: 10px 0; font-size: .9rem; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
input[type=text], input[type=password], input[type=number], select, textarea {
  display: block; width: 100%; margin-top: 4px; min-height: 46px; padding: 10px 12px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font: inherit; font-size: 16px; /* iOS büyütmesin */
}
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--primary); }
.form-error { color: var(--bad); min-height: 1.4em; margin: 6px 0; }

.login-wrap { min-height: 80vh; display: flex; align-items: center; }
.login { width: 100%; padding: 24px 18px; }
.login h1 { text-align: center; margin: 6px 0 0; }
.logo { text-align: center; }
.logo img { width: 72px; height: 72px; border-radius: 18px; }

/* ── Bina görünümü ── */
.block-tabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.block-tabs::-webkit-scrollbar { display: none; }
.block-tab {
  position: relative; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font: inherit; font-weight: 700; font-size: 1.05rem; scroll-snap-align: start;
}
.block-tab.active { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.block-tab .badge {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--warn); color: #000; font-size: .7rem; line-height: 18px;
}
.block-title { font-weight: 700; margin: 2px 0 6px; }
.building { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.floor { display: grid; grid-template-columns: 48px 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.floor:last-child { margin-bottom: 0; }
.floor.head { margin-bottom: 2px; }
.floor .side { text-align: center; font-size: .75rem; color: var(--muted); }
.floor-label { display: flex; align-items: center; font-size: .75rem; color: var(--muted); }
.cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 76px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--cell); color: var(--text); font: inherit; padding: 4px; cursor: pointer;
}
.cell .no { font-size: .72rem; color: var(--muted); }
.cell .main { font-size: 1.15rem; font-weight: 700; }
.cell .sub { font-size: .8rem; }
.cell.empty { background: var(--cell-empty); }
.cell.empty .main { color: var(--muted); font-weight: 400; }
.cell.filled { border-color: var(--primary); }
.cell.warn { border-color: var(--bad); background: var(--bad-bg); }
.cell.todo { border-color: var(--warn); }
.cell.done { border-color: var(--good); background: var(--good-bg); }
.cell.done .main::after { content: " ✓"; color: var(--good); }
.cell.short .no::after { content: " · eksik"; color: var(--bad); }
.cell.inactive { opacity: .4; }
.cell.void { visibility: hidden; }
.block-footer { text-align: center; color: var(--muted); font-size: .85rem; margin: 8px 0 12px; }

/* ── Alttan panel ── */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0);
  display: flex; align-items: flex-end; justify-content: center; transition: background .2s;
}
.sheet-overlay.open { background: rgba(0, 0, 0, .45); }
.sheet {
  width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  background: var(--card); border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .2s ease-out;
}
.sheet-overlay.open .sheet { transform: none; }
.sheet-head { display: flex; align-items: baseline; justify-content: space-between; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0; }
.field .label { color: var(--muted); font-size: .9rem; }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper-v { min-width: 36px; text-align: center; font-size: 1.6rem; font-weight: 700; }
.cash { font-size: 1.6rem; font-weight: 700; }
.quick-cash { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 8px; }
.quick-cash .btn.primary { grid-column: 1 / -1; }
.calc { margin: 10px 0; }
.result { text-align: center; font-weight: 700; padding: 10px; border-radius: 12px; background: var(--info-bg); margin: 8px 0; }
.result.big { font-size: 1.4rem; }
.result.good { background: var(--good-bg); color: var(--good); }
.result.bad { background: var(--bad-bg); color: var(--bad); }
.sheet .row { margin-top: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip { display: inline-flex; gap: 3px; padding: 6px 10px; border-radius: 999px; background: var(--cell-empty); border: 1px solid var(--line); font: inherit; font-size: .9rem; color: var(--text); }
.chip.warn { background: var(--warn-bg); }
.chip.link { cursor: pointer; color: var(--primary); font-weight: 600; }
.check-row { padding: 6px 0; font-weight: 600; }
.check-row.good::before { content: "✓ "; color: var(--good); }
.check-row.bad::before { content: "✗ "; color: var(--bad); }

/* ── Liste, tablo ── */
.list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line);
  color: inherit; text-decoration: none; font: inherit; text-align: left; width: 100%;
}
.badge { font-size: .75rem; padding: 3px 8px; border-radius: 999px; background: var(--cell-empty); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--good-bg); color: var(--good); }
.badge.busy { background: var(--warn-bg); color: var(--warn); }
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; font-size: .75rem; padding: 4px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 6px 4px; border-bottom: 1px dashed var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
pre { white-space: pre-wrap; font-family: inherit; margin: 6px 0 0; }
.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.month-nav h1 { margin: 0; }

.flat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.flat-col { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; align-content: start; }
.flat-col strong { grid-column: 1 / -1; text-align: center; }
.flat-toggle { min-height: 34px; border-radius: 8px; border: 1px solid var(--line); font: inherit; }
.flat-toggle.on { background: var(--good-bg); color: var(--good); }
.flat-toggle.off { background: var(--cell-empty); color: var(--muted); text-decoration: line-through; }

/* ── Bildirim ── */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; transition: all .25s;
  background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 12px; max-width: 90vw; box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: var(--bad); }
