/**
 * Mandarin Cloud — Design System & Theme
 * Brand: startup-delivery.ro palette (Indigo/Violet)
 * Dual theme: Light (default) + Dark
 *
 * Ultima modificare: 2026-03-17 15:00
 * Modificari:
 *   2026-03-17 15:00 — Creare design system complet: tokens, layout, componente, dual theme
 */

/* ═══════════════════════════════════════════════════════════
   1. CSS CUSTOM PROPERTIES — DESIGN TOKENS
   ═══════════════════════════════════════════════════════════ */

:root, [data-theme="light"] {
    /* Brand */
    --color-primary:        #6366f1;
    --color-primary-hover:  #4f46e5;
    --color-primary-light:  #818cf8;
    --color-primary-bg:     rgba(99, 102, 241, 0.08);
    --color-primary-rgb:    99, 102, 241;
    --color-secondary:      #8b5cf6;
    --color-secondary-hover:#7c3aed;
    --color-accent:         #10b981;
    --color-gradient:       linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

    /* Surfaces */
    --bg-app:               #f5f6fa;
    --bg-sidebar:           #ffffff;
    --bg-navbar:            #ffffff;
    --bg-card:              #ffffff;
    --bg-input:             #ffffff;
    --bg-hover:             #f0f2f5;
    --bg-active:            rgba(99, 102, 241, 0.08);

    /* Borders & Shape */
    --border-color:         #e5e7eb;
    --border-radius-sm:     6px;
    --border-radius-md:     10px;
    --border-radius-lg:     14px;
    --border-radius-xl:     20px;
    --border-radius-pill:   999px;

    /* Text */
    --text-primary:         #111827;
    --text-secondary:       #6b7280;
    --text-muted:           #9ca3af;
    --text-inverse:         #ffffff;

    /* Shadows */
    --shadow-xs:  0 1px 2px rgba(0,0,0,.05);
    --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg:  0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.05);
    --shadow-xl:  0 20px 25px rgba(0,0,0,.08), 0 10px 10px rgba(0,0,0,.04);
    --shadow-glow: 0 0 0 3px rgba(99, 102, 241, 0.15);

    /* Sidebar */
    --sidebar-width:      260px;
    --sidebar-collapsed:  68px;

    /* Navbar */
    --navbar-height:      60px;

    /* Semantic */
    --color-success:       #16a34a;
    --color-success-light: #dcfce7;
    --color-danger:        #dc2626;
    --color-danger-light:  #fee2e2;
    --color-warning:       #d97706;
    --color-warning-light: #fef3c7;
    --color-info:          #2563eb;
    --color-info-light:    #dbeafe;

    /* Transitions */
    --transition-fast:   150ms ease;
    --transition-base:   250ms ease;
    --transition-slow:   400ms ease;
}

/* ── DARK THEME ── */
[data-theme="dark"] {
    --bg-app:               #0f1117;
    --bg-sidebar:           #161b27;
    --bg-navbar:            #161b27;
    --bg-card:              #1e2433;
    --bg-input:             #252d3d;
    --bg-hover:             #252d3d;
    --bg-active:            rgba(99, 102, 241, 0.15);
    --border-color:         #2d3748;
    --text-primary:         #f1f5f9;
    --text-secondary:       #94a3b8;
    --text-muted:           #64748b;
    --text-inverse:         #0f1117;
    --shadow-xs:  0 1px 2px rgba(0,0,0,.2);
    --shadow-sm:  0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
    --shadow-md:  0 4px 6px rgba(0,0,0,.25), 0 2px 4px rgba(0,0,0,.2);
    --shadow-lg:  0 10px 15px rgba(0,0,0,.3), 0 4px 6px rgba(0,0,0,.2);
    --shadow-xl:  0 20px 25px rgba(0,0,0,.3), 0 10px 10px rgba(0,0,0,.15);
    --color-primary-bg:     rgba(99, 102, 241, 0.18);
    --color-primary-light:  rgba(99, 102, 241, 0.18);
    --color-success-light:  rgba(22, 163, 74, 0.15);
    --color-danger-light:   rgba(220, 38, 38, 0.15);
    --color-warning-light:  rgba(217, 119, 6, 0.15);
    --color-info-light:     rgba(37, 99, 235, 0.15);
}

/* ═══════════════════════════════════════════════════════════
   2. RESET & BASE
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-app);
    transition: background-color var(--transition-base), color var(--transition-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

/* ═══════════════════════════════════════════════════════════
   3. APP LAYOUT — NAVBAR + SIDEBAR + CONTENT
   ═══════════════════════════════════════════════════════════ */

/* ── Navbar ── */
.app-navbar {
    position: sticky;
    top: 0;
    z-index: 1040;
    height: var(--navbar-height);
    background: var(--bg-navbar);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    transition: background-color var(--transition-base), border-color var(--transition-base);
    backdrop-filter: blur(12px);
}

.app-navbar .navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
}

