/* app.css — E-Kütüphane tasarım sistemi
   Tokenlar :root üzerinde tanımlanır; [data-theme="light"] yalnızca değerleri
   yeniden atar, böylece tema geçişi tek bir attribute ile olur. */

/* ============ 1. Tokenlar ============ */
:root {
  color-scheme: dark;

  --bg: #0b0f19;
  --bg-elevated: #111726;
  --bg-sunken: #080b13;
  --surface: #141b2c;
  --surface-hover: #1b2437;
  --surface-active: #212c44;

  --border: #222d44;
  --border-strong: #2f3c58;

  --text: #e9edf5;
  --text-soft: #a9b4c8;
  --text-dim: #6b7791;

  --accent: #6c8cff;
  --accent-hover: #8aa2ff;
  --accent-soft: rgba(108, 140, 255, 0.14);
  --accent-text: #ffffff;

  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 20px -6px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.7);

  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-full: 999px;

  --sidebar-w: 248px;
  --topbar-h: 64px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', var(--font);

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

[data-theme='light'] {
  color-scheme: light;

  --bg: #f6f7fb;
  --bg-elevated: #ffffff;
  --bg-sunken: #eceef5;
  --surface: #ffffff;
  --surface-hover: #f2f4fa;
  --surface-active: #e8ecf6;

  --border: #e2e6ef;
  --border-strong: #cdd4e2;

  --text: #10162a;
  --text-soft: #4c5670;
  --text-dim: #7e879c;

  --accent: #4a63d8;
  --accent-hover: #3b52c0;
  --accent-soft: rgba(74, 99, 216, 0.1);

  --shadow-sm: 0 1px 2px rgba(16, 22, 42, 0.06);
  --shadow-md: 0 8px 24px -10px rgba(16, 22, 42, 0.18);
  --shadow-lg: 0 24px 60px -24px rgba(16, 22, 42, 0.28);
}

/* ============ 2. Temel ============ */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

/* hidden özniteliği her zaman kazanmalı: .empty, .loading-row, .pager gibi
   sınıflar display tanımladığı için UA'nın [hidden] kuralını eziyorlardı. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  overflow-x: hidden;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100svh;
}

h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -0.02em; line-height: 1.25; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { flex-shrink: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ============ 3. Düğmeler ve form ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem; font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.1s var(--ease), color 0.15s;
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }

.btn-outline { background: transparent; border-color: var(--border); color: var(--text-soft); }
.btn-outline:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }

.btn-danger { background: transparent; border-color: transparent; color: var(--danger); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.12); }

.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8125rem; }
.btn-icon { padding: 0.5rem; width: 38px; height: 38px; }
.btn-icon.btn-sm { width: 32px; height: 32px; padding: 0.3rem; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.field label { font-size: 0.8125rem; font-weight: 500; color: var(--text-soft); }
.field .hint { font-size: 0.75rem; color: var(--text-dim); }

.input, .select, .textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-dim); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.select {
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7791' stroke-width='2' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 16px;
  cursor: pointer;
}

/* ============ 4. Uygulama iskeleti ============ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0;
  /* svh: tarayıcı araç çubukları görünürken bile tam sığan yükseklik.
     100vh ve 100dvh mobilde çubuğun altındaki alanı da sayabildiği için
     alt kısım (kullanıcı adı, çıkış) ekrandan taşıyordu. */
  height: 100vh; height: 100svh; height: min(100svh, var(--app-h, 100svh));
  display: flex; flex-direction: column;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 1.1rem 0.85rem;
  overflow-y: auto;
  z-index: 40;
}

.brand {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.35rem 0.5rem 1.1rem;
  font-family: var(--font-display); font-size: 1.0625rem; font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--accent), #a06cff);
  color: #fff; box-shadow: var(--shadow-sm);
}

.nav-group { margin-bottom: 1.25rem; }
.nav-label {
  padding: 0 0.6rem 0.45rem;
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-dim);
}
.nav-item {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--r-sm);
  color: var(--text-soft);
  font-size: 0.875rem; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.active svg { color: var(--accent); }
.nav-item svg { width: 18px; height: 18px; color: var(--text-dim); }
.nav-count {
  margin-left: auto;
  font-size: 0.6875rem; font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  background: var(--surface); padding: 0.1rem 0.4rem; border-radius: var(--r-full);
}
.nav-item.active .nav-count { background: transparent; color: var(--accent); }

