:root {
  --bg: #f8fafc;
  /* Daha soğuk/modern bir gri-beyaz */
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: rgba(148, 163, 184, .2);

  /* Modern Emerald Palette */
  --accent: #10b981;
  /* Vivid Emerald */
  --accent-dark: #059669;
  /* Darker Emerald */
  --accent-soft: rgba(16, 185, 129, .12);
  --accent-gradient: linear-gradient(135deg, #10b981, #059669);

  --danger: #ef4444;

  --shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.08);
  /* Daha soft, yayvan gölge */
  --shadow-active: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --radius: 20px;
  /* Daha yuvarlak */

  /* Font */
  --app-font: 'Poppins', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  /* Safe Areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  overscroll-behavior-y: none;
  /* Pull-to-refresh engelleme */
}

body {
  margin: 0;
  font-family: var(--app-font);
  background:
    radial-gradient(1000px 600px at 10% 0%, rgba(47, 111, 85, .10), transparent 55%),
    radial-gradient(900px 600px at 90% 20%, rgba(34, 197, 94, .10), transparent 55%),
    var(--bg);
  color: var(--text);

  /* Seçimi engelle, uygulama hissi */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* iOS Safari input zoom fix & Selection allow */
input,
textarea,
select,
button {
  font-family: var(--app-font);
  user-select: text;
  -webkit-user-select: text;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: rgba(246, 248, 247, .85);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: calc(14px + var(--safe-top)) 14px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  box-shadow: 0 6px 14px rgba(15, 23, 42, .06);
  display: grid;
  place-items: center;
}

.icon-btn.soft {
  width: 42px;
  height: 42px;
  background: rgba(15, 23, 42, .03);
  box-shadow: none;
}

.icon-btn i {
  font-size: 16px
}

.month-title {
  flex: 1;
  min-width: 0
}

.month {
  font-size: 18px;
  font-weight: 900
}

.sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px
}

.container {
  max-width: 980px;
  margin: 14px auto 70px;
  padding: 0 14px;
  display: grid;
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.card-title i {
  color: var(--accent)
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 12px 12px 8px;
  color: var(--muted);
  font-size: 12px;
}

.dow div {
  text-align: center
}

.grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  padding: 12px;
}

.day {
  position: relative;
  height: 54px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, .08);
  background: #fff;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 10px;
  color: var(--text);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.day.muted {
  color: rgba(15, 23, 42, .35);
  background: rgba(15, 23, 42, .02);
}

.day.today {
  outline: 2px solid rgba(34, 197, 94, .22);
  background: rgba(34, 197, 94, .10);
}

.day.selected {
  box-shadow: 0 0 0 2px var(--accent) inset;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.day-num {
  font-weight: 900;
  font-size: 14px;
  line-height: 1
}

.dot {
  position: absolute;
  bottom: 6px;
  left: 8px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 5px rgba(16, 185, 129, 0.25);
}

.dot.multi {
  /* Reuse base dot style now since we always show count */
}

/* Bottom Sheet */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .35);
  z-index: 40;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: -100%;
  z-index: 50;
  background: #fff;
  border-top: 1px solid var(--line);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  box-shadow: 0 -18px 40px rgba(15, 23, 42, .18);
  padding: 10px 14px calc(6px + var(--safe-bottom));
  transition: bottom .22s ease, transform .22s ease;
  will-change: transform;
  max-width: 980px;
  margin: 0 auto;
}

.sheet.open {
  bottom: 0;
}

.sheet-handle {
  width: 56px;
  height: 6px;
  border-radius: 999px;
  margin: 4px auto 10px;
  background: rgba(15, 23, 42, .18);
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.sheet-head-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sheet-header h3 {
  margin: 0;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sheet-header h3 i {
  color: var(--accent)
}

.sheet-sub {
  font-size: 12px;
  color: var(--muted);
}

.pill-row {
  padding: 10px 2px 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(15, 23, 42, .03);
}

.pill.ghost {
  background: transparent;
}

/* Saatlik çizelge */
.timeline {
  padding: 2px 0 6px;
  display: grid;
  gap: 10px;
  max-height: 45vh;
  overflow: auto;
}

.slot {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.hour {
  min-width: 72px;
  padding: 12px 10px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, .10);
  background: rgba(15, 23, 42, .02);
  color: var(--muted);
  font-weight: 900;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slot-btn {
  flex: 1;
  border-radius: 18px;
  border: 2px dashed var(--line);
  background: transparent;
  color: var(--text);
  padding: 16px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
}

.slot-btn:active {
  transform: scale(0.98);
}

/* DOLU Slot - Modern Green Card */
.slot-btn.has {
  border: none;
  background: var(--accent-gradient);
  box-shadow: 0 8px 20px -4px rgba(16, 185, 129, 0.4);
  color: white;
}

.slot-title {
  font-weight: 700;
  margin: 0;
  font-size: 15px;
}

.slot-note {
  margin: 0;
  color: rgba(255, 255, 255, .9);
  font-size: 13px;
  line-height: 1.4;
}

/* Eğer slot boşsa not rengi koyu kalmalı */
.slot-btn:not(.has) .slot-note {
  color: var(--muted);
}

.slot-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, .9);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Boş slot meta rengi */
.slot-btn:not(.has) .slot-meta {
  color: var(--muted);
}

.slot-btn:not(.has) .slot-meta i {
  color: var(--accent);
}

/* Dolu slot ikonu beyaz olsun */
.slot-btn.has .slot-meta i {
  color: white;
}

/* Form */
.form {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

input,
textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, .12);
  background: #fff;
  color: var(--text);
  padding: 12px 12px;
  outline: none;

  /* iOS zoom engellemek için 16px */
  font-size: 16px;
}

textarea {
  resize: none;
}

.actions {
  display: flex;
  gap: 10px;
  padding-top: 4px;
  flex-wrap: wrap;
}

.btn {
  flex: 1;
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(15, 23, 42, .12);
  background: rgba(15, 23, 42, .04);
  color: var(--text);
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 120px;
}

.btn.primary {
  border: none;
  background: var(--accent-gradient);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  color: white;
}

.btn.primary:active {
  box-shadow: none;
  transform: translateY(1px);
}

.btn.danger {
  border-color: rgba(220, 38, 38, .25);
  background: rgba(220, 38, 38, .08);
  color: var(--danger);
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  z-index: 60;
  background: rgba(255, 255, 255, .95);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 13px;
  max-width: calc(100% - 28px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 860px) {
  .day {
    height: 66px;
  }
}

.slot-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #9ca3af;
  opacity: .8;
}

.slot-btn:hover .slot-empty {
  color: #2f6f55;
  opacity: 1;
}

/* iOS Safari focus zoom fix (kesin) */
.sheet input,
.sheet textarea,
#eventForm input,
#eventForm textarea {
  font-size: 16px !important;
  -webkit-text-size-adjust: 100%;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px;
}

.stat {
  background: rgba(47, 111, 85, .06);
  border: 1px solid rgba(47, 111, 85, .18);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
}

.stat-value {
  font-size: 22px;
  font-weight: 900;
  margin-top: 6px;
  color: var(--accent);
}