/* ============================================================
   Baysal CRM - main.css
   GLOBAL: CSS değişkenleri, reset, utility,
   topbar, sidebar (navbar), header, footer, back-to-top
   Sayfaya özel stiller {page}.css'e yazılır.
   Mobile-first: Base <480, 480+, 768+, 992+, 1200+
   ============================================================ */

/* ---------- 1. CSS Değişkenleri ---------- */
:root {
  /* Marka */
  --brand-primary:      #fab216;
  --brand-primary-600:  #e09b0a;
  --brand-primary-100:  #fef3d4;
  --brand-primary-50:   #fff8e6;
  --brand-black:        #000000;
  --brand-black-80:     #1a1a1a;
  --brand-black-60:     #333333;
  --brand-black-40:     #595959;

  /* Açık tema */
  --bg-page:      #f6f7fb;
  --bg-surface:   #ffffff;
  --bg-muted:     #f1f2f4;
  --bg-soft:      #fafbfc;
  --text-primary: #111111;
  --text-muted:   #6b7280;
  --text-invert:  #ffffff;
  --border:       #eceef2;
  --border-strong:#d7dae0;

  /* Durumlar */
  --success:      #22c55e;
  --success-soft: #d1fae5;
  --warning:      #f59e0b;
  --warning-soft: #fef3c7;
  --danger:       #ef4444;
  --danger-soft:  #fee2e2;
  --info:         #0ea5e9;
  --info-soft:    #e0f2fe;
  --purple:       #8b5cf6;
  --purple-soft:  #ede9fe;

  /* Risk skalası */
  --risk-0: #22c55e;
  --risk-1: #84cc16;
  --risk-2: #f59e0b;
  --risk-3: #f97316;
  --risk-4: #ef4444;

  /* Tipografi */
  --font-main: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: 2.125rem;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 999px;

  /* Gölge */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 14px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.10);

  /* Ölçüler */
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 72px;
  --header-h: 64px;
  --topbar-h: 0px;
  --container-max: 1440px;

  /* Geçişler */
  --t-fast: 150ms ease;
  --t-base: 220ms ease;
}

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

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

body {
  margin: 0;
  font-family: var(--font-main);
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

img, svg { max-width: 100%; height: auto; display: block; }

a {
  color: var(--brand-black);
  text-decoration: none;
  transition: color var(--t-fast);
}
a:hover, a:focus { color: var(--brand-primary-600); }

button { font-family: inherit; cursor: pointer; }

/* ---------- 3. A11Y ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand-black);
  color: var(--brand-primary);
  padding: 0.5rem 1rem;
  z-index: 10000;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}
.skip-link:focus {
  left: 0;
  outline: 3px solid var(--brand-primary);
  outline-offset: 2px;
}

:focus-visible {
  outline: 3px solid var(--brand-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

/* ---------- 4. App Shell Layout ---------- */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-body {
  display: flex;
  flex: 1 1 auto;
  position: relative;
}

.app-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-main__content {
  flex: 1 0 auto;
  padding: 1rem;
}

@media (min-width: 768px) {
  .app-main__content { padding: 1.5rem; }
}
@media (min-width: 1200px) {
  .app-main__content { padding: 1.75rem 2rem; }
}

.container-app {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
}

/* ---------- 5. Topbar (ince banner; tasarımda gizli) ---------- */
.topbar {
  display: none;
  background-color: var(--brand-black);
  color: var(--text-invert);
  min-height: 32px;
  align-items: center;
  padding: 0 1rem;
  font-size: var(--fs-xs);
}

/* ---------- 6. Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

/* Desktop: sabit yan panel */
@media (min-width: 992px) {
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
  }
}

/* Mobilde offcanvas */
@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    max-width: 84vw;
    transform: translateX(-100%);
    transition: transform var(--t-base);
    z-index: 1040;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: translateX(0); }
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1039;
  opacity: 0;
  transition: opacity var(--t-base);
}
.sidebar-backdrop.is-visible {
  display: block;
  opacity: 1;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.9rem;
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar__brand img {
  height: 36px;
  width: auto;
}

/* Sidebar içi hamburger: logonun sağında, sağ kenara itilir */
.sidebar__brand-toggle {
  margin-left: auto;
  background: var(--bg-muted);
  border: 1px solid transparent;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: var(--brand-black);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-md);
  transition: background-color var(--t-fast), border-color var(--t-fast);
}
.sidebar__brand-toggle:hover,
.sidebar__brand-toggle:focus {
  background: var(--brand-primary-100);
  border-color: var(--brand-primary);
}

