:root {
  color-scheme: light dark;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #16181d;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --ok: #059669;
  --err: #dc2626;
  --warn: #b45309;
  --sidebar: #111827;
  --sidebar-text: #e5e7eb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f13;
    --card: #171a21;
    --text: #e8e8e8;
    --muted: #9aa0aa;
    --border: #2a2e37;
    --accent: #3b82f6;
    --ok: #34d399;
    --err: #f87171;
    --warn: #fbbf24;
    --sidebar: #0a0c10;
    --sidebar-text: #c9ccd3;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }

/* --- auth pages --- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
}
.auth-card h1 { font-size: 1.3em; margin: 0 0 22px; text-align: center; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.85em; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95em;
}
button, .btn {
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.92em;
  cursor: pointer;
  font-weight: 600;
}
button.secondary, .btn.secondary { background: transparent; border: 1px solid var(--border); color: var(--text); font-weight: 500; }
button.danger { background: var(--err); }
button:disabled { opacity: 0.5; cursor: default; }
.auth-card button[type=submit] { width: 100%; margin-top: 6px; }
.auth-alt { text-align: center; margin-top: 16px; font-size: 0.88em; color: var(--muted); }
.msg { font-size: 0.88em; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.msg.err { background: color-mix(in srgb, var(--err) 15%, transparent); color: var(--err); }
.msg.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }

/* --- app shell --- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 20px 14px;
  flex-shrink: 0;
}
.sidebar .brand { font-weight: 700; font-size: 1.05em; margin-bottom: 22px; color: #fff; }
.sidebar .who { font-size: 0.82em; opacity: 0.75; margin-bottom: 18px; word-break: break-all; }
.sidebar form { margin-top: 24px; }
.sidebar button.secondary { color: var(--sidebar-text); border-color: #3a3f4b; width: 100%; }
.main { flex: 1; padding: 26px 24px 60px; min-width: 0; }
.topbar-mobile { display: none; }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
  .sidebar .who, .sidebar form { display: none; }
  .main { padding: 18px 16px 50px; }
}

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 20px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.card h2 { font-size: 1em; margin: 0 0 14px; }
.stat .num { font-size: 1.5em; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 0.82em; margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 0.82em; }
.table-wrap { overflow-x: auto; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row .field { flex: 1; min-width: 140px; margin-bottom: 0; }

.mail-item { border-bottom: 1px solid var(--border); padding: 12px 0; }
.mail-item:last-child { border-bottom: none; }
.mail-item .top { display: flex; justify-content: space-between; gap: 10px; font-size: 0.85em; color: var(--muted); }
.mail-item .subject { font-weight: 600; margin: 3px 0; }
.mail-item .snippet { color: var(--muted); font-size: 0.88em; white-space: pre-wrap; }
.empty { color: var(--muted); font-size: 0.9em; padding: 8px 0; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.75em; font-weight: 600; }
.badge.pending { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.badge.approved { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.badge.rejected { background: color-mix(in srgb, var(--err) 20%, transparent); color: var(--err); }

.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form input { width: 90px; padding: 6px 8px; }
.inline-form button { padding: 6px 10px; font-size: 0.82em; }

.section-title { font-size: 1.1em; font-weight: 700; margin: 28px 0 12px; }
.section-title:first-child { margin-top: 0; }

/* --- urun listesi (uye satin alma ekrani) -------------------------------
   Basliklarla satirlarin ayni sutunlarda hizali durmasi icin TEK bir grid
   kullaniyoruz: .product-list grid container'in kendisi, .product-head ve
   her .product-row ise "display:contents" ile o grid'in icine acilan
   sadece birer gruplayici -- boylece basliklar ve tum satirlar ayni sutun
   genisliklerini paylasir (eskiden her satir kendi grid'ini kurdugu icin
   icerige gore farkli genislikler olusuyor, bu da basliklarin "kaymis"
   gorunmesine yol aciyordu). */
.product-list {
  display: grid;
  grid-template-columns: 2.2fr 1.6fr 1.1fr 1.1fr 0.8fr auto;
  column-gap: 14px;
  align-items: center;
}

/* Satirlar #productRows adli bir sarmalayici div icinde geliyor (bkz.
   member.html) -- o da "contents" olmazsa tek bir grid hucresine sikisir
   ve tum satirlar 1. sutunda ust uste yigilir. */
#productRows,
.product-head,
.product-row {
  display: contents;
}

.product-head > div,
.product-row > div {
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}

.product-head > div {
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.6;
  padding: 0 4px 8px;
}

.product-row:last-child > div { border-bottom: none; }
.product-row.out > div { opacity: 0.5; }

/* Ad hucresinde ikon (28px) + bosluk (10px gap) var; baslikta ayni girinti
   olmazsa "ÜRÜN" yazisi urun adinin solunda kalir. Ayni girintiyi
   baslikta da uyguluyoruz. */
.product-head > div:first-child { padding-left: 38px; }

.product-name { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.product-icon {
  width: 28px; height: 28px; flex: 0 0 28px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  font-size: 0.78em; font-weight: 700;
}
.product-domain { opacity: 0.7; font-size: 0.92em; }
.product-price { font-weight: 600; white-space: nowrap; }
.product-life { opacity: 0.75; font-size: 0.9em; }
.product-stock { font-variant-numeric: tabular-nums; }
.product-buy { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.product-buy input { width: 66px; }
.product-buy button { white-space: nowrap; }
.product-out-label { font-size: 0.82em; opacity: 0.7; white-space: nowrap; }

@media (max-width: 760px) {
  .product-list { display: block; }
  .product-head { display: none; }
  .product-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 14px 0;
  }
  .product-row > div {
    padding: 0;
    border-bottom: none;
  }
  .product-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
  }
  .product-row > div[data-label]::before {
    content: attr(data-label) ": ";
    opacity: 0.6;
    font-size: 0.85em;
  }
  .product-buy { justify-content: flex-start; margin-top: 6px; }
  .product-buy input { flex: 1; max-width: 110px; }
}
