/* === DESIGN TOKENS === */
:root {
  --color-bg: #f7f8fa;
  --color-surface: #ffffff;
  --color-border: rgba(0, 0, 0, 0.08);
  --color-border-hover: rgba(0, 0, 0, 0.14);
  --color-text: #1a1d21;
  --color-text-muted: #6b7280;
  --color-text-subtle: #9ca3af;
  --color-primary: #0d6efd;
  --color-primary-soft: #e7f0ff;
  --color-success: #10b981;
  --color-success-soft: #d1fae5;
  --color-danger: #ef4444;
  --color-danger-soft: #fee2e2;
  --color-warning: #f59e0b;
  --color-warning-soft: #fef3c7;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --sidebar-width: 240px;
  --color-sidebar-bg: #1a1f2e;
  --color-sidebar-text: #cbd5e1;
  --color-sidebar-text-muted: #64748b;
  --color-sidebar-text-active: #ffffff;
  --color-sidebar-hover-bg: rgba(255, 255, 255, 0.06);
  --color-sidebar-active-bg: rgba(13, 110, 253, 0.18);
  --color-sidebar-border: rgba(255, 255, 255, 0.08);
  --color-sidebar-logo: #ffffff;
}

/* === GLOBAL BASE === */
html {
  position: relative;
  min-height: 100%;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

a {
  color: var(--color-primary);
}

a:hover {
  color: #0b5ed7;
}

.text-muted {
  color: var(--color-text-muted) !important;
}

/* === MAIN CONTENT === */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

main,
.admin-main {
  background: var(--color-bg);
  padding: 0 !important;
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.2s ease;
}

body.sidebar-collapsed main,
body.sidebar-collapsed .admin-main {
  margin-left: 64px;
}

.main-content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  transition: margin-left 0.2s ease, width 0.2s ease;
}

body.sidebar-collapsed .main-content {
  margin-left: 64px;
  width: calc(100% - 64px);
}

@media (max-width: 767.98px) {
  main,
  .admin-main {
    margin-left: 0;
    padding: 0 !important;
  }
}

.main-content-body {
  padding: 1.5rem 2rem;
}

@media (max-width: 767.98px) {
  .main-content-body {
    padding: 1rem;
  }
}

/* === TOPBAR === */
.topbar {
  background: var(--color-surface);
  border-bottom: 0.5px solid var(--color-border);
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-icon-btn {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--color-text-muted);
}

.topbar-icon-btn:hover {
  background: var(--color-bg);
}

.topbar-user {
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 8px;
  cursor: pointer;
}

.topbar-user:hover {
  background: var(--color-bg);
}

.topbar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
}

.topbar-username {
  font-size: 13px;
  font-weight: 500;
}

.topbar-user-chevron {
  font-size: 10px;
  color: var(--color-text-muted);
}

.topbar-user-menu {
  min-width: 220px;
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 6px;
  margin-top: 6px;
}

.dropdown-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}

.dropdown-user-name {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
}

.dropdown-user-role {
  margin: 0;
  font-size: 11px;
  color: var(--color-text-muted);
}

.dropdown-menu .dropdown-item {
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dropdown-menu .dropdown-item i {
  font-size: 14px;
  color: var(--color-text-muted);
}

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

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

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

.dropdown-divider {
  margin: 4px 0;
  border-color: var(--color-border);
}

/* === SIDEBAR === */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-sidebar-bg) !important;
  border-right: 0.5px solid var(--color-sidebar-border);
  box-shadow: none;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.2s ease;
  z-index: 1030;
  color: var(--color-sidebar-text);
}

body.sidebar-collapsed .sidebar {
  width: 64px;
}

.sidebar .position-sticky {
  position: relative !important;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 0.75rem 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 0.5px solid var(--color-sidebar-border);
}

.sidebar-toggle {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.sidebar-toggle:hover {
  background: var(--color-bg);
  border-color: var(--color-border-hover);
  color: var(--color-text);
}

.sidebar-user h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-sidebar-logo);
}

