/* Reset / temel */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh-base);
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
img, svg { vertical-align: middle; }
[data-lucide], .lucide { width: 1.2em; height: 1.2em; stroke-width: 2; }
.tnum { font-variant-numeric: tabular-nums; }
.text-muted, .muted { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-center { text-align: center; }
.fs-caption { font-size: var(--fs-caption); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.stack-sm > * + * { margin-top: var(--sp-2); }
.mt-1{margin-top:var(--sp-1)} .mt-3{margin-top:var(--sp-3)} .mt-4{margin-top:var(--sp-4)}

/* Uygulama çerçevesi */
.app-body {
  max-width: var(--app-max);
  margin: 0 auto;
  min-height: 100vh; min-height: 100dvh;
  background: var(--bg);
  position: relative;
}
.app-content {
  padding: var(--sp-5) var(--sp-5) calc(var(--bottomnav-h) + env(safe-area-inset-bottom,0px) + 52px);
}

/* Sayfa başlığı (pagehead) */
.pagehead {
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--primary); color: var(--primary-ink);
  margin: calc(var(--sp-5) * -1) calc(var(--sp-5) * -1) var(--sp-4);
  padding: calc(env(safe-area-inset-top,0px) + 15px) var(--sp-5) 15px;
  position: sticky; top: 0; z-index: 900;
}
.pagehead-title { flex: 1; font-size: 20px; font-weight: 800; color: var(--primary-ink); letter-spacing: var(--ls-tight); }
.pagehead.is-detail .pagehead-title { font-size: 18px; }
.pagehead .iconbtn { background: rgba(255,255,255,.16); border-color: transparent; color: var(--primary-ink); }
.pagehead .iconbtn:active { background: rgba(255,255,255,.28); }
.iconbtn {
  width: 40px; height: 40px; border-radius: var(--r-md); flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); cursor: pointer;
}
.iconbtn:active { background: var(--surface-2); }

/* Dashboard başlığı */
.dash-head { display: flex; align-items: center; justify-content: space-between; padding-top: env(safe-area-inset-top,0px); margin-bottom: var(--sp-5); }
.dash-id { display: flex; align-items: center; gap: var(--sp-3); }
.dash-hello { font-size: var(--fs-caption); color: var(--text-3); font-weight: 600; }
.dash-name { font-size: 17px; font-weight: 800; color: var(--text); letter-spacing: -.3px; }