.app-navbar .navbar-brand img {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-sm);
}

.app-navbar .navbar-brand span {
    background: var(--color-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-navbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-navbar-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

.navbar-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: var(--border-radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    font-size: 1rem;
}

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

.navbar-icon-btn .badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-danger);
    border: 2px solid var(--bg-navbar);
}

.navbar-icon-btn .badge-count {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    color: #fff;
    background: var(--color-danger);
    border-radius: var(--border-radius-pill);
}

/* Hamburger */
.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: var(--border-radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1.15rem;
}

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

/* ── Sidebar ── */
.app-sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    z-index: 1030;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    overflow-x: hidden;
    transition: width var(--transition-base), background-color var(--transition-base), border-color var(--transition-base);
    display: flex;
    flex-direction: column;
}

.app-sidebar::-webkit-scrollbar {
    width: 4px;
}

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

.app-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* User panel in sidebar */
.sidebar-user-panel {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

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

.sidebar-user-info {
    overflow: hidden;
    line-height: 1.3;
}

.sidebar-user-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8125rem;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Section labels */
.sidebar-section-label {
    padding: 1rem 1rem 0.375rem;
    font-size: 0.8125rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

/* Nav items */
.sidebar-nav {
    list-style: none;
    padding: 0 0.5rem;
    margin: 0;
    flex: 1;
}

.sidebar-nav-item {
    margin-bottom: 2px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    position: relative;
}

.sidebar-nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-nav-link.active {
    background: var(--bg-active);
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    font-weight: 600;
}

.sidebar-nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-nav-link .nav-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    color: #fff;
    background: var(--color-warning);
    border-radius: var(--border-radius-pill);
}

/* Submenu / treeview */
.sidebar-submenu {
    list-style: none;
    padding: 0.375rem 0 0.375rem 2.25rem;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-base);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-nav-item.open > .sidebar-submenu {
    max-height: 500px;
}

.sidebar-nav-item.open > .sidebar-nav-link .submenu-arrow {
    transform: rotate(90deg);
}

.submenu-arrow {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform var(--transition-fast);
}

.sidebar-submenu .sidebar-nav-link {
    padding: 0.4375rem 0.75rem;
    font-size: 0.8125rem;
    border-left: none;
}

/* Sidebar collapse toggle at bottom */
.sidebar-collapse-toggle {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: var(--border-radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sidebar-collapse-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ── Sidebar collapsed state ── */
body.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-collapsed);
}

body.sidebar-collapsed .sidebar-user-info,
body.sidebar-collapsed .sidebar-user-role,
body.sidebar-collapsed .sidebar-section-label,
body.sidebar-collapsed .sidebar-nav-link span,
body.sidebar-collapsed .sidebar-nav-link .nav-badge,
body.sidebar-collapsed .sidebar-nav-link .submenu-arrow,
body.sidebar-collapsed .sidebar-collapse-btn span,
body.sidebar-collapsed .sidebar-submenu {
    display: none;
}

body.sidebar-collapsed .sidebar-user-panel {
    justify-content: center;
    padding: 1rem 0.5rem 0.75rem;
}

body.sidebar-collapsed .sidebar-nav-link {
    justify-content: center;
    padding: 0.625rem;
    border-left: none;
}

body.sidebar-collapsed .sidebar-nav-link i {
    font-size: 1.125rem;
}

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

body.sidebar-collapsed .app-content {
    margin-left: var(--sidebar-collapsed);
}

/* ── Main Content ── */
.app-content {
    margin-left: var(--sidebar-width);
    min-height: calc(100vh - var(--navbar-height));
    transition: margin-left var(--transition-base);
    animation: fadeSlideIn 200ms ease;
}

.app-content-inner {
    padding: 1.5rem;
}

/* ── Footer ── */
.app-footer {
    margin-left: var(--sidebar-width);
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: margin-left var(--transition-base), border-color var(--transition-base);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.sidebar-collapsed .app-footer {
    margin-left: var(--sidebar-collapsed);
}

.app-footer a {
    color: var(--color-primary);
    font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════
   4. PAGE HEADER / BREADCRUMBS
   ═══════════════════════════════════════════════════════════ */

/* ── Page Header Card (gradient banner, ca CDM) ── */
.page-header-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.page-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--color-gradient);
    color: #fff;
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-header-icon {
    font-size: 1.75rem;
    line-height: 1;
    opacity: 0.9;
}

.page-header-text {
    display: flex;
    flex-direction: column;
}

.page-header-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.page-header-desc {
    font-size: 0.8rem;
    opacity: 0.85;
    margin-top: 2px;
    color: rgba(255,255,255,0.9);
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
}

.page-header-breadcrumb a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
}

.page-header-breadcrumb a:hover {
    color: #fff;
}

.page-header-breadcrumb .separator {
    margin: 0 0.25rem;
}

.page-header-breadcrumb .active {
    color: #fff;
    font-weight: 600;
}

/* Header color variants */
.page-header-content.header-green {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.page-header-content.header-orange {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.page-header-content.header-teal {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* Buton header (white semi-transparent) */
.btn-page-header {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 0.4375rem 1rem;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.8125rem;
    transition: all var(--transition-fast);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.btn-page-header:hover {
    background: rgba(255,255,255,0.3);
    color: #fff;
    transform: translateY(-1px);
}

/* Dark mode header */
[data-theme="dark"] .page-header-content {
    background: linear-gradient(135deg, #4f46e5 0%, #6d28d9 100%);
}

/* Responsive */
@media (max-width: 767.98px) {
    .page-header-content {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
    .page-header-left { flex-direction: column; }
    .page-header-right { width: 100%; justify-content: center; }
}

/* Legacy breadcrumb (fallback) */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.8125rem;
}

.breadcrumb-item { color: var(--text-muted); }
.breadcrumb-item a { color: var(--text-secondary); }
.breadcrumb-item a:hover { color: var(--color-primary); }
.breadcrumb-item + .breadcrumb-item::before { content: '/'; margin-right: 0.375rem; color: var(--text-muted); }
.breadcrumb-item.active { color: var(--text-primary); font-weight: 500; }

/* ═══════════════════════════════════════════════════════════
   5. CARDS
   ═══════════════════════════════════════════════════════════ */

.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition-base), background-color var(--transition-base), border-color var(--transition-base);
    margin-bottom: 1.5rem;
}

.app-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    gap: 0.75rem;
}

.app-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-card-title i {
    color: var(--color-primary);
    font-size: 1rem;
}

.app-card-tools {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.app-card-body {
    padding: 1.25rem;
}

.app-card-body.no-padding {
    padding: 0;
}

.app-card-footer {
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════
   6. BUTTONS
   ═══════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.5;
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-primary,
a.btn-primary {
    background: var(--color-gradient);
    color: #fff !important;
    border: none;
}

.btn-primary:hover,
.btn-primary:focus,
a.btn-primary:hover,
a.btn-primary:focus {
    box-shadow: var(--shadow-md);
    color: #fff !important;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--bg-card);
}

.btn-danger,
a.btn-danger {
    background: var(--color-danger);
    color: #fff !important;
}

.btn-danger:hover,
.btn-danger:focus,
a.btn-danger:hover,
a.btn-danger:focus {
    background: #b91c1c;
    color: #fff !important;
}

.btn-success,
a.btn-success {
    background: var(--color-success);
    color: #fff !important;
}

.btn-success:hover,
.btn-success:focus,
a.btn-success:hover,
a.btn-success:focus {
    background: #15803d;
    color: #fff !important;
}

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

.btn-info,
a.btn-info {
    background: var(--color-info);
    color: #fff !important;
}

.btn-info:hover,
.btn-info:focus,
a.btn-info:hover,
a.btn-info:focus {
    background: #1d4ed8;
    color: #fff !important;
}

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

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

.btn-outline-secondary {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

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

.btn-outline-warning {
    background: transparent;
    color: var(--color-warning);
    border-color: var(--color-warning);
}

.btn-outline-warning:hover {
    background: var(--color-warning);
    color: #fff;
}

.btn-sm {
    padding: 0.3125rem 0.75rem;
    font-size: 0.75rem;
}

.btn-xs {
    padding: 0.1875rem 0.5rem;
    font-size: 0.6875rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-tool {
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

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

.btn-group {
    display: inline-flex;
    gap: 0;
}

.btn-group > .btn {
    border-radius: 0;
}

.btn-group > .btn:first-child {
    border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm);
}

.btn-group > .btn:last-child {
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
}

.btn-group-sm > .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Legacy gradient buttons (compatibility) */
.bg-gradient-primary {
    background: var(--color-gradient) !important;
    color: #fff !important;
    border: none !important;
}

.bg-gradient-primary:hover {
    box-shadow: var(--shadow-md);
}

/* ═══════════════════════════════════════════════════════════
   7. FORMS
   ═══════════════════════════════════════════════════════════ */

.form-group {
    margin-bottom: 1rem;
}

.form-label,
label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-base);
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control-sm {
    padding: 0.3125rem 0.625rem;
    font-size: 0.8125rem;
}

.form-control-plaintext {
    background: transparent;
    border: none;
    padding: 0.5rem 0;
    color: var(--text-primary);
}

.form-control[readonly] {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

/* Input groups */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group > .form-control {
    flex: 1;
    border-radius: 0;
}

.input-group > .form-control:first-child,
.input-group > .input-group-prepend:first-child > * {
    border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm);
}

.input-group > .form-control:last-child,
.input-group > .input-group-append:last-child > * {
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
}

.input-group-prepend,
.input-group-append {
    display: flex;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
}

.input-group-sm > .form-control,
.input-group-sm > .input-group-text {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
}

/* Validation */
.form-control.is-invalid {
    border-color: var(--color-danger);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.invalid-feedback {
    font-size: 0.75rem;
    color: var(--color-danger);
    margin-top: 0.25rem;
}

/* Custom switches */
.custom-control {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 1.5rem;
}

.custom-switch {
    padding-left: 2.75rem;
}

.custom-control-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.custom-switch .custom-control-label {
    font-weight: 400;
    cursor: pointer;
    margin-bottom: 0;
}

.custom-switch .custom-control-label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.125rem;
    width: 2.25rem;
    height: 1.25rem;
    border-radius: var(--border-radius-pill);
    background: var(--border-color);
    transition: background-color var(--transition-fast);
}

.custom-switch .custom-control-label::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 5px;
    width: 0.875rem;
    height: 0.875rem;
    border-radius: 50%;
    background: #fff;
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-xs);
}

.custom-switch .custom-control-input:checked ~ .custom-control-label::before {
    background: var(--color-primary);
}

.custom-switch .custom-control-input:checked ~ .custom-control-label::after {
    transform: translateX(1rem);
}

.custom-switch .custom-control-input:focus ~ .custom-control-label::before {
    box-shadow: var(--shadow-glow);
}

/* ═══════════════════════════════════════════════════════════
   8. TABLES — CDM style (rotunjite, compacte, striped, selectable)
   ═══════════════════════════════════════════════════════════ */

.table {
    width: 100%;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    color: var(--text-primary);
    background: var(--bg-card);
    font-size: 0.8125rem;
}

.table th {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.5px;
    color: #4a5568;
    background: linear-gradient(180deg, #f8fafc 0%, #edf2f7 100%);
    border-bottom: 2px solid #cbd5e0;
    border-top: none;
    padding: 0.3rem 0.5rem;
    white-space: nowrap;
    position: relative;
}

.table thead tr:first-child th:first-child {
    border-top-left-radius: var(--border-radius-sm);
}
.table thead tr:first-child th:last-child {
    border-top-right-radius: var(--border-radius-sm);
}

/* Footer row — same style as header */
.table tfoot th {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.5px;
    color: #4a5568;
    background: linear-gradient(180deg, #edf2f7 0%, #f8fafc 100%);
    border-top: 2px solid #cbd5e0;
    border-bottom: none;
    padding: 0.3rem 0.5rem;
}

.table tfoot tr:last-child th:first-child {
    border-bottom-left-radius: var(--border-radius-sm);
}
.table tfoot tr:last-child th:last-child {
    border-bottom-right-radius: var(--border-radius-sm);
}

.table td {
    padding: 0.25rem 0.5rem;
    border-top: 1px solid var(--border-color);
    vertical-align: middle;
    transition: background-color 0.1s ease;
    font-size: 0.8rem;
}

/* Coloana actiuni — butoane pe un singur rand */
.table td:last-child {
    white-space: nowrap;
}

.table td:last-child .btn {
    margin-bottom: 0;
}

/* Striped rows */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(248, 250, 252, 0.6);
}

/* Hover — indigo tint */
.table-hover tbody tr {
    cursor: pointer;
}

.table-hover tbody tr:hover {
    background-color: rgba(99, 102, 241, 0.04);
}

.table-hover tbody tr:hover td {
    border-top-color: rgba(99, 102, 241, 0.12);
}

/* Selected row — subtil, doar bg ușor lavandă */
.table tbody tr.selected,
table.dataTable tbody tr.selected,
table.dataTable tbody tr.selected td {
    background-color: #f0f0ff !important;
    color: var(--text-primary) !important;
    box-shadow: none !important;
}

[data-theme="dark"] .table tbody tr.selected,
[data-theme="dark"] table.dataTable tbody tr.selected,
[data-theme="dark"] table.dataTable tbody tr.selected td {
    background-color: rgba(99, 102, 241, 0.1) !important;
    color: var(--text-primary) !important;
}

/* Bordered — rotunjit */
.table-bordered {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid var(--border-color);
}

.table-sm th,
.table-sm td {
    padding: 0.3rem 0.5rem;
}

/* Dark mode tables */
[data-theme="dark"] .table th {
    color: #94a3b8;
    background: linear-gradient(180deg, #1e2433 0%, #161b27 100%);
    border-bottom-color: #2d3748;
}

[data-theme="dark"] .table tfoot th {
    color: #94a3b8;
    background: linear-gradient(180deg, #161b27 0%, #1e2433 100%);
    border-top-color: #2d3748;
}

[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(255,255,255,.02);
}

[data-theme="dark"] .table-hover tbody tr:hover {
    background-color: rgba(99, 102, 241, 0.08);
}

/* ═══════════════════════════════════════════════════════════
   9. BADGES
   ═══════════════════════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: var(--border-radius-pill);
    line-height: 1.4;
}

.badge-primary {
    background: var(--color-primary-bg);
    color: var(--color-primary);
}

.badge-success {
    background: var(--color-success-light);
    color: var(--color-success);
}

.badge-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.badge-warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.badge-info {
    background: var(--color-info-light);
    color: var(--color-info);
}

.badge-secondary {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════
   10. ALERTS & CALLOUTS
   ═══════════════════════════════════════════════════════════ */

.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid transparent;
    margin-bottom: 1rem;
    font-size: 0.8125rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.alert-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border-color: rgba(220, 38, 38, 0.2);
}

.alert-success {
    background: var(--color-success-light);
    color: var(--color-success);
    border-color: rgba(22, 163, 74, 0.2);
}

.alert-warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
    border-color: rgba(217, 119, 6, 0.2);
}

.alert-info {
    background: var(--color-info-light);
    color: var(--color-info);
    border-color: rgba(37, 99, 235, 0.2);
}

.alert-light {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.alert .close,
.alert .btn-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.callout {
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    border-left: 4px solid var(--color-info);
    background: var(--color-info-light);
    margin-bottom: 1rem;
}

.callout-info {
    border-left-color: var(--color-info);
    background: var(--color-info-light);
}

.callout-warning {
    border-left-color: var(--color-warning);
    background: var(--color-warning-light);
}

.callout-danger {
    border-left-color: var(--color-danger);
    background: var(--color-danger-light);
}

/* ═══════════════════════════════════════════════════════════
   11. MODALS
   ═══════════════════════════════════════════════════════════ */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1050;
    overflow-y: auto;
    padding: 1rem;
}

.modal.show,
.modal.fade.show {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1049;
}

.modal-backdrop.show {
    opacity: 1;
}

.modal-dialog {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 2rem auto;
    z-index: 1051;
    animation: modalSlideIn 200ms ease;
}

.modal-dialog.modal-sm { max-width: 400px; }
.modal-dialog.modal-md { max-width: 600px; }
.modal-dialog.modal-lg { max-width: 800px; }
.modal-dialog.modal-xl { max-width: 1100px; }

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

/* Modal header color variants */
.modal-header.bg-primary {
    background: var(--color-gradient) !important;
    color: #fff;
    border-bottom: none;
}

.modal-header.bg-success {
    background: var(--color-success) !important;
    color: #fff;
    border-bottom: none;
}

.modal-header.bg-info {
    background: var(--color-info) !important;
    color: #fff;
    border-bottom: none;
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header.bg-primary .modal-title,
.modal-header.bg-success .modal-title,
.modal-header.bg-info .modal-title {
    color: #fff !important;
}

.modal-header.bg-primary .modal-title i,
.modal-header.bg-success .modal-title i,
.modal-header.bg-info .modal-title i {
    color: #fff !important;
    opacity: 0.9;
}

.modal-header .close,
.modal-header .btn-close {
    background: rgba(255,255,255,0.2);
    border: none;
    font-size: 1.25rem;
    color: inherit;
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
    padding: 0;
    line-height: 1;
}

.modal-header .close:hover,
.modal-header .btn-close:hover {
    background: rgba(255,255,255,0.3);
}

/* Close button for non-colored headers */
.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info) .close,
.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info) .btn-close {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info) .close:hover,
.modal-header:not(.bg-primary):not(.bg-success):not(.bg-info) .btn-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

/* ═══════════════════════════════════════════════════════════
   12. GRID SYSTEM (Bootstrap 5 compatible)
   ═══════════════════════════════════════════════════════════ */

.container-fluid {
    width: 100%;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
    margin-right: auto;
    margin-left: auto;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.75rem;
    margin-left: -0.75rem;
}

.row > * {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
}

/* Column classes */
.col { flex: 1 0 0%; }
.col-2 { flex: 0 0 auto; width: 16.666667%; }
.col-3 { flex: 0 0 auto; width: 25%; }
.col-4 { flex: 0 0 auto; width: 33.333333%; }
.col-5 { flex: 0 0 auto; width: 41.666667%; }
.col-6 { flex: 0 0 auto; width: 50%; }
.col-7 { flex: 0 0 auto; width: 58.333333%; }
.col-8 { flex: 0 0 auto; width: 66.666667%; }
.col-9 { flex: 0 0 auto; width: 75%; }
.col-10 { flex: 0 0 auto; width: 83.333333%; }
.col-12 { flex: 0 0 auto; width: 100%; }

@media (min-width: 576px) {
    .col-sm-6 { flex: 0 0 auto; width: 50%; }
    .col-sm-12 { flex: 0 0 auto; width: 100%; }
}

@media (min-width: 768px) {
    .col-md-2 { flex: 0 0 auto; width: 16.666667%; }
    .col-md-3 { flex: 0 0 auto; width: 25%; }
    .col-md-4 { flex: 0 0 auto; width: 33.333333%; }
    .col-md-5 { flex: 0 0 auto; width: 41.666667%; }
    .col-md-6 { flex: 0 0 auto; width: 50%; }
    .col-md-8 { flex: 0 0 auto; width: 66.666667%; }
    .col-md-12 { flex: 0 0 auto; width: 100%; }
    .d-md-table-cell { display: table-cell !important; }
}

@media (min-width: 992px) {
    .col-lg-3 { flex: 0 0 auto; width: 25%; }
    .col-lg-4 { flex: 0 0 auto; width: 33.333333%; }
    .col-lg-6 { flex: 0 0 auto; width: 50%; }
    .col-lg-12 { flex: 0 0 auto; width: 100%; }
    .d-lg-table-cell { display: table-cell !important; }
}

@media (min-width: 1200px) {
    .d-xl-table-cell { display: table-cell !important; }
}

/* ═══════════════════════════════════════════════════════════
   13. UTILITIES
   ═══════════════════════════════════════════════════════════ */

/* Display */
.d-none { display: none !important; }
.d-flex { display: flex !important; }
.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-inline-flex { display: inline-flex !important; }

@media (min-width: 576px) {
    .d-sm-inline-block { display: inline-block !important; }
    .d-sm-inline { display: inline !important; }
    .d-sm-none { display: none !important; }
}

@media print {
    .d-print-none { display: none !important; }
}

/* Flex */
.flex-column { flex-direction: column; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

/* Float */
.float-right { float: right; }
.float-left { float: left; }
@media (min-width: 576px) {
    .float-sm-right { float: right; }
}

/* Spacing */
.m-0 { margin: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }
.ml-1 { margin-left: 0.25rem !important; }
.ml-2 { margin-left: 0.5rem !important; }
.ml-auto { margin-left: auto !important; }
.mr-1 { margin-right: 0.25rem !important; }
.mr-2 { margin-right: 0.5rem !important; }
.p-0 { padding: 0 !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.px-3 { padding-left: 1rem !important; padding-right: 1rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.pb-2 { padding-bottom: 0.5rem !important; }
.pt-3 { padding-top: 1rem !important; }

/* Text */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-primary { color: var(--color-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-success { color: var(--color-success) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-info { color: var(--color-info) !important; }
.text-dark { color: var(--text-primary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-white { color: #fff !important; }
.text-bold, .font-weight-bold { font-weight: 700 !important; }
.font-weight-light { font-weight: 300 !important; }
.small { font-size: 0.8125rem; }

/* Borders */
.border { border: 1px solid var(--border-color) !important; }
.border-bottom { border-bottom: 1px solid var(--border-color) !important; }
.border-top { border-top: 1px solid var(--border-color) !important; }

/* Sizing */
.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* ═══════════════════════════════════════════════════════════
   14. DATATABLES OVERRIDE
   ═══════════════════════════════════════════════════════════ */

.dataTables_wrapper {
    color: var(--text-primary);
    font-size: 0.8125rem;
}

/* Toolbar zones */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Top toolbar spacing */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    padding-bottom: 0.5rem;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.dataTables_wrapper .dataTables_length select {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.dataTables_wrapper .dataTables_length select:hover {
    border-color: var(--color-primary);
}

.dataTables_wrapper .dataTables_filter input {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.3125rem 0.75rem;
    font-size: 0.8125rem;
    min-width: 180px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

.dataTables_wrapper .dataTables_info {
    color: var(--text-muted);
    font-size: 0.75rem;
    padding-top: 0.75rem;
}

.dataTables_wrapper .dataTables_paginate {
    padding-top: 0.75rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    margin: 0 2px;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-sm);
    background: var(--bg-card) !important;
    color: var(--text-secondary) !important;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--bg-hover) !important;
    color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--color-primary) !important;
    color: #fff !important;
    border-color: var(--color-primary) !important;
    font-weight: 600;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.4;
    cursor: default;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background: var(--bg-card) !important;
    color: var(--text-muted) !important;
    border-color: var(--border-color) !important;
}

table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after {
    opacity: 0.5;
}

table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after {
    opacity: 1;
    color: var(--color-primary);
}

/* DataTables processing overlay */
.dataTables_processing {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-md);
    padding: 0.75rem 1rem !important;
}

/* DataTables inside app-card — rotunjite */
.app-card .dataTables_wrapper {
    padding: 0;
}

.app-card table.dataTable {
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.app-card table.dataTable thead th:first-child {
    border-top-left-radius: var(--border-radius-sm);
}

.app-card table.dataTable thead th:last-child {
    border-top-right-radius: var(--border-radius-sm);
}

/* ── Full-screen map (tablet style with rounded frame) ── */
.map-fullscreen-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
}

.map-fullscreen-wrapper #map {
    width: 100%;
    height: calc(100vh - var(--navbar-height) - 230px);
    min-height: 300px;
}

.map-fullscreen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.map-fullscreen-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.map-fullscreen-title i {
    color: var(--color-primary);
}

/* ═══════════════════════════════════════════════════════════
   15. TOASTR OVERRIDE
   ═══════════════════════════════════════════════════════════ */

#toast-container > .toast {
    border-radius: var(--border-radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
    opacity: 1 !important;
    font-family: inherit;
}

#toast-container > .toast-success {
    background-color: var(--color-success) !important;
}

#toast-container > .toast-error {
    background-color: var(--color-danger) !important;
}

#toast-container > .toast-warning {
    background-color: var(--color-warning) !important;
}

#toast-container > .toast-info {
    background-color: var(--color-info) !important;
}

/* ═══════════════════════════════════════════════════════════
   16. DATERANGEPICKER OVERRIDE
   ═══════════════════════════════════════════════════════════ */

.daterangepicker {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    background: var(--bg-card);
    font-family: inherit;
}

.daterangepicker .calendar-table {
    background: var(--bg-card);
    border: none;
}

.daterangepicker td.active,
.daterangepicker td.active:hover {
    background: var(--color-primary) !important;
    color: #fff;
    border-radius: var(--border-radius-sm);
}

.daterangepicker .drp-buttons .btn {
    font-size: 0.8125rem;
    border-radius: var(--border-radius-sm);
}

.daterangepicker .drp-buttons .applyBtn {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

/* ═══════════════════════════════════════════════════════════
   17. LOGIN PAGE
   ═══════════════════════════════════════════════════════════ */

.login-page {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
    background: var(--bg-app);
}

.login-hero {
    display: none;
    flex: 1;
    background: var(--color-gradient);
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.login-hero::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    top: -50px;
    right: -50px;
}

.login-hero::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    bottom: 60px;
    left: -40px;
}

.login-hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    height: 100%;
    color: #fff;
    max-width: 480px;
    margin: 0 auto;
}

.login-hero-logo {
    margin-bottom: 2rem;
}

.login-hero-logo img {
    width: 56px;
    height: 56px;
    border-radius: var(--border-radius-md);
}

.login-hero h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.login-hero p {
    font-size: 1.0625rem;
    color: rgba(255,255,255,0.8);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.login-hero-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    text-align: left;
}

.login-hero-features li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9375rem;
    color: rgba(255,255,255,0.9);
}

.login-hero-features li i {
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

@media (min-width: 992px) {
    .login-hero {
        display: flex;
        flex: 0 0 55%;
        max-width: 55%;
    }
}

/* Mobile login — show hero as compact banner above form */
@media (max-width: 991.98px) {
    .login-page {
        flex-direction: column;
    }

    .login-hero {
        display: flex !important;
        flex: none;
        padding: 1.5rem;
        min-height: auto;
    }

    .login-hero h1 {
        font-size: 1.5rem;
    }

    .login-hero p {
        font-size: 0.875rem;
        margin-bottom: 1rem;
    }

    .login-hero-features {
        gap: 0.5rem;
    }

    .login-hero-features li {
        font-size: 0.8125rem;
    }
}

.login-form-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bg-card);
}

.login-form-inner {
    width: 100%;
    max-width: 400px;
}

.login-form-inner h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-form-inner .login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.875rem;
}

.login-form-inner .form-group {
    margin-bottom: 1.25rem;
}

.login-form-inner .btn-primary {
    height: 44px;
    font-size: 0.9375rem;
}

.login-remember {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.login-remember label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: 0;
}

.login-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.login-footer {
    margin-top: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ═══════════════════════════════════════════════════════════
   18. CUSTOM COMPONENTS — label-status, drpicker
   ═══════════════════════════════════════════════════════════ */

.label-status {
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem 0.5rem;
    border-radius: var(--border-radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
}

.bg-gradient-green {
    background: var(--color-success) !important;
    color: #fff;
}

.drpicker {
    cursor: pointer;
    min-width: 200px;
}

/* Feedback new row highlight */
.feedback-new {
    background: var(--color-warning-light) !important;
}

/* ═══════════════════════════════════════════════════════════
   19. ANIMATIONS
   ═══════════════════════════════════════════════════════════ */

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

.skeleton {
    background: linear-gradient(90deg,
        var(--bg-hover) 25%, var(--border-color) 50%, var(--bg-hover) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius-sm);
}

/* ═══════════════════════════════════════════════════════════
   SELECT2 OVERRIDE
   ═══════════════════════════════════════════════════════════ */

.select2-container--default .select2-selection--single {
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-input);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-primary);
    line-height: 34px;
    padding-left: 10px;
    font-size: 0.8125rem;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 34px;
}

.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

.select2-dropdown {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    background: var(--bg-card);
    overflow: hidden;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--color-primary);
    color: #fff;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
    background: var(--bg-active);
    color: var(--color-primary);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
    background: var(--bg-input);
    color: var(--text-primary);
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--color-primary);
    outline: none;
}

