/* Ramak Kala Bildirim — tek CSS. Framework yok. Modern CSS (2025-26).
   Radikal sadelik: az öğe, kusursuz işçilik. */

:root {
  color-scheme: light dark;

  /* Renk token'ları — oklch, light-dark() ile otomatik koyu mod */
  --bg:        light-dark(oklch(0.98 0.005 250), oklch(0.17 0.02 260));
  --surface:   light-dark(oklch(1 0 0),          oklch(0.22 0.02 260));
  --surface-2: light-dark(oklch(0.965 0.008 250),oklch(0.26 0.02 260));
  --text:      light-dark(oklch(0.25 0.02 260),  oklch(0.94 0.01 250));
  --muted:     light-dark(oklch(0.52 0.02 260),  oklch(0.70 0.02 250));
  --border:    light-dark(oklch(0.90 0.01 250),  oklch(0.34 0.02 260));
  --accent:    light-dark(oklch(0.58 0.14 235),  oklch(0.70 0.13 235));
  --accent-ink: oklch(0.98 0.01 235);
  --ok:        light-dark(oklch(0.62 0.15 150),  oklch(0.72 0.15 150));
  --danger:    light-dark(oklch(0.58 0.19 25),   oklch(0.68 0.19 25));
  --danger-bg: light-dark(oklch(0.96 0.03 25),   oklch(0.30 0.06 25));

  /* Ölçek */
  --sp: clamp(0.9rem, 0.7rem + 0.8vw, 1.25rem);
  --radius: 14px;
  --radius-sm: 9px;
  --fs: clamp(1rem, 0.94rem + 0.3vw, 1.12rem);
  --fs-h1: clamp(1.4rem, 1.1rem + 1.4vw, 2rem);
  --fs-sm: clamp(0.82rem, 0.78rem + 0.2vw, 0.92rem);
  --shadow: 0 1px 2px oklch(0 0 0 / 0.06), 0 6px 24px oklch(0 0 0 / 0.06);
  --tap: 48px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: var(--fs);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: contain;
}

.wrap {
  width: min(100% - 2rem, 640px);
  margin-inline: auto;
  padding-block: clamp(1.2rem, 3vw, 2.4rem);
}
.wrap--wide { width: min(100% - 2rem, 1100px); }

/* Başlık alanı */
.brand { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 1.4rem; }
.brand__logo {
  width: 42px; height: 42px; border-radius: 11px; flex: none;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 1.1rem;
}
.brand__t { font-weight: 650; font-size: 1.05rem; letter-spacing: 0.2px; }
.brand__s { color: var(--muted); font-size: var(--fs-sm); }

h1 { font-size: var(--fs-h1); margin: 0 0 0.3rem; line-height: 1.15; }
.lead { color: var(--muted); margin: 0 0 1.4rem; }

/* Kart */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.1rem, 3vw, 1.6rem);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 1rem; }

/* Formlar */
label { display: block; font-weight: 550; margin-bottom: 0.35rem; }
.field { margin-bottom: 1.05rem; }
.req::after { content: " *"; color: var(--danger); }

input, textarea, select, button {
  font: inherit;
  font-size: max(16px, 1rem);   /* iOS zoom önleme */
  color: inherit;
}
input[type=text], input[type=tel], input[type=date], input[type=time],
input[type=password], input[type=search], textarea, select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 6.5rem; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 30%, transparent);
}
input[readonly] { background: var(--surface); color: var(--muted); }

/* Nazik, geç tetiklenen doğrulama */
.field:has(input:user-invalid) label,
.field:has(textarea:user-invalid) label { color: var(--danger); }
input:user-invalid, textarea:user-invalid { border-color: var(--danger); }

input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 1.15rem; height: 1.15rem; }

