/* =========================================================
   app.css – Modern CRM Design System
   Deep slate dark theme · Indigo/violet accent palette
   Glassmorphism · Inter font · Micro-animations
   ========================================================= */

/* ----- Custom Theme Variables ----- */
:root {
    /* Core palette - Premium Dark Mode (Midnight Blue / Deep Navy) */
    --crm-bg-deep:       #080c14;
    --crm-bg-base:       #0d111d;
    --crm-bg-surface:    #141926;
    --crm-bg-elevated:   #1d2436;
    --crm-bg-hover:      #262f45;
    --crm-bg-glass:      rgba(13, 17, 29, 0.75);

    /* Accent – Blue */
    --crm-accent:        #3b82f6;
    --crm-accent-hover:  #60a5fa;
    --crm-accent-muted:  rgba(59, 130, 246, 0.15);
    --crm-accent-glow:   rgba(59, 130, 246, 0.25);

    /* Gradient */
    --crm-grad-primary:  linear-gradient(135deg, #2563eb 0%, #3b82f6 50%, #60a5fa 100%);
    --crm-grad-subtle:   linear-gradient(135deg, rgba(59,130,246,0.12) 0%, rgba(96,165,250,0.06) 100%);

    /* Text - Highly legible slate palette */
    --crm-text:          #f8fafc; /* Slate 50 */
    --crm-text-muted:    #cbd5e1; /* Slate 300 - High contrast */
    --crm-text-faint:    #94a3b8; /* Slate 400 - Medium contrast */

    /* Borders */
    --crm-border:        rgba(255, 255, 255, 0.08);
    --crm-border-accent: rgba(59, 130, 246, 0.4);

    /* Radius */
    --crm-radius-sm:     8px;
    --crm-radius:        12px;
    --crm-radius-lg:     16px;
    --crm-radius-xl:     20px;

    /* Shadow */
    --crm-shadow-sm:     0 1px 3px rgba(0,0,0,0.4);
    --crm-shadow:        0 4px 24px rgba(0,0,0,0.45);
    --crm-shadow-lg:     0 8px 40px rgba(0,0,0,0.55);
    --crm-shadow-glow:   0 0 30px rgba(59,130,246,0.15);

    /* Semantic */
    --crm-success:       #34d399;
    --crm-warning:       #fbbf24;
    --crm-danger:        #f87171;
    --crm-info:          #38bdf8;
    --crm-orange:        #fb923c;
    --crm-indigo:        #a78bfa;
}

/* ----- Override Bootstrap dark theme tokens ----- */
[data-bs-theme="dark"] {
    --bs-body-bg:            var(--crm-bg-base);
    --bs-body-color:         var(--crm-text);
    --bs-body-color-rgb:     248, 250, 252;
    --bs-secondary-color:    var(--crm-text-muted);
    --bs-secondary-color-rgb: 203, 213, 225;
    --bs-tertiary-color:     var(--crm-text-faint);
    --bs-tertiary-color-rgb: 148, 163, 184;

    --bs-secondary-bg:       var(--crm-bg-surface);
    --bs-tertiary-bg:        var(--crm-bg-elevated);
    --bs-border-color:       var(--crm-border);
    --bs-primary:            var(--crm-accent);
    --bs-primary-rgb:        59, 130, 246;
    --bs-danger:             var(--crm-danger);
    --bs-success:            var(--crm-success);
    --bs-warning:            var(--crm-warning);
    --bs-info:               var(--crm-info);
    --bs-orange:             var(--crm-orange);
    --bs-indigo:             var(--crm-indigo);

    --bs-primary-bg-subtle:  rgba(59, 130, 246, 0.12);
    --bs-success-bg-subtle:  rgba(52, 211, 153, 0.12);
    --bs-warning-bg-subtle:  rgba(251, 191, 36, 0.12);
    --bs-danger-bg-subtle:   rgba(248, 113, 113, 0.12);
}

/* ----- Global base ----- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--crm-bg-deep);
    color: var(--crm-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

::selection {
    background: var(--crm-accent);
    color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--crm-bg-hover);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: var(--crm-text-faint); }

/* ----- Transitions ----- */
body, a, button, .btn, .form-control, .form-select,
.metric-card, .panel-card, .panel-link, .app-nav-item,
.brand-mark, .user-chip, .nav-link, .app-topbar, .user-profile-badge {
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s ease,
                transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================================
   APP SHELL (üst menü)
   ========================================================= */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    padding: 0 20px;
    height: 64px;
    background: var(--crm-bg-glass);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border-bottom: 1px solid var(--crm-border);
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
}

.app-topbar-brand .brand-text { min-width: 0; }
.app-main-nav { min-width: 0; }

/* ----- Brand mark ----- */
.brand-mark {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--crm-radius-sm);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    background: var(--crm-grad-primary);
    color: #fff;
    border: none;
    box-shadow: var(--crm-shadow-sm), 0 0 20px rgba(59,130,246,0.2);
}

