/* ============ Randevu Takip — iOS tasarım sistemi ============ */
:root {
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --card2: #F2F2F7;
  --text: #000000;
  --text2: #6D6D72;
  --text3: #AEAEB2;
  --sep: rgba(60, 60, 67, 0.15);
  --accent: #007AFF;
  --accent-soft: rgba(0, 122, 255, 0.12);
  --green: #34C759;
  --green-soft: rgba(52, 199, 89, 0.14);
  --red: #FF3B30;
  --red-soft: rgba(255, 59, 48, 0.12);
  --orange: #FF9500;
  --orange-soft: rgba(255, 149, 0, 0.14);
  --gray-soft: rgba(120, 120, 128, 0.12);
  --tabbar-bg: rgba(249, 249, 249, 0.82);
  --sheet-bg: #FFFFFF;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.06);
  --hero-grad: linear-gradient(135deg, #0A84FF 0%, #5E5CE6 100%);
  --hero-grad-ok: linear-gradient(135deg, #30D158 0%, #34C7A9 100%);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1C1C1E;
    --card2: #2C2C2E;
    --text: #FFFFFF;
    --text2: #98989E;
    --text3: #636366;
    --sep: rgba(84, 84, 88, 0.5);
    --accent: #0A84FF;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --green: #30D158;
    --green-soft: rgba(48, 209, 88, 0.18);
    --red: #FF453A;
    --red-soft: rgba(255, 69, 58, 0.16);
    --orange: #FF9F0A;
    --orange-soft: rgba(255, 159, 10, 0.18);
    --gray-soft: rgba(120, 120, 128, 0.24);
    --tabbar-bg: rgba(22, 22, 24, 0.82);
    --sheet-bg: #1C1C1E;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.4);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  font-size: 17px;
  line-height: 1.35;
  overscroll-behavior-y: none;
}
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 17px; color: var(--text); }

.hidden { display: none !important; }

/* ============ Kilit ekranı ============ */
#lock {
  position: fixed; inset: 0; background: var(--bg); z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; padding-bottom: max(24px, env(safe-area-inset-bottom));
}
.lock-icon { font-size: 56px; margin-bottom: 12px; }
.lock-logo { width: 170px; color: var(--text); margin-bottom: 20px; }
.lock-logo svg { width: 100%; height: auto; display: block; }
.nav-logo { width: 74px; color: var(--text); margin-bottom: 6px; }
.nav-logo svg { width: 100%; height: auto; display: block; }
.lock-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; text-align: center; }
.lock-sub { font-size: 15px; color: var(--text2); margin-bottom: 28px; text-align: center; max-width: 300px; }
.pin-dots { display: flex; gap: 16px; margin-bottom: 32px; min-height: 14px; }
.pin-dot {
  width: 13px; height: 13px; border-radius: 50%;
  border: 1.5px solid var(--text3); transition: all 0.15s;
}
.pin-dot.on { background: var(--accent); border-color: var(--accent); }
.pin-dots.shake { animation: shake 0.4s; }
@keyframes shake {
  0%,100% { transform: translateX(0); } 20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); }
}
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; justify-content: center; }
.key {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--gray-soft); font-size: 28px; font-weight: 400;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s;
  user-select: none; -webkit-user-select: none;
}
.key:active { background: var(--sep); transform: scale(0.94); }
.key { transition: transform 0.1s ease, background 0.1s ease; }
.chip:active { opacity: 0.7; }
.key.ghost { background: transparent; font-size: 17px; color: var(--accent); font-weight: 500; }
.lock-actions { margin-top: 26px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.lock-msg { margin-top: 18px; font-size: 14px; color: var(--red); text-align: center; min-height: 20px; }

/* ============ Ana yerleşim ============ */
#app { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.view { display: none; animation: fadein 0.18s ease; }
.view.active { display: block; }
@keyframes fadein { from { opacity: 0.4; } to { opacity: 1; } }

.nav {
  position: sticky; top: 0; z-index: 20;
  padding: calc(10px + env(safe-area-inset-top)) 16px 8px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.8); backdrop-filter: blur(20px) saturate(1.8);
  display: flex; align-items: flex-end; justify-content: space-between;
}
.large-title { font-size: 33px; font-weight: 800; letter-spacing: 0.2px; }
.nav-sub { font-size: 14px; color: var(--text2); font-weight: 500; margin-top: 1px; }
.nav-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 500; flex-shrink: 0;
}

.content { padding: 4px 16px 16px; max-width: 640px; margin: 0 auto; }

