/* =========================================================================
   Yerlesim (shell)
   Masaustu: sidebar viewport yuksekliginde SABIT (sticky) kolon, sadece icerik kayar.
   Boylece sayfa ne kadar uzun olursa olsun sidebar asla "kisa kalmaz" ve
   sidebar'in kendi yuksekligi sayfaya ekstra scroll eklemez.
   Mobil (<768px): ust bar + Bootstrap offcanvas cekmece.
   ========================================================================= */
:root {
  --sidebar-w: 248px;
}

body.admin-body {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 100vh;
  min-height: 100dvh;
}

.admin-mobile-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--color-primary);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 6px 16px rgba(0, 0, 0, 0.12);
}

.mobile-topbar-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  border-radius: 8px;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-sidebar {
  --bs-offcanvas-width: min(var(--sidebar-w), 86vw);
  flex-shrink: 0;
}

.admin-sidebar.offcanvas-md {
  background: var(--color-primary) !important;
}

.admin-sidebar .offcanvas-header {
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar .offcanvas-body {
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

@media (min-width: 768px) {
  .admin-sidebar {
    position: sticky;
    top: 0;
    width: var(--sidebar-w);
    height: 100vh;
    height: 100dvh;
  }

  .admin-sidebar .offcanvas-body {
    height: 100%;
    padding: 24px 16px;
  }
}

@media (max-width: 767.98px) {
  body.admin-body {
    flex-direction: column;
  }
}

/* ---------- Sidebar marka alani ---------- */
.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 12px 22px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
  flex-shrink: 0;
}

.sidebar-brand .brand-logo {
  --brand-logo-h: 30px;
  max-width: 100%;
}

/* Logodaki "SECURITY SOLUTIONS" sloganinin tipografisini yankilar: genis harf araligi, celik gri. */
.sidebar-brand-text {
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  line-height: 1;
}

/* Alt marka iliskisi: sidebar'in en altinda soluk MTM logosu (dogrulama sayfasi footer'ini yankilar). */
.sidebar-endorse {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 12px 2px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.sidebar-endorse .brand-logo {
  --brand-logo-h: 14px;
  opacity: 0.5;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 0;
}

.mobile-brand .brand-logo {
  --brand-logo-h: 20px;
}

.mobile-brand .sidebar-brand-text {
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  letter-spacing: 0.24em;
}

/* ---------- Sidebar navigasyon ---------- */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 0 auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-icon {
  display: inline-flex;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-link:hover,
.sidebar-link:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.sidebar-link:focus-visible {
  outline: 2px solid var(--color-brand-soft);
  outline-offset: -2px;
}

.sidebar-link.active {
  background: linear-gradient(90deg, rgba(var(--color-brand-rgb), 0.32), rgba(var(--color-brand-rgb), 0.12));
  box-shadow: inset 3px 0 0 var(--color-brand-soft);
  color: #fff;
  font-weight: 600;
}

.sidebar-link.active .sidebar-icon {
  color: var(--color-brand-soft);
  opacity: 1;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.35);
  padding: 16px 12px 4px;
}

/* Firma kullanicisinda: hangi firmanin panelinde oldugu her zaman gorunur. */
.sidebar-tenant {
  margin: -6px 12px 16px;
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 14px 8px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  min-width: 0;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-brand);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.sidebar-user-info {
  min-width: 0;
  line-height: 1.25;
}

.sidebar-user-name {
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-role {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-actions {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}

.sidebar-link--small {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 7px 12px;
  font-size: 13px;
  text-align: left;
}

/* ---------- Icerik alani ---------- */
.admin-content {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 1520px;
  padding: 28px clamp(16px, 3vw, 40px) 40px;
}

.admin-topbar {
  margin-bottom: 20px;
}

.admin-topbar h1 {
  overflow-wrap: anywhere;
}

.admin-topbar p {
  font-size: 14px;
  overflow-wrap: anywhere;
}

@media (max-width: 767.98px) {
  .admin-content {
    padding-top: 18px;
    padding-bottom: 32px;
  }
}

.min-w-0 { min-width: 0; }
.tabular { font-variant-numeric: tabular-nums; }

/* =========================================================================
   Kartlar, basliklar
   ========================================================================= */
.card {
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease;
}

.card.card-hover:hover {
  box-shadow: var(--shadow-md);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.link-more {
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--color-brand);
}

@media (min-width: 1200px) {
  .sticky-xl-card {
    position: sticky;
    top: 24px;
  }
}

.page-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-toolbar-field {
  width: 100%;
  max-width: 320px;
}

/* =========================================================================
   Login
   ========================================================================= */
.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--gradient-hero);
  padding-top: 24px;
  padding-bottom: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  border-top: 4px solid var(--color-brand) !important;
}

.login-logo {
  --brand-logo-h: 96px;
  max-width: 100%;
  margin: 8px auto 14px;
}

/* Alt marka iliskisi: HoloTag, MTM Security Solutions'in markasidir. */
.login-endorse {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: 22px;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 500;
}

.login-endorse .brand-logo {
  --brand-logo-h: 16px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(var(--color-primary-rgb), 0.1);
}

/* =========================================================================
   Durum rozetleri
   ========================================================================= */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.status-badge--success { background: rgba(var(--color-success-rgb), 0.1); color: #22662A; }
.status-badge--danger  { background: rgba(var(--color-error-rgb), 0.1); color: #B02E22; }
.status-badge--warning { background: #FFF4DB; color: #8A5A00; }
.status-badge--neutral { background: rgba(var(--color-primary-rgb), 0.06); color: var(--color-text-muted); }
.status-badge--brand   { background: rgba(var(--color-brand-rgb), 0.08); color: var(--color-brand-strong); }

/* =========================================================================
   Stat tile'lar — CSS grid ile her ekran genisliginde esit, tasmayan dagilim
   ========================================================================= */
.stat-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 168px), 1fr));
}

.stat-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 991.98px) {
  .stat-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 575.98px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
}