.sidebar-brand,
.sidebar-header {
  color: var(--color-sidebar-logo);
  border-bottom: 0.5px solid var(--color-sidebar-border);
}

.sidebar-brand h1,
.sidebar-brand h2,
.sidebar-brand span,
.sidebar-header h1,
.sidebar-header h2,
.sidebar-header span {
  color: var(--color-sidebar-logo);
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 8px 8px;
}

.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-group-title {
  margin: 0 6px 4px;
  color: var(--color-sidebar-text-muted) !important;
  font-size: 11px !important;
  font-weight: 500;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.sidebar-item {
  border-radius: var(--radius-md);
  color: var(--color-sidebar-text);
  background: transparent;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 400;
  margin: 1px 0;
  padding: 8px 12px;
  transition: all 0.15s ease;
  width: 100%;
}

.sidebar-item:hover {
  background: var(--color-sidebar-hover-bg);
  color: var(--color-sidebar-text-active);
}

.sidebar-item.active {
  background: var(--color-sidebar-active-bg);
  color: var(--color-sidebar-text-active);
  font-weight: 500;
  position: relative;
}

.sidebar-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--color-primary);
  border-radius: 0 2px 2px 0;
}

.sidebar-icon {
  width: 16px;
  min-width: 16px;
  height: 16px;
  font-size: 16px;
  color: currentColor;
  line-height: 1;
  transition: color 0.15s ease;
}

.sidebar-item .sidebar-icon {
  color: var(--color-sidebar-text-muted);
}

.sidebar-item:hover .sidebar-icon {
  color: var(--color-sidebar-text-active);
}

.sidebar-item.active .sidebar-icon {
  color: var(--color-primary);
}

.sidebar-item-button {
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.sidebar-logout-form {
  margin: 0;
  padding: 0;
}

.sidebar-logout-btn {
  width: 100%;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.sidebar-logout-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

.sidebar-logout-btn:hover .sidebar-icon {
  color: #fca5a5;
}

.sidebar-logout {
  margin-top: auto;
  padding: 8px;
  border-top: 0.5px solid var(--color-sidebar-border);
}

body.sidebar-collapsed .sidebar-label {
  display: none;
}

body.sidebar-collapsed .sidebar-group-title {
  display: none;
}

body.sidebar-collapsed .sidebar-user h4 {
  display: none;
}

body.sidebar-collapsed .sidebar-item {
  justify-content: center;
  padding: 8px;
}

body.sidebar-collapsed .sidebar-item-button {
  justify-content: center;
}

body.sidebar-collapsed .sidebar-top {
  justify-content: center;
}

body.sidebar-collapsed .sidebar-item .sidebar-icon {
  color: var(--color-text-muted);
}

body.sidebar-collapsed .sidebar-item.active .sidebar-icon {
  color: var(--color-primary);
}

.sidebar-overlay {
  display: none;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* === CARDS === */
.card {
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  background: transparent;
  border-bottom: 0.5px solid var(--color-border);
  padding: 1rem 1.25rem;
}

/* === TABLES === */
.table {
  font-size: 16px;
  margin-bottom: 0;
}

.table > :not(caption) > * > * {
  box-shadow: none;
}

.table thead th {
  background: #fafbfc;
  border-bottom: 0.5px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  padding: 10px 16px;
  text-transform: none;
  white-space: nowrap;
}

.table tbody td {
  border-top: 0.5px solid var(--color-border);
  padding: 12px 16px;
  vertical-align: middle;
}

.table tbody tr:hover {
  background: #fafbfc;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: transparent;
  color: inherit;
}

/* === BUTTONS === */
.btn {
  border-radius: var(--radius-md);
  box-shadow: none !important;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  transition: all 0.15s ease;
}

.btn:focus,
.btn:active:focus,
.btn-check:focus + .btn,
.btn-check:checked + .btn:focus {
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1) !important;
}

.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background: #0b5ed7;
  border-color: #0b5ed7;
}

[class*="btn-outline-"] {
  border-width: 1px;
}

.btn-outline-primary:hover {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-outline-success:hover {
  background: var(--color-success-soft);
  border-color: var(--color-success);
  color: #065f46;
}

.btn-outline-danger:hover {
  background: var(--color-danger-soft);
  border-color: var(--color-danger);
  color: #991b1b;
}

.btn-outline-warning:hover {
  background: var(--color-warning-soft);
  border-color: var(--color-warning);
  color: #92400e;
}

/* === FORMS === */
.form-control,
.form-select,
input,
select,
textarea {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 14px;
  min-height: 38px;
  padding: 8px 12px;
}

textarea.form-control {
  min-height: 96px;
}

.form-control:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
  outline: none;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
  color: var(--color-text-subtle);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ============================================
   CHECKBOX & RADIO - Bootstrap override
   ============================================ */

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 0;
  margin-bottom: 4px;
  min-height: auto;
}

.form-check .form-check-input {
  margin-left: 0;
  margin-top: 0;
  float: none;
  flex-shrink: 0;
}

.form-check-input {
  width: 16px;
  height: 16px;
  background-color: var(--color-surface);
  border: 1.5px solid #cbd5e1;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  -webkit-appearance: none;
  appearance: none;
  print-color-adjust: exact;
}

.form-check-input[type="checkbox"] {
  border-radius: 4px;
}

.form-check-input[type="radio"] {
  border-radius: 50%;
}

.form-check-input:hover:not(:disabled) {
  border-color: var(--color-primary);
}

.form-check-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.18);
  outline: 0;
}

