:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --add: #15803d;
  --add-bg: #dcfce7;
  --sub: #b91c1c;
  --sub-bg: #fee2e2;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  line-height: 1.45;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: var(--primary);
  color: #fff;
}
.topbar h1 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.topbar-admin { background: #1e293b; }

.container {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 8px; font-size: 1.3rem; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

/* Form */
label { display: block; font-weight: 600; margin: 16px 0 6px; }
input[type="text"], input[type="tel"], input[type="password"], input[type="number"], input[type="search"] {
  width: 100%;
  font-size: 1.05rem;           /* iOS'ta otomatik zoom olmasın diye >= 16px */
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15); }
.hint { margin: 6px 0 0; font-size: 0.85rem; color: var(--muted); }

label.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
  font-size: 0.92rem;
  margin-top: 12px;
  cursor: pointer;
}
label.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--primary); }

.kvkk { margin-top: 18px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; background: #f8fafc; }
.kvkk summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.kvkk-text { font-size: 0.85rem; color: #334155; }
.kvkk-text p { margin: 8px 0; }

/* Butonlar */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  padding: 13px 18px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  cursor: pointer;
  background: #e2e8f0;
  color: var(--text);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { display: flex; width: 100%; margin-top: 16px; }
.btn-large { font-size: 1.25rem; padding: 18px; }
.btn-small { padding: 8px 12px; font-size: 0.875rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: var(--border); color: inherit; }
.topbar .btn-ghost { border-color: rgba(255, 255, 255, 0.35); color: #fff; }
.btn-add { background: var(--add); color: #fff; }
.btn-sub { background: var(--sub); color: #fff; }

.link {
  background: none;
  border: none;
  padding: 4px;
  font: inherit;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
}
.link.muted { color: var(--muted); }

.error, .success {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
}
.error { background: var(--sub-bg); color: var(--sub); }
.success { background: var(--add-bg); color: var(--add); }

/* Katılımcı QR ekranı */
.person-name { font-size: 1.5rem; margin: 6px 0; word-break: break-word; }
.person-name.big { font-size: 2rem; line-height: 1.15; letter-spacing: 0.01em; margin: 4px 0; }
.balance-box {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin: 10px 0 14px;
}
.balance-value { font-size: 3.4rem; font-weight: 800; color: var(--primary); line-height: 1; font-variant-numeric: tabular-nums; }
.balance-label { font-size: 1.2rem; color: var(--muted); font-weight: 600; }
.qr-code { width: min(78vw, 320px); margin: 6px auto 10px; }
.qr-code svg { display: block; width: 100%; height: auto; border-radius: 8px; }

@keyframes flash-up { 0% { color: var(--add); transform: scale(1.18); } 100% { color: var(--primary); transform: scale(1); } }
@keyframes flash-down { 0% { color: var(--sub); transform: scale(0.88); } 100% { color: var(--primary); transform: scale(1); } }
.flash-up { display: inline-block; animation: flash-up 0.9s ease-out; }
.flash-down { display: inline-block; animation: flash-down 0.9s ease-out; }

.spinner {
  width: 36px; height: 36px; margin: 10px auto;
  border: 4px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Görevli paneli */
.tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.tab {
  flex: 1;
  padding: 14px 8px;
  font: inherit;
  font-weight: 700;
  border: none;
  background: none;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  cursor: pointer;
}
.tab.active { color: var(--text); border-bottom-color: var(--primary); }

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #0f172a;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}
.video-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}
.seg {
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 14px 8px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}
.seg-add.active { border-color: var(--add); background: var(--add-bg); color: var(--add); }
.seg-sub.active { border-color: var(--sub); background: var(--sub-bg); color: var(--sub); }

.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.quick-btn { font-size: 1.2rem; padding: 14px 0; background: #f1f5f9; border-color: var(--border); }
.quick-btn.active { border-color: var(--text); background: #e2e8f0; }

.history { margin-top: 18px; }
.history summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.history-list { list-style: none; padding: 0; margin: 8px 0 0; }
.history-list li {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.tx-add { color: var(--add); font-weight: 800; }
.tx-sub { color: var(--sub); font-weight: 800; }
.tx-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.list-tools { display: flex; gap: 8px; }
.list-tools input { flex: 1; }
.export { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.people { list-style: none; padding: 0; margin: 0; }
.people li + li { border-top: 1px solid var(--border); }
.people > li.center { padding: 14px 0; }
.person-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 4px;
  font: inherit;
  text-align: left;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
}
.person-row:active { background: #f8fafc; }
.person-row-main { display: flex; flex-direction: column; min-width: 0; }
.person-row-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-row-balance { font-weight: 800; font-size: 1.2rem; color: var(--primary); font-variant-numeric: tabular-nums; }