.stat-tile {
  display: block;
  width: 100%;
  min-width: 0;
  text-align: left;
  border: 0;
  border-radius: var(--bs-border-radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  background: var(--color-surface);
  color: inherit;
}

.stat-tile--flat {
  box-shadow: none;
  background: var(--color-bg);
  padding: 14px;
}

.stat-tile--action {
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.stat-tile--action:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-tile--action:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

@media (max-width: 575.98px) {
  .stat-tile { padding: 14px; }
}

.stat-tile-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.stat-tile-icon--primary { background: rgba(var(--color-primary-rgb), 0.07); color: var(--color-primary); }
.stat-tile-icon--success { background: rgba(var(--color-success-rgb), 0.1); color: var(--color-success); }
.stat-tile-icon--danger  { background: rgba(var(--color-error-rgb), 0.1); color: var(--color-error); }

.stat-tile-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stat-tile-value--sm {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

@media (max-width: 575.98px) {
  .stat-tile-value { font-size: 22px; }
}

.stat-tile-label {
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.stat-tile-hint {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-success);
}

/* Yukleniyor iskeletleri */
.skeleton-line,
.skeleton-block {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(var(--color-primary-rgb), 0.06) 25%, rgba(var(--color-primary-rgb), 0.11) 50%, rgba(var(--color-primary-rgb), 0.06) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.skeleton-block {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-line, .skeleton-block { animation: none; }
}

/* =========================================================================
   Tablolar
   ========================================================================= */
.table-admin {
  font-size: 14px;
  --bs-table-hover-bg: rgba(var(--color-primary-rgb), 0.025);
}

.table-admin thead th {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  border-bottom-width: 1px;
  white-space: nowrap;
  padding-top: 10px;
  padding-bottom: 10px;
}

.table-admin td {
  padding-top: 11px;
  padding-bottom: 11px;
  border-color: rgba(var(--color-primary-rgb), 0.06);
}

.table-admin tbody tr:last-child td {
  border-bottom: 0;
}

.table-admin tbody {
  transition: opacity 0.15s ease;
}

.table-admin tbody.is-refreshing {
  opacity: 0.5;
  pointer-events: none;
}

.table-admin .skeleton-row:hover > * {
  --bs-table-bg-state: transparent;
}

.cell-clip {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uid-link {
  font-family: var(--bs-font-monospace);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.table-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 32px 16px;
  text-align: center;
  color: var(--color-text);
}

.table-state svg {
  color: var(--color-steel);
  margin-bottom: 6px;
}

.table-state--error {
  color: var(--color-error);
}

.state-row:hover > * {
  --bs-table-bg-state: transparent;
}

.row-actions {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-success-soft {
  --bs-btn-color: #22662A;
  --bs-btn-bg: rgba(var(--color-success-rgb), 0.1);
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--color-success);
  --bs-btn-hover-border-color: var(--color-success);
  --bs-btn-active-bg: #256628;
  --bs-btn-active-color: #fff;
  font-weight: 600;
}

/* Mobilde (<576px) yatay kaydirmali tablo yerine her satir bir kart olur.
   Hucreler data-label ile kendi sutun basligini gosterir; hicbir icerik tasmaz/ust uste binmez. */
@media (max-width: 575.98px) {
  .table-stack thead {
    display: none;
  }

  .table-stack,
  .table-stack tbody,
  .table-stack tr,
  .table-stack td {
    display: block;
    width: 100%;
  }

  .table-stack tr {
    border: 1px solid rgba(var(--color-primary-rgb), 0.08);
    border-radius: 12px;
    padding: 6px 12px;
    margin-bottom: 10px;
    background: var(--color-surface);
  }

  .table-stack td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 7px 0 !important;
    border-bottom: 1px solid rgba(var(--color-primary-rgb), 0.05) !important;
    text-align: right !important;
    min-width: 0;
  }

  .table-stack td:last-child {
    border-bottom: 0 !important;
  }

  .table-stack td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    text-align: left;
  }

  .table-stack td > * {
    min-width: 0;
  }

  .table-stack .cell-clip,
  .table-stack td .cell-clip {
    max-width: 62vw;
  }

  .table-stack .state-row,
  .table-stack .skeleton-row {
    border: 0;
    padding: 0;
    background: transparent;
  }

  .table-stack .state-row td {
    justify-content: center;
    text-align: center !important;
  }

  .table-stack .skeleton-row td {
    padding: 6px 0 !important;
    border: 0 !important;
  }

  .table-stack .skeleton-row td:not(:first-child) {
    display: none;
  }

  .table-responsive:has(.table-stack) {
    overflow: visible;
  }
}

/* =========================================================================
   Liste araclari: arama + filtre
   ========================================================================= */
.list-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.list-toolbar > .search-field {
  flex: 1 1 240px;
}

.list-toolbar > .form-select {
  flex: 0 1 200px;
  min-width: 160px;
}

@media (max-width: 575.98px) {
  .list-toolbar > .form-select {
    flex: 1 1 100%;
  }
}

.search-field {
  position: relative;
  min-width: 0;
}

.search-field svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-field .form-control {
  padding-left: 36px;
}

/* =========================================================================
   Sayfalama
   ========================================================================= */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  padding-top: 14px;
  margin-top: 4px;
  border-top: 1px solid rgba(var(--color-primary-rgb), 0.06);
  font-size: 13px;
  color: var(--color-text-muted);
}

.pager-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pager-info strong {
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.pager-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.pager-size .form-select {
  width: auto;
  padding-top: 2px;
  padding-bottom: 2px;
  font-size: 13px;
}

.pager-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pager-numbers {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pager-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.pager-btn:hover:not(:disabled):not(.is-active) {
  background: rgba(var(--color-primary-rgb), 0.06);
}

.pager-btn:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 1px;
}

.pager-btn.is-active {
  background: var(--color-brand);
  color: #fff;
  box-shadow: 0 2px 6px rgba(var(--color-brand-rgb), 0.3);
}

.pager-btn:disabled {
  color: rgba(var(--color-primary-rgb), 0.25);
  cursor: not-allowed;
}

.pager-gap {
  min-width: 20px;
  text-align: center;
}

.pager-compact {
  display: none;
  min-width: 64px;
  text-align: center;
  font-weight: 600;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

/* Dar ekranda sayfa numaralari yerine "3 / 12" ozet + ileri/geri; tasma olmaz. */
@media (max-width: 575.98px) {
  .pager {
    justify-content: center;
  }

  .pager-info {
    width: 100%;
    justify-content: space-between;
  }

  .pager-numbers {
    display: none;
  }

  .pager-compact {
    display: inline-block;
  }

  .pager-nav {
    width: 100%;
    justify-content: space-between;
  }

  .pager-btn {
    min-width: 44px;
    height: 40px;
    border-color: rgba(var(--color-primary-rgb), 0.1);
  }
}

/* =========================================================================
   Segment (sekme) kontrolu
   ========================================================================= */
.segmented {
  display: inline-flex;
  max-width: 100%;
  overflow-x: auto;
  padding: 3px;
  gap: 2px;
  border-radius: 11px;
  background: rgba(var(--color-primary-rgb), 0.05);
  scrollbar-width: none;
}

.segmented::-webkit-scrollbar { display: none; }

.segmented-btn {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.segmented-btn:hover {
  color: var(--color-text);
}

.segmented-btn.is-active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

.segmented-btn:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 1px;
}

/* =========================================================================
   Loyalty: trend grafigi, siralama listesi, odul satirlari
   ========================================================================= */
/* Eksen etiketi yerine her cubugun ustunde kendi degeri yazar; kesikli cizgiler sadece gorsel ritim. */
.trend-chart {
  position: relative;
  height: 180px;
}

.trend-grid {
  position: absolute;
  inset: 0 0 36px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.trend-grid span {
  border-top: 1px dashed rgba(var(--color-primary-rgb), 0.07);
}

.trend-cols {
  position: relative;
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 4px;
  height: 100%;
}

.trend-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Deger etiketi cubugun hemen ustunde durur (kolon flex); cubuk yuksekligi JS'te en fazla %82 —
   en yuksek cubukta bile etikete yer kalir, grafik alanindan tasmaz. */
.trend-bar-area {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}

.trend-bar {
  width: 100%;
  max-width: 28px;
  border-radius: 5px 5px 2px 2px;
  background: var(--color-brand);
  transition: height 0.4s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.15s ease;
}

.trend-col:hover .trend-bar.has-value {
  background: var(--color-brand-strong);
}

.trend-value {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: var(--color-brand-strong);
  font-variant-numeric: tabular-nums;
}

.trend-label {
  height: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 6px;
  line-height: 1.1;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  border-top: 1px solid rgba(var(--color-primary-rgb), 0.12);
}

.trend-label small {
  font-size: 9.5px;
  font-weight: 500;
  color: var(--color-text-muted);
}

.trend-empty {
  position: absolute;
  inset: 0 0 36px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--color-text-muted);
}

/* Dar ekranda 14 etiketin hepsi sigmaz: tek gunlerin etiketi gizlenir, cubuklar kalir. */
@media (max-width: 575.98px) {
  .trend-chart { height: 160px; }
  .trend-col:nth-child(even) .trend-label span,
  .trend-col:nth-child(even) .trend-label small { visibility: hidden; }
  .trend-label small { display: none; }
  .trend-value { font-size: 10px; }
}

.rank-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rank-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  min-width: 0;
}

.rank-num {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(var(--color-primary-rgb), 0.06);
  color: var(--color-text-muted);
}

.rank-list li:first-child .rank-num {
  background: rgba(var(--color-brand-rgb), 0.1);
  color: var(--color-brand);
}

.rank-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-count {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rank-empty {
  color: var(--color-text-muted);
}

.switch-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--color-bg);
}

.switch-row .form-check-input {
  width: 2.5em;
  height: 1.35em;
  cursor: pointer;
}

.reward-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 96px auto;
  gap: 8px;
}

@media (max-width: 575.98px) {
  .reward-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .reward-form > :first-child,
  .reward-form > button {
    grid-column: 1 / -1;
  }
}

.rewards-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 440px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.reward-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(var(--color-primary-rgb), 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.reward-row.is-inactive {
  background: var(--color-bg);
}

.reward-row.is-inactive .reward-main {
  opacity: 0.55;
}

.reward-main {
  flex: 1;
  min-width: 0;
}

.reward-stock {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  color: var(--color-text-muted);
}

.reward-stock input {
  width: 84px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 400px) {
  .reward-stock span { display: none; }
  .reward-stock input { width: 70px; }
}

/* =========================================================================
   Tag detay
   ========================================================================= */
.eyebrow-sm {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.uid-display {
  font-family: var(--bs-font-monospace);
  font-size: clamp(16px, 2.2vw, 20px);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.detail-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0 0 20px;
  font-size: 14px;
}

.detail-list dt {
  font-weight: 500;
  color: var(--color-text-muted);
}

.detail-list dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.status-form {
  padding-top: 16px;
  border-top: 1px solid rgba(var(--color-primary-rgb), 0.08);
}

.dist-row + .dist-row {
  margin-top: 12px;
}

.dist-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 5px;
}

.dist-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(var(--color-primary-rgb), 0.06);
  overflow: hidden;
}

.dist-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--color-brand);
}