/* ============ Kartlar & listeler ============ */
.hero {
  border-radius: 20px; padding: 22px 20px; color: #fff;
  background: var(--hero-grad); box-shadow: var(--shadow);
  margin-bottom: 18px; position: relative; overflow: hidden;
  transition: transform 0.12s ease;
}
button.hero { width: 100%; text-align: left; display: block; }
button.hero:active { transform: scale(0.985); }
.hero.ok { background: var(--hero-grad-ok); }
.hero-label { font-size: 14px; font-weight: 600; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.6px; }
.hero-amount { font-size: 40px; font-weight: 800; letter-spacing: -0.5px; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.hero-sub { font-size: 14px; opacity: 0.85; font-weight: 500; }
.hero-time { font-size: 44px; letter-spacing: -1px; }
.hero-name { font-size: 19px; font-weight: 700; margin-bottom: 3px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hero-chip {
  background: rgba(255,255,255,0.18); border-radius: 100px;
  padding: 5px 12px; font-size: 13px; font-weight: 600;
}

.section-title {
  font-size: 13px; font-weight: 600; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin: 22px 4px 8px; display: flex; justify-content: space-between; align-items: center;
}
.section-title .link { font-size: 13px; color: var(--accent); text-transform: none; letter-spacing: 0; font-weight: 600; }

.list { background: var(--card); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; position: relative; width: 100%; text-align: left;
}
.row + .row::before {
  content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 0.5px; background: var(--sep);
}
.row:active { background: var(--gray-soft); }
.row.static:active { background: none; }
.row-time { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); min-width: 48px; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--text2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-end { text-align: right; flex-shrink: 0; }
.row-amount { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chevron { color: var(--text3); font-size: 14px; flex-shrink: 0; }
.dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }

.badge {
  display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 6px;
  padding: 2.5px 7px; letter-spacing: 0.2px; margin-top: 3px;
}
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.badge.blue { background: var(--accent-soft); color: var(--accent); }
.badge.gray { background: var(--gray-soft); color: var(--text2); }

.row.cancelled .row-title, .row.cancelled .row-time { text-decoration: line-through; color: var(--text3); }
.row.cancelled .row-sub { color: var(--text3); }

.empty {
  text-align: center; padding: 28px 16px; color: var(--text2); font-size: 15px;
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
}
.empty .big { font-size: 34px; display: block; margin-bottom: 8px; }

/* ============ Butonlar ============ */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px; border-radius: 13px;
  background: var(--accent); color: #fff; font-size: 17px; font-weight: 600;
  transition: opacity 0.1s;
}
.btn:active { opacity: 0.8; transform: scale(0.97); }
.btn { transition: transform 0.12s ease, opacity 0.12s ease; }
.btn.secondary { background: var(--accent-soft); color: var(--accent); }
.btn.danger-soft { background: var(--red-soft); color: var(--red); }
.btn.green { background: var(--green); }
.btn.small { padding: 9px 14px; font-size: 15px; width: auto; border-radius: 10px; }
.btn:disabled { opacity: 0.4; }

/* ============ Sekme çubuğu ============ */
#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: space-around;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--tabbar-bg);
  -webkit-backdrop-filter: blur(24px) saturate(1.8); backdrop-filter: blur(24px) saturate(1.8);
  border-top: 0.5px solid var(--sep);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--text3); font-size: 10.5px; font-weight: 600;
  padding: 4px 10px; flex: 1; max-width: 110px;
}
.tab svg { width: 26px; height: 26px; }
.tab.active { color: var(--accent); }