.auth-brand {
    width: 56px;
    height: 56px;
    font-size: 1rem;
    border-radius: var(--crm-radius);
}

.brand-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--crm-text);
}

/* ----- Nav items (yatay menü) ----- */
.app-nav-item {
    display: inline-flex;
    align-items: center;
    border-radius: 24px;
    padding: 6px 14px;
    color: var(--crm-text-muted);
    text-decoration: none;
    white-space: nowrap;
    font-size: 0.82rem;
    font-weight: 600;
    position: relative;
    letter-spacing: 0.02em;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.app-nav-item .nav-icon {
    font-size: 0.95rem;
    transition: transform 0.25s ease, color 0.25s ease;
    color: var(--crm-text-faint);
}

.app-nav-item:hover {
    background-color: var(--crm-accent-muted);
    color: var(--crm-accent-hover);
    border-color: rgba(59, 130, 246, 0.15);
}

.app-nav-item:hover .nav-icon {
    transform: scale(1.12);
    color: var(--crm-accent-hover);
}

.app-nav-item.active {
    background: var(--crm-bg-elevated);
    color: var(--crm-accent);
    border-color: var(--crm-border-accent);
    box-shadow: 0 0 12px var(--crm-accent-glow);
    font-weight: 700;
}

.app-nav-item.active .nav-icon {
    color: var(--crm-accent);
    transform: scale(1.05);
}

/* ----- User chip ----- */
.user-chip {
    padding: 6px 16px;
    border-radius: 999px;
    background: var(--crm-bg-elevated);
    border: 1px solid var(--crm-border);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--crm-text-muted);
}

.user-chip:hover {
    border-color: var(--crm-border-accent);
    color: var(--crm-text);
}

.app-topbar-user { flex-shrink: 0; }

/* ----- Main content ----- */
.app-main {
    flex: 1;
    min-width: 0;
    background: var(--crm-bg-deep);
}

/* ----- Page head ----- */
.app-page-head {
    padding: 20px 0 16px;
    border-bottom: 1px solid var(--crm-border);
    background: var(--crm-bg-base);
}

.app-page-head .page-heading {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--crm-text);
}

/* =========================================================
   SIDEBAR NAV
   ========================================================= */
.sidebar-nav .nav-link {
    border-radius: var(--crm-radius-sm);
    padding: 11px 16px;
    margin-bottom: 3px;
    color: var(--crm-text);
    font-weight: 600;
    font-size: 0.92rem;
    letter-spacing: -0.01em;
}

.sidebar-nav .nav-link:hover {
    background: var(--crm-accent-muted);
    color: var(--crm-accent-hover);
}

.sidebar-nav .nav-link.active {
    background: var(--crm-grad-primary);
    color: #fff;
    box-shadow: 0 2px 12px rgba(59,130,246,0.25);
    font-weight: 700;
}

/* =========================================================
   CARDS — Glassmorphism panel & metric
   ========================================================= */