.select2-results__option {
    font-size: 0.8125rem;
    padding: 0.4375rem 0.75rem;
}

/* Small variant */
.select2-container--default .select2-selection--single.select2-selection--sm,
.input-group-sm .select2-container--default .select2-selection--single {
    height: 30px;
}

.input-group-sm .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 28px;
    font-size: 0.75rem;
}

/* Dark mode Select2 */
[data-theme="dark"] .select2-container--default .select2-selection--single {
    background: var(--bg-input);
    border-color: var(--border-color);
}

[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-primary);
}

[data-theme="dark"] .select2-dropdown {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .select2-container--default .select2-results__option {
    color: var(--text-primary);
}

[data-theme="dark"] .select2-container--default .select2-search--dropdown .select2-search__field {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--border-color);
}

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

/* ═══════════════════════════════════════════════════════════
   20. MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

/* Mobile: sidebar hidden, overlay mode */
@media (max-width: 991.98px) {
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }

    .app-sidebar {
        transform: translateX(-100%);
        box-shadow: none;
        z-index: 1060;
        top: 0;
        height: 100vh;
    }

    body.sidebar-mobile-open .app-sidebar {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    body.sidebar-mobile-open .sidebar-backdrop {
        display: block;
    }

    .app-content {
        margin-left: 0 !important;
    }

    .app-footer {
        margin-left: 0 !important;
    }

    .app-content-inner {
        padding: 0.75rem;
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 1055;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(2px);
    }

    /* Hide collapse toggle on mobile */
    .sidebar-collapse-toggle {
        display: none;
    }

    /* DataTables responsive — horizontal scroll in card */
    .app-card-body {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* DataTables — actions become hamburger menu on mobile */
    .table .mobile-actions-original {
        display: none !important;
    }

    .mobile-actions-menu {
        display: inline-block !important;
        position: relative;
    }

    .mobile-actions-toggle {
        width: 36px;
        height: 36px;
        border: none;
        border-radius: var(--border-radius-sm);
        background: var(--color-primary);
        color: #fff;
        font-size: 0.9rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all var(--transition-fast);
    }

    .mobile-actions-toggle:hover,
    .mobile-actions-toggle:focus {
        background: var(--color-primary-hover);
        transform: scale(1.05);
    }

    .mobile-actions-dropdown {
        display: none;
        position: fixed;
        min-width: 160px;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius-md);
        box-shadow: var(--shadow-lg);
        z-index: 9999;
        overflow: hidden;
    }

    .mobile-actions-menu.open .mobile-actions-dropdown {
        display: block;
    }

    .mobile-actions-dropdown .mobile-action-item,
    .mobile-actions-dropdown button.mobile-action-item,
    .mobile-actions-dropdown a.mobile-action-item {
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
        padding: 0.5rem 0.875rem !important;
        font-size: 0.8125rem !important;
        color: #1f2937 !important;
        min-height: 38px !important;
        cursor: pointer !important;
        transition: background 0.15s ease !important;
        border: none !important;
        background: #fff !important;
        width: 100% !important;
        text-align: left !important;
        text-decoration: none !important;
        font-family: 'Inter', sans-serif !important;
        line-height: 1.4 !important;
    }

    .mobile-actions-dropdown .mobile-action-item:hover,
    .mobile-actions-dropdown .mobile-action-item:active {
        background: #f3f4f6 !important;
    }

    .mobile-actions-dropdown .mobile-action-item.action-danger,
    .mobile-actions-dropdown button.mobile-action-item.action-danger {
        color: #dc2626 !important;
    }

    .mobile-actions-dropdown .mobile-action-item.action-danger:hover {
        background: #fef2f2 !important;
    }

    .mobile-actions-dropdown .mobile-action-item i {
        width: 20px !important;
        text-align: center !important;
        font-size: 0.9375rem !important;
        color: #6366f1 !important;
        flex-shrink: 0 !important;
    }

    .mobile-actions-dropdown .mobile-action-item.action-danger i {
        color: #dc2626 !important;
    }
}

