/* ==========================================================================
   BiyoCard Yönetim Paneli — profesyonel yönetim arayüzü
   Koyu kenar çubuğu + aydınlık içerik. Marka kırmızısı ölçülü vurgu olarak.
   ========================================================================== */

:root {
  /* Marka */
  --red: #be1e2d; --red-600: #a81a28; --red-bright: #d12435; --red-soft: rgba(190, 30, 45, .10);

  /* Kenar çubuğu (koyu, nötr) */
  --sb: #15171e; --sb-2: #1d2029; --sb-line: #282c38;
  --sb-text: #b7bcc9; --sb-dim: #767c8b; --sb-active: #ffffff;

  /* İçerik yüzeyleri (aydınlık, nötr) */
  --bg: #f4f6f9; --surface: #ffffff; --surface-2: #f8fafc;
  --line: #e7eaf0; --line-2: #dbe0e8;

  /* Mürekkep */
  --ink: #171a22; --ink-2: #59616f; --ink-3: #8a909e;

  /* Durum */
  --ok: #12805c; --ok-soft: #e2f3ec; --warn: #9a6a12; --warn-soft: #fbf1dc;
  --err: #cf2438; --err-soft: #fdebed;

  /* Ölçü */
  --r: 14px; --r-sm: 10px; --r-xs: 8px;
  --shadow-sm: 0 1px 2px rgba(18, 22, 33, .05), 0 1px 3px rgba(18, 22, 33, .06);
  --shadow: 0 1px 2px rgba(18, 22, 33, .04), 0 8px 24px rgba(18, 22, 33, .07);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Geriye dönük takma adlar (view içindeki eski var() kullanımları için) */
  --text: var(--ink); --text-2: var(--ink-2); --text-3: var(--ink-3);
  --hair: var(--line); --raised: var(--surface); --base: var(--bg);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  display: flex; min-height: 100vh;
}
a { color: var(--red-600); text-decoration: none; }
a:hover { color: var(--red-bright); }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; color: var(--ink); }