/* Butonlar */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: var(--tap); padding: 0.7rem 1.3rem;
  border: 1.5px solid transparent; border-radius: var(--radius-sm);
  font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--surface-2); color: var(--text);
  transition: transform 0.08s, background 0.15s, border-color 0.15s;
  touch-action: manipulation;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--danger  { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn--ghost   { background: transparent; border-color: var(--border); }
.btn--block   { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.2rem; }
.btn-row .btn { flex: 1 1 auto; }

/* Zorunlu alanlar dolunca GÖNDER aktif (JS'e minimum iş) */
.needs-fill:has(input[required]:placeholder-shown) .btn--submit,
.needs-fill:has(textarea[required]:placeholder-shown) .btn--submit { opacity: 0.5; pointer-events: none; }

/* Uyarılar */
.alert { padding: 0.8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: var(--fs-sm); }
.alert--error { background: var(--danger-bg); color: var(--danger); border: 1px solid color-mix(in oklch, var(--danger) 40%, transparent); }
.alert--ok    { background: color-mix(in oklch, var(--ok) 18%, transparent); color: var(--ok); }
.alert ul { margin: 0.3rem 0 0; padding-left: 1.1rem; }

/* İşçi listesi (arama) */
.search { position: sticky; top: 0; padding-block: 0.4rem; background: var(--bg); z-index: 2; }
.worker-list { list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.worker-list button {
  width: 100%; text-align: left; padding: 0.85rem 1rem;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; min-height: var(--tap);
  display: flex; flex-direction: column; gap: 2px;
}
.worker-list button:hover { border-color: var(--accent); }
.worker-list .wn { font-weight: 600; }
.worker-list .wr { color: var(--muted); font-size: var(--fs-sm); }
.empty { color: var(--muted); text-align: center; padding: 1.4rem; }

/* PIN kutuları */
.pin { display: flex; gap: 0.6rem; justify-content: center; margin: 1.4rem 0; }
.pin input {
  width: 3.4rem; height: 4rem; text-align: center; font-size: 1.8rem; font-weight: 700;
  border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--surface-2);
}
.who { text-align: center; margin-bottom: 0.6rem; }
.who b { font-size: 1.1rem; }
.who span { display: block; color: var(--muted); font-size: var(--fs-sm); }

/* Başarı ekranı */
.success { text-align: center; padding-block: 1.5rem; }
.tick { width: 96px; height: 96px; margin: 0 auto 1rem; display: block; }
.tick circle { stroke: var(--ok); stroke-width: 5; fill: none; stroke-dasharray: 289; stroke-dashoffset: 289; animation: draw 0.5s ease forwards; }
.tick path { stroke: var(--ok); stroke-width: 6; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 80; stroke-dashoffset: 80; animation: draw 0.35s 0.45s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ============ ADMIN ============ */
.admin-shell { display: grid; grid-template-columns: 1fr; min-height: 100dvh; }
.topbar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 0.7rem clamp(0.8rem, 3vw, 1.6rem);
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.topbar .brand { margin: 0; }
.nav { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-left: auto; align-items: center; }
.nav a { padding: 0.5rem 0.85rem; border-radius: var(--radius-sm); text-decoration: none; color: var(--muted); font-weight: 550; }
.nav a.on, .nav a:hover { background: var(--surface-2); color: var(--text); }
.badge { display: inline-grid; place-items: center; min-width: 1.4rem; height: 1.4rem; padding: 0 0.35rem;
  background: var(--danger); color: white; border-radius: 999px; font-size: 0.72rem; font-weight: 700; margin-left: 0.3rem; }
.admin-main { padding: clamp(1rem, 3vw, 2rem); container-type: inline-size; }

/* Tablo → dar ekranda kart (container query) */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.grid { width: 100%; border-collapse: collapse; background: var(--surface); }
table.grid th, table.grid td { padding: 0.7rem 0.9rem; text-align: left; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
table.grid th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }
table.grid tr:last-child td { border-bottom: none; }
table.grid a { color: var(--accent); text-decoration: none; }
.chip { font-size: 0.72rem; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chip--new { background: color-mix(in oklch, var(--danger) 20%, transparent); color: var(--danger); }
.chip--ok  { background: color-mix(in oklch, var(--ok) 20%, transparent); color: var(--ok); }

.filters { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; margin-bottom: 1rem; }
.filters .field { margin: 0; }
.filters label { font-size: var(--fs-sm); }
.pager { display: flex; gap: 0.5rem; align-items: center; justify-content: center; margin-top: 1rem; }

@container (max-width: 640px) {
  table.grid thead { display: none; }
  table.grid, table.grid tbody, table.grid tr, table.grid td { display: block; width: 100%; }
  table.grid tr { border-bottom: 8px solid var(--bg); }
  table.grid td { border: none; display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0.9rem; }
  table.grid td::before { content: attr(data-th); color: var(--muted); font-weight: 600; }
}

.tools { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.2rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

.qr-box { text-align: center; }
.qr-box img { width: min(320px, 80vw); height: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; padding: 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Yazdırma — QR temiz A4 */
@media print {
  body { background: white; }
  .no-print, .topbar, .nav, .btn { display: none !important; }
  .qr-box img { border: none; }
}