/* =========================================================================
   Toplu ice aktarma
   ========================================================================= */
.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 28px 16px;
  border: 1.5px dashed rgba(var(--color-primary-rgb), 0.2);
  border-radius: 14px;
  background: var(--color-bg);
  color: var(--color-text-muted);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.file-drop:hover,
.file-drop.is-dragover {
  border-color: var(--color-brand);
  background: rgba(var(--color-brand-rgb), 0.03);
}

.file-drop.is-selected {
  border-style: solid;
  border-color: rgba(var(--color-success-rgb), 0.5);
  background: rgba(var(--color-success-rgb), 0.04);
}

.file-drop.is-invalid {
  border-style: solid;
  border-color: var(--color-error);
  background: rgba(var(--color-error-rgb), 0.04);
}

.file-drop-title {
  font-weight: 600;
  color: var(--color-text);
  overflow-wrap: anywhere;
}

.file-drop-hint {
  font-size: 12.5px;
}

/* Urun formu gorsel alani: bosken surukle-birak kutusu, gorsel varken onizleme (tiklayinca degistirilir). */
.image-drop {
  min-height: 150px;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.image-drop-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.image-drop.has-image {
  padding: 10px;
  border-style: solid;
  border-color: rgba(var(--color-primary-rgb), 0.12);
  background:
    repeating-conic-gradient(rgba(var(--color-primary-rgb), 0.04) 0 25%, transparent 0 50%) 0 0 / 16px 16px,
    var(--color-surface);
}

.image-drop-preview {
  display: block;
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
}

.image-field-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  min-width: 0;
}

