/* ================================================================
   ARMADA SYSTEM — Premium SaaS Design System v2
   Deep Indigo + Emerald Teal — Modern Glassmorphism
   ================================================================ */

/* ===== CSS VARIABLES / COLOR SYSTEM ===== */
:root {
    /* Brand Colors */
    --color-primary: #3A5BFF;
    --color-secondary: #00B894;

    /* Primary aliases */
    --primary: #3A5BFF;
    --primary-hover: #2D4ADB;
    --primary-soft: rgba(58, 91, 255, 0.07);
    --primary-soft-hover: rgba(58, 91, 255, 0.13);

    /* Secondary */
    --secondary: #00B894;
    --secondary-soft: rgba(0, 184, 148, 0.08);

    /* Backgrounds */
    --color-bg: #F0F2F5;
    --bg-main: #F0F2F5;
    --color-card: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F8F9FA;

    /* Texts */
    --text-main: #1A1F36;
    --text-secondary: #3C4257;
    --text-muted: #8492A6;
    --text-xs: #A0AEC0;

    /* Borders */
    --border-soft: rgba(195, 207, 220, 0.60);
    --border-light: rgba(220, 228, 238, 0.50);

    /* Shadows — very subtle per reference */
    --shadow-soft: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.03);
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-hover: 0 2px 8px rgba(0,0,0,0.08);

    /* Radii — small, technical style (6-8px) */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 8px;
    --radius-xl: 8px;

    /* Layout */
    --sidebar-width: 240px;
    --sidebar-bg: #1B2437;
    --sidebar-bg-flat: #1B2437;
    --sidebar-bg-subtle: #212D42;
    --sidebar-text: #8896AB;
    --sidebar-text-active: #ffffff;
    --sidebar-accent: #3A5BFF;
    --sidebar-hover: rgba(255,255,255,0.05);
    --sidebar-section: rgba(136,150,171,0.45);
    --sidebar-divider: rgba(255,255,255,0.06);
    --topbar-height: 50px;
    --sidebar-collapsed-width: 72px;
    --bottomnav-height: 54px;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.25s ease;
}

/* ===== DARK MODE OVERRIDES ===== */
[data-bs-theme="dark"] {
    --color-bg: #0C1222;
    --bg-main: #0C1222;
    --color-card: #161F36;
    --bg-card: #161F36;
    --bg-card-hover: #1D2A47;
    --text-main: #E8ECF4;
    --text-secondary: #B4C0D6;
    --text-muted: #5C6B84;
    --text-xs: #485470;
    --border-soft: rgba(56, 72, 105, 0.65);
    --border-light: rgba(30, 44, 72, 0.6);
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.20);
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.25);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.30);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.35);
    --shadow-hover: 0 2px 8px rgba(0,0,0,0.30);
    --shadow-soft: 0 1px 3px rgba(0,0,0,0.20);
    --sidebar-bg: #111827;
    --sidebar-bg-flat: #111827;
    --sidebar-bg-subtle: #151D2E;
}

/* ===== GLOBAL RESETS ===== */
*,
*::before,
*::after {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: 0.8125rem;
    color: var(--text-main);
    background: var(--bg-main);
    overflow-x: hidden;
    line-height: 1.55;
    letter-spacing: -0.006em;
}

/* ===== MODERN SCROLLBAR (Notion / Linear style) ===== */
/* Webkit (Chrome, Edge, Safari) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(148,163,184,0.25);
    border-radius: 100px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(148,163,184,0.45);
}
::-webkit-scrollbar-corner {
    background: transparent;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(148,163,184,0.25) transparent;
}

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 100px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.15);
}

/* Table container scrollbar */
.table-responsive::-webkit-scrollbar {
    height: 5px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(148,163,184,0.2);
    border-radius: 100px;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg-flat);
    color: var(--sidebar-text);
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--transition-slow);
    border-right: 1px solid rgba(255,255,255,0.04);
}

.sidebar-brand {
    padding: 0 1rem;
    border-bottom: 1px solid var(--sidebar-divider);
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--topbar-height);
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
}