.sidebar-footer { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); }
.user-chip {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.5rem; border-radius: var(--r-sm); width: 100%;
  background: transparent; border: none; cursor: pointer; text-align: left;
}
.user-chip:hover { background: var(--surface-hover); }
.avatar {
  width: 32px; height: 32px; border-radius: var(--r-full);
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), #a06cff);
  color: #fff; font-size: 0.8125rem; font-weight: 600; text-transform: uppercase;
}
.user-chip-name { font-size: 0.8125rem; font-weight: 600; line-height: 1.2; }
.user-chip-role { font-size: 0.6875rem; color: var(--text-dim); }

/* ============ 5. Üst çubuk ============ */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0 1.5rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.search {
  position: relative; flex: 1; max-width: 520px;
}
.search svg {
  position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--text-dim); pointer-events: none;
}
.search input {
  width: 100%; padding: 0.55rem 2.6rem 0.55rem 2.3rem;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r-full); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search kbd {
  position: absolute; right: 0.55rem; top: 50%; transform: translateY(-50%);
  font-family: var(--font); font-size: 0.6875rem; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: var(--r-xs);
  padding: 0.05rem 0.35rem; background: var(--surface);
}
.search input:not(:placeholder-shown) ~ kbd { display: none; }

.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }

/* Sıralama + görünüm denetimleri. Üst çubuğun doğrudan çocuğu oldukları
   için dar ekranda kendi satırlarına kayabiliyorlar. */