.panel-card {
    padding: 24px;
    background: var(--crm-bg-glass);
    backdrop-filter: blur(16px) saturate(1.1);
    -webkit-backdrop-filter: blur(16px) saturate(1.1);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    box-shadow: var(--crm-shadow);
}

.panel-card:hover {
    border-color: rgba(148, 163, 194, 0.12);
    box-shadow: var(--crm-shadow), var(--crm-shadow-glow);
}

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

.panel-head h3, .panel-head h4 {
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* ----- Metric cards ----- */
.metric-card {
    padding: 24px;
    min-height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--crm-bg-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--crm-grad-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.metric-card:hover {
    border-color: var(--crm-border-accent);
    transform: translateY(-2px);
    box-shadow: var(--crm-shadow), var(--crm-shadow-glow);
}

.metric-card:hover::before {
    opacity: 1;
}

.metric-card span {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--crm-text-muted);
}

.metric-card strong {
    font-size: 2.2rem;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: var(--crm-grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* =========================================================
   STATISTICS
   ========================================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.stats-card {
    padding: 20px;
    background: var(--crm-bg-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
}

.stat-bar-row {
    display: grid;
    grid-template-columns: 70px 1fr auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.stat-bar {
    background: var(--crm-bg-elevated);
    border-radius: 999px;
    overflow: hidden;
    height: 8px;
}

.stat-bar i {
    display: block;
    height: 100%;
    background: var(--crm-grad-primary);
    border-radius: 999px;
}

/* =========================================================
   MANAGEMENT PANEL LINKS
   ========================================================= */
.panel-link {
    display: flex;
    align-items: center;
    padding: 22px 24px;
    border-radius: var(--crm-radius-lg);
    font-weight: 600;
    font-size: 0.9rem;
    background: var(--crm-bg-surface);
    border: 1px solid var(--crm-border);
    color: var(--crm-text);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.panel-link::after {
    content: '→';
    position: absolute;
    right: 20px;
    opacity: 0;
    transform: translateX(-8px);
    transition: all 0.25s ease;
    color: var(--crm-accent-hover);
    font-size: 1.1rem;
}

.panel-link:hover {
    border-color: var(--crm-border-accent);
    background: var(--crm-grad-subtle);
    color: var(--crm-text);
    transform: translateY(-2px);
    box-shadow: var(--crm-shadow), var(--crm-shadow-glow);
}

.panel-link:hover::after {
    opacity: 1;
    transform: translateX(0);
}

/* =========================================================
   SERVIS TAG ROW COLORS
   ========================================================= */
.color-chip {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    vertical-align: middle;
    box-shadow: 0 0 6px rgba(0,0,0,0.3);
}

.servis-takip-table tbody tr.servis-tag-r_kirmizi > td,
table.table.servis-takip-table tbody tr.servis-tag-r_kirmizi > td,
tr.servis-tag-r_kirmizi > td {
    box-shadow: inset 4px 0 0 0 var(--crm-danger);
    background-color: rgba(248, 113, 113, 0.06);
}

.servis-takip-table tbody tr.servis-tag-r_turuncu > td,
tr.servis-tag-r_turuncu > td {
    box-shadow: inset 4px 0 0 0 var(--crm-orange);
    background-color: rgba(251, 146, 60, 0.06);
}

.servis-takip-table tbody tr.servis-tag-r_sari > td,
tr.servis-tag-r_sari > td {
    box-shadow: inset 4px 0 0 0 var(--crm-warning);
    background-color: rgba(251, 191, 36, 0.06);
}

.servis-takip-table tbody tr.servis-tag-r_yesil > td,
tr.servis-tag-r_yesil > td {
    box-shadow: inset 4px 0 0 0 var(--crm-success);
    background-color: rgba(52, 211, 153, 0.06);
}

.servis-takip-table tbody tr.servis-tag-r_mavi > td,
tr.servis-tag-r_mavi > td {
    box-shadow: inset 4px 0 0 0 var(--crm-accent);
    background-color: rgba(59, 130, 246, 0.06);
}

.servis-takip-table tbody tr.servis-tag-r_mor > td,
tr.servis-tag-r_mor > td {
    box-shadow: inset 4px 0 0 0 var(--crm-indigo);
    background-color: rgba(167, 139, 250, 0.06);
}

/* =========================================================
   FORM OVERRIDES
   ========================================================= */
.form-control, .form-select {
    background-color: var(--crm-bg-elevated);
    border: 1px solid var(--crm-border);
    color: var(--crm-text);
    border-radius: var(--crm-radius-sm);
    font-size: 0.875rem;
}

.form-control:hover, .form-select:hover {
    border-color: rgba(59, 130, 246, 0.4);
    background-color: var(--crm-bg-hover);
}

.form-control.border-0:hover {
    background-color: var(--crm-bg-hover);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.25) !important;
}

.form-control:focus, .form-select:focus {
    background-color: var(--crm-bg-hover);
    border-color: var(--crm-accent) !important;
    box-shadow: 0 0 0 3px var(--crm-accent-glow) !important;
    color: var(--crm-text);
}

.form-control.border-0:focus {
    box-shadow: inset 0 0 0 1px var(--crm-accent), 0 0 0 3px var(--crm-accent-glow) !important;
}

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--crm-text-muted);
    margin-bottom: 6px;
}

/* ----- Uppercase entry inputs ----- */
.st-uppercase {
    text-transform: uppercase;
}

.st-uppercase::placeholder {
    text-transform: none;
}

/* =========================================================
   BUTTON OVERRIDES
   ========================================================= */
.btn-primary {
    background: var(--crm-grad-primary);
    border: none;
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--crm-radius-sm);
    box-shadow: 0 2px 10px rgba(59,130,246,0.25);
}

.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 50%, #93c5fd 100%);
    box-shadow: 0 4px 20px rgba(59,130,246,0.4);
    color: #fff;
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline-light {
    border-color: var(--crm-border);
    color: var(--crm-text-muted);
    font-weight: 500;
    font-size: 0.85rem;
    border-radius: var(--crm-radius-sm);
    background: transparent;
}

.btn-outline-light:hover {
    background: var(--crm-accent-muted);
    border-color: var(--crm-border-accent);
    color: var(--crm-accent-hover);
}

.btn-outline-secondary {
    border-color: var(--crm-border);
    color: var(--crm-text-muted);
    border-radius: var(--crm-radius-sm);
}

.btn-outline-secondary:hover {
    background: var(--crm-bg-hover);
    border-color: rgba(148, 163, 194, 0.15);
    color: var(--crm-text);
}

.btn-outline-danger {
    border-color: rgba(248, 113, 113, 0.3);
    color: var(--crm-danger);
    border-radius: var(--crm-radius-sm);
}

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

/* =========================================================
   TABLE OVERRIDES
   ========================================================= */
.table-dark {
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--crm-border);
    --bs-table-color: var(--crm-text);
    --bs-table-hover-bg: var(--crm-accent-muted);
    --bs-table-hover-color: var(--crm-text);
}

.table thead th {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--crm-text-muted);
    border-bottom: 1px solid var(--crm-border) !important;
    padding: 12px;
}