/* ---- Full logo wrapper: landscape slot (sidebar OPEN) ---- */
.sidebar-logo-wrap-full {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 160px;
    height: 30px;
    overflow: hidden;
    flex-shrink: 0;
}
.sidebar-logo-wrap-full img {
    width: 160px;
    height: 30px;
    object-fit: contain;
    object-position: center center;
    display: block;
}

/* ---- Mini logo wrapper: square slot (sidebar COLLAPSED) ---- */
.sidebar-logo-wrap-mini {
    display: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    overflow: hidden;
    flex-shrink: 0;
}
.sidebar-logo-wrap-mini img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
    border-radius: 4px;
}

/* Nav sections */
.sidebar-nav .nav-section {
    padding: 1rem 1rem 0.3rem;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-section);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav .nav-section:first-child {
    padding-top: 0.625rem;
}

/* Nav links */
.sidebar-nav .nav-link {
    color: var(--sidebar-text);
    padding: 0.625rem 1rem;
    min-height: 44px;
    font-size: 0.9rem;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    border-radius: 0;
    transition: all var(--transition-fast);
    position: relative;
    margin: 0;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav .nav-link:hover {
    color: #e2e8f0;
    background: var(--sidebar-hover);
}

.sidebar-nav .nav-link.active {
    color: var(--sidebar-text-active);
    background: rgba(58, 91, 255, 0.10);
    font-weight: 500;
}

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    background: var(--sidebar-accent);
    border-radius: 0 2px 2px 0;
}

.sidebar-nav .nav-link i {
    font-size: 1.2rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.55;
    transition: opacity var(--transition-fast);
}

.sidebar-nav .nav-link.active i {
    opacity: 1;
    color: var(--sidebar-accent);
}

.sidebar-nav .nav-link:hover i {
    opacity: 0.8;
}

.sidebar-nav .nav-item.has-children {
    position: relative;
    overflow: visible;
}

.sidebar-nav .submenu-toggle .submenu-arrow {
    margin-left: auto;
    font-size: 0.8rem;
    opacity: 0.7;
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.sidebar-nav .submenu-toggle:not(.collapsed) .submenu-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

.sidebar-nav .submenu-panel {
    padding: 0.25rem 0 0.35rem;
}

.sidebar-nav .submenu-panel .nav-link {
    padding-left: 2.25rem;
    font-size: 0.82rem;
}

.sidebar-nav .submenu-panel .nav-link i {
    font-size: 1rem;
    opacity: 0.55;
}

.sidebar-nav .submenu-popout {
    display: none;
}

.sidebar-nav .submenu-popout-title {
    display: none;
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
    overflow-y: auto;
    overflow-x: hidden;
}

body.sidebar-collapsed .sidebar-nav {
    position: relative;
    overflow: visible;
}

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

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

body.sidebar-collapsed .sidebar .sidebar-brand {
    justify-content: center;
    padding: 0;
}

/* Collapsed: hide full logo, show mini */
body.sidebar-collapsed .sidebar .sidebar-brand .sidebar-logo-wrap-full {
    display: none !important;
}
body.sidebar-collapsed .sidebar .sidebar-brand .sidebar-logo-wrap-mini {
    display: flex !important;
}

body.sidebar-collapsed .sidebar .nav-section,
body.sidebar-collapsed .sidebar .nav-link .nav-label,
body.sidebar-collapsed .sidebar .submenu-panel {
    display: none !important;
}

body.sidebar-collapsed .sidebar-nav .nav-link {
    justify-content: center;
    gap: 0;
    padding-left: 0;
    padding-right: 0;
    min-height: 52px;
}

body.sidebar-collapsed .sidebar-nav .nav-link i {
    width: auto;
    font-size: 1.25rem;
}

body.sidebar-collapsed .sidebar-nav .submenu-toggle {
    justify-content: center;
    position: relative;
}

body.sidebar-collapsed .sidebar-nav .submenu-toggle .submenu-arrow {
    display: none !important;
}

body.sidebar-collapsed .sidebar-nav .submenu-popout {
    position: fixed;
    left: calc(var(--sidebar-collapsed-width) + 6px);
    top: 0;
    min-width: 210px;
    background: var(--sidebar-bg-subtle);
    border: 1px solid var(--sidebar-divider);
    border-radius: 0;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    display: block;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateX(4px);
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s ease;
}

body.sidebar-collapsed .sidebar-nav .nav-item.has-children {
    z-index: 1;
}

body.sidebar-collapsed .sidebar-nav .nav-item.has-children:hover,
body.sidebar-collapsed .sidebar-nav .nav-item.has-children:focus-within,
body.sidebar-collapsed .sidebar-nav .nav-item.has-children.show-popout {
    z-index: 2001;
}

body.sidebar-collapsed .sidebar-nav .nav-item.has-children.show-popout > .submenu-popout {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

body.sidebar-collapsed .sidebar-nav .submenu-popout-title {
    display: block;
    font-size: 0.74rem;
    font-weight: 700;
    color: #fff;
    padding: 0.5rem 0.9rem;
    border-bottom: 1px solid var(--sidebar-divider);
    margin-bottom: 0.2rem;
}

body.sidebar-collapsed .sidebar-nav .submenu-popout .nav-link {
    justify-content: flex-start;
    padding: 0.45rem 0.9rem;
}

body.sidebar-collapsed .sidebar-nav .submenu-popout .nav-link .nav-label {
    display: inline !important;
    font-size: 0.82rem;
}

body.sidebar-collapsed .sidebar-nav .submenu-popout .nav-link i {
    display: none;
}

/* ================================================================
   TOPBAR
   ================================================================ */
.topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-soft);
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    transition: left var(--transition-slow);
    box-shadow: var(--shadow-xs);
}