/* Mobile actions menu — hidden on desktop */
@media (min-width: 992px) {
    .mobile-actions-menu {
        display: none !important;
    }
}

/* Tablet */
@media (max-width: 767.98px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .page-header-title {
        font-size: 1.25rem;
    }
}

/* ═══════════════════════════════════════════════════════════
   21. THEME TOGGLE
   ═══════════════════════════════════════════════════════════ */

.theme-toggle {
    position: relative;
    width: 38px;
    height: 38px;
}

.theme-toggle .theme-icon-light,
.theme-toggle .theme-icon-dark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

[data-theme="light"] .theme-toggle .theme-icon-dark { opacity: 0; transform: translate(-50%, -50%) rotate(90deg); }
[data-theme="light"] .theme-toggle .theme-icon-light { opacity: 1; }
[data-theme="dark"] .theme-toggle .theme-icon-light { opacity: 0; transform: translate(-50%, -50%) rotate(-90deg); }
[data-theme="dark"] .theme-toggle .theme-icon-dark { opacity: 1; }

/* Smooth color transitions on theme toggle */
body, .app-navbar, .app-sidebar, .app-card, .app-footer,
.modal-content, .form-control, .table, .breadcrumb,
.callout, .alert, .badge, .sidebar-nav-link {
    transition: background-color var(--transition-base),
                color var(--transition-base),
                border-color var(--transition-base);
}