/* ------------------------------------------------------------- Kenar çubuğu */
.sidebar {
  width: 250px; flex-shrink: 0; background: var(--sb); color: var(--sb-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--sb-line);
}
.sb-brand {
  display: flex; align-items: center; gap: 10px; padding: 20px 22px 18px;
}
.sb-brand img { height: 30px; width: auto; }
.sb-brand .tag {
  font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--sb-dim); border: 1px solid var(--sb-line); border-radius: 999px; padding: 3px 8px;
}
.sb-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; flex: 1; overflow-y: auto; }
.sb-nav .sec {
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--sb-dim); padding: 14px 12px 6px;
}
.sb-nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--r-sm);
  color: var(--sb-text); font-weight: 500; font-size: 14px; transition: background .12s, color .12s;
}
.sb-nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.sb-nav a:hover { background: var(--sb-2); color: #fff; }
.sb-nav a.active { background: var(--red); color: #fff; box-shadow: 0 4px 14px rgba(190, 30, 45, .35); }
.sb-nav a.active svg { opacity: 1; }
.sb-foot { border-top: 1px solid var(--sb-line); padding: 14px; }
.sb-user { display: flex; align-items: center; gap: 11px; padding: 4px 6px 12px; }
.sb-user .av {
  width: 34px; height: 34px; border-radius: 50%; background: var(--sb-2); border: 1px solid var(--sb-line);
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 14px;
}
.sb-user .who { min-width: 0; }
.sb-user .who .n { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user .who .r { color: var(--sb-dim); font-size: 11.5px; }
.logout-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--sb-2); border: 1px solid var(--sb-line); color: var(--sb-text);
  padding: 10px; border-radius: var(--r-sm); cursor: pointer; font: inherit; font-size: 13px; font-weight: 600;
}
.logout-btn:hover { background: #24283340; border-color: #3a3f4e; color: #fff; }

/* Mobil üst bar (varsayılan gizli) */
.topbar { display: none; }

/* ------------------------------------------------------------------- İçerik */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 30px 34px 60px; }

/* Sayfa başlığı */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .lead h1 { font-size: 24px; font-weight: 800; }
.page-head .lead p { margin: 5px 0 0; color: var(--ink-2); font-size: 14px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 600; font-size: 13px; margin-bottom: 14px; }
.back-link:hover { color: var(--red-600); }
h2.section { font-size: 15px; font-weight: 700; margin: 30px 0 12px; color: var(--ink); }

/* İstatistik kartları */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 8px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat .lbl { color: var(--ink-3); font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.stat .num { font-size: 30px; font-weight: 800; margin-top: 8px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .ico { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 10px;
  background: var(--red-soft); color: var(--red); display: flex; align-items: center; justify-content: center; }
.stat .ico svg { width: 18px; height: 18px; }

/* Yüzey kartı + tablolar */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel + .panel { margin-top: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 14.5px; font-weight: 700; }
.panel-head .count { color: var(--ink-3); font-size: 12.5px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); padding: 2px 9px; border-radius: 999px; }

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; padding: 11px 16px; background: var(--surface-2);
  color: var(--ink-3); font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .1s; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .primary { font-weight: 600; }
.muted { color: var(--ink-3); }
.empty-cell { text-align: center; color: var(--ink-3); padding: 34px 16px !important; }

/* Rozet */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.4; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.on { background: var(--ok-soft); color: var(--ok); border-color: #bfe6d6; }
.badge.off { background: var(--surface-2); color: var(--ink-3); border-color: var(--line-2); }
.badge.self { background: var(--red-soft); color: var(--red-600); border-color: #f0cdd1; }
.badge.self::before { display: none; }
.badge.plain { background: var(--surface-2); color: var(--ink-2); border-color: var(--line-2); }
.badge.plain::before { display: none; }

/* Butonlar */
.btn {
  display: inline-flex; align-items: center; gap: 7px; background: var(--red); color: #fff; border: 1px solid var(--red);
  padding: 9px 16px; border-radius: var(--r-sm); cursor: pointer; font: inherit; font-weight: 600; font-size: 13.5px;
  transition: background .12s, box-shadow .12s, transform .04s; white-space: nowrap; box-shadow: 0 1px 2px rgba(190,30,45,.2);
}
.btn:hover { background: var(--red-bright); color: #fff; box-shadow: 0 4px 12px rgba(190, 30, 45, .28); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { background: var(--surface-2); color: var(--ink); border-color: #c8cfda; }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: transparent; color: var(--err); border-color: #eab6bd; box-shadow: none; }
.btn.danger:hover { background: var(--err-soft); color: var(--err); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }

/* Filtre / form kartları */
.toolbar {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 18px; margin-bottom: 20px; box-shadow: var(--shadow-sm);
}
.toolbar .grow { flex: 1; min-width: 200px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field .hint { color: var(--ink-3); font-weight: 400; }
input, select, textarea {
  background: var(--surface); border: 1px solid var(--line-2); color: var(--ink);
  padding: 9px 12px; border-radius: var(--r-xs); font: inherit; font-size: 14px; width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
textarea { resize: vertical; min-height: 90px; }

.form-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 22px; margin-bottom: 24px; max-width: 680px; box-shadow: var(--shadow-sm);
}
.form-card .field { margin-bottom: 14px; }
.form-card label { display: block; margin-bottom: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }

/* ------------------------------------------------------------------ Modal */
.modal { position: fixed; inset: 0; z-index: 80; display: none; }
.modal.open { display: block; }
.modal-scrim { position: absolute; inset: 0; background: rgba(18, 22, 33, .48); backdrop-filter: blur(2px); animation: modal-fade .16s ease; }
.modal-dialog {
  position: relative; z-index: 1; width: 100%; max-width: 520px; margin: 6vh auto 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: 0 24px 70px rgba(18, 22, 33, .28); overflow: hidden;
  animation: modal-pop .18s cubic-bezier(.16, 1, .3, 1);
  max-height: 88vh; display: flex; flex-direction: column;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; font-weight: 800; }
.modal-head p { margin: 3px 0 0; color: var(--ink-2); font-size: 13px; }
.modal-close { width: 34px; height: 34px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-2); border-radius: var(--r-xs); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.modal-close:hover { background: var(--surface-2); color: var(--ink); }
.modal-close svg { width: 16px; height: 16px; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-body .field { margin-bottom: 14px; }
.modal-body label { display: block; margin-bottom: 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* Bilgi listesi (kullanıcı detayı) */
.info-list {
  display: grid; grid-template-columns: 180px 1fr; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-sm); margin-bottom: 8px;
}
.info-list .k, .info-list .v { padding: 13px 20px; border-bottom: 1px solid var(--line); }
.info-list .k { color: var(--ink-2); font-weight: 600; background: var(--surface-2); font-size: 13px; }
.info-list > div:nth-last-child(-n+2) { border-bottom: none; }

/* Sayfalama */
.pager { display: flex; gap: 6px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: var(--r-xs); color: var(--ink-2); font-weight: 600; font-size: 13px; background: var(--surface);
}
.pager a:hover { border-color: var(--red); color: var(--red-600); }
.pager .current { background: var(--red); border-color: var(--red); color: #fff; }
.total-line { color: var(--ink-3); font-size: 13px; margin-top: 12px; }

/* Bildirim şeridi */
.notice { border-radius: var(--r-sm); padding: 12px 16px; margin-bottom: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 13.5px; box-shadow: var(--shadow-sm); }
.notice.ok { background: var(--ok-soft); border-color: #bfe6d6; color: #0d6a4c; }
.notice.err { background: var(--err-soft); border-color: #eab6bd; color: #a81d2d; }

/* Standalone (giriş / yetkisiz) */
.auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; background:
  radial-gradient(1200px 500px at 50% -10%, #1d2029 0%, var(--sb) 55%); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 34px 32px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-brand img { height: 46px; width: auto; }
.auth-brand .tag { margin-top: 12px; color: var(--ink-3); font-weight: 700; letter-spacing: .16em; text-transform: uppercase; font-size: 11.5px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 14.5px; margin-top: 6px; }

/* ------------------------------------------------------------------ Responsive */
@media (max-width: 900px) {
  body { flex-direction: column; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.4);
  }
  .sidebar.open { transform: translateX(0); }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
  .scrim.show { display: block; }
  .topbar {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    background: var(--sb); color: #fff; border-bottom: 1px solid var(--sb-line); position: sticky; top: 0; z-index: 30;
  }
  .topbar img { height: 26px; }
  .topbar .burger { width: 42px; height: 40px; display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    padding: 10px; background: var(--sb-2); border: 1px solid var(--sb-line); border-radius: 10px; cursor: pointer; }
  .topbar .burger span { display: block; height: 2px; background: #fff; border-radius: 2px; }
  .container { padding: 20px 16px 60px; }
  .page-head { align-items: stretch; }
  .page-head .actions .btn { flex: 1; justify-content: center; }
  .info-list { grid-template-columns: 1fr; }
  .info-list .k { border-bottom: none; padding-bottom: 2px; }
  .grid2 { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .modal-dialog { max-width: none; margin: 0; min-height: 100%; max-height: 100vh; border-radius: 0; }
  .modal-foot .btn { flex: 1; justify-content: center; }
}