[data-bs-theme="dark"] .topbar {
    background: var(--bg-card);
}

.topbar .page-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.topbar .btn-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    padding: 0;
    font-size: 1.05rem;
}

.topbar .btn-icon:hover {
    background: rgba(58, 91, 255, 0.07);
    color: var(--primary);
}

.topbar .user-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.topbar .user-dropdown-toggle:hover {
    background: var(--bg-main);
    border-color: var(--border-soft);
}

.topbar .user-dropdown-toggle::after {
    font-size: 0.6rem;
    opacity: 0.5;
}

.topbar .locale-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    min-width: 72px;
    height: 34px;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    background-color: transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
}

.topbar .locale-dropdown-toggle:hover {
    background: var(--bg-main);
    border-color: var(--border-soft);
}

.topbar .locale-dropdown-toggle::after {
    margin-left: 0.45rem;
    font-size: 0.6rem;
    opacity: 0.6;
}

.topbar .locale-dropdown-toggle:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(58,91,255,0.12);
}

.topbar .user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(58, 91, 255, 0.10);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.topbar .user-avatar-img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--border-soft);
}

/* ================================================================
   MAIN CONTENT
   ================================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    padding-top: calc(var(--topbar-height) + 0.875rem);
    padding-bottom: 1rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    min-height: 100vh;
    transition: margin-left var(--transition-slow);
    background: var(--bg-main);
}

/* ================================================================
   BREADCRUMB
   ================================================================ */
.breadcrumb {
    font-size: 0.75rem;
    margin-bottom: 0;
}

.breadcrumb-item a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumb-item a:hover {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.breadcrumb-item.active {
    color: var(--text-secondary);
}

/* ================================================================
   CARDS
   ================================================================ */
.card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xl);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base);
    position: relative;
    overflow: hidden;
}

.card-header {
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    background: transparent;
    border-bottom: 1px solid var(--border-light);
}

.card-body {
    padding: 0.875rem 1rem;
}