/* ============ Alt sayfa (sheet) ============ */
#sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 40;
  opacity: 0; transition: opacity 0.22s;
}
#sheet-backdrop.show { opacity: 1; }
#sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  background: var(--sheet-bg); border-radius: 18px 18px 0 0;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 88dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  max-width: 640px; margin: 0 auto;
}
#sheet.show { transform: translateY(0); }
.sheet-grip { width: 38px; height: 5px; border-radius: 3px; background: var(--sep); margin: 2px auto 14px; }
.sheet-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.sheet-sub { font-size: 14px; color: var(--text2); margin-bottom: 14px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.field input[type="text"], .field input[type="number"], .field input[type="date"],
.field input[type="time"], .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 11px; border: none;
  background: var(--gray-soft); outline: none; -webkit-appearance: none; appearance: none; min-height: 46px;
}
.field input:focus { box-shadow: 0 0 0 2px var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.field-hint { font-size: 12.5px; color: var(--text2); margin-top: 6px; }
.sheet-note {
  background: var(--gray-soft); border-radius: 10px; padding: 10px 12px;
  font-size: 14.5px; color: var(--text); margin-bottom: 12px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.sheet-note.linked { border-left: 3px solid var(--accent); }
.sheet-note.linked b { color: var(--accent); font-size: 13px; }

/* Notlar */
.note-list { display: flex; flex-direction: column; gap: 10px; }
.note-card {
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  padding: 13px 15px; text-align: left; width: 100%;
  transition: transform 0.12s ease;
}
.note-card:active { transform: scale(0.99); }
.note-top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.note-tag { font-size: 11.5px; font-weight: 700; border-radius: 6px; padding: 3px 8px; }
.note-date { font-size: 12.5px; color: var(--text2); font-weight: 500; margin-left: auto; }
.note-text {
  font-size: 15px; line-height: 1.45; color: var(--text);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.note-prov {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text2); font-weight: 600; margin-top: 9px;
}
.note-dot { font-size: 12px; }

.field textarea { resize: none; line-height: 1.45; }

/* iOS segmented control */
.seg { display: flex; background: var(--gray-soft); border-radius: 11px; padding: 2.5px; gap: 2px; }
.seg .chip {
  flex: 1; justify-content: center; padding: 8px 4px; border-radius: 9px;
  border: none; background: transparent; color: var(--text2); font-size: 14px; font-weight: 600;
  transition: all 0.15s ease;
}
.seg .chip.on {
  background: var(--card); color: var(--text); border-color: transparent;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* yatay kaydırılan hızlı seçim hapları */
.pills { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pills .chip { white-space: nowrap; flex-shrink: 0; }
.chip {
  padding: 8px 14px; border-radius: 100px; background: var(--gray-soft);
  font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 7px;
  border: 1.5px solid transparent;
}
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.daypick { display: flex; gap: 6px; }
.daypick .chip { padding: 8px 0; flex: 1; justify-content: center; border-radius: 10px; }
.colorpick { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; }
.swatch.on { border-color: var(--text); }

.sheet-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.action-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px 4px; font-size: 17px; font-weight: 500; text-align: left;
  border-bottom: 0.5px solid var(--sep);
}
.action-row:last-child { border-bottom: none; }
.action-row .ico { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.action-row.red { color: var(--red); }
a.action-row { text-decoration: none; color: inherit; }

/* Özet satırları */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--card); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12.5px; color: var(--text2); font-weight: 600; margin-top: 2px; }

/* Hafta gezinme */
.weeknav {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
  padding: 6px 8px; margin-bottom: 14px;
}
.weeknav .wk-label { font-size: 15px; font-weight: 700; }
.weeknav .wk-sub { font-size: 12px; color: var(--text2); font-weight: 500; text-align: center; }
.weeknav button { width: 40px; height: 36px; font-size: 20px; color: var(--accent); font-weight: 600; }
.day-head {
  display: flex; align-items: baseline; gap: 8px; margin: 16px 4px 6px;
  width: calc(100% - 8px); text-align: left; padding: 2px 0;
}
.day-head .day-add {
  margin-left: auto; color: var(--accent); font-size: 19px; font-weight: 500;
  line-height: 1; padding: 0 4px; opacity: 0.55;
}
.day-head:active { opacity: 0.55; }
.day-head .d { font-size: 15px; font-weight: 700; }
.day-head .d.today { color: var(--accent); }
.day-head .n { font-size: 13px; color: var(--text2); }

/* Aylık takvim ızgarası */
.mgrid-head {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  font-size: 11.5px; font-weight: 700; color: var(--text2); text-align: center; margin-bottom: 4px;
}
.mgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mcell {
  aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; background: var(--card);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04); transition: transform 0.1s ease;
}
.mcell.empty-cell { background: transparent; box-shadow: none; }
.mcell:active { transform: scale(0.93); }
.mnum { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mdots { display: flex; gap: 3px; height: 6px; align-items: center; }
.mdots i { width: 5px; height: 5px; border-radius: 50%; display: block; }
.mcell.today .mnum { color: var(--accent); font-weight: 800; }
.mcell.sel { background: var(--accent); }
.mcell.sel .mnum { color: #fff; }
.mcell.sel .mdots i { background: rgba(255,255,255,0.9) !important; }

/* Seans paketleri */
.pkg-card {
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  padding: 13px 15px; text-align: left; width: 100%; transition: transform 0.12s ease;
}
.pkg-card:active { transform: scale(0.99); }
.pkg-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.pkg-name { font-size: 15.5px; font-weight: 700; margin-right: auto; }
.pkg-bar { height: 7px; border-radius: 4px; background: var(--gray-soft); overflow: hidden; }
.pkg-fill { height: 100%; border-radius: 4px; transition: width 0.3s ease; }
.pkg-sub { font-size: 12.5px; color: var(--text2); font-weight: 500; margin-top: 7px; }

/* Geri düğmesi */
.back-btn { color: var(--accent); font-size: 16px; font-weight: 500; padding: 2px 0 4px; display: block; }

/* Arama kutusu */
.search-box {
  width: 100%; padding: 10px 14px; border-radius: 11px; border: none;
  background: var(--gray-soft); outline: none; -webkit-appearance: none; appearance: none;
  font-size: 16px; margin-bottom: 12px;
}

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px); z-index: 60;
  background: var(--card2); color: var(--text);
  padding: 11px 20px; border-radius: 100px; font-size: 15px; font-weight: 600;
  box-shadow: 0 6px 24px rgba(0,0,0,0.25); opacity: 0; transition: all 0.25s; pointer-events: none;
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