.form-check-input:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.form-check-input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

.form-check-input[type="radio"]:checked {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%23fff'/%3e%3c/svg%3e");
}

.form-check-input[type="checkbox"]:indeterminate {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10h8'/%3e%3c/svg%3e");
}

.form-check-input:disabled {
  pointer-events: none;
  opacity: 0.55;
  cursor: not-allowed;
}

.form-check-label {
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  line-height: 1.4;
  user-select: none;
}

.form-check-input:disabled ~ .form-check-label {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ============================================
   FORM SWITCH (.form-switch)
   ============================================ */

.form-switch {
  padding-left: 0;
}

.form-switch .form-check-input {
  width: 36px;
  height: 20px;
  margin-right: 8px;
  background-color: #e2e8f0;
  border-color: #cbd5e1;
  border-radius: 10px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
  background-position: left center;
  background-size: contain;
  transition: background-color 0.15s ease, background-position 0.15s ease, border-color 0.15s ease;
}

.form-switch .form-check-input:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  background-position: right center;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

/* ============================================
   KOYU SIDEBAR İÇİNDEKİ FORM CONTROLS
   ============================================ */

.sidebar .form-check-input {
  background-color: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.25);
}

.sidebar .form-check-input:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.sidebar .form-check-label {
  color: var(--color-sidebar-text);
}

/* ============================================
   MODAL İÇİNDEKİ CHECKBOX LİSTESİ — KOMPAKT
   ============================================ */

.modal .form-check {
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 0;
  transition: background-color 0.1s ease;
  min-height: 30px;
}

.modal .form-check:hover {
  background-color: var(--color-bg);
}

.modal .form-check-label {
  flex: 1;
  font-size: 13px;
}

.modal-body {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.modal-body h6,
.modal-body .list-group-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  margin: 12px 0 6px;
  text-transform: none;
}

.modal-body h6:first-child,
.modal-body .list-group-title:first-child {
  margin-top: 0;
}

.modal-body .checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px 12px;
}

@media (max-width: 767.98px) {
  .modal-body .checkbox-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 479.98px) {
  .modal-body .checkbox-grid {
    grid-template-columns: 1fr;
  }
}

/* === BADGES === */
.badge {
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  padding: 3px 8px;
}

.bg-success {
  background: var(--color-success-soft) !important;
  color: #065f46 !important;
}

.bg-danger {
  background: var(--color-danger-soft) !important;
  color: #991b1b !important;
}

.bg-warning {
  background: var(--color-warning-soft) !important;
  color: #92400e !important;
}