/* Avatar */
.avatar {
  width: 44px; height: 44px; border-radius: var(--r-md); flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
  font-size: var(--fs-subhead); font-weight: 800; text-transform: uppercase;
  border: none; cursor: pointer; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.is-neutral { background: var(--surface-3); color: var(--text-2); }
.avatar.is-danger  { background: var(--danger-soft); color: var(--danger); }
.avatar.is-warning { background: var(--warning-soft); color: var(--warning); }
.avatar.is-success { background: var(--success-soft); color: var(--success); }

/* Buton */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 48px; padding: 0 var(--sp-5);
  font-family: inherit; font-size: var(--fs-body); font-weight: 700; line-height: 1;
  border: 1px solid transparent; border-radius: var(--r-md);
  background: var(--surface-2); color: var(--text);
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: background var(--transition), transform .08s ease, opacity var(--transition);
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn-primary   { background: var(--primary); color: var(--primary-ink); font-weight: 800; box-shadow: 0 10px 24px -12px var(--primary); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-soft      { background: var(--primary-soft); color: var(--primary); }
.btn-ghost     { background: transparent; color: var(--text); }
.btn-danger    { background: var(--danger); color: #fff; font-weight: 800; }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
@media (hover: hover) {
  .btn-primary:hover   { background: var(--primary-hover); }
  .btn-secondary:hover { background: var(--surface-3); }
  .btn-ghost:hover     { background: var(--surface-2); }
  .btn-danger-soft:hover { background: var(--danger); color: #fff; }
  a.list-item:hover, button.list-item:hover { border-color: var(--border-2); }
  .quick-item:hover, .kpi:hover { border-color: var(--border-2); }
}
.btn-block { width: 100%; }
.btn-sm    { min-height: 38px; padding: 0 var(--sp-3); font-size: var(--fs-caption); }
.btn-icon  { padding: 0; width: 48px; min-height: 48px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Form */
.form-group { margin-bottom: var(--sp-3); }
.form-label, label.form-label { display: block; margin-bottom: 7px; font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.form-control, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="tel"], input[type="search"], select, textarea {
  width: 100%; min-height: 48px; padding: 0 14px;
  font-family: inherit; font-size: var(--fs-body); color: var(--text); font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none; -webkit-appearance: none;
}
textarea, textarea.form-control { min-height: 92px; padding: 12px 14px; resize: vertical; line-height: var(--lh-base); }
.form-control::placeholder, input::placeholder, textarea::placeholder { color: var(--text-3); }
.form-control:focus, input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-control.has-error, input.has-error, select.has-error, textarea.has-error { border-color: var(--danger); }
.field-error { margin-top: 6px; font-size: var(--fs-caption); color: var(--danger); font-weight: 600; }
.form-hint   { margin-top: 6px; font-size: var(--fs-caption); color: var(--text-3); }
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A4948F' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px;
}

/* Section label */
.section-title { font-size: var(--fs-label); font-weight: 800; color: var(--text-3); text-transform: uppercase; letter-spacing: .7px; margin: 22px 2px 12px; }
.section-title:first-child { margin-top: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 12px; }
.section-head .section-title { margin: 0; }
.section-link { font-size: 12.5px; font-weight: 700; color: var(--primary); cursor: pointer; background: none; border: none; padding: 0; font-family: inherit; display: inline-flex; align-items: center; gap: 4px; }

/* Kart */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4); }
.card + .card, .card + .list, .list + .card, .list + .list { margin-top: var(--sp-3); }
.card-title { font-size: var(--fs-heading); font-weight: 800; margin-bottom: var(--sp-3); }

/* Hero kart (dashboard) */
.hero { display: block; background: var(--primary); border-radius: var(--r-xl); padding: 22px; box-shadow: 0 18px 36px -18px var(--primary); color: var(--primary-ink); }
.hero-label { font-size: var(--fs-caption); color: var(--primary-ink); opacity: .82; font-weight: 600; }
.hero-value { font-size: 38px; font-weight: 800; color: var(--primary-ink); letter-spacing: -1.5px; margin: 4px 0 16px; line-height: 1.05; }
.hero-bar { height: 9px; border-radius: var(--r-full); background: rgba(255,255,255,.22); overflow: hidden; }
.hero-bar > span { display: block; height: 100%; border-radius: var(--r-full); background: var(--primary-ink); }
.hero-foot { display: flex; justify-content: space-between; margin-top: 11px; }
.hero-foot .lbl { font-size: 11px; color: var(--primary-ink); opacity: .78; font-weight: 600; }
.hero-foot .val { font-size: 16px; color: var(--primary-ink); font-weight: 800; }

/* KPI mini kartlar */
.kpi-row { display: flex; gap: var(--sp-3); margin-top: 14px; }
.kpi { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 15px; display: flex; align-items: center; gap: 11px; }
.kpi-ico { width: 38px; height: 38px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.kpi-ico.is-danger { background: var(--danger-soft); color: var(--danger); }
.kpi-ico.is-warning { background: var(--warning-soft); color: var(--warning); }
.kpi-ico.is-primary { background: var(--primary-soft); color: var(--primary); }
.kpi-ico.is-success { background: var(--success-soft); color: var(--success); }
.kpi-value { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1; }
.kpi-label { font-size: 11.5px; color: var(--text-2); font-weight: 600; margin-top: 3px; }
/* Tıklanabilir hero / KPI */
a.hero, a.kpi { text-decoration: none; color: inherit; }
.hero { cursor: pointer; transition: transform .08s ease; }
.hero:active { transform: scale(.99); }
.kpi { cursor: pointer; transition: border-color var(--transition), transform .08s ease; }
.kpi:active { transform: scale(.98); }

/* eski .stat-grid uyumluluğu (genel KPI ızgarası) */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.stat-grid-3 { grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 15px; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.5px; line-height: 1.15; }
.stat-value.is-danger { color: var(--danger); } .stat-value.is-success { color: var(--success); }
.stat-label { font-size: var(--fs-caption); color: var(--text-2); font-weight: 600; margin-top: 3px; }
.stat-grid-3 .stat-card { padding: 13px; } .stat-grid-3 .stat-value { font-size: 17px; } .stat-grid-3 .stat-label { font-size: 11.5px; }

/* Hızlı erişim grid */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick-item { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px 6px; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; font-family: inherit; text-decoration: none; }
.quick-ico { width: 42px; height: 42px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.quick-label { font-size: 11px; font-weight: 700; color: var(--text-2); text-align: center; line-height: 1.2; }

/* Liste (ayrılmış kart öğeleri) */
.list { display: flex; flex-direction: column; gap: 9px; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 15px;
  padding: 13px 15px; color: var(--text); text-decoration: none; width: 100%; text-align: left;
  font-family: inherit; cursor: pointer;
}
button.list-item { font: inherit; }
.list-item:active { background: var(--surface-2); }
.list-item-ico { flex: none; width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: var(--fs-caption); }
.list-item-ico.is-neutral { background: var(--surface-3); color: var(--text-2); }
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { display: block; font-size: var(--fs-subhead); font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item-sub { display: block; font-size: 12.5px; color: var(--text-3); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item-value { font-size: var(--fs-subhead); font-weight: 800; color: var(--text); white-space: nowrap; }
.list-item-trail { flex: none; display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.list-item-trail br { display: none; }
.list-item-chevron { color: var(--text-3); flex: none; }
.list-item-chevron [data-lucide] { width: 18px; height: 18px; }

/* Chip / rozet */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: var(--r-full); font-size: 10.5px; font-weight: 700; line-height: 1.4; background: var(--surface-3); color: var(--text-2); }
.chip-success { background: var(--success-soft); color: var(--success); }
.chip-danger  { background: var(--danger-soft);  color: var(--danger); }
.chip-warning { background: var(--warning-soft);  color: var(--warning); }
.chip-accent, .chip-primary { background: var(--primary-soft); color: var(--primary); }

/* Occupancy / progress bar */
.occbar { display: flex; align-items: center; gap: 10px; }
.occbar-track { flex: 1; height: 7px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.occbar-fill { height: 100%; border-radius: var(--r-full); background: var(--primary); }
.occbar-fill.is-success { background: var(--success); }
.occbar-label { font-size: 12px; font-weight: 700; color: var(--text-2); white-space: nowrap; }

/* Sözleşme takvimi öğesi (renkli nokta) */
.sched-item { display: flex; align-items: center; gap: 13px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 13px 15px; cursor: pointer; width: 100%; font-family: inherit; text-align: left; }
.sched-dot { width: 8px; height: 8px; border-radius: var(--r-full); flex: none; }
.sched-dot.is-paid { background: var(--success); } .sched-dot.is-late { background: var(--danger); } .sched-dot.is-pending { background: var(--warning); } .sched-dot.is-waived { background: var(--text-3); }

/* Segmented control */
.segmented { display: flex; gap: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px; padding: 4px; margin-bottom: var(--sp-4); }
.segmented a, .segmented button { flex: 1; text-align: center; padding: 9px; border: none; background: transparent; border-radius: 9px; font: inherit; font-size: var(--fs-caption); font-weight: 700; color: var(--text-2); cursor: pointer; text-decoration: none; transition: background var(--transition), color var(--transition); }
.segmented .is-active { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px -3px rgba(0,0,0,.18); }

/* Alt navigasyon */
.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, var(--app-max)); z-index: 950; display: flex; background: var(--surface); border-top: 1px solid var(--border); padding: 9px 12px calc(9px + env(safe-area-inset-bottom,0px)); }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 0; background: none; border: none; cursor: pointer; color: var(--text-3); font-size: 10.5px; font-weight: 700; font-family: inherit; text-decoration: none; transition: color var(--transition); }
.nav-item [data-lucide] { width: 23px; height: 23px; }
.nav-item.is-active { color: var(--primary); }
.nav-item-label { line-height: 1; }

/* Özellik yardımcıları */
.iconbtn { position: relative; }
.bell-badge { position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: var(--r-full); background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--surface); }
.qpay { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--success-soft); color: var(--success); border: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.qpay:active { transform: scale(.92); }
.comm-row { display: flex; gap: 10px; }
.comm-row .btn { flex: 1; }
.btn-wa { background: #25D366; color: #fff; }
@media (hover: hover) { .btn-wa:hover { background: #1FBF5B; } }

/* FAB */
.fab { position: fixed; z-index: 940; bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom,0px) + 18px); right: max(var(--sp-5), calc((100vw - var(--app-max)) / 2 + var(--sp-5))); width: 58px; height: 58px; border-radius: 19px; display: inline-flex; align-items: center; justify-content: center; background: var(--primary); color: var(--primary-ink); border: none; box-shadow: 0 14px 28px -8px var(--primary); cursor: pointer; }
.fab:active { transform: scale(.95); }

/* Toggle switch (izin/ayar satırları) */
.switch { position: relative; flex: none; width: 46px; height: 28px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.switch .track { position: absolute; inset: 0; background: var(--surface-3); border-radius: var(--r-full); transition: background .15s ease; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: transform .15s ease; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(18px); }
.fab [data-lucide] { width: 26px; height: 26px; stroke-width: 2.4; }

/* Flash */
.flash-stack { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.flash { display: flex; align-items: center; gap: var(--sp-3); padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); font-size: var(--fs-subhead); font-weight: 600; }
.flash-ico { flex-shrink: 0; }
.flash-msg { flex: 1; }
.flash-close { background: none; border: none; color: var(--text-3); cursor: pointer; padding: 4px; display: inline-flex; }
.flash-success .flash-ico { color: var(--success); }
.flash-error .flash-ico { color: var(--danger); }
.flash-warning .flash-ico { color: var(--warning); }
.flash-info .flash-ico { color: var(--primary); }

/* Toast */
.toast-stack { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom,0px) + var(--sp-4)); z-index: 1200; display: flex; flex-direction: column; gap: var(--sp-2); width: min(92vw, var(--app-max)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: var(--sp-3); padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); color: var(--text); box-shadow: var(--shadow-md); border: 1px solid var(--border); font-size: var(--fs-subhead); font-weight: 600; opacity: 0; transform: translateY(12px); transition: opacity var(--transition), transform var(--transition); pointer-events: auto; cursor: pointer; }
.toast.is-in { opacity: 1; transform: translateY(0); }
.toast-ico { flex-shrink: 0; }
.toast-msg { flex: 1; }
.toast-success .toast-ico { color: var(--success); }
.toast-error .toast-ico { color: var(--danger); }
.toast-warning .toast-ico { color: var(--warning); }
.toast-info .toast-ico { color: var(--primary); }

/* Sheet (bottom sheet) — TIKLAMA DÜZELTMESİ: kapalıyken pointer-events:none */
.sheet-backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 1300; opacity: 0; pointer-events: none; transition: opacity var(--transition-sheet); }
.sheet-backdrop.is-in { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1310; width: min(100%, var(--app-max)); margin: 0 auto; background: var(--surface); color: var(--text); border-radius: var(--r-2xl) var(--r-2xl) 0 0; padding: 8px var(--sp-5) calc(28px + env(safe-area-inset-bottom,0px)); box-shadow: var(--shadow-md); transform: translateY(100%); pointer-events: none; transition: transform var(--transition-sheet); max-height: 90%; overflow-y: auto; }
.sheet.is-in { transform: translateY(0); pointer-events: auto; }
.sheet-handle { width: 40px; height: 5px; border-radius: var(--r-full); background: var(--border-2); margin: 0 auto 16px; }
.sheet-title { font-size: var(--fs-heading); font-weight: 800; margin-bottom: var(--sp-3); }
.sheet-text { color: var(--text-3); font-size: var(--fs-subhead); font-weight: 500; }
.sheet-body { margin-bottom: var(--sp-5); }
.sheet-actions { display: flex; gap: 11px; margin-top: 22px; }
.sheet-actions .btn { flex: 1; }
.sheet-actions .btn-primary { flex: 1.6; }
body.sheet-open { overflow: hidden; }

/* Skeleton */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-sm); }
.skeleton::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 60%, transparent), transparent); transform: translateX(-100%); animation: shimmer 1.3s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skeleton-line { height: 12px; margin: var(--sp-2) 0; }

/* Boş durum */
.empty-state { text-align: center; padding: var(--sp-8) var(--sp-5); color: var(--text-3); }
.empty-ico { width: 64px; height: 64px; margin: 0 auto var(--sp-4); border-radius: var(--r-lg); display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-3); }
.empty-ico [data-lucide] { width: 30px; height: 30px; }
.empty-title { font-size: var(--fs-heading); font-weight: 800; color: var(--text); margin-bottom: var(--sp-1); }
.empty-text { font-size: var(--fs-subhead); margin-bottom: var(--sp-5); }

/* Arama kutusu (ikonlu) */
.search-box { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 0 14px; margin-bottom: var(--sp-4); }
.search-box [data-lucide] { color: var(--text-3); flex: none; width: 18px; height: 18px; }
.search-box input { border: none; background: transparent; padding: 14px 0; min-height: 0; }
.search-box input:focus { box-shadow: none; }

/* Erişilebilirlik / hareket */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; } }