.table tbody td {
    padding: 10px 12px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--crm-border);
    vertical-align: middle;
}

.table tbody tr {
    transition: background 0.15s ease;
}

.table tbody tr:hover td {
    background: var(--crm-accent-muted);
}

.servis-takip-table-wrap {
    border-color: var(--crm-border) !important;
    border-radius: var(--crm-radius) !important;
    overflow: hidden;
}

/* =========================================================
   AUTH CARD (Login)
   ========================================================= */
.auth-card {
    background: var(--crm-bg-glass) !important;
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border: 1px solid var(--crm-border) !important;
    border-radius: var(--crm-radius-xl) !important;
    box-shadow: var(--crm-shadow-lg), var(--crm-shadow-glow);
}

/* =========================================================
   MODAL OVERRIDES
   ========================================================= */
.modal-content {
    background: var(--crm-bg-surface) !important;
    border: 1px solid var(--crm-border) !important;
    border-radius: var(--crm-radius-lg) !important;
    box-shadow: var(--crm-shadow-lg);
}

.modal-header {
    border-bottom-color: var(--crm-border) !important;
}

.modal-footer {
    border-top-color: var(--crm-border) !important;
}

.modal-title {
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* =========================================================
   DROPDOWN OVERRIDES
   ========================================================= */
.dropdown-menu-dark {
    background: var(--crm-bg-elevated);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    box-shadow: var(--crm-shadow-lg);
    padding: 6px;
}

.dropdown-menu-dark .dropdown-item {
    border-radius: 6px;
    font-size: 0.85rem;
    padding: 7px 12px;
    color: var(--crm-text-muted);
}

.dropdown-menu-dark .dropdown-item:hover,
.dropdown-menu-dark .dropdown-item:focus {
    background: var(--crm-accent-muted);
    color: var(--crm-accent-hover);
}

/* =========================================================
   BADGE OVERRIDES
   ========================================================= */
.badge.text-bg-primary {
    background: var(--crm-grad-primary) !important;
    color: #fff !important;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    border-radius: 999px;
    padding: 5px 12px;
}

/* =========================================================
   AUTOCOMPLETE DROPDOWN
   ========================================================= */
.st-musteri-ac-wrap {
    position: relative;
}

.st-ac-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    max-height: 180px;
    overflow-y: auto;
    background: var(--crm-bg-elevated);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    box-shadow: var(--crm-shadow-lg);
    margin-top: 4px;
    padding: 4px;
}