.bg-primary {
  background: var(--color-primary-soft) !important;
  color: #1e40af !important;
}

/* === USER CELL === */
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-weight: 500;
  font-size: 14px;
}

.user-email {
  font-size: 16px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === CARD HEADER ICON BADGE === */
.card-icon-badge {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.card-icon-badge-primary { background: var(--color-primary-soft); color: var(--color-primary); }
.card-icon-badge-success { background: var(--color-success-soft); color: #065f46; }
.card-icon-badge-warning { background: var(--color-warning-soft); color: #92400e; }
.card-icon-badge-danger  { background: var(--color-danger-soft);  color: #991b1b; }

/* === INFO GRID (kişi kartı detay alanları) === */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px 24px;
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.info-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.info-item-label {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

.info-item-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  word-break: break-word;
}

/* === CALL HISTORY TIMELINE === */
.call-history-item {
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.call-history-item:last-child {
  margin-bottom: 0;
}

.call-history-item:hover {
  border-color: var(--color-border-hover);
  background: #fafbfc;
}

.call-history-outcome {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
}

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

/* === CONTACT AVATAR (Yetkili Kişiler) === */
.contact-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

/* === SONRAKİ ARAMA ROZETLERİ — dolgun renk + beyaz yazı (dikkat çeksin diye diğer soft rozetlerden kasıtlı farklı) === */
.badge-solid-warning {
  background: var(--color-warning) !important;
  color: #fff !important;
}

.badge-solid-success {
  background: var(--color-success) !important;
  color: #fff !important;
}

.badge-solid-primary {
  background: var(--color-primary) !important;
  color: #fff !important;
}

/* === CRM SEKME BUTONLARI (Kullanıcılar/Müşteriler/Potalar/Genel Data) — her biri sabit renkte,
   normal nav-tabs çizgisi yerine dolgun buton görünümü, aktif olan belirginleşsin diye opacity+gölge,
   ortalanmış + responsive (sarar), tıklayınca basma animasyonu ile geri bildirim verir === */
.crm-tab-buttons {
  border-bottom: none;
  justify-content: center;
  gap: 10px;
  row-gap: 10px;
}

.crm-tab-buttons .nav-item {
  margin-bottom: 0;
}

.crm-tab-btn {
  border: 2px solid transparent !important;
  border-radius: 8px !important;
  font-weight: 600;
  padding: 10px 22px !important;
  opacity: 0.72;
  transform: scale(1) translateY(0);
  transition: opacity 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.crm-tab-btn:hover {
  opacity: 1;
  transform: translateY(-2px);
}

.crm-tab-btn:active {
  transform: scale(0.93);
  transition-duration: 0.05s;
}

.crm-tab-btn.active {
  opacity: 1;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28);
}

.crm-tab-btn.crm-tab-pressed {
  animation: crmTabPress 0.32s ease;
}

@keyframes crmTabPress {
  0% { transform: scale(1); }
  35% { transform: scale(0.88); }
  100% { transform: scale(1); }
}

.crm-tab-btn-kullanicilar {
  background: #146c43 !important;
  color: #fff !important;
}

.crm-tab-btn-musteriler {
  background: #8bc34a !important;
  color: #ffff !important;
}

.crm-tab-btn-potalar {
  background: var(--color-warning) !important;
  color: #fff !important;
}

.crm-tab-btn-genel-data {
  background: #fff !important;
  color: #333 !important;
  border-color: #ced4da !important;
}

@media (max-width: 576px) {
  .crm-tab-buttons {
    flex-wrap: wrap;
  }

  .crm-tab-btn {
    flex: 1 1 calc(50% - 10px);
    padding: 10px 8px !important;
    font-size: 0.85rem;
    text-align: center;
  }
}

/* === AUDIT TIMELINE ("Geçmiş" kartı — aday durum/satış/devir geçmişi) === */
.audit-timeline {
  position: relative;
}

.audit-timeline-item {
  position: relative;
  display: flex;
  gap: 14px;
  padding-bottom: 18px;
}

.audit-timeline-item:last-child {
  padding-bottom: 0;
}

.audit-timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 17px;
  top: 36px;
  bottom: -2px;
  width: 2px;
  background: var(--color-border);
}

.audit-timeline-dot {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  z-index: 1;
}

.audit-timeline-dot-pota { background: var(--color-warning-soft); color: var(--color-warning); }
.audit-timeline-dot-musteri { background: var(--color-success-soft); color: var(--color-success); }
.audit-timeline-dot-sale { background: var(--color-primary-soft); color: var(--color-primary); }
.audit-timeline-dot-reassign { background: #ede9fe; color: #7c3aed; }
.audit-timeline-dot-vacation { background: #e0f2fe; color: #0284c7; }
.audit-timeline-dot-default { background: var(--color-bg); color: var(--color-text-muted); }

.audit-timeline-content {
  flex: 1;
  min-width: 0;
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.audit-timeline-content:hover {
  border-color: var(--color-border-hover);
  background: #fafbfc;
}

.audit-timeline-desc {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
}

.audit-arrow {
  color: var(--color-warning);
  font-weight: 700;
  font-size: 1.3em;
  margin: 0 6px;
  vertical-align: -3px;
  display: inline-block;
}

.audit-timeline-reason {
  font-size: 12px;
  color: var(--color-text-muted);
  font-style: italic;
  margin-top: 6px;
}

.audit-timeline-meta {
  margin-top: 8px;
}

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 28px 16px;
  color: var(--color-text-muted);
  font-size: 14px;
}

.empty-state i {
  font-size: 26px;
  color: var(--color-text-subtle);
  display: block;
  margin-bottom: 8px;
}

/* === STATUS DOT === */
.status-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.status-dot-success {
  background: var(--color-success);
  box-shadow: 0 0 0 3px var(--color-success-soft);
}

.status-dot-danger {
  background: var(--color-danger);
  box-shadow: 0 0 0 3px var(--color-danger-soft);
}

.status-dot-warning {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.22);
}

.status-dot-black {
  background: #111827;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.2);
}

.status-dot-blink {
  animation: cdrDangerBlink 1s ease-in-out infinite;
}

@keyframes cdrDangerBlink {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 3px var(--color-danger-soft);
  }
  50% {
    opacity: 0.35;
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.2);
  }
}

.user-balance-badge {
  cursor: pointer;
}

/* === PHONE PRIMARY TOGGLE === */
.phone-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.phone-row .form-control {
  flex: 1;
}

.phone-primary-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
}

.phone-primary-toggle:hover {
  background: var(--color-bg);
}

.phone-primary-toggle input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.phone-primary-star {
  font-size: 18px;
  color: #d1d5db;
  transition: color 0.15s ease;
}

.phone-primary-toggle input[type="radio"]:checked ~ .phone-primary-star {
  color: #f59e0b;
}

.phone-primary-toggle:hover .phone-primary-star {
  color: #f59e0b;
  opacity: 0.7;
}

/* === TYPOGRAPHY === */
h1,
h2 {
  font-weight: 500;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 16px;
  font-weight: 500;
}

/* === PAGINATION === */
.pagination {
  flex-wrap: wrap;
  row-gap: 0.25rem;
}

.page-link {
  border: 0;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  margin: 0 2px;
}

.page-link:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.page-item.active .page-link {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

/* === SCROLLBAR === */
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: #eef1f5;
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: #c5ccd6;
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: #aeb7c4;
}

/* === SELECT2 OVERRIDES === */
.select2-container--bootstrap-5 .select2-selection {
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-md) !important;
  min-height: 38px !important;
  font-size: 14px !important;
  padding: 4px 8px !important;
  box-shadow: none !important;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1) !important;
}

.select2-dropdown {
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-md) !important;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
  background: var(--color-primary-soft) !important;
  color: var(--color-primary) !important;
}