.image-field-meta[hidden],
.image-drop-empty[hidden],
.image-drop-preview[hidden] {
  display: none;
}

/* HoloTag eslestirme: etiketteki code ile urun barkodu karsilastirmasi. */
.code-check {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.45;
  border: 1px solid transparent;
}

.code-check[hidden] { display: none; }
.code-check code { font-size: 12px; }
.code-check--ok { background: rgba(var(--color-success-rgb), 0.08); border-color: rgba(var(--color-success-rgb), 0.25); color: var(--color-success); }
.code-check--danger { background: rgba(var(--color-error-rgb), 0.06); border-color: rgba(var(--color-error-rgb), 0.3); color: var(--color-error); }
.code-check--warn { background: rgba(176, 125, 22, 0.08); border-color: rgba(176, 125, 22, 0.3); color: #7a5a12; }
.code-check--info { background: rgba(var(--color-primary-rgb), 0.04); border-color: rgba(var(--color-primary-rgb), 0.12); color: var(--color-text); }

/* Dokunmatik cihazda surukle-birak yok: alana dokununca telefonun secicisi (galeri / kamera / dosyalar) acilir. */
.only-touch { display: none; }

@media (hover: none) and (pointer: coarse) {
  .only-pointer { display: none; }
  .only-touch { display: inline; }
}

.image-field-name {
  font-size: 12.5px;
  color: var(--color-text-muted);
  min-width: 0;
}

.image-field-error {
  margin-top: 6px;
  font-size: 0.875em;
  color: var(--color-error);
}

#csv-file:focus-visible + .file-drop,
.file-drop:focus-within {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.code-sample {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--color-primary);
  color: #E8EAEB;
  font-size: 12.5px;
  overflow-x: auto;
}

.error-list {
  max-height: 260px;
  overflow-y: auto;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(var(--color-error-rgb), 0.05);
  color: #9A2A1F;
}

/* =========================================================================
   Toast bildirimleri
   ========================================================================= */
.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1090;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

@media (max-width: 575.98px) {
  .toast-host {
    left: 12px;
    right: 12px;
    bottom: 12px;
    align-items: stretch;
  }
}

.app-toast {
  max-width: 380px;
  padding: 11px 16px 11px 14px;
  border-radius: 12px;
  background: var(--color-primary);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--color-success);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: auto;
}