.st-ac-dropdown .st-ac-item {
    padding: 7px 12px;
    cursor: pointer;
    font-size: 0.83rem;
    color: var(--crm-text-muted);
    border-radius: 6px;
    transition: all 0.15s ease;
}

.st-ac-dropdown .st-ac-item:hover,
.st-ac-dropdown .st-ac-item.active {
    background: var(--crm-accent-muted);
    color: var(--crm-accent-hover);
}

/* =========================================================
   SECTION TITLES
   ========================================================= */
.section-title {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

/* =========================================================
   ALERT OVERRIDES
   ========================================================= */
.alert {
    border-radius: var(--crm-radius-sm);
    border: 1px solid var(--crm-border);
    font-size: 0.875rem;
}

/* =========================================================
   ANIMATIONS
   ========================================================= */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.metric-card,
.panel-card,
.panel-link,
.auth-card,
.stats-card {
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.metric-card:nth-child(2) { animation-delay: 0.05s; }
.metric-card:nth-child(3) { animation-delay: 0.1s; }
.metric-card:nth-child(4) { animation-delay: 0.15s; }

.col-xl-3:nth-child(1) .metric-card { animation-delay: 0s; }
.col-xl-3:nth-child(2) .metric-card { animation-delay: 0.06s; }
.col-xl-3:nth-child(3) .metric-card { animation-delay: 0.12s; }
.col-xl-3:nth-child(4) .metric-card { animation-delay: 0.18s; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 991.98px) {
    .app-main-nav {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .app-topbar {
        height: auto;
        padding: 10px 16px;
    }
}

/* =========================================================
   LIGHT THEME VARIABLES
   ========================================================= */
[data-bs-theme="light"] {
    --crm-bg-deep:       #f1f5f9;
    --crm-bg-base:       #ffffff;
    --crm-bg-surface:    #f8fafc;
    --crm-bg-elevated:   #ffffff;
    --crm-bg-hover:      #e2e8f0;
    --crm-bg-glass:      rgba(255, 255, 255, 0.85);

    --crm-accent:        #2563eb;
    --crm-accent-hover:  #1d4ed8;
    --crm-accent-muted:  rgba(37, 99, 235, 0.1);
    --crm-accent-glow:   rgba(37, 99, 235, 0.15);

    --crm-text:          #0f172a;
    --crm-text-muted:    #475569;
    --crm-text-faint:    #94a3b8;

    --crm-border:        rgba(15, 23, 42, 0.12);
    --crm-border-accent: rgba(37, 99, 235, 0.3);

    --crm-shadow-sm:     0 1px 2px rgba(0,0,0,0.05);
    --crm-shadow:        0 4px 12px rgba(0,0,0,0.05);
    --crm-shadow-lg:     0 8px 24px rgba(0,0,0,0.08);
    --crm-shadow-glow:   0 0 20px rgba(37, 99, 235, 0.15);

    --bs-body-bg:            var(--crm-bg-base);
    --bs-body-color:         var(--crm-text);
    --bs-secondary-bg:       var(--crm-bg-surface);
    --bs-tertiary-bg:        var(--crm-bg-elevated);
    --bs-border-color:       var(--crm-border);
    --bs-primary:            var(--crm-accent);
    --bs-primary-rgb:        37, 99, 235;
}

[data-bs-theme="light"] .dropdown-menu-dark {
    background: var(--crm-bg-elevated);
    border: 1px solid var(--crm-border);
}

[data-bs-theme="light"] .dropdown-menu-dark .dropdown-item {
    color: var(--crm-text-muted);
}

[data-bs-theme="light"] .dropdown-menu-dark .dropdown-item:hover,
[data-bs-theme="light"] .dropdown-menu-dark .dropdown-item:focus {
    background: var(--crm-accent-muted);
    color: var(--crm-accent-hover);
}

[data-bs-theme="light"] .table-dark {
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--crm-border);
    --bs-table-color: var(--crm-text);
    --bs-table-hover-bg: var(--crm-accent-muted);
    --bs-table-hover-color: var(--crm-text);
}

[data-bs-theme="light"] .modal-content {
    background: var(--crm-bg-surface) !important;
}

[data-bs-theme="light"] .btn-outline-light {
    border-color: var(--crm-border);
    color: var(--crm-text-muted);
}

[data-bs-theme="light"] .btn-outline-light:hover {
    background: var(--crm-accent-muted);
    border-color: var(--crm-border-accent);
    color: var(--crm-accent-hover);
}

/* =========================================================
   PREMIUM CUSTOM DESIGN OVERRIDES & ENHANCEMENTS
   ========================================================= */

/* ----- Double Border & Elevation Glows (Öneri 2) ----- */
[data-bs-theme="dark"] .panel-card, 
[data-bs-theme="dark"] .metric-card {
    box-shadow: 
        var(--crm-shadow), 
        inset 0 1px 1px rgba(255, 255, 255, 0.08); /* top inner highlight line */
}

[data-bs-theme="dark"] .panel-card:hover, 
[data-bs-theme="dark"] .metric-card:hover {
    box-shadow: 
        var(--crm-shadow), 
        var(--crm-shadow-glow), 
        inset 0 1px 1px rgba(255, 255, 255, 0.15); /* intensified inner highlight */
}

/* ----- Form Odaklanma Tasarımı (Öneri 3) ----- */
.form-control:focus, .form-select:focus {
    background-color: var(--crm-bg-hover);
    border-color: var(--crm-accent) !important;
    box-shadow: 0 0 0 1px var(--crm-accent), 0 0 0 4px var(--crm-accent-glow) !important;
    color: var(--crm-text);
}

/* ----- Hatalı Girişlerde Sarsıntı (Shake) Animasyonu (Öneri 3) ----- */
@keyframes shakeInput {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}
.input-error {
    animation: shakeInput 0.2s ease-in-out 2;
    border-color: var(--crm-danger) !important;
}

/* ----- Dönen Yenileme Butonu Animasyonu (Öneri 3) ----- */
@keyframes spinAround {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.btn-refresh-active i,
.btn-refresh-active svg {
    display: inline-block !important;
    animation: spinAround 0.8s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* ----- Tipografi Hiyerarşisi ve Harf Aralıkları (Öneri 4) ----- */
.dash-greeting, .page-heading, .section-title, .modal-title {
    font-weight: 800 !important;
    letter-spacing: -0.035em !important;
}

.form-label, 
.table thead th, 
.metric-card span {
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
}

/* ----- Detay Paneli Akıcı Kayma Animasyonu ----- */
.crm-accordion-detay,
#st-detay,
#yillik-detay,
#ozet-detay,
#mesai-ozet-detay {
    animation: slideDownDetay 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
    overflow: hidden;
}

.crm-accordion-detay.closing,
#st-detay.closing,
#yillik-detay.closing,
#ozet-detay.closing,
#mesai-ozet-detay.closing {
    animation: slideUpDetay 0.25s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes slideDownDetay {
    from {
        opacity: 0;
        transform: translateY(-8px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 800px;
    }
}

@keyframes slideUpDetay {
    from {
        opacity: 1;
        transform: translateY(0);
        max-height: 800px;
    }
    to {
        opacity: 0;
        transform: translateY(-8px);
        max-height: 0;
    }
}



/* Force high z-index on the color selection dropdown menu */
#st-d-renk-menu {
    z-index: 2000 !important;
}

/* =========================================================
   CRM Custom Modal (crmConfirm / crmAlert)
   Glassmorphism overlay · Smooth scale animation
   ========================================================= */
.crm-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.crm-modal-overlay.crm-modal-visible {
    opacity: 1;
}

.crm-modal-dialog {
    width: 100%;
    max-width: 420px;
    border-radius: var(--crm-radius-lg, 16px);
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45), 0 0 40px rgba(59, 130, 246, 0.08);
    transform: scale(0.85) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.25s ease;
    opacity: 0;
}
.crm-modal-visible .crm-modal-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* -- Closing animation -- */
.crm-modal-overlay.crm-modal-closing {
    opacity: 0;
}
.crm-modal-closing .crm-modal-dialog {
    transform: scale(0.9) translateY(10px);
    opacity: 0;
}

/* -- Theme-aware background -- */
[data-bs-theme="dark"] .crm-modal-dialog {
    background: linear-gradient(160deg, #1a2035 0%, #141926 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
[data-bs-theme="light"] .crm-modal-dialog {
    background: linear-gradient(160deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0,0,0,0.04);
}

/* -- Icon area -- */
.crm-modal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1.5rem 0.5rem;
}
.crm-modal-icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    animation: crm-modal-icon-pop 0.4s 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
@keyframes crm-modal-icon-pop {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* Icon variants */
.crm-modal-icon-danger .crm-modal-icon-circle {
    background: rgba(248, 113, 113, 0.12);
    color: #f87171;
    border: 2px solid rgba(248, 113, 113, 0.25);
}
.crm-modal-icon-warning .crm-modal-icon-circle {
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
    border: 2px solid rgba(251, 191, 36, 0.25);
}
.crm-modal-icon-info .crm-modal-icon-circle {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border: 2px solid rgba(56, 189, 248, 0.25);
}
.crm-modal-icon-success .crm-modal-icon-circle {
    background: rgba(52, 211, 153, 0.12);
    color: #34d399;
    border: 2px solid rgba(52, 211, 153, 0.25);
}

/* -- Body -- */
.crm-modal-body {
    padding: 1rem 1.75rem 0.5rem;
    text-align: center;
}
.crm-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}
.crm-modal-message {
    font-size: 0.9rem;
    line-height: 1.55;
    opacity: 0.75;
    margin: 0;
}

/* -- Footer -- */
.crm-modal-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.75rem 1.5rem;
    justify-content: center;
}
.crm-modal-btn {
    flex: 1;
    max-width: 180px;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: var(--crm-radius-sm, 8px);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
.crm-modal-btn:focus-visible {
    outline: 2px solid var(--crm-accent, #3b82f6);
    outline-offset: 2px;
}

/* Cancel button */
[data-bs-theme="dark"] .crm-modal-btn-cancel {
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
}
[data-bs-theme="dark"] .crm-modal-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.12);
}
[data-bs-theme="light"] .crm-modal-btn-cancel {
    background: #f1f5f9;
    color: #475569;
}
[data-bs-theme="light"] .crm-modal-btn-cancel:hover {
    background: #e2e8f0;
}

/* Confirm variants */
.crm-modal-btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}
.crm-modal-btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
}