.select2-container--bootstrap-5 .select2-results__option--selected {
  background: var(--color-primary) !important;
  color: white !important;
}

/* === RESPONSIVE SIDEBAR (MOBILE) === */
@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  }

  body.sidebar-mobile-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-mobile-open .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1030;
    animation: fadeIn 0.2s ease;
  }

  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  body.sidebar-collapsed .sidebar {
    width: var(--sidebar-width);
  }

  body.sidebar-collapsed .sidebar-label,
  body.sidebar-collapsed .sidebar-group-title {
    display: block !important;
  }

  .topbar {
    padding: 0 1rem;
  }

  .topbar-title {
    font-size: 15px;
  }

  .topbar-username {
    display: none;
  }

  main.main-content {
    padding: 1rem !important;
  }
}

/* === TABLE RESPONSIVE HELPERS === */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.users-table-responsive {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.users-table-responsive table {
  table-layout: fixed;
  min-width: 100%;
  white-space: nowrap;
}

.users-table-responsive .dropdown-menu {
  min-width: 190px;
  z-index: 2050;
}

.users-table-responsive td,
.users-table-responsive th {
  overflow: visible;
}

@media (max-width: 767.98px) {
  .table {
    font-size: 13px;
  }

  .table th,
  .table td {
    padding: 8px 10px !important;
    white-space: nowrap;
  }
}

.users-table-responsive .originators-cell {
  max-width: 240px;
  min-width: 140px;
}

.users-table-responsive .originators-cell .badge {
  white-space: nowrap;
}

/* Kritik / kopyalanması gereken alanlar (Kullanıcı, Ad Soyad): kısaltma yok, tam metin görünür kalır */
.cell-wrap {
  white-space: normal !important;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
}

.originators-table-responsive {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.originators-table-responsive table {
  table-layout: fixed;
  min-width: 100%;
  white-space: nowrap;
}

.roles-table-responsive,
.segmentation-staff-table-responsive {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.roles-table-responsive table,
.segmentation-staff-table-responsive table {
  table-layout: fixed;
  min-width: 100%;
  white-space: nowrap;
}

.segmentation-staff-table-responsive .badge-list-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  white-space: normal;
}

/* ============================================
   MODAL CHECKBOX FORCE OVERRIDE
   Specificity ve sıra sorunlarını aşmak için
   ============================================ */

.modal .form-check,
.modal-body .form-check,
.modal .checkbox-grid .form-check {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 4px 6px !important;
  margin: 0 !important;
  min-height: 28px !important;
  line-height: 1.3 !important;
}

.modal .form-check-input,
.modal-body .form-check-input,
.modal .checkbox-grid .form-check-input {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: 0 0 16px !important;
  border-radius: 4px !important;
  border: 1.5px solid #cbd5e1 !important;
  background-color: #ffffff !important;
}

.modal .form-check-input[type="radio"],
.modal-body .form-check-input[type="radio"] {
  border-radius: 50% !important;
}

.modal .form-check-input:checked,
.modal-body .form-check-input:checked {
  background-color: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
}

.modal .form-check-label,
.modal-body .form-check-label {
  font-size: 13px !important;
  line-height: 1.3 !important;
  padding: 0 !important;
  margin: 0 !important;
  flex: 1 !important;
  min-width: 0 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.modal .checkbox-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 4px 16px !important;
}

@media (max-width: 767.98px) {
  .modal .checkbox-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Modal body'de h6 başlıkları — Bölgeler / İller ayraçları */
.modal-body h6 {
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--color-text-muted) !important;
  margin: 14px 0 8px !important;
  padding-bottom: 4px !important;
  border-bottom: 0.5px solid var(--color-border) !important;
}

.modal-body h6:first-child {
  margin-top: 0 !important;
}

/* SMS Raporlari filtresi - API checkbox kompakt */
.sms-api-toggle {
  align-items: center !important;
  gap: 6px !important;
}

.sms-api-toggle .sms-api-toggle-input {
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  min-height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  flex: 0 0 14px !important;
  margin: 0 !important;
}

.sms-api-toggle .form-check-label {
  font-size: 12px !important;
  line-height: 1.2 !important;
}