/* Kayıt Botu paneli — ortak tasarım sistemi (panel ve giriş sayfası).
   Renkler, boşluklar, yarıçaplar ve gölgeler aşağıdaki değişkenlerden gelir.
   Tema: <html data-theme="light|dark">; öznitelik yoksa sistem tercihi kullanılır. */

:root {
  color-scheme: light;
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #f0f3f2;
  --surface-3: #e7ecea;
  --text: #111b21;
  --muted: #53635c;
  --line: #dfe5e2;
  --line-strong: #c7d0cc;
  --accent: #008069;
  --accent-strong: #00705c;
  --accent-soft: #dff3ec;
  --accent-bright: #25d366;
  --on-accent: #ffffff;
  --focus: #1f8fff;

  --ok: #0b7a43;     --ok-soft: #e1f4e8;
  --warn: #8f5500;   --warn-soft: #fcf0d8;
  --info: #1d5bb8;   --info-soft: #e3edfc;
  --bad: #b3261e;    --bad-soft: #fbe5e3;
  --neutral: #53635c; --neutral-soft: #eaefed;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-full: 999px;
  --shadow-sm: 0 1px 2px rgba(17, 27, 33, .06);
  --shadow: 0 1px 2px rgba(17, 27, 33, .05), 0 4px 14px rgba(17, 27, 33, .06);
  --shadow-lg: 0 10px 40px rgba(17, 27, 33, .18);
  --tap: 40px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --side-w: 240px;
  --bottom-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1014;
    --surface: #111b21;
    --surface-2: #17232a;
    --surface-3: #1f2d35;
    --text: #e9edef;
    --muted: #97a8b1;
    --line: #22313a;
    --line-strong: #34454f;
    --accent: #00a884;
    --accent-strong: #19b995;
    --accent-soft: #0f2f28;
    --accent-bright: #25d366;
    --on-accent: #04130f;
    --focus: #5cb2ff;
    --ok: #4fd18b;     --ok-soft: #13301f;
    --warn: #f0b85a;   --warn-soft: #342812;
    --info: #7fb0ff;   --info-soft: #172a47;
    --bad: #ff8a80;    --bad-soft: #3b1a18;
    --neutral: #a4b3bb; --neutral-soft: #1f2b32;
    --shadow-sm: none;
    --shadow: 0 1px 0 rgba(255, 255, 255, .02);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1014;
  --surface: #111b21;
  --surface-2: #17232a;
  --surface-3: #1f2d35;
  --text: #e9edef;
  --muted: #97a8b1;
  --line: #22313a;
  --line-strong: #34454f;
  --accent: #00a884;
  --accent-strong: #19b995;
  --accent-soft: #0f2f28;
  --accent-bright: #25d366;
  --on-accent: #04130f;
  --focus: #5cb2ff;
  --ok: #4fd18b;     --ok-soft: #13301f;
  --warn: #f0b85a;   --warn-soft: #342812;
  --info: #7fb0ff;   --info-soft: #172a47;
  --bad: #ff8a80;    --bad-soft: #3b1a18;
  --neutral: #a4b3bb; --neutral-soft: #1f2b32;
  --shadow-sm: none;
  --shadow: 0 1px 0 rgba(255, 255, 255, .02);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .6);
}

@media (pointer: coarse) { :root { --tap: 44px; } }

/* ---------- Temel ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.25; }
a { color: var(--accent); }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 16px; height: 16px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: 10px 14px; border-radius: var(--r-sm); font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Düğmeler ---------- */
button, .btn {
  font: inherit; font-weight: 600; font-size: 14px; line-height: 1.2;
  min-height: var(--tap); padding: 8px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; text-decoration: none; white-space: nowrap; max-width: 100%;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
button:hover, .btn:hover { background: var(--surface-2); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover, .btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
button.danger, .btn.danger { color: var(--bad); }
button.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--surface-2); }
button.small, .btn.small { min-height: 34px; padding: 6px 10px; font-size: 13px; }
@media (pointer: coarse) { button.small, .btn.small { min-height: 40px; } }
button.icon-btn { width: var(--tap); padding: 0; flex: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.busy { position: relative; color: transparent !important; }
button.busy::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); border-top-color: transparent; animation: spin .7s linear infinite; }
button.primary.busy::after { border-color: var(--on-accent); border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Form öğeleri ---------- */
input, select, textarea {
  font: inherit; font-size: 15px; color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  min-height: var(--tap); padding: 8px 12px; min-width: 0; max-width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
textarea { width: 100%; resize: vertical; min-height: 72px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
input:disabled, select:disabled { opacity: .55; }
select { padding-right: 32px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23889' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-weight: 600; font-size: 13px; color: var(--muted); }
.field input, .field select { width: 100%; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; cursor: pointer; min-height: var(--tap); padding: 8px 0; }
.check input { width: 20px; height: 20px; min-height: 0; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 14px 16px; }
.form .wide { grid-column: 1 / -1; }
.search { position: relative; display: flex; align-items: center; min-width: 0; }
.search .ic { position: absolute; left: 11px; color: var(--muted); pointer-events: none; width: 18px; height: 18px; }
.search input { padding-left: 36px; width: 100%; }

/* ---------- Rozetler ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-full); font-size: 12.5px; font-weight: 700; white-space: nowrap; line-height: 1.5; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill.plain::before { display: none; }
.ok { background: var(--ok-soft); color: var(--ok); }
.warn { background: var(--warn-soft); color: var(--warn); }
.info { background: var(--info-soft); color: var(--info); }
.bad { background: var(--bad-soft); color: var(--bad); }
.neutral { background: var(--neutral-soft); color: var(--neutral); }
.pill.live::before { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Kartlar ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: var(--s4); }
.card-head h2 { font-size: 16px; font-weight: 700; }
.card-head .sub { font-size: 13px; }
.card h3 { font-size: 14px; font-weight: 700; margin: var(--s5) 0 var(--s3); }
.sub { color: var(--muted); font-size: 13px; }
.note { color: var(--muted); font-size: 13px; margin: var(--s3) 0 0; }
.spacer { flex: 1; }
.row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; min-width: 0; }
.row > input, .row > select { flex: 1 1 160px; }
.progress { height: 10px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; margin: var(--s3) 0 var(--s2); }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-bright)); border-radius: inherit; transition: width .5s; }

/* ---------- Boş durum, iskelet ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 36px 16px; color: var(--muted); }
.empty .empty-ic { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.empty .empty-ic .ic { width: 26px; height: 26px; }
.empty b { color: var(--text); font-size: 15px; }
.empty p { margin: 0; max-width: 42ch; font-size: 13.5px; }
.empty button { margin-top: 8px; }
.sk { display: block; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 6px; height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Bildirim balonları ---------- */
.toasts { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: 20px; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r); background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); pointer-events: auto; animation: toastIn .22s ease-out; overflow-wrap: anywhere; }
.toast .ic { margin-top: 1px; }
.toast.ok .ic { color: var(--accent-bright); }
.toast.err { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Pencereler ---------- */
dialog { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0; width: min(620px, calc(100vw - 32px)); max-height: min(86vh, 900px); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden; }
dialog[open] { display: flex; flex-direction: column; animation: dlgIn .2s ease-out; }
dialog::backdrop { background: rgba(8, 14, 12, .55); backdrop-filter: blur(2px); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.dlg-head { padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex: none; }
.dlg-head b { font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
.dlg-body { padding: 18px 20px 22px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.dlg-grip { display: none; }
@media (max-width: 719px) {
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 20px 20px 0 0; max-height: 94dvh; border-bottom: 0; }
  dialog[open] { animation: sheetIn .25s ease-out; }
  .dlg-grip { display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 8px auto 0; flex: none; }
  .dlg-body { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: .4; } }
}
button svg, .btn svg { pointer-events: none; }

/* ---------- Soru düzenleyici (assets/sorular.js; panel ve kurulum sihirbazı) ---------- */
.qitem { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; background: var(--surface-2); }
.qitem .form { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.qitem input, .qitem select, .qitem textarea { background: var(--surface); }
.qitem-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.qnum { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 13px; font-weight: 800; }