/* Desktop: brand-toggle aktif */
@media (min-width: 992px) {
  .sidebar__brand-toggle { display: inline-flex; }
}

/* Mobil close butonu (offcanvas kapat) */
.sidebar__close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
@media (min-width: 992px) {
  .sidebar__close { display: none; }
}

.sidebar__nav {
  padding: 0.75rem 0.75rem 1rem;
  flex: 1 1 auto;
  overflow-y: auto;
}

.sidebar__group {
  margin-bottom: 0.75rem;
}

.sidebar__group-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 0.75rem 0.75rem 0.35rem;
  margin: 0;
}

.sidebar__nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--brand-black-60);
  font-size: var(--fs-sm);
  font-weight: 500;
  position: relative;
  transition: background-color var(--t-fast), color var(--t-fast);
}

.sidebar__link:hover,
.sidebar__link:focus {
  background-color: var(--brand-primary);
  color: var(--brand-black);
  font-weight: 600;
}

.sidebar__link i {
  width: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  transition: color var(--t-fast);
}

.sidebar__link:hover i,
.sidebar__link:focus i {
  color: var(--brand-black);
}

/* Hover'daki badge, aktif gibi görünsün ama arka planla kaynaşsın */
.sidebar__link:hover .badge-count,
.sidebar__link:focus .badge-count {
  background: var(--brand-black);
  color: var(--brand-primary);
}

.sidebar__link.active {
  background-color: var(--brand-primary-100);
  color: var(--brand-black);
  font-weight: 600;
}

.sidebar__link.active i {
  color: var(--brand-primary-600);
}

.sidebar__link.active::before {
  content: '';
  position: absolute;
  left: -0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background: var(--brand-primary);
  border-radius: 0 4px 4px 0;
}

.sidebar__link .badge-count {
  margin-left: auto;
  background: var(--brand-primary);
  color: var(--brand-black);
  font-size: 10px;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

/* Sidebar altı: Kullanıcı kartı (header'dan taşındı) */
.sidebar__foot {
  padding: 0.6rem 0.75rem 0.9rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar__user {
  width: 100%;
  position: relative;
}

.sidebar__user-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--brand-black);
  text-align: left;
  transition: background-color var(--t-fast), border-color var(--t-fast);
}

.sidebar__user-btn:hover,
.sidebar__user-btn:focus {
  background: var(--brand-primary-50);
  border-color: var(--brand-primary);
}

.sidebar__user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: var(--brand-black);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.sidebar__user-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar__user-name {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--brand-black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__user-role {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar__user-caret {
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
}

/* ---------- 6b. Sidebar COLLAPSED (desktop) ---------- */
@media (min-width: 992px) {
  .sidebar.is-collapsed {
    width: var(--sidebar-w-collapsed);
  }

  .sidebar.is-collapsed .sidebar__brand {
    padding: 0.75rem 0.4rem;
    justify-content: center;
    gap: 0;
  }
  /* Collapsed'te logo gizli, sadece toggle görünür ve merkezde */
  .sidebar.is-collapsed .sidebar__brand img { display: none; }
  .sidebar.is-collapsed .sidebar__brand-toggle { margin-left: 0; }

  .sidebar.is-collapsed .sidebar__nav { padding: 0.75rem 0.5rem 1rem; }

  .sidebar.is-collapsed .sidebar__group-title {
    text-align: center;
    padding: 0.6rem 0 0.35rem;
    font-size: 9px;
    letter-spacing: 1px;
    opacity: 0.6;
  }

  .sidebar.is-collapsed .sidebar__link {
    justify-content: center;
    padding: 0.65rem 0.4rem;
  }

  .sidebar.is-collapsed .sidebar__link span,
  .sidebar.is-collapsed .sidebar__link .badge-count {
    display: none;
  }

  .sidebar.is-collapsed .sidebar__link i {
    font-size: 16px;
    width: auto;
  }

  .sidebar.is-collapsed .sidebar__link.active::before {
    left: -0.5rem;
  }

  /* Collapsed — Kullanıcı kartı */
  .sidebar.is-collapsed .sidebar__foot {
    padding: 0.6rem 0.4rem 0.9rem;
  }
  .sidebar.is-collapsed .sidebar__user-btn {
    justify-content: center;
    padding: 0.4rem;
  }
  .sidebar.is-collapsed .sidebar__user-body,
  .sidebar.is-collapsed .sidebar__user-caret {
    display: none;
  }
}

/* ---------- Sidebar tooltip (JS yönetimli, fixed — overflow clip etmesin) ---------- */
.sb-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1080;
  background: var(--brand-primary);
  color: var(--brand-black);
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(0, 0, 0) translateX(-6px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  box-shadow: var(--shadow-md);
  font-family: var(--font-main);
}
.sb-tooltip::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: var(--brand-primary);
  width: 0; height: 0;
}
.sb-tooltip.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) translateX(0);
}
@media (prefers-reduced-motion: reduce) {
  .sb-tooltip { transition: opacity 0.08s ease; transform: none; }
  .sb-tooltip.is-visible { transform: none; }
}