.app-toast--danger {
  border-left-color: var(--color-error);
}

.app-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 575.98px) {
  .app-toast { max-width: none; }
}

.app-toast {
  position: relative;
  padding-right: 36px;
}

.app-toast-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 2px;
}

.app-toast-body {
  font-weight: 400;
  color: rgba(255, 255, 255, 0.85);
  overflow-wrap: anywhere;
}

.app-toast-close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-size: 18px;
  line-height: 1;
  padding: 4px;
}

.app-toast-close:hover {
  color: #fff;
}

.app-toast--warning {
  border-left-color: #E0A100;
}

/* =========================================================================
   Formlar ve modallar — tasma korumasi
   ========================================================================= */
.modal-content,
.modal-body,
.alert,
.form-text,
.invalid-feedback {
  overflow-wrap: anywhere;
}

.modal-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 8px;
}

textarea.form-control {
  resize: vertical;
  min-height: 72px;
  max-height: 320px;
}

.form-select {
  text-overflow: ellipsis;
}

.char-counter {
  margin-top: 4px;
  text-align: right;
  font-size: 11.5px;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.char-counter.is-near {
  color: #8A5A00;
  font-weight: 600;
}

.confirm-details {
  padding-left: 18px;
}

.confirm-details li + li {
  margin-top: 4px;
}

.date-input {
  flex: 0 1 160px;
  min-width: 140px;
}

@media (max-width: 575.98px) {
  .date-input { flex: 1 1 calc(50% - 5px); }
}

.pw-rules {
  list-style: none;
  padding: 0;
  font-size: 12.5px;
  color: var(--color-text-muted);
}

.pw-rules li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pw-rules li::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(var(--color-primary-rgb), 0.25);
  flex-shrink: 0;
}