.topbar-controls { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.topbar-controls .select { width: auto; }

.seg {
  display: flex; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: 2px;
}
.seg button {
  border: none; background: transparent; cursor: pointer;
  padding: 0.3rem 0.5rem; border-radius: 7px; color: var(--text-dim);
  display: grid; place-items: center;
}
.seg button.active { background: var(--surface-active); color: var(--text); }

/* ============ 6. İçerik ============ */
.content { padding: 1.5rem; flex: 1; }
.content-inner { max-width: 1500px; margin: 0 auto; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.page-title { font-size: 1.5rem; font-weight: 700; }
.page-sub { font-size: 0.8125rem; color: var(--text-dim); margin-top: 0.15rem; }

.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.7rem; border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--bg-elevated);
  font-size: 0.8125rem; color: var(--text-soft); cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chip:hover { background: var(--surface-hover); color: var(--text); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 500; }
.chip .chip-count { font-size: 0.6875rem; opacity: 0.7; font-variant-numeric: tabular-nums; }

.section-title {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 1rem; font-weight: 600; margin-bottom: 0.9rem;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ============ 7. Kitap ızgarası ============ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 1.35rem 1.1rem;
}

.card { position: relative; display: flex; flex-direction: column; gap: 0.55rem; }

.cover {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.card:hover .cover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.cover img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; }

.cover-fallback {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center; gap: 0.5rem;
  padding: 2rem 0.85rem 0.9rem;
  background: linear-gradient(155deg, #2b3352, #171d31 60%, #221a3a);
  color: #e8ecf8;
}
[data-theme='light'] .cover-fallback { background: linear-gradient(155deg, #5a67a8, #38406b 60%, #4a3a72); color: #fff; }
.cover-fallback .fb-title {
  font-family: var(--font-display); font-size: 0.9375rem; font-weight: 600; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.cover-fallback .fb-author { font-size: 0.6875rem; opacity: 0.6; }

.badge-format {
  position: absolute; top: 0.5rem; left: 0.5rem; z-index: 2;
  padding: 0.12rem 0.4rem; border-radius: var(--r-xs);
  font-size: 0.625rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: rgba(10, 14, 24, 0.72); color: #fff; backdrop-filter: blur(6px);
}

.fav {
  position: absolute; top: 0.45rem; right: 0.45rem; z-index: 3;
  width: 30px; height: 30px; display: grid; place-items: center;
  border: none; border-radius: var(--r-full); cursor: pointer;
  background: rgba(10, 14, 24, 0.6); color: #fff; backdrop-filter: blur(6px);
  opacity: 0; transform: scale(0.85);
  transition: opacity 0.18s, transform 0.18s, color 0.18s, background 0.18s;
}
.card:hover .fav, .fav.on, .fav:focus-visible { opacity: 1; transform: scale(1); }
.fav svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.fav.on { color: #ff5f7a; }
.fav.on svg { fill: #ff5f7a; stroke: #ff5f7a; }
.fav:hover { background: rgba(10, 14, 24, 0.85); }

.cover-actions {
  position: absolute; inset: auto 0 0 0; z-index: 2;
  display: flex; gap: 0.35rem; padding: 0.55rem;
  background: linear-gradient(to top, rgba(6, 9, 16, 0.94), rgba(6, 9, 16, 0.55) 60%, transparent);
  opacity: 0; transform: translateY(6px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.card:hover .cover-actions, .card:focus-within .cover-actions { opacity: 1; transform: translateY(0); }
.cover-actions .btn { flex: 1; padding: 0.35rem 0.4rem; font-size: 0.75rem; }
.cover-actions .btn-icon { flex: 0 0 32px; }
.cover-actions .btn-outline { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.2); color: #fff; }
.cover-actions .btn-outline:hover { background: rgba(255, 255, 255, 0.24); color: #fff; }

.progress-strip {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  height: 3px; background: rgba(0, 0, 0, 0.35);
}
.progress-strip span { display: block; height: 100%; background: var(--accent); }

.card-title {
  font-size: 0.8125rem; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-author {
  font-size: 0.75rem; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-meta { font-size: 0.6875rem; color: var(--accent); font-weight: 500; }

/* Liste görünümü */
.grid.list { display: flex; flex-direction: column; gap: 0.5rem; }
.grid.list .card {
  flex-direction: row; align-items: center; gap: 0.9rem;
  padding: 0.6rem; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--bg-elevated);
}
.grid.list .cover { width: 46px; flex: 0 0 46px; border-radius: var(--r-xs); box-shadow: none; }
.grid.list .card:hover .cover { transform: none; box-shadow: none; }
.grid.list .cover-actions, .grid.list .badge-format, .grid.list .cover-fallback .fb-author { display: none; }
.grid.list .cover-fallback { padding: 0.3rem; }
.grid.list .cover-fallback .fb-title { font-size: 0.5rem; -webkit-line-clamp: 3; }
.grid.list .card-body { flex: 1; min-width: 0; }
.grid.list .card-title { -webkit-line-clamp: 1; font-size: 0.875rem; }
.grid.list .fav { position: static; opacity: 1; transform: none; background: transparent; color: var(--text-dim); }
.grid.list .fav.on { color: #ff5f7a; }
.grid.list .list-actions { display: flex; gap: 0.35rem; }
.card .list-actions { display: none; }
.grid.list .card .list-actions { display: flex; }

/* Yatay raf */
.shelf {
  display: grid; grid-auto-flow: column; grid-auto-columns: 168px;
  gap: 1.1rem; overflow-x: auto; padding-bottom: 0.75rem;
  scroll-snap-type: x proximity; scrollbar-width: thin;
}
.shelf .card { scroll-snap-align: start; }

/* ============ 8. Durumlar ============ */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 4.5rem 1.5rem; color: var(--text-dim); gap: 0.6rem;
}
.empty svg { width: 42px; height: 42px; opacity: 0.5; margin-bottom: 0.4rem; }
.empty h3 { font-size: 1.0625rem; color: var(--text); }
.empty p { font-size: 0.875rem; max-width: 380px; }

.skeleton-grid { display: contents; }
.skeleton { border-radius: var(--r-md); background: var(--surface); position: relative; overflow: hidden; }
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  animation: shimmer 1.3s infinite;
}
.skeleton-card { aspect-ratio: 2 / 3; }
@keyframes shimmer { 100% { transform: translateX(100%); } }

.sentinel { height: 1px; }
.loading-row { display: flex; justify-content: center; padding: 2rem; color: var(--text-dim); font-size: 0.875rem; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite; margin-right: 0.6rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 9. Modal & toast ============ */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: center; justify-content: center;
  padding: 1.25rem;
  background: rgba(5, 8, 15, 0.62); backdrop-filter: blur(4px);
}
.modal.open { display: flex; animation: fade 0.15s var(--ease); }
.modal-box {
  width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  animation: pop 0.2s var(--ease);
}
.modal-box.wide { max-width: 760px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.15rem 1.35rem; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-elevated); z-index: 1;
}
.modal-head h3 { font-size: 1.0625rem; }
.modal-body { padding: 1.35rem; }
.modal-foot { padding: 0 1.35rem 1.35rem; display: flex; gap: 0.6rem; justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } }

.toasts {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 300;
  display: flex; flex-direction: column; gap: 0.55rem; max-width: min(360px, calc(100vw - 2rem));
}
.toast {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm); box-shadow: var(--shadow-lg);
  font-size: 0.875rem; animation: slideIn 0.22s var(--ease);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.leaving { animation: slideOut 0.2s var(--ease) forwards; }
.toast svg { width: 17px; height: 17px; margin-top: 1px; }
.toast.success svg { color: var(--success); }
.toast.error svg { color: var(--danger); }
@keyframes slideIn { from { opacity: 0; transform: translateX(16px); } }
@keyframes slideOut { to { opacity: 0; transform: translateX(16px); } }

.alert {
  display: flex; gap: 0.6rem; align-items: flex-start;
  padding: 0.8rem 1rem; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface);
  font-size: 0.875rem; margin-bottom: 1.25rem;
}
.alert.success { border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.08); }
.alert.error { border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.08); }

/* ============ 10. Giriş sayfası ============ */
.auth {
  min-height: 100vh;
  min-height: 100svh; display: grid; grid-template-columns: 1fr 1fr;
}
.auth-art {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, #1a2140, #0d1120 55%, #221a3c);
  display: flex; flex-direction: column; justify-content: space-between; padding: 3rem;
  color: #e9edf5;
}
.auth-art::before {
  content: ''; position: absolute; width: 520px; height: 520px; right: -160px; top: -120px;
  background: radial-gradient(circle, rgba(108, 140, 255, 0.35), transparent 62%);
}
.auth-art-quote { position: relative; font-family: var(--font-display); font-size: 1.75rem; line-height: 1.35; max-width: 22ch; }
.auth-art-sub { position: relative; color: rgba(233, 237, 245, 0.6); font-size: 0.875rem; }
.auth-form-wrap { display: grid; place-items: center; padding: 2rem; }
.auth-form { width: 100%; max-width: 360px; }
.auth-form h1 { font-size: 1.6rem; margin-bottom: 0.35rem; }
.auth-form .lede { color: var(--text-dim); font-size: 0.875rem; margin-bottom: 1.75rem; }

/* ============ 11. Yönetim ============ */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; }
.tab {
  padding: 0.6rem 0.9rem; border: none; background: transparent; cursor: pointer;
  color: var(--text-dim); font-size: 0.875rem; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade 0.2s var(--ease); }

.panel {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 1.35rem; margin-bottom: 1.25rem;
}
.panel h3 { font-size: 1rem; margin-bottom: 0.35rem; }
.panel .panel-sub { font-size: 0.8125rem; color: var(--text-dim); margin-bottom: 1.15rem; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.85rem; margin-bottom: 1.5rem; }
.stat { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-md); padding: 1rem 1.1rem; }
.stat-value { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { padding: 0.65rem 0.85rem; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); background: var(--surface); position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-hover); }
td.num { font-variant-numeric: tabular-nums; color: var(--text-dim); }

.tag {
  display: inline-block; padding: 0.1rem 0.45rem; border-radius: var(--r-xs);
  font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--surface-active); color: var(--text-soft);
}
.tag.admin { background: var(--accent-soft); color: var(--accent); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }

.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-md);
  padding: 1.5rem; text-align: center; color: var(--text-dim);
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.dropzone input { display: none; }