/* ---------- 7. Header (sağ üst — breadcrumb + aksiyonlar) ---------- */
.app-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .app-header { padding: 0 1.5rem; }
}

.app-header__crumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-sm);
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.app-header__crumb .crumb-sep {
  color: var(--text-muted);
  font-size: 11px;
}

.app-header__crumb .crumb-page {
  font-weight: 600;
  color: var(--brand-black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header__crumb .crumb-link {
  color: var(--text-muted);
  font-weight: 500;
}

.app-header__actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.header-icon-btn {
  background: transparent;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  color: var(--brand-black-60);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background-color var(--t-fast), color var(--t-fast);
}

.header-icon-btn:hover,
.header-icon-btn:focus {
  background: var(--brand-primary-50);
  color: var(--brand-black);
}

.header-icon-btn .badge-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-surface);
}

/* Not: Kullanıcı chip sidebar'a taşındı (.sidebar__user-btn). Header sağında
   sadece bildirim simgesi kalıyor. Mobilde header'ın en solunda
   .app-header__toggle görünür (yalnızca <992px). */

/* ---------- 7b. Header Mobile Toggle (mobilde menüyü açar) ---------- */
.app-header__toggle {
  display: none;
  background: var(--bg-muted);
  border: 1px solid transparent;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: var(--brand-black);
  align-items: center;
  justify-content: center;
  font-size: var(--fs-md);
  flex-shrink: 0;
  transition: background-color var(--t-fast), border-color var(--t-fast);
}

.app-header__toggle:hover,
.app-header__toggle:focus {
  background: var(--brand-primary-100);
  border-color: var(--brand-primary);
}

@media (max-width: 991.98px) {
  .app-header__toggle { display: inline-flex; }
}

/* ---------- 8. Rol rozeti ---------- */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--brand-primary);
  color: var(--brand-black);
  white-space: nowrap;
}
.role-badge--admin      { background: var(--brand-primary); color: var(--brand-black); }
.role-badge--muhasebe   { background: var(--info-soft);    color: #075985; }
.role-badge--pazarlamaci{ background: var(--success-soft); color: #065f46; }

/* ---------- 9. Bootstrap dropdown marka uyumu ---------- */
.dropdown-menu {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-md);
  padding: 0.4rem;
  font-size: var(--fs-sm);
  min-width: 230px;
}

.dropdown-menu .dropdown-item {
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-primary);
}

.dropdown-menu .dropdown-item i {
  width: 18px;
  text-align: center;
  color: var(--text-muted);
}

.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus {
  background-color: var(--brand-primary-50);
  color: var(--brand-black);
}

.dropdown-menu .dropdown-item:hover i,
.dropdown-menu .dropdown-item:focus i {
  color: var(--brand-primary-600);
}

.dropdown-menu .dropdown-item.text-danger,
.dropdown-menu .dropdown-item.text-danger i {
  color: var(--danger);
}