.crm-modal-btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    color: #1a1a1a;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}
.crm-modal-btn-warning:hover {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
    transform: translateY(-1px);
}

.crm-modal-btn-primary {
    background: var(--crm-grad-primary, linear-gradient(135deg, #2563eb 0%, #3b82f6 100%));
    color: #fff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}
.crm-modal-btn-primary:hover {
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
    transform: translateY(-1px);
}

.crm-modal-btn-success {
    background: linear-gradient(135deg, #059669 0%, #34d399 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}
.crm-modal-btn-success:hover {
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.5);
    transform: translateY(-1px);
}

/* Shake animation for important confirms */
@keyframes crm-modal-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ----- Turkish License Plate Badge ----- */
.plate-badge {
    display: inline-flex;
    align-items: center;
    background: #ffffff !important;
    border: 1.5px solid #1e293b;
    border-radius: 4px;
    font-weight: 800;
    font-family: 'Inter', monospace;
    color: #0f172a !important;
    padding: 1px 6px 1px 18px;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    white-space: nowrap;
}

.plate-badge::before {
    content: 'TR';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #2563eb;
    color: #ffffff;
    font-size: 0.5rem;
    font-weight: 900;
    height: 100%;
    width: 14px;
    position: absolute;
    top: 0;
    left: 0;
    line-height: 1;
    padding-top: 1px;
}

[data-bs-theme="dark"] .plate-badge {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #0f172a;
}

/* ----- Service tracking table styling updates ----- */
.servis-takip-table {
    border-collapse: separate !important;
    border-spacing: 0 6px !important;
}

.servis-takip-table tbody tr {
    background: var(--crm-bg-surface);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
}

.servis-takip-table tbody tr td {
    border-bottom: 1px solid transparent !important;
    border-top: 1px solid transparent !important;
    background-color: var(--crm-bg-surface);
}

.servis-takip-table tbody tr.table-active,
.servis-takip-table tbody tr.table-active > td,
.servis-takip-table tbody tr.table-active > th {
    --bs-table-active-bg: transparent !important;
    --bs-table-bg: var(--crm-bg-hover) !important;
    background-color: var(--crm-bg-hover) !important;
}

.servis-takip-table tbody tr td:first-child {
    border-top-left-radius: 8px !important;
    border-bottom-left-radius: 8px !important;
}

.servis-takip-table tbody tr td:last-child {
    border-top-right-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
}

.servis-takip-table tbody tr:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.35);
}



.servis-takip-table tbody tr[class*="servis-tag-"] > td {
    box-shadow: none !important;
}

.servis-takip-table tbody tr.servis-tag-r_kirmizi > td:first-child { box-shadow: inset 6px 0 0 0 var(--crm-danger) !important; }
.servis-takip-table tbody tr.servis-tag-r_turuncu > td:first-child { box-shadow: inset 6px 0 0 0 var(--crm-orange) !important; }
.servis-takip-table tbody tr.servis-tag-r_sari > td:first-child { box-shadow: inset 6px 0 0 0 var(--crm-warning) !important; }
.servis-takip-table tbody tr.servis-tag-r_yesil > td:first-child { box-shadow: inset 6px 0 0 0 var(--crm-success) !important; }
.servis-takip-table tbody tr.servis-tag-r_mavi > td:first-child { box-shadow: inset 6px 0 0 0 var(--crm-info) !important; }
.servis-takip-table tbody tr.servis-tag-r_mor > td:first-child { box-shadow: inset 6px 0 0 0 var(--crm-indigo) !important; }

/* Align icons perfectly with text in flex layouts */
.d-inline-flex.align-items-center i.bi,
.app-nav-item i.bi,
.user-profile-badge i.bi,
.btn i.bi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    height: 1em;
    vertical-align: middle;
    margin-top: 0.1rem; /* Micro-adjustment for optical alignment */
}