.import-list { max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r-sm); }
.import-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.8125rem;
}
.import-row:last-child { border-bottom: none; }
.import-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-row .state { font-size: 0.75rem; color: var(--text-dim); }
.import-row.done .state { color: var(--success); }
.import-row.failed .state { color: var(--danger); }

.progressbar { height: 6px; background: var(--surface-active); border-radius: var(--r-full); overflow: hidden; }
.progressbar span { display: block; height: 100%; background: var(--accent); transition: width 0.25s var(--ease); }

/* ============ 12. Sayfalama ============ */
.pager { display: flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 2rem 0 0.5rem; }
.pager .page-info { font-size: 0.8125rem; color: var(--text-dim); padding: 0 0.6rem; }

/* ============ 13. Duyarlılık ============ */
.menu-toggle { display: none; }
.scrim { display: none; }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 268px;
    transform: translateX(-100%); transition: transform 0.25s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .app.nav-open .sidebar { transform: translateX(0); }
  /* Çekmecede alt bilgiyi ekranın dibine itmek erişimi zorlaştırıyor;
     menü öğelerinin hemen altında dursun. */
  .sidebar-footer { margin-top: 0.5rem; }
  .sidebar { padding-bottom: max(1.1rem, env(safe-area-inset-bottom)); }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(4, 7, 13, 0.5); }
  .menu-toggle { display: grid; }
  .content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}

@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 1rem 0.75rem; }
  .shelf { grid-auto-columns: 132px; }
  .toasts { left: 1rem; right: 1rem; bottom: 1rem; }

  /* Telefonda arama kutusu tek satıra sığmadığı için sıralama ve görünüm
     denetimleri alt satıra iner; eskiden gizleniyorlardı. */
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 0.55rem 1rem 0.65rem;
    row-gap: 0.55rem;
  }
  .topbar-controls {
    order: 10;
    flex: 1 1 100%;
    margin-left: 0;
  }
  .topbar-controls .select { flex: 1; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Tema düğmesi: aktif temaya göre tek ikon gösterilir */
[data-theme='dark'] .on-light,
[data-theme='light'] .on-dark { display: none; }
[data-theme='dark'] .on-dark,
[data-theme='light'] .on-light { display: grid; place-items: center; }