.pw-rules li.is-met {
  color: #22662A;
}

.pw-rules li.is-met::before {
  border-color: var(--color-success);
  background: var(--color-success) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='white' stroke-width='2.5' d='M4 8.5l2.5 2.5L12 5'/%3e%3c/svg%3e") center / 10px no-repeat;
}

/* Modul / kapsam secenekleri (checkbox + radio kartlari) */
.module-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.module-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(var(--color-primary-rgb), 0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.module-option + .module-option {
  margin-top: 0;
}

label.module-option:not(:first-child) {
  margin-top: 8px;
}

.module-options label.module-option {
  margin-top: 0;
}

.module-option:hover {
  border-color: rgba(var(--color-brand-rgb), 0.4);
}

.module-option:has(input:checked:not(:disabled)) {
  border-color: var(--color-brand);
  background: rgba(var(--color-brand-rgb), 0.03);
}

.module-option.is-locked {
  cursor: default;
  background: var(--color-bg);
}

.module-option .form-check-input {
  margin-top: 3px;
  flex-shrink: 0;
}

.module-option-title {
  display: block;
  font-weight: 600;
  font-size: 14px;
}

.module-option-desc {
  display: block;
  font-size: 12.5px;
  color: var(--color-text-muted);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(var(--color-brand-rgb), 0.08);
  color: var(--color-brand-strong);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.chip--sm {
  font-size: 10.5px;
  padding: 1px 6px;
}

/* =========================================================================
   Roller ve izinler
   ========================================================================= */
.role-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.role-list-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  padding: 10px 8px 4px;
}

.role-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.role-item:hover {
  background: var(--color-bg);
}

.role-item.is-active {
  border-color: rgba(var(--color-brand-rgb), 0.35);
  background: rgba(var(--color-brand-rgb), 0.05);
}

.role-item-name {
  font-weight: 600;
  font-size: 14px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-item-meta {
  font-size: 12px;
  color: var(--color-text-muted);
}

.perm-groups {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}

.perm-group {
  border: 1px solid rgba(var(--color-primary-rgb), 0.08);
  border-radius: 12px;
  padding: 10px 14px 12px;
  min-width: 0;
}

.perm-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  float: none;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
}

.perm-group-head .btn-link {
  font-size: 12px;
  text-decoration: none;
}

.perm-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.perm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 2px;
  font-size: 13.5px;
  cursor: pointer;
  min-width: 0;
}

.perm-item .form-check-input {
  margin: 0;
  flex-shrink: 0;
}

.perm-label {
  flex: 1;
  min-width: 0;
}

.perm-item.is-disabled {
  cursor: not-allowed;
  color: var(--color-text-muted);
}

.role-save-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px -4px 0;
  padding: 12px 4px 4px;
  background: var(--color-surface);
  border-top: 1px solid rgba(var(--color-primary-rgb), 0.08);
}

.role-save-bar #role-dirty {
  margin-right: auto;
}

/* =========================================================================
   Loglar
   ========================================================================= */
.log-row {
  cursor: pointer;
}

.log-row:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: -2px;
}

.log-row[aria-expanded="true"] > td {
  background: rgba(var(--color-brand-rgb), 0.03);
}

.log-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  min-width: 220px;
}

.log-detail {
  padding: 4px 4px 8px;
  text-align: left;
}

.detail-list--compact {
  font-size: 13px;
  gap: 4px 14px;
}

.diff-table {
  font-size: 13px;
}

.diff-table th {
  font-size: 11.5px;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.code-sample--light {
  background: var(--color-bg);
  color: var(--color-text);
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 575.98px) {
  .log-summary { min-width: 0; -webkit-line-clamp: 3; text-align: left; }
  .table-stack .log-detail-row td { display: block; text-align: left !important; }
}

.boot-failure {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--color-bg);
}

/* =========================================================================
   Rapor yer tutuculari
   ========================================================================= */
.placeholder-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(var(--color-primary-rgb), 0.06);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