/* Stat cards (dashboard) — small metric cards get subtle hover */
.stat-card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    box-shadow: var(--shadow-xs);
    padding: 0.875rem 1rem;
    transition: box-shadow var(--transition-fast);
    cursor: default;
}

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

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.stat-icon.primary { background: rgba(58,91,255,0.08); color: #3A5BFF; }
.stat-icon.success { background: rgba(0,184,148,0.08); color: #00B894; }
.stat-icon.warning { background: rgba(245,158,11,0.08); color: #D97706; }
.stat-icon.info    { background: rgba(6,182,212,0.08); color: #0891B2; }
.stat-icon.danger  { background: rgba(239,68,68,0.08); color: #DC2626; }

.stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.15;
    letter-spacing: -0.025em;
}

.stat-label {
    font-size: 0.675rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
    opacity: 0.85;
}

/* ================================================================
   TABLES
   ================================================================ */
.table {
    font-size: 0.8rem;
    margin-bottom: 0;
    --bs-table-bg: transparent;
}

.table > thead {
    border-bottom: 2px solid var(--border-soft);
}

.table > thead > tr > th {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 0.5625rem 0.75rem;
    background: linear-gradient(180deg, rgba(58,91,255,0.03) 0%, rgba(58,91,255,0.01) 100%);
    border-bottom: none;
    white-space: nowrap;
}

[data-bs-theme="dark"] .table > thead > tr > th {
    background: rgba(58,91,255,0.06);
}

.table > tbody > tr > td {
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.table > tbody > tr:last-child > td {
    border-bottom: none;
}

.table > tbody > tr {
    transition: background var(--transition-fast);
}

.table-hover > tbody > tr:hover > td {
    background: rgba(58, 91, 255, 0.04) !important;
}

.table-responsive {
    border-radius: var(--radius-md);
    overflow-x: auto;
    overflow-y: visible;
}

/* ================================================================
   BADGES
   ================================================================ */
.badge {
    font-size: 0.675rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    padding: 0.28rem 0.62rem;
    border-radius: 6px;
}

/* Soft badge overrides — pill style with tinted backgrounds */
.badge.bg-primary {
    background: rgba(58, 91, 255, 0.12) !important;
    color: #2D4ADB !important;
}
.badge.bg-success {
    background: rgba(0, 184, 148, 0.12) !important;
    color: #009B7D !important;
}
.badge.bg-danger {
    background: rgba(239, 68, 68, 0.12) !important;
    color: #C53030 !important;
}
.badge.bg-warning {
    background: rgba(245, 158, 11, 0.12) !important;
    color: #B45309 !important;
}
.badge.bg-info {
    background: rgba(6, 182, 212, 0.12) !important;
    color: #0E7490 !important;
}
.badge.bg-secondary {
    background: rgba(100, 116, 139, 0.12) !important;
    color: #475569 !important;
}

[data-bs-theme="dark"] .badge.bg-primary { background: rgba(58, 91, 255, 0.20) !important; color: #7C9AFF !important; }
[data-bs-theme="dark"] .badge.bg-success { background: rgba(0, 184, 148, 0.20) !important; color: #55DFC4 !important; }
[data-bs-theme="dark"] .badge.bg-danger { background: rgba(239, 68, 68, 0.20) !important; color: #FC8181 !important; }
[data-bs-theme="dark"] .badge.bg-warning { background: rgba(245, 158, 11, 0.20) !important; color: #FBBF24 !important; }
[data-bs-theme="dark"] .badge.bg-info { background: rgba(6, 182, 212, 0.20) !important; color: #67E8F9 !important; }
[data-bs-theme="dark"] .badge.bg-secondary { background: rgba(100, 116, 139, 0.20) !important; color: #94A3B8 !important; }

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
    letter-spacing: -0.005em;
}

.btn-sm {
    font-size: 0.75rem;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-sm);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 2px 6px rgba(58,91,255,0.20);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 2px 8px rgba(58,91,255,0.25);
}

.btn-primary:active {
    box-shadow: 0 1px 3px rgba(58,91,255,0.20);
}

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

.btn-outline-secondary:hover {
    background: rgba(58, 91, 255, 0.04);
    border-color: rgba(58, 91, 255, 0.15);
    color: var(--text-main);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: rgba(58,91,255,0.25);
}

.btn-outline-primary:hover {
    background: var(--primary-soft);
    color: var(--primary-hover);
    border-color: rgba(58,91,255,0.35);
}

.btn-outline-success {
    color: #00B894;
    border-color: rgba(0,184,148,0.25);
}

.btn-outline-success:hover {
    background: rgba(0,184,148,0.06);
    color: #009B7D;
    border-color: rgba(0,184,148,0.35);
}

.btn-outline-warning {
    color: #d97706;
    border-color: rgba(245,158,11,0.25);
}

.btn-outline-warning:hover {
    background: rgba(245,158,11,0.06);
    color: #b45309;
    border-color: rgba(245,158,11,0.35);
}

.btn-success {
    background: var(--secondary);
    border-color: var(--secondary);
    box-shadow: 0 2px 6px rgba(0,184,148,0.20);
}

.btn-success:hover {
    background: #009B7D;
    border-color: #009B7D;
    box-shadow: 0 2px 8px rgba(0,184,148,0.25);
}

/* ================================================================
   FORMS
   ================================================================ */
.form-control,
.form-select {
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
    border-color: var(--border-soft);
    padding: 0.4375rem 0.75rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    color: var(--text-main);
    background: var(--bg-card);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(58,91,255,0.10);
}

.form-control-sm,
.form-select-sm {
    font-size: 0.775rem;
    padding: 0.3125rem 0.625rem;
    border-radius: var(--radius-sm);
    height: calc(1.5em + 0.625rem + 2px);
    min-height: calc(1.5em + 0.625rem + 2px);
}

.form-label {
    font-size: 0.775rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.form-text {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.input-group-text {
    font-size: 0.8rem;
    border-color: var(--border-soft);
    background: var(--bg-main);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
}

.invalid-feedback {
    font-size: 0.725rem;
}

/* ================================================================
   DROPDOWNS
   ================================================================ */
.dropdown-menu {
    font-size: 0.8rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-lg);
    padding: 0.375rem;
    animation: dropdownFade 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-card);
    backdrop-filter: blur(12px);
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown-item {
    border-radius: 6px;
    padding: 0.375rem 0.625rem;
    font-size: 0.8rem;
    transition: background var(--transition-fast);
}

.dropdown-item:hover {
    background: rgba(58, 91, 255, 0.06);
}

.dropdown-divider {
    margin: 0.25rem 0;
    border-color: var(--border-light);
}

.topbar .dropdown-menu {
    z-index: 1041;
    animation: none;
}

/* ===== Action dropdown (table) — hide caret arrow ===== */
.table .dropdown .btn.dropdown-toggle::after,
.table .dropdown .btn-sm.dropdown-toggle::after {
    display: none;
}

/* ================================================================
   BOTTOM NAV (mobile)
   ================================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottomnav-height);
    background: var(--bg-card);
    border-top: 1px solid var(--border-soft);
    z-index: 1030;
    display: none;
    box-shadow: 0 -2px 12px rgba(15,23,42,0.06);
    backdrop-filter: blur(10px);
}

.bottom-nav a {
    font-size: 0.6rem;
    font-weight: 500;
    padding: 0.25rem 0;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.bottom-nav a i {
    font-size: 1.2rem;
    transition: transform var(--transition-fast);
}

.bottom-nav a.text-primary {
    color: var(--primary) !important;
}

.bottom-nav a.text-primary i {
    transform: scale(1.05);
}

/* ================================================================
   SIDEBAR OVERLAY (mobile)
   ================================================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11,17,41,0.55);
    backdrop-filter: blur(4px);
    z-index: 1039;
    transition: opacity var(--transition-base);
}

.sidebar-overlay.show {
    display: block;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 991.98px) {
    body.sidebar-collapsed .sidebar,
    body.sidebar-collapsed .topbar,
    body.sidebar-collapsed .main-content {
        width: auto;
        left: 0;
        margin-left: 0;
    }

    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .topbar {
        left: 0;
    }
    .topbar .locale-dropdown-toggle {
        width: 62px;
        min-width: 62px;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    .main-content {
        margin-left: 0;
        padding-left: 1rem;
        padding-right: 1rem;
        padding-bottom: calc(var(--bottomnav-height) + 1.25rem);
    }
    .bottom-nav {
        display: flex;
    }
}

@media (min-width: 992px) {
    .main-content {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

/* ================================================================
   PAGINATION
   ================================================================ */
.pagination {
    flex-wrap: wrap;
}

.pagination .page-item .page-link {
    font-size: 0.775rem;
    border: 1px solid var(--border-soft);
    color: var(--text-secondary);
    padding: 0.3rem 0.625rem;
    transition: all var(--transition-fast);
    background: var(--bg-card);
    line-height: 1.4;
    margin-left: -1px;
}

.pagination .page-item:first-child .page-link {
    border-top-left-radius: var(--radius-sm);
    border-bottom-left-radius: var(--radius-sm);
    margin-left: 0;
}

.pagination .page-item:last-child .page-link {
    border-top-right-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
}

.pagination .page-item .page-link:hover {
    background: rgba(58,91,255,0.06);
    border-color: rgba(58,91,255,0.2);
    color: var(--primary);
    z-index: 2;
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(58,91,255,0.20);
    z-index: 3;
}

.pagination .page-item.disabled .page-link {
    background: var(--bg-main);
    color: var(--text-muted);
    opacity: 0.6;
    pointer-events: none;
}

[data-bs-theme="dark"] .pagination .page-item .page-link {
    background: var(--bg-card);
    border-color: var(--border-soft);
    color: var(--text-secondary);
}

[data-bs-theme="dark"] .pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* DataTables pagination wrapper */
.dataTables_wrapper .dataTables_paginate {
    margin-top: 1rem;
}

.dataTables_wrapper .dataTables_paginate .pagination {
    margin: 0;
}

/* ================================================================
   CODE / MONO
   ================================================================ */
code {
    font-size: 0.775rem;
    padding: 0.15em 0.4em;
    border-radius: 6px;
    background: rgba(58,91,255,0.06);
    color: var(--primary);
    font-weight: 500;
}

/* ================================================================
   MISC UTILITIES
   ================================================================ */
.section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.section-title i {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2rem;
    opacity: 0.35;
    margin-bottom: 0.5rem;
    display: block;
}

/* Quick action buttons */
.quick-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    background: var(--bg-card);
}

.quick-action:hover {
    background: var(--bg-card-hover);
    border-color: rgba(58,91,255,0.2);
    color: var(--primary);
}

.quick-action i {
    font-size: 0.95rem;
}

/* ================================================================
   HIGHLIGHT CARD (dashboard hero metric)
   ================================================================ */
.highlight-card {
    border-radius: var(--radius-md);
    padding: 1.25rem 1.25rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.highlight-card .highlight-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.85;
    margin-bottom: 0.25rem;
}

.highlight-card .highlight-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.highlight-card .highlight-sub {
    font-size: 0.7rem;
    opacity: 0.75;
    margin-top: 0.375rem;
}

.highlight-card.bg-gradient-success {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}

.highlight-card.bg-gradient-primary {
    background: linear-gradient(135deg, #2D4ADB 0%, #3A5BFF 100%);
}

.highlight-card.bg-gradient-danger {
    background: linear-gradient(135deg, #DC2626 0%, #EF4444 100%);
}

.highlight-card.bg-gradient-warning {
    background: linear-gradient(135deg, #D97706 0%, #F59E0B 100%);
}

/* ================================================================
   LOGIN PAGE
   ================================================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #0B1129 0%, #131D3D 40%, #0E1A35 100%);
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(58,91,255,0.12) 0%, transparent 70%);
    border-radius: 50%;
}

.login-wrapper::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(0,184,148,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.login-card-container {
    max-width: 400px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.login-brand {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-brand-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(58,91,255,0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.login-brand-icon i {
    font-size: 1.375rem;
    color: #7C9AFF;
}

.login-brand h4 {
    color: #ffffff;
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.login-brand p {
    color: #64748b;
    font-size: 0.8rem;
    margin: 0;
}

.login-card {
    background: rgba(22,32,68,0.55);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

.login-card .form-control {
    background: rgba(15,23,42,0.5);
    border-color: rgba(255,255,255,0.08);
    color: #f1f5f9;
}

.login-card .form-control::placeholder {
    color: #64748b;
}

.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(58,91,255,0.15);
    background: rgba(15,23,42,0.7);
}

.login-card .form-label {
    color: #94a3b8;
    font-size: 0.775rem;
}

.login-card .input-group-text {
    background: rgba(15,23,42,0.5);
    border-color: rgba(255,255,255,0.08);
    color: #64748b;
}

.login-card .form-check-label {
    color: #94a3b8;
    font-size: 0.775rem;
}

.login-card .form-check-input {
    border-color: rgba(255,255,255,0.15);
    background-color: transparent;
}

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

.login-card .btn-primary {
    padding: 0.5rem;
    font-weight: 600;
    letter-spacing: -0.005em;
}

/* ================================================================
   SELECT2 OVERRIDES
   ================================================================ */
.select2-container--bootstrap-5 .select2-selection {
    border-color: var(--border-soft) !important;
    border-radius: var(--radius-sm) !important;
    font-size: 0.8125rem !important;
    min-height: 0 !important;
    height: calc(1.5em + 0.875rem + 2px) !important;
    padding: 0.4375rem 0.75rem !important;
    line-height: 1.5 !important;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding: 0 !important;
    line-height: 1.5 !important;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    height: 100% !important;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__clear {
    height: auto !important;
}

select.form-select-sm + .select2-container--bootstrap-5 .select2-selection,
select.form-select-sm + .select2-container .select2-selection {
    box-sizing: border-box !important;
    min-height: 0 !important;
    height: calc(1.5em + 0.625rem + 2px) !important;
    padding: 0.3125rem 0.625rem !important;
    font-size: 0.775rem !important;
}

select.form-select-sm + .select2-container--bootstrap-5,
select.form-select-sm + .select2-container {
    height: calc(1.5em + 0.625rem + 2px) !important;
}

select.form-select-sm + .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered,
select.form-select-sm + .select2-container .select2-selection--single .select2-selection__rendered {
    line-height: 1.5 !important;
}

select.form-select-sm + .select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow,
select.form-select-sm + .select2-container .select2-selection--single .select2-selection__arrow {
    height: 100% !important;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    color: var(--text-main) !important;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(58,91,255,0.10) !important;
}

.select2-dropdown {
    border-radius: var(--radius-md) !important;
    border-color: var(--border-soft) !important;
    box-shadow: var(--shadow-lg) !important;
}

.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    border-radius: 0 !important;
    padding: 0.25rem 0 !important;
}

.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field:focus {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}

/* ================================================================
   FLATPICKR OVERRIDES
   ================================================================ */
.flatpickr-input {
    background: var(--bg-card) !important;
}

/* ================================================================
   SWEETALERT2 OVERRIDES
   ================================================================ */
.swal2-popup {
    font-size: 0.875rem !important;
    border-radius: var(--radius-xl) !important;
}

.swal2-title {
    font-size: 1.1rem !important;
    font-weight: 600 !important;
}

.swal2-confirm {
    border-radius: var(--radius-sm) !important;
}

.swal2-cancel {
    border-radius: var(--radius-sm) !important;
}
/* ================================================================
   DATATABLES OVERRIDES
   ================================================================ */
/* Wrapper & General */
.dataTables_wrapper {
    font-size: 0.8rem;
}

/* Keep action dropdown in DataTables stable (no clipping / glitch) */
.card:has(.dataTables_wrapper) {
    overflow: visible;
}

.card:has(.dataTables_wrapper) .card-body {
    overflow: visible;
}

.card.dt-dropdown-open,
.card.dt-dropdown-open .card-body {
    overflow: visible !important;
}

.dataTables_wrapper .table-responsive {
    overflow-x: auto !important;
    overflow-y: visible !important;
}

.dataTables_wrapper table.dataTable,
.dataTables_wrapper table.dataTable tbody,
.dataTables_wrapper table.dataTable tbody tr,
.dataTables_wrapper table.dataTable tbody td {
    overflow: visible !important;
}

.dataTables_wrapper .dropdown-menu {
    z-index: 1085;
    animation: none;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    font-size: 0.775rem;
    color: var(--text-secondary);
}

/* Length select */
.dataTables_wrapper .dataTables_length select {
    font-size: 0.775rem;
    border-radius: var(--radius-sm);
    border-color: var(--border-soft);
    padding: 0.25rem 1.75rem 0.25rem 0.5rem;
    background-color: var(--bg-card);
    color: var(--text-main);
}

/* Search input */
.dataTables_wrapper .dataTables_filter input {
    font-size: 0.775rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    padding: 0.3rem 0.625rem;
    background-color: var(--bg-card);
    color: var(--text-main);
    margin-left: 0.5rem;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(58,91,255,0.10);
}

/* Info text */
.dataTables_wrapper .dataTables_info {
    padding-top: 0.75rem;
    color: var(--text-muted);
}

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

/* Bootstrap pagination mode (DataTables Bootstrap 5) */
.dataTables_wrapper .dataTables_paginate .pagination .page-item {
    margin-left: 0 !important;
    border: 0 !important;
    background: transparent !important;
}

.dataTables_wrapper .dataTables_paginate .pagination .page-item .page-link {
    margin-left: -1px;
}

.dataTables_wrapper .dataTables_paginate .pagination .page-item:first-child .page-link {
    margin-left: 0;
}

/* Legacy DataTables pagination mode (non-Bootstrap renderer) */
.dataTables_wrapper .dataTables_paginate .paginate_button:not(.page-item) {
    padding: 0.3rem 0.625rem;
    margin-left: 2px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary) !important;
    font-size: 0.775rem;
    transition: all var(--transition-fast);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:not(.page-item):hover {
    background: rgba(58,91,255,0.06) !important;
    border-color: rgba(58,91,255,0.2) !important;
    color: var(--primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:not(.page-item).current {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
    box-shadow: 0 2px 6px rgba(58,91,255,0.20);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:not(.page-item).disabled {
    background: var(--bg-main) !important;
    color: var(--text-muted) !important;
    opacity: 0.6;
    cursor: not-allowed !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:not(.page-item).disabled:hover {
    background: var(--bg-main) !important;
    border-color: var(--border-soft) !important;
    color: var(--text-muted) !important;
}

/* Processing indicator */
.dataTables_wrapper .dataTables_processing {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    color: var(--text-main);
    padding: 1rem 1.5rem;
    font-size: 0.8rem;
}

/* Sorting icons */
table.dataTable thead > tr > th.sorting:before,
table.dataTable thead > tr > th.sorting_asc:before,
table.dataTable thead > tr > th.sorting_desc:before,
table.dataTable thead > tr > th.sorting:after,
table.dataTable thead > tr > th.sorting_asc:after,
table.dataTable thead > tr > th.sorting_desc:after {
    opacity: 0.4;
}

table.dataTable thead > tr > th.sorting_asc:after,
table.dataTable thead > tr > th.sorting_desc:after {
    opacity: 0.8;
    color: var(--primary);
}

/* Responsive */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
    background-color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 4px rgba(58,91,255,0.3);
}

table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th.dtr-control:before {
    background-color: var(--secondary);
    border-color: var(--secondary);
}

/* Dark mode adjustments */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input {
    background-color: var(--bg-card);
    border-color: var(--border-soft);
    color: var(--text-main);
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    background: var(--bg-card);
    border-color: var(--border-soft);
    color: var(--text-secondary) !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}