.dropdown-menu .dropdown-item.text-danger:hover {
  background-color: var(--danger-soft);
  color: var(--danger);
}

.dropdown-menu .dropdown-divider {
  margin: 0.3rem 0;
  border-top-color: var(--border);
}

.dropdown-menu .dropdown-header {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.5rem 0.8rem 0.25rem;
}

/* Bildirim dropdown */
.notif-menu {
  width: min(360px, 92vw);
  padding: 0;
  overflow: hidden;
}
.notif-menu__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}
.notif-menu__head h6 {
  margin: 0; font-size: var(--fs-md); font-weight: 700;
}
.notif-menu__list {
  max-height: 340px; overflow-y: auto; padding: 0.25rem;
}
.notif-item {
  display: flex; gap: 0.65rem; padding: 0.7rem 0.8rem;
  border-radius: var(--radius-sm); text-decoration: none; color: inherit;
  align-items: flex-start;
}
.notif-item:hover, .notif-item:focus { background: var(--brand-primary-50); color: inherit; }

.notif-item__icon {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.notif-item__icon--warning { background: var(--warning-soft); color: #92400e; }
.notif-item__icon--danger  { background: var(--danger-soft);  color: #991b1b; }
.notif-item__icon--info    { background: var(--info-soft);    color: #075985; }
.notif-item__icon--success { background: var(--success-soft); color: #065f46; }

.notif-item__body { flex: 1; min-width: 0; }
.notif-item__title { font-size: var(--fs-sm); font-weight: 600; margin: 0 0 2px; }
.notif-item__meta  { font-size: var(--fs-xs); color: var(--text-muted); margin: 0; }

.notif-menu__foot {
  text-align: center; padding: 0.7rem;
  border-top: 1px solid var(--border); font-size: var(--fs-sm);
}

/* ---------- 10. Footer ---------- */
footer[role="contentinfo"] {
  padding: 0.9rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  flex-shrink: 0;
}

footer[role="contentinfo"] a {
  color: var(--brand-black-60);
  text-decoration: none;
  font-weight: 600;
}

footer[role="contentinfo"] a:hover,
footer[role="contentinfo"] a:focus {
  color: var(--brand-primary-600);
  text-decoration: underline;
}

.footer__grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  max-width: 100%;
}

.footer__left   { justify-self: start;  text-align: left;   }
.footer__center { justify-self: center; text-align: center; font-weight: 600; color: var(--brand-black); }
.footer__right  { justify-self: end;    text-align: right;  }

.footer__ver {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  vertical-align: middle;
}

.footer__ver-icon {
  color: var(--text-muted);
  font-size: 12px;
  vertical-align: middle;
}

.footer__heart {
  color: var(--brand-primary);
  display: inline-block;
  margin: 0 0.15rem;
  animation: footer-heartbeat 2.6s ease-in-out infinite;
  transform-origin: center;
  will-change: transform;
}

@keyframes footer-heartbeat {
  0%, 100% { transform: scale(1);    color: var(--brand-primary);     }
  10%      { transform: scale(1.22); color: var(--brand-primary-600); }
  20%      { transform: scale(1);    color: var(--brand-primary);     }
  30%      { transform: scale(1.14); color: var(--brand-primary-600); }
  45%      { transform: scale(1);    color: var(--brand-primary);     }
}

@media (prefers-reduced-motion: reduce) {
  .footer__heart { animation: none; }
}

/* Mobilde üç satır ortalanmış, sıkı aralıklı */
@media (max-width: 767.98px) {
  footer[role="contentinfo"] { padding: 0.7rem 1rem; }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: 0.2rem;
    text-align: center;
  }
  .footer__left,
  .footer__center,
  .footer__right {
    justify-self: center;
    text-align: center;
  }
}

/* ---------- 11. Back to Top ---------- */
.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background-color: var(--brand-primary);
  color: var(--brand-black);
  border: none;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity var(--t-base), transform var(--t-base), background-color var(--t-fast), visibility var(--t-base);
  z-index: 1030;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover,
.back-to-top:focus {
  background-color: var(--brand-primary-600);
}

.back-to-top i { font-size: var(--fs-lg); }

@media (min-width: 768px) {
  .back-to-top { right: 1.5rem; bottom: 1.5rem; }
}

/* ---------- 12. Utility ---------- */
.text-brand  { color: var(--brand-primary); }
.bg-brand    { background-color: var(--brand-primary); }
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.text-warning{ color: var(--warning); }

/* Brand button */
.btn-brand {
  background-color: var(--brand-primary);
  border: 1px solid var(--brand-primary);
  color: var(--brand-black);
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  transition: background-color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.btn-brand:hover, .btn-brand:focus {
  background-color: var(--brand-primary-600);
  border-color: var(--brand-primary-600);
  color: var(--brand-black);
}
.btn-brand:active { transform: translateY(1px); }
.btn-brand:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-outline-dark-app {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--brand-black);
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  transition: background-color var(--t-fast), border-color var(--t-fast);
}
.btn-outline-dark-app:hover, .btn-outline-dark-app:focus {
  background: var(--brand-primary-50);
  border-color: var(--brand-primary);
  color: var(--brand-black);
}

/* Risk badge */
.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.risk-0 { background-color: var(--risk-0); }
.risk-1 { background-color: var(--risk-1); color: #1a2e05; }
.risk-2 { background-color: var(--risk-2); color: #1f1300; }
.risk-3 { background-color: var(--risk-3); }
.risk-4 { background-color: var(--risk-4); }

/* Durum etiketi (noktalı) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--bg-muted);
  color: var(--brand-black-60);
  white-space: nowrap;
}
.status-pill::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: 0.9;
}
.status-pill--success { background: var(--success-soft); color: #065f46; }
.status-pill--warning { background: var(--warning-soft); color: #92400e; }
.status-pill--danger  { background: var(--danger-soft);  color: #991b1b; }
.status-pill--info    { background: var(--info-soft);    color: #075985; }

/* ---------- 13. Page heading ---------- */
.page-heading {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0 0 1.5rem;
}

.page-heading__title {
  margin: 0;
  font-size: var(--fs-2xl);
  font-weight: 800;
  color: var(--brand-black);
  letter-spacing: -0.4px;
}

.page-heading__subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

.page-heading__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

@media (min-width: 768px) {
  .page-heading {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }
  .page-heading__title { font-size: var(--fs-3xl); }
}

/* ---------- 14. Panel (genel kart) ---------- */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.panel__head {
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}

.panel__title {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--brand-black);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.panel__title i {
  color: var(--brand-primary);
  font-size: var(--fs-md);
}

.panel__body { padding: 0.5rem 0.5rem; }

.panel--plain .panel__body { padding: 1.25rem; }

/* ---------- 14b. Coming soon (placeholder) ---------- */
.coming-soon {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 2.5rem 1.25rem;
  text-align: center;
  max-width: 680px;
  margin: 1.5rem auto;
  position: relative;
  overflow: hidden;
}

.coming-soon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand-primary) 0%, var(--brand-primary-600) 100%);
}

.coming-soon__icon {
  width: 84px;
  height: 84px;
  border-radius: var(--radius-full);
  background: var(--brand-primary-100);
  color: var(--brand-primary-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  margin: 0 auto 1.1rem;
}

.coming-soon__title {
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--brand-black);
  margin: 0 0 0.4rem;
  letter-spacing: -0.2px;
}

@media (min-width: 768px) {
  .coming-soon__title { font-size: var(--fs-2xl); }
}

.coming-soon__subtitle {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  margin: 0 auto 1.4rem;
  max-width: 480px;
  line-height: 1.55;
}

.coming-soon__badges {
  display: inline-flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.coming-soon__version {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  background: var(--brand-primary-100);
  color: var(--brand-black);
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.coming-soon__features {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin: 1rem auto 0;
  text-align: left;
  max-width: 480px;
}

@media (min-width: 560px) {
  .coming-soon__features { grid-template-columns: 1fr 1fr; }
}

.coming-soon__feature {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.6rem 0.8rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--brand-black-60);
}

.coming-soon__feature i {
  color: var(--brand-primary-600);
  margin-top: 3px;
  flex-shrink: 0;
}

.coming-soon__actions {
  margin-top: 1.5rem;
  display: inline-flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------- 15. Hareket duyarlı ---------- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 16. Mobil Genel İyileştirmeler ---------- */

/* Global taşma koruması */
html, body { overflow-x: hidden; }

/* Tablo saran yardımcı - responsive scroll */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
}
.table-responsive::-webkit-scrollbar { height: 6px; }
.table-responsive::-webkit-scrollbar-thumb {
  background: var(--brand-primary-100);
  border-radius: 999px;
}

/* Mobil < 768px: Ortak ayarlamalar */
@media (max-width: 767.98px) {
  /* İçerik padding daraltma */
  .app-main__content { padding: 0.85rem; }

  /* Page heading akışı */
  .page-heading { margin: 0 0 1.1rem; }
  .page-heading__title {
    font-size: clamp(1.2rem, 5vw, var(--fs-2xl));
    line-height: 1.25;
  }
  .page-heading__subtitle { font-size: var(--fs-xs); }
  .page-heading__actions {
    width: 100%;
    gap: 0.4rem;
  }
  .page-heading__actions > .btn,
  .page-heading__actions > button,
  .page-heading__actions > a {
    flex: 1 1 auto;
    min-height: 40px;
    justify-content: center;
  }

  /* Panel */
  .panel__head {
    padding: 0.7rem 0.85rem;
    gap: 0.5rem;
  }
  .panel__title { font-size: var(--fs-sm); }
  .panel--plain .panel__body { padding: 0.9rem; }

  /* Form kontrolleri - iOS auto-zoom engelleme + dokunmatik hedef */
  .form-control,
  .form-select,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="search"],
  input[type="url"],
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"],
  select,
  textarea {
    font-size: 16px !important;
    min-height: 44px;
  }
  textarea.form-control, textarea { min-height: 88px; }

  /* Butonlarda dokunmatik alan */
  .btn { min-height: 40px; }
  .btn-brand,
  .btn-primary,
  .btn-outline-primary,
  .btn-outline-secondary,
  .btn-outline-dark,
  .btn-outline-danger,
  .btn-danger,
  .btn-success { min-height: 40px; }

  /* İkon butonları — dokunulabilir */
  .btn-icon,
  .icon-btn,
  [class*="-icon-btn"] {
    min-width: 40px;
    min-height: 40px;
  }

  /* Modal mobil davranış */
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100vw - 1rem);
  }
  .modal-content {
    border-radius: var(--radius-lg);
  }
  .modal-body { padding: 0.9rem; }
  .modal-header, .modal-footer {
    padding: 0.75rem 0.9rem;
  }
  .modal-footer { gap: 0.4rem; flex-wrap: wrap; }
  .modal-footer > .btn { flex: 1 1 auto; }

  /* Ortak filtre/toolbar pattern */
  .toolbar,
  .filter-bar,
  .panel__toolbar {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  /* Tablo mobil daraltma */
  table.table { font-size: var(--fs-xs); }
  .table > :not(caption) > * > * {
    padding: 0.55rem 0.5rem;
  }

  /* Uzun string/sayı koruması */
  .truncate,
  .cell-truncate {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Bootstrap row/col gutter daraltma */
  .row { --bs-gutter-x: 0.75rem; }

  /* Genel kart başlıklarında taşma önleme */
  .card-title,
  .panel__title,
  .page-heading__title {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Back-to-top daha küçük */
  .back-to-top {
    width: 40px;
    height: 40px;
    right: 0.8rem;
    bottom: 0.8rem;
  }
}

/* Çok dar cihazlar < 380px: aşırı kompakt */
@media (max-width: 379.98px) {
  .app-main__content { padding: 0.7rem; }
  .page-heading__title { font-size: 1.1rem; }
  .panel__head { padding: 0.6rem 0.7rem; }
  .panel--plain .panel__body { padding: 0.75rem; }
  .btn, .btn-brand { font-size: var(--fs-xs); padding: 0.45rem 0.75rem; }
  .back-to-top { width: 38px; height: 38px; }
}

/* iOS input dolgusu */
@supports (-webkit-touch-callout: none) {
  input, select, textarea {
    -webkit-appearance: none;
  }
}
