/* ===========================
   TrackColis — Premium Design System
   Professional SaaS UI
   =========================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --sidebar-width: 268px;
    --navbar-height: 64px;
    --primary: #E8533F;
    --primary-hover: #d4432f;
    --primary-light: rgba(232,83,63,0.08);
    --primary-lighter: rgba(232,83,63,0.04);
    --primary-gradient: var(--primary);
    --dark: #1a1c2e;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --bg-body: #f4f6fb;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-input: #f9fafb;
    --bg-subtle: #f7f8fb;
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.03);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 32px rgba(0,0,0,0.08);
    --shadow-xl: 0 24px 64px rgba(0,0,0,0.1);
    --shadow-primary: 0 4px 14px rgba(232,83,63,0.25);
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --green: #22c55e;
    --blue: #3b82f6;
    --orange: #f97316;
    --purple: #8b5cf6;
    --teal: #14b8a6;
    --pink: #ec4899;
    --cyan: #06b6d4;
    --red: #ef4444;
    --transition: all 0.2s cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --bg-body: #0c1222;
    --bg-card: #1a2332;
    --bg-sidebar: #141d2b;
    --bg-input: #1e293b;
    --bg-subtle: #131c2a;
    --border-color: #2a3548;
    --border-light: #1e2d3f;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.15);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
    --shadow-lg: 0 10px 32px rgba(0,0,0,0.3);
}
[data-theme="dark"] .login-container { background: var(--bg-body); }
[data-theme="dark"] .login-card { background: var(--bg-card); }

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    margin: 0;
    min-height: 100vh;
    font-size: 0.925rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--primary-hover); }
::selection { background: rgba(232,83,63,0.15); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }

.animate-fadeUp { animation: fadeUp 0.4s ease both; }

/* ===================== SIDEBAR ===================== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
    position: fixed;
    top: 0; left: 0;
    z-index: 1040;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.sidebar-header {
    padding: 22px 22px 18px;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    padding: 6px 8px;
    margin: -6px -8px;
    border-radius: 12px;
    transition: var(--transition);
}
.sidebar-header .logo:hover {
    background: var(--primary-light);
    text-decoration: none;
}
.sidebar-header .logo:hover .logo-icon {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(232,83,63,0.35);
}
.sidebar-header .logo:hover .logo-img {
    transform: scale(1.05);
}
.sidebar-header .logo:hover .logo-text {
    color: var(--primary);
}
.sidebar-header .logo-icon {
    width: 40px; height: 40px;
    background: var(--primary-gradient);
    color: #fff;
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.8rem; letter-spacing: 0.3px;
    box-shadow: 0 4px 14px rgba(232,83,63,0.32), inset 0 1px 0 rgba(255,255,255,0.25);
    transition: var(--transition);
    flex-shrink: 0;
}
.sidebar-header .logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    color: var(--text-primary);
    transition: var(--transition);
    font-weight: 700; font-size: 0.86rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.sidebar-header .logo-text span {
    color: var(--primary);
    font-weight: 800;
    letter-spacing: 4px;
}

.sidebar-nav {
    padding: 12px 14px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
.sidebar-nav .nav-section {
    font-size: 0.67rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-muted);
    padding: 18px 10px 6px;
}
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.85rem; font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
}
.sidebar-nav .nav-link i {
    font-size: 1.1rem; width: 22px;
    text-align: center; flex-shrink: 0;
    transition: var(--transition);
}
.sidebar-nav .nav-link:hover {
    background: var(--primary-light);
    color: var(--primary);
}
.sidebar-nav .nav-link.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    box-shadow: var(--shadow-primary);
}
.sidebar-nav .nav-link.active i { color: #fff; }

.sidebar-footer {
    padding: 18px 20px;
    border-top: 1px solid var(--border-color);
    display: flex; align-items: center; gap: 12px;
}
.sidebar-footer .user-avatar {
    width: 38px; height: 38px; border-radius: 12px;
    background: var(--primary-gradient); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(232,83,63,0.2);
}
.sidebar-footer .user-info { flex: 1; min-width: 0; }
.sidebar-footer .user-name {
    font-weight: 600; font-size: 0.83rem;
    color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-footer .user-role { font-size: 0.72rem; color: var(--text-muted); text-transform: capitalize; }
.sidebar-footer .logout-btn {
    color: var(--text-muted); font-size: 1.1rem;
    transition: var(--transition);
    background: none; border: none; cursor: pointer;
    padding: 6px; border-radius: 8px;
}
.sidebar-footer .logout-btn:hover { color: var(--primary); background: var(--primary-light); }

/* ===================== MAIN CONTENT ===================== */
.main-content { margin-left: var(--sidebar-width); min-height: 100vh; transition: margin-left 0.3s cubic-bezier(.4,0,.2,1); }
.sidebar-collapsed .sidebar { transform: translateX(-100%); }
.sidebar-collapsed .main-content { margin-left: 0; }

/* ===================== TOP NAVBAR ===================== */
.top-navbar {
    background: rgba(255,255,255,0.92);
    border-bottom: 1px solid var(--border-color);
    padding: 0 28px;
    height: var(--navbar-height);
    display: flex; align-items: center; gap: 16px;
    position: sticky; top: 0; z-index: 1030;
    backdrop-filter: blur(12px);
}
[data-theme="dark"] .top-navbar { background: rgba(26,35,50,0.92); }

.top-navbar .page-title {
    font-weight: 700; font-size: 1.08rem;
    color: var(--text-primary); letter-spacing: -0.2px;
}
.top-navbar .search-box {
    position: relative; max-width: 320px; flex: 1; margin-left: 16px;
}
.top-navbar .search-box input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 9px 14px 9px 40px;
    font-size: 0.84rem; width: 100%;
    color: var(--text-primary); transition: var(--transition);
}
.top-navbar .search-box input::placeholder { color: var(--text-muted); }
.top-navbar .search-box input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(232,83,63,0.08);
    background: var(--bg-card);
}
.top-navbar .search-box i {
    position: absolute; left: 13px; top: 50%;
    transform: translateY(-50%); color: var(--text-muted); font-size: 0.9rem;
    line-height: 1; pointer-events: none; margin-left: 10px;
}
.top-navbar .search-box .search-shortcut {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 5px; padding: 2px 7px;
    font-size: 0.68rem; color: var(--text-muted); font-weight: 600;
}

.top-navbar .nav-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.top-navbar .nav-date {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.82rem; color: var(--text-secondary);
    font-weight: 500; padding: 7px 14px;
    background: var(--bg-input); border-radius: 10px;
    border: 1px solid var(--border-light);
}
.top-navbar .nav-icon-btn {
    width: 38px; height: 38px; border-radius: 10px;
    border: none; background: transparent;
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem; transition: var(--transition); cursor: pointer;
    position: relative;
}
.top-navbar .nav-icon-btn:hover { background: var(--bg-input); color: var(--text-primary); }
.top-navbar .nav-icon-btn .badge-dot {
    position: absolute; top: 7px; right: 7px;
    width: 8px; height: 8px;
    background: var(--primary); border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.top-navbar .user-btn {
    display: flex; align-items: center; gap: 8px;
    background: var(--primary-gradient); color: #fff;
    border: none; border-radius: 12px;
    padding: 6px 16px 6px 8px;
    font-size: 0.84rem; font-weight: 600;
    cursor: pointer; transition: var(--transition);
    box-shadow: var(--shadow-primary);
}
.top-navbar .user-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(232,83,63,0.3);
}
.top-navbar .user-btn .avatar {
    width: 30px; height: 30px; border-radius: 8px;
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.78rem;
}

/* ===================== PAGE CONTENT ===================== */
.page-content { padding: 28px; animation: fadeIn 0.3s ease; }

/* ===================== PAGE HEADER ===================== */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 28px; flex-wrap: wrap; gap: 16px;
}
.page-header .ph-left { display: flex; align-items: center; gap: 16px; }
.page-header .ph-icon {
    width: 48px; height: 48px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; flex-shrink: 0;
}
.page-header .ph-title {
    font-size: 1.35rem; font-weight: 700;
    color: var(--text-primary); margin: 0; letter-spacing: -0.3px;
}
.page-header .ph-subtitle { font-size: 0.82rem; color: var(--text-muted); margin: 2px 0 0; }
.page-header .ph-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ===================== PRO CARDS ===================== */
.pro-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-xs);
    transition: var(--transition);
    overflow: hidden;
}
.pro-card:hover { box-shadow: var(--shadow-md); }
.pro-card-title {
    padding: 22px 24px 0; font-size: 1.05rem; font-weight: 700;
    color: var(--text-primary);
}
.pro-card-header {
    padding: 20px 24px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border-light); gap: 12px;
}
.pro-card-header .pch-left { display: flex; align-items: center; gap: 12px; }
.pro-card-header .pch-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
}
.pro-card-header h6 { margin: 0; font-weight: 600; font-size: 0.9rem; color: var(--text-primary); }
.pro-card-header .pch-count { font-size: 0.72rem; color: var(--text-muted); }
.pro-card-body { padding: 24px; }
.pro-card-body.p-0 { padding: 0; }

/* ===================== TABLE SEARCH ===================== */
.tc-search-wrap {
    padding: 14px 24px 0;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.tc-search-wrap .tc-table-search {
    width: 100%; max-width: 350px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px; padding: 8px 14px 8px 40px;
    font-size: 0.84rem; color: var(--text-primary);
    background: var(--bg-card); transition: var(--transition);
    outline: none;
}
.tc-search-wrap .tc-table-search:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(232,83,63,0.08);
}
.tc-search-wrap .tc-table-search::placeholder { color: var(--text-muted); }
.tc-search-wrap .tc-search-icon {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 0.9rem; line-height: 1; pointer-events: none; margin-left: 10px;
}
.tc-search-wrap .tc-search-field { position: relative; flex: 1; max-width: 350px; }
.tc-search-wrap .tc-col-filter {
    border: 1.5px solid var(--border-color);
    border-radius: 10px; padding: 8px 12px;
    font-size: 0.82rem; color: var(--text-primary);
    background: var(--bg-card); transition: var(--transition);
    cursor: pointer;
}
.tc-search-wrap .tc-col-filter:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(232,83,63,0.08);
}

/* ===================== PRO TABLES ===================== */
.pro-table {
    width: 100%; border-collapse: separate; border-spacing: 0;
}
.pro-table thead th {
    font-weight: 600; font-size: 0.7rem;
    text-transform: uppercase; letter-spacing: 0.8px;
    color: #8b93a7; padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    background: transparent; white-space: nowrap;
}
.pro-table tbody td {
    padding: 14px 18px; font-size: 0.84rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(0,0,0,0.04);
    vertical-align: middle; white-space: nowrap;
}
.pro-table tbody tr { transition: background 0.15s; }
.pro-table tbody tr:hover { background: var(--primary-lighter); }
.pro-table tbody tr:last-child td { border-bottom: none; }
.pro-table .cell-bold { font-weight: 600; color: var(--text-primary); }
.pro-table .cell-sub { font-size: 0.72rem; color: #a0aec0; margin-top: 2px; }
.pro-table .cell-muted { color: var(--text-muted); font-size: 0.82rem; }
.pro-table .cell-link {
    font-weight: 600; color: var(--primary);
    text-decoration: none; display: inline-flex;
    align-items: center; gap: 5px;
}
.pro-table .cell-link:hover { text-decoration: underline; }

.cell-user { display: flex; align-items: center; gap: 12px; }
.cell-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.75rem;
    flex-shrink: 0; color: #fff;
}
.cell-avatar-sm {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.65rem;
    flex-shrink: 0; color: #fff;
}

/* ===================== PRO BADGES ===================== */
.badge { font-weight: 600; font-size: 0.72rem; border-radius: 6px; padding: 4px 10px; }
.pro-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.72rem; font-weight: 600;
    padding: 4px 12px; border-radius: 20px;
}
.pro-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.pro-badge-success { background: rgba(34,197,94,0.1); color: #16a34a; }
.pro-badge-success::before { background: #22c55e; }
.pro-badge-warning { background: rgba(249,115,22,0.1); color: #ea580c; }
.pro-badge-warning::before { background: #f97316; }
.pro-badge-danger { background: rgba(239,68,68,0.1); color: #dc2626; }
.pro-badge-danger::before { background: #ef4444; }
.pro-badge-info { background: rgba(59,130,246,0.1); color: #2563eb; }
.pro-badge-info::before { background: #3b82f6; }
.pro-badge-secondary { background: rgba(107,114,128,0.1); color: #6b7280; }
.pro-badge-secondary::before { background: #9ca3af; }
.pro-badge-purple { background: rgba(139,92,246,0.1); color: #7c3aed; }
.pro-badge-purple::before { background: #8b5cf6; }

/* ===================== BUTTONS ===================== */
.btn {
    font-weight: 600; font-size: 0.84rem; border-radius: 10px;
    padding: 9px 18px; transition: var(--transition);
    display: inline-flex; align-items: center; gap: 7px;
}
.btn i { font-size: 1rem; }
.btn-primary {
    background: var(--primary-gradient); border: none; color: #fff;
    box-shadow: 0 2px 8px rgba(232,83,63,0.25);
}
.btn-primary:hover, .btn-primary:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(232,83,63,0.35);
    background: var(--primary-gradient); color: #fff;
}
.btn-outline-primary { color: var(--primary); border: 1.5px solid rgba(232,83,63,0.3); background: transparent; }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: var(--shadow-primary); }

.btn-pro {
    background: var(--primary-gradient); border: none; color: #fff;
    font-weight: 600; padding: 10px 22px; border-radius: 12px;
    box-shadow: var(--shadow-primary);
    display: inline-flex; align-items: center; gap: 8px;
}
.btn-pro:hover, .btn-pro:focus, .btn-pro:active { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(232,83,63,0.35); background: var(--primary-gradient); color: #fff; }

.btn-ghost {
    background: var(--primary-light);
    border: 1px solid rgba(232,83,63,0.12);
    color: var(--primary); font-weight: 600;
    padding: 9px 18px; border-radius: 10px;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-ghost:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; border-radius: 8px; }
.btn-xs { padding: 4px 10px; font-size: 0.72rem; border-radius: 6px; }

/* Action icon buttons (table actions) */
.act-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 10px;
    border: none; cursor: pointer; transition: all 0.2s ease;
    font-size: 0.92rem; text-decoration: none; color: #fff;
}
.act-btn:hover { transform: translateY(-2px); color: #fff; }
.act-btn-view    { background: #3b82f6; box-shadow: 0 2px 8px rgba(59,130,246,0.30); }
.act-btn-view:hover { box-shadow: 0 4px 14px rgba(59,130,246,0.45); background: #2563eb; }
.act-btn-edit    { background: #3b82f6; box-shadow: 0 2px 8px rgba(59,130,246,0.30); }
.act-btn-edit:hover { box-shadow: 0 4px 14px rgba(59,130,246,0.45); background: #2563eb; }
.act-btn-delete  { background: #ef4444; box-shadow: 0 2px 8px rgba(239,68,68,0.30); }
.act-btn-delete:hover { box-shadow: 0 4px 14px rgba(239,68,68,0.45); background: #dc2626; }
.act-btn-toggle  { background: #f59e0b; box-shadow: 0 2px 8px rgba(245,158,11,0.30); }
.act-btn-toggle:hover { box-shadow: 0 4px 14px rgba(245,158,11,0.45); background: #d97706; }
.act-btn-print   { background: #6b7280; box-shadow: 0 2px 8px rgba(107,114,128,0.30); }
.act-btn-print:hover { box-shadow: 0 4px 14px rgba(107,114,128,0.45); background: #4b5563; }
.act-btn-success { background: #22c55e; box-shadow: 0 2px 8px rgba(34,197,94,0.30); }
.act-btn-success:hover { box-shadow: 0 4px 14px rgba(34,197,94,0.45); background: #16a34a; }
.act-btn-info    { background: #8b5cf6; box-shadow: 0 2px 8px rgba(139,92,246,0.30); }
.act-btn-info:hover { box-shadow: 0 4px 14px rgba(139,92,246,0.45); background: #7c3aed; }
.act-btn-danger  { background: #ef4444; box-shadow: 0 2px 8px rgba(239,68,68,0.30); }
.act-btn-danger:hover { box-shadow: 0 4px 14px rgba(239,68,68,0.45); background: #dc2626; }

/* Table layout helpers */
.pro-table th.text-center, .pro-table td.text-center { text-align: center; }
.pro-table td .act-actions { display: flex; align-items: center; gap: 6px; white-space: nowrap; }

/* ===================== STAT CARDS ===================== */
.stat-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); background: var(--bg-card);
    box-shadow: var(--shadow-xs); transition: var(--transition); overflow: hidden;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card .card-body { padding: 22px; }
.stat-card .stat-icon {
    width: 48px; height: 48px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; flex-shrink: 0;
}
.stat-card .stat-label {
    font-size: 0.72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.6px;
    color: var(--text-muted); margin-bottom: 5px;
}
.stat-card .stat-value {
    font-size: 1.6rem; font-weight: 700;
    color: var(--text-primary); line-height: 1.2; letter-spacing: -0.3px;
}

.icon-orange { background: rgba(249,115,22,0.1); color: #f97316; }
.icon-teal { background: rgba(20,184,166,0.1); color: #14b8a6; }
.icon-green { background: rgba(34,197,94,0.1); color: #22c55e; }
.icon-blue { background: rgba(59,130,246,0.1); color: #3b82f6; }
.icon-purple { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.icon-pink { background: rgba(236,72,153,0.1); color: #ec4899; }
.icon-red { background: rgba(232,83,63,0.1); color: var(--primary); }

/* ===================== CARDS ===================== */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); background: var(--bg-card);
    box-shadow: var(--shadow-xs); transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    padding: 18px 24px; font-weight: 600; font-size: 0.9rem;
    display: flex; align-items: center; gap: 10px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.card-header i { font-size: 1rem; color: var(--primary); }
.card-body { padding: 24px; }

/* ===================== TABLES (PROFESSIONAL) ===================== */
.table {
    --bs-table-bg: transparent;
    width: 100%; margin: 0;
    border-collapse: separate; border-spacing: 0;
    color: var(--text-primary);
}

/* Header */
.table thead th {
    position: sticky; top: 0; z-index: 2;
    font-weight: 700; font-size: 0.68rem;
    text-transform: uppercase; letter-spacing: 0.7px;
    color: var(--text-muted);
    background: var(--bg-card);
    border-top: none;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 18px; white-space: nowrap;
    vertical-align: middle;
}
.table thead th:first-child { border-top-left-radius: var(--radius-md); }
.table thead th:last-child  { border-top-right-radius: var(--radius-md); }

/* Body cells */
.table tbody td {
    vertical-align: middle;
    padding: 16px 18px;
    font-size: 0.86rem;
    color: var(--text-primary);
    border-top: none;
    border-bottom: 1px solid var(--border-light);
    background: transparent;
}
.table tbody tr { transition: background-color 0.15s ease; }
.table tbody tr:last-child td { border-bottom: none; }

/* Hover */
.table-hover tbody tr:hover td,
.table tbody tr:hover td { background: var(--primary-lighter); }

/* Numeric / action alignment helpers */
.table td.text-end, .table th.text-end { text-align: right; }
.table td.text-end .btn-group, .table td.text-end .d-flex { justify-content: flex-end; }

/* Compact variant */
.table-sm thead th { padding: 10px 14px; }
.table-sm tbody td { padding: 10px 14px; font-size: 0.82rem; }

/* Rounded, contained scroll area */
.card .card-body.p-0 .table-responsive {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ===== DataTables skin ===== */
.dataTables_wrapper { position: relative; }

/* Toolbar (search + length) placed above the table */
.dataTables_wrapper .filter-bar {
    background: transparent; border: none; box-shadow: none;
    border-bottom: 1px solid var(--border-light);
    border-radius: 0; margin: 0;
    padding: 16px 20px;
    justify-content: space-between;
}

/* Search */
.dataTables_wrapper .dataTables_filter { margin: 0; }
.dataTables_wrapper .dataTables_filter label {
    display: flex; align-items: center; gap: 0; margin: 0;
    font-size: 0.82rem; font-weight: 500; color: var(--text-secondary);
    position: relative;
}
.dataTables_wrapper .dataTables_filter input {
    min-width: 280px; max-width: 380px;
    border: 1.5px solid var(--border-color);
    border-radius: 12px; padding: 11px 16px 11px 42px;
    font-size: 0.86rem; background: var(--bg-input, #fff);
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.dataTables_wrapper .dataTables_filter input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(232,83,63,0.10);
}
.dataTables_wrapper .dataTables_filter label i.bi-search {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 0.9rem; line-height: 1;
    margin: 0 0 0 10px; pointer-events: none; z-index: 1;
}

/* Length menu */
.dataTables_wrapper .dataTables_length { margin: 0; }
.dataTables_wrapper .dataTables_length label {
    display: flex; align-items: center; gap: 8px; margin: 0;
    font-size: 0.82rem; font-weight: 500; color: var(--text-secondary);
}
.dataTables_wrapper .dataTables_length select {
    border: 1.5px solid var(--border-color);
    border-radius: 8px; padding: 7px 30px 7px 12px;
    font-size: 0.82rem; background: var(--bg-input, #fff);
    color: var(--text-primary); cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%238b93a7'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;
}
.dataTables_wrapper .dataTables_length select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(232,83,63,0.10);
}

/* Footer: info + pagination */
.dataTables_wrapper .dataTables_info {
    font-size: 0.8rem; color: var(--text-muted); padding: 0;
}
.dataTables_wrapper .dataTables_paginate { margin: 0; }
.dataTables_wrapper .dt-footer { border-top: 1px solid var(--border-light); }
.dataTables_wrapper .dataTables_paginate .pagination { margin: 0; gap: 4px; }
.dataTables_wrapper .pagination .page-link {
    border: 1px solid var(--border-color);
    border-radius: 8px !important;
    color: var(--text-secondary);
    font-size: 0.82rem; font-weight: 600;
    min-width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 8px; margin: 0;
    background: var(--bg-card);
    transition: all 0.15s ease;
}
.dataTables_wrapper .pagination .page-link:hover {
    background: var(--primary-lighter); border-color: var(--primary);
    color: var(--primary); z-index: 1;
}
.dataTables_wrapper .pagination .page-item.active .page-link {
    background: var(--primary-gradient, var(--primary));
    border-color: var(--primary); color: #fff;
    box-shadow: 0 3px 10px rgba(232,83,63,0.25);
}
.dataTables_wrapper .pagination .page-item.disabled .page-link {
    opacity: 0.45; cursor: not-allowed;
    background: var(--bg-card); border-color: var(--border-light); color: var(--text-muted);
}

/* Sorting indicators */
.table thead th.sorting,
.table thead th.sorting_asc,
.table thead th.sorting_desc { cursor: pointer; padding-right: 30px; position: relative; }
.table thead th.sorting::after,
.table thead th.sorting_asc::after,
.table thead th.sorting_desc::after {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    font-family: "bootstrap-icons"; font-size: 0.7rem; opacity: 0.35;
}
.table thead th.sorting::after { content: "\f575"; }
.table thead th.sorting_asc::after { content: "\f57b"; opacity: 1; color: var(--primary); }
.table thead th.sorting_desc::after { content: "\f574"; opacity: 1; color: var(--primary); }
.table thead th.sorting_asc, .table thead th.sorting_desc { color: var(--text-primary); }

/* Empty / loading cells */
.table td.loading, .table td.dataTables_empty {
    text-align: center; padding: 40px 16px !important;
    color: var(--text-muted); font-size: 0.9rem;
}
.table td.loading i { font-size: 1.4rem; animation: spin 1s linear infinite; display: inline-block; }

/* Dark mode adjustments */
[data-theme="dark"] .table thead th { background: var(--bg-card); }
[data-theme="dark"] .dataTables_wrapper .pagination .page-link { background: var(--bg-card); }

/* ===================== DETAIL VIEW ===================== */
.detail-hero {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
    padding: 32px; display: flex; align-items: center; gap: 24px;
    flex-wrap: wrap; justify-content: space-between;
}
.detail-hero-left { display: flex; align-items: center; gap: 20px; }
.detail-hero-avatar {
    width: 72px; height: 72px; border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.5rem; color: #fff;
    flex-shrink: 0;
}
.detail-hero-info h3 { font-size: 1.4rem; font-weight: 700; margin: 0 0 4px; color: var(--text-primary); }
.detail-hero-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 6px; }
.detail-hero-meta span {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.8rem; color: var(--text-muted);
}
.detail-hero-meta span i { font-size: 0.85rem; }
.detail-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.detail-stat {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
    padding: 20px; display: flex; align-items: center; gap: 16px;
    transition: var(--transition);
}
.detail-stat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.detail-stat-icon {
    width: 48px; height: 48px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
}
.detail-stat-text .ds-value {
    font-size: 1.5rem; font-weight: 700; color: var(--text-primary); line-height: 1.2;
}
.detail-stat-text .ds-label {
    font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--text-muted); margin-top: 2px;
}

.detail-info-row {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 14px 0; border-bottom: 1px solid var(--border-light);
}
.detail-info-row:last-child { border-bottom: none; }
.detail-info-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; flex-shrink: 0;
    background: var(--primary-lighter); color: var(--primary);
}
.detail-info-content { flex: 1; }
.detail-info-content .di-label {
    font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 2px;
}
.detail-info-content .di-value {
    font-size: 0.88rem; font-weight: 500; color: var(--text-primary);
}
.detail-info-content .di-value code {
    background: var(--primary-lighter); color: var(--primary);
    padding: 2px 8px; border-radius: 6px; font-size: 0.8rem; font-weight: 600;
}

.detail-sub-card {
    background: linear-gradient(135deg, rgba(232,83,63,0.04), rgba(232,83,63,0.01));
    border: 1px dashed rgba(232,83,63,0.2); border-radius: var(--radius-lg);
    padding: 20px; text-align: center;
}
.detail-sub-card .sub-dates {
    display: flex; justify-content: center; gap: 32px; margin-top: 12px;
}
.detail-sub-card .sub-date-item small { display: block; font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }
.detail-sub-card .sub-date-item span { font-size: 0.88rem; font-weight: 600; color: var(--text-primary); }

/* ===================== LOGIN PAGE ===================== */
.login-container {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: #f4f6fb;
    position: relative; overflow: hidden;
}

.login-card {
    width: 100%; max-width: 440px;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl); background: #fff;
    padding: 44px 40px; position: relative; z-index: 1;
    animation: fadeUp 0.5s ease;
    border: 1px solid rgba(255,255,255,0.8);
}
.login-card .login-logo {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; margin-bottom: 8px;
}
.login-card .login-logo .logo-icon {
    width: 44px; height: 44px;
    background: var(--primary-gradient); color: #fff;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.2rem;
    box-shadow: 0 4px 14px rgba(232,83,63,0.3);
}
.login-card .login-logo .logo-text {
    font-size: 1.6rem; font-weight: 800;
    color: var(--primary); letter-spacing: -0.5px;
}
.login-card .login-subtitle {
    text-align: center; color: var(--text-secondary);
    font-size: 0.88rem; margin-bottom: 32px;
}
.login-card .form-label {
    font-weight: 600; font-size: 0.82rem;
    color: var(--text-primary);
    display: flex; align-items: center; gap: 6px;
}
.login-card .form-control {
    border-radius: 10px; padding: 11px 16px;
    border: 1.5px solid var(--border-color);
    font-size: 0.88rem; background: var(--bg-input);
}
.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(232,83,63,0.08);
    background: #fff;
}
.login-card .btn-login {
    background: var(--primary-gradient); border: none; color: #fff;
    font-weight: 700; padding: 13px; border-radius: 12px;
    width: 100%; font-size: 0.95rem;
    box-shadow: var(--shadow-primary);
}
.login-card .btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(232,83,63,0.35);
}
.login-card .forgot-link { text-align: right; margin-bottom: 20px; }
.login-card .forgot-link a { font-size: 0.82rem; color: var(--primary); font-weight: 600; }
.login-card .divider {
    display: flex; align-items: center; gap: 14px;
    margin: 28px 0; color: var(--text-muted);
    font-size: 0.8rem; font-weight: 500;
}
.login-card .divider::before, .login-card .divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border-color);
}
.login-card .social-btns { display: flex; gap: 12px; margin-bottom: 24px; }
.login-card .social-btns .btn-social {
    flex: 1; display: flex; align-items: center; justify-content: center;
    gap: 8px; padding: 11px; border-radius: 10px;
    font-weight: 600; font-size: 0.84rem; cursor: pointer; transition: var(--transition);
}
.login-card .btn-google { border: 1.5px solid var(--border-color); background: #fff; color: var(--text-primary); }
.login-card .btn-google:hover { background: #f8f9fa; }
.login-card .btn-apple { border: none; background: #111; color: #fff; }
.login-card .btn-apple:hover { background: #222; }
.login-card .login-footer { text-align: center; font-size: 0.84rem; color: var(--text-secondary); }
.login-card .login-footer a { color: var(--primary); font-weight: 700; }

/* ===================== FORMS ===================== */
.form-label {
    font-size: 0.8rem; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 6px;
}
.form-control, .form-select {
    border: 1.5px solid var(--border-color);
    border-radius: 10px; padding: 10px 14px;
    font-size: 0.86rem; color: var(--text-primary);
    background: var(--bg-card); transition: var(--transition);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(232,83,63,0.08);
}
.form-section {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 28px; margin-bottom: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs); transition: var(--transition);
}
.form-section:hover { box-shadow: var(--shadow-sm); border-color: rgba(232,83,63,0.12); }
.form-section h6 {
    color: var(--primary); font-weight: 600; font-size: 0.9rem;
    margin-bottom: 20px; padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; gap: 8px;
}
.form-section h6 i { font-size: 1.05rem; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-label { font-size: 0.84rem; color: var(--text-secondary); }

.detail-section-title {
    font-size: 0.85rem; font-weight: 600;
    display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.detail-row {
    display: flex; justify-content: space-between;
    padding: 8px 0; font-size: 0.84rem;
    border-bottom: 1px solid var(--border-light);
}
.detail-row:last-child { border-bottom: none; }
.detail-row .label { color: var(--text-muted); }
.detail-row .value { font-weight: 600; color: var(--text-primary); }

/* ===================== FILTER BAR ===================== */
.filter-bar {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 18px 22px;
    margin-bottom: 20px;
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    box-shadow: var(--shadow-xs);
}
.filter-bar .form-control, .filter-bar .form-select {
    max-width: 200px; font-size: 0.82rem; padding: 8px 12px;
}
.filter-bar .btn { padding: 8px 16px; font-size: 0.82rem; }

/* ===================== EMPTY STATE ===================== */
.empty-state { padding: 60px 24px; text-align: center; }
.empty-state .empty-icon {
    width: 72px; height: 72px; border-radius: 20px;
    background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; margin: 0 auto 18px;
}
.empty-state h6 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.empty-state p { color: var(--text-muted); font-size: 0.88rem; margin: 0; }

/* ===================== ALERTS ===================== */
.alert {
    border-radius: var(--radius-md); font-size: 0.86rem;
    font-weight: 500; padding: 14px 20px; border: none;
    display: flex; align-items: center; gap: 8px;
}

/* ===================== PAGINATION ===================== */
.pagination { gap: 4px; }
.pagination .page-link {
    border: 1px solid var(--border-color); color: var(--text-secondary);
    font-weight: 600; font-size: 0.8rem;
    border-radius: 8px !important; padding: 6px 12px;
}
.pagination .page-link:hover { background: var(--primary-light); color: var(--primary); }
.pagination .page-item.active .page-link {
    background: var(--primary); border-color: var(--primary);
    box-shadow: var(--shadow-primary);
}

/* ===================== MODAL ===================== */
.modal-content {
    border: none; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl); background: var(--bg-card);
}
.modal-header { border-bottom: 1px solid var(--border-light); padding: 20px 24px; }
.modal-title { font-weight: 700; font-size: 1rem; }
.modal-body { padding: 24px; }
.modal-footer { border-top: 1px solid var(--border-light); padding: 16px 24px; }

/* ===================== SCAN AREA ===================== */
.scan-area {
    border: 3px dashed var(--border-color); border-radius: var(--radius-lg);
    padding: 48px; text-align: center; background: var(--bg-input);
    transition: var(--transition);
}
.scan-area.scanning { border-color: var(--primary); background: var(--primary-light); }

.parcel-label {
    border: 2px solid #000; padding: 15px;
    max-width: 400px; font-family: monospace;
}
.parcel-label .tracking-code { font-size: 1.5rem; font-weight: bold; letter-spacing: 2px; }

.mini-stat { display: flex; align-items: center; gap: 8px; }
.mini-stat .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ===================== REPORT STYLES ===================== */
.report-filter {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 20px 24px;
    margin-bottom: 20px; box-shadow: var(--shadow-xs);
}
.report-stat {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 20px; border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs); position: relative; overflow: hidden;
    transition: var(--transition);
}
.report-stat:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.report-stat::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.report-stat .rs-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.3px; }
.report-stat .rs-label {
    font-size: 0.75rem; font-weight: 500; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.report-table {
    background: var(--bg-card); border-radius: var(--radius-lg);
    border: 1px solid var(--border-color); overflow: hidden; box-shadow: var(--shadow-xs);
}

/* ===================== PRINT ===================== */
@media print {
    .sidebar, .top-navbar, .btn, .no-print, .filter-bar { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 992px) {
    .page-header { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar-open .sidebar { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .top-navbar .search-box, .top-navbar .nav-date { display: none; }
    .page-content { padding: 16px; }
    .top-navbar { padding: 0 16px; }
    .pro-card-body { padding: 18px; }
    .form-section { padding: 20px; }
}
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 1035;
    backdrop-filter: blur(4px);
}
.sidebar-open .sidebar-overlay { display: block; }

/* ===================== TOAST NOTIFICATIONS ===================== */
.tc-toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 10px;
    pointer-events: none; max-width: 400px;
}
.tc-toast {
    pointer-events: auto;
    display: flex; align-items: flex-start; gap: 12px;
    background: var(--bg-card); border-radius: var(--radius-md);
    padding: 16px 20px; border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    animation: toastSlideIn 0.35s cubic-bezier(.4,0,.2,1);
    position: relative; overflow: hidden;
}
.tc-toast::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0;
    width: 4px; border-radius: 4px 0 0 4px;
}
.tc-toast.toast-success::before { background: var(--green); }
.tc-toast.toast-danger::before { background: var(--red); }
.tc-toast.toast-warning::before { background: var(--orange); }
.tc-toast.toast-info::before { background: var(--blue); }

.tc-toast-icon {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.tc-toast.toast-success .tc-toast-icon { background: rgba(34,197,94,.1); color: var(--green); }
.tc-toast.toast-danger .tc-toast-icon { background: rgba(239,68,68,.1); color: var(--red); }
.tc-toast.toast-warning .tc-toast-icon { background: rgba(249,115,22,.1); color: var(--orange); }
.tc-toast.toast-info .tc-toast-icon { background: rgba(59,130,246,.1); color: var(--blue); }

.tc-toast-body { flex: 1; min-width: 0; }
.tc-toast-title { font-weight: 700; font-size: 0.88rem; color: var(--text-primary); margin-bottom: 2px; }
.tc-toast-msg { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.4; }
.tc-toast-close {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    padding: 0; font-size: 1rem; line-height: 1; flex-shrink: 0;
    transition: color .15s;
}
.tc-toast-close:hover { color: var(--text-primary); }

.tc-toast-progress {
    position: absolute; bottom: 0; left: 0; height: 3px;
    border-radius: 0 0 0 4px; animation: toastProgress linear forwards;
}
.tc-toast.toast-success .tc-toast-progress { background: var(--green); }
.tc-toast.toast-danger .tc-toast-progress { background: var(--red); }
.tc-toast.toast-warning .tc-toast-progress { background: var(--orange); }
.tc-toast.toast-info .tc-toast-progress { background: var(--blue); }

.tc-toast.removing { animation: toastSlideOut 0.3s ease forwards; }

@keyframes toastSlideIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastSlideOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px) scale(0.95); } }
@keyframes toastProgress { from { width: 100%; } to { width: 0%; } }

/* ===================== DIALOG / CONFIRM MODAL ===================== */
.tc-dialog-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.2s ease;
}
.tc-dialog {
    background: var(--bg-card); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%; max-width: 420px; padding: 0;
    animation: scaleIn 0.25s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}
.tc-dialog-header {
    padding: 24px 24px 0; display: flex; align-items: flex-start; gap: 14px;
}
.tc-dialog-icon {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.tc-dialog-icon.dlg-danger { background: rgba(239,68,68,.1); color: var(--red); }
.tc-dialog-icon.dlg-warning { background: rgba(249,115,22,.1); color: var(--orange); }
.tc-dialog-icon.dlg-info { background: rgba(59,130,246,.1); color: var(--blue); }
.tc-dialog-icon.dlg-success { background: rgba(34,197,94,.1); color: var(--green); }

.tc-dialog-text h6 { font-weight: 700; font-size: 1rem; color: var(--text-primary); margin: 0 0 6px; }
.tc-dialog-text p { font-size: 0.85rem; color: var(--text-secondary); margin: 0; line-height: 1.5; }

.tc-dialog-body { padding: 20px 24px; }
.tc-dialog-input {
    width: 100%; border-radius: var(--radius-sm); border: 1.5px solid var(--border-color);
    padding: 10px 14px; font-size: 0.88rem; outline: none; transition: border-color .2s;
    background: var(--bg-input); color: var(--text-primary);
}
.tc-dialog-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(232,83,63,.08); }

.tc-dialog-footer {
    padding: 16px 24px 24px; display: flex; gap: 10px; justify-content: flex-end;
}
.tc-dialog-btn {
    padding: 9px 20px; border-radius: var(--radius-sm); font-size: 0.85rem;
    font-weight: 600; border: none; cursor: pointer; transition: all .15s;
}
.tc-dialog-btn.btn-cancel {
    background: var(--bg-input); color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.tc-dialog-btn.btn-cancel:hover { background: var(--border-color); }
.tc-dialog-btn.btn-confirm { background: var(--primary); color: white; }
.tc-dialog-btn.btn-confirm:hover { background: var(--primary-hover); }
.tc-dialog-btn.btn-danger { background: var(--red); color: white; }
.tc-dialog-btn.btn-danger:hover { background: #dc2626; }

/* ===================== NOTIFICATION PANEL ===================== */
.tc-notif-panel {
    position: fixed; top: 0; right: -380px; bottom: 0; width: 380px;
    background: var(--bg-card); z-index: 9998;
    box-shadow: var(--shadow-xl); transition: right .3s cubic-bezier(.4,0,.2,1);
    display: flex; flex-direction: column;
}
.tc-notif-panel.open { right: 0; }
.tc-notif-backdrop {
    position: fixed; inset: 0; z-index: 9997;
    background: rgba(0,0,0,.3); display: none;
}
.tc-notif-backdrop.open { display: block; }

.tc-notif-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
}
.tc-notif-header h6 { font-weight: 700; font-size: 1rem; margin: 0; display: flex; align-items: center; gap: 8px; }
.tc-notif-header h6 .notif-count {
    background: var(--primary); color: white; font-size: 0.65rem;
    padding: 2px 8px; border-radius: 10px; font-weight: 700;
}
.tc-notif-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 1.2rem; cursor: pointer; padding: 4px;
}
.tc-notif-close:hover { color: var(--text-primary); }
.tc-notif-readall {
    background: none; border: none; color: var(--text-muted);
    font-size: 1.1rem; cursor: pointer; padding: 4px;
}
.tc-notif-readall:hover { color: var(--primary); }
.tc-notif-footer {
    padding: 10px 16px; text-align: center; border-top: 1px solid var(--border-color);
}
.tc-notif-footer a {
    font-size: 0.8rem; font-weight: 600; color: var(--primary); text-decoration: none;
}
.tc-notif-footer a:hover { text-decoration: underline; }

.tc-notif-tabs { display: flex; border-bottom: 1px solid var(--border-color); }
.tc-notif-tab {
    flex: 1; padding: 10px; text-align: center; font-size: 0.78rem;
    font-weight: 600; color: var(--text-muted); cursor: pointer;
    border-bottom: 2px solid transparent; transition: all .15s;
    background: none; border-top: none; border-left: none; border-right: none;
}
.tc-notif-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.tc-notif-list { flex: 1; overflow-y: auto; }
.tc-notif-item {
    display: flex; gap: 12px; padding: 14px 24px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer; transition: background .15s;
}
.tc-notif-item:hover { background: var(--primary-lighter); }
.tc-notif-item.unread { background: var(--primary-lighter); }
.tc-notif-item.unread::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: var(--primary); flex-shrink: 0; margin-top: 6px;
}

.tc-notif-item-icon {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 0.9rem;
}
.tc-notif-item-icon.ni-parcel { background: rgba(59,130,246,.1); color: var(--blue); }
.tc-notif-item-icon.ni-manifest { background: rgba(139,92,246,.1); color: var(--purple); }
.tc-notif-item-icon.ni-payment { background: rgba(34,197,94,.1); color: var(--green); }
.tc-notif-item-icon.ni-alert { background: rgba(239,68,68,.1); color: var(--red); }
.tc-notif-item-icon.ni-system { background: rgba(107,114,128,.1); color: var(--text-secondary); }

.tc-notif-item-body { flex: 1; min-width: 0; }
.tc-notif-item-title { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.tc-notif-item-text { font-size: 0.76rem; color: var(--text-muted); line-height: 1.4; }
.tc-notif-item-time { font-size: 0.68rem; color: var(--text-muted); margin-top: 4px; }

.tc-notif-empty {
    text-align: center; padding: 48px 24px; color: var(--text-muted);
}
.tc-notif-empty i { font-size: 2rem; margin-bottom: 8px; display: block; opacity: .4; }
.tc-notif-empty span { font-size: 0.85rem; }

/* ===================== LEGACY COMPATIBILITY ===================== */
/* Keep existing PHP/JS templates functional while using TrackColis design tokens. */

/* Common legacy vars */
:root {
    --accent: var(--primary);
    --border: var(--border-color);
    --text: var(--text-primary);
}

.text-accent { color: var(--primary) !important; }
.fw-800 { font-weight: 800 !important; }

/* Legacy page headers */
.page-header-left h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}
.page-header-left p {
    margin: 4px 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Legacy accent buttons */
.btn-accent,
.btn.btn-accent {
    background: var(--primary-gradient);
    border: none;
    color: #fff;
    box-shadow: var(--shadow-primary);
}
.btn-accent:hover,
.btn-accent:focus,
.btn.btn-accent:hover,
.btn.btn-accent:focus {
    color: #fff;
    background: var(--primary-gradient);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(232,83,63,0.3);
}

.btn-outline-accent,
.btn.btn-outline-accent {
    color: var(--primary);
    border: 1.5px solid rgba(232,83,63,0.3);
    background: transparent;
}
.btn-outline-accent:hover,
.btn-outline-accent:focus,
.btn.btn-outline-accent:hover,
.btn.btn-outline-accent:focus {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: var(--shadow-primary);
}

/* Legacy KPI cards emitted by JS */
.kpi-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-xs);
    transition: var(--transition);
    padding: 20px;
    height: 100%;
}
.kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}
.kpi-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}
.kpi-icon-wrap.orange { background: rgba(249,115,22,0.1); color: #f97316; }
.kpi-icon-wrap.blue { background: rgba(59,130,246,0.1); color: #3b82f6; }
.kpi-icon-wrap.green { background: rgba(34,197,94,0.1); color: #22c55e; }
.kpi-icon-wrap.purple { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.kpi-icon-wrap.red { background: rgba(239,68,68,0.1); color: #ef4444; }

.kpi-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(107,114,128,0.12);
    color: #6b7280;
}
.kpi-badge.badge-blue { background: rgba(59,130,246,0.1); color: #2563eb; }
.kpi-badge.badge-green { background: rgba(34,197,94,0.1); color: #16a34a; }
.kpi-badge.badge-red { background: rgba(239,68,68,0.1); color: #dc2626; }
.kpi-badge.badge-orange { background: rgba(249,115,22,0.1); color: #ea580c; }

.kpi-value {
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}
.kpi-label {
    margin-top: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
}
.kpi-sub {
    margin-top: 2px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Legacy stock status badges */
.badge-stock-ok {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(34,197,94,0.1);
    color: #16a34a;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
}
.badge-stock-low {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(249,115,22,0.1);
    color: #ea580c;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
}
.badge-stock-critical {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(239,68,68,0.1);
    color: #dc2626;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
}

/* Legacy helpers */
.chart-wrapper {
    position: relative;
    width: 100%;
    min-height: 260px;
}
.loading {
    padding: 22px !important;
    text-align: center;
    color: var(--text-muted) !important;
    font-size: 0.84rem;
}
.loading i {
    margin-right: 8px;
}
.section-title {
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--text-primary);
}
.divider {
    border-color: var(--border-light) !important;
}

/* Sales item rows */
.item-row {
    padding: 10px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
}
.item-total {
    border-color: var(--border-color) !important;
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
}

/* Login page legacy markup */
.login-page,
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-body);
}
.login-page .login-card {
    padding: 40px 38px;
}
/* Override TrackColis .login-card .login-logo flex row -> vertical stack */
.login-page .login-logo,
.login-card .login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0;
    margin-bottom: 30px;
}
.login-logo-icon {
    width: 56px;
    height: 56px;
    background: var(--primary-gradient);
    color: #fff;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.3px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-primary), inset 0 1px 0 rgba(255,255,255,0.25);
}
.login-logo h2 {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 1.25rem;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: none;
    color: var(--text-primary);
}
.login-logo h2 span {
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: 0.4px;
}
.login-logo p {
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.login-field { margin-bottom: 18px; }
.login-field-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.login-field-label i { color: var(--text-muted); }
.login-input-wrap { position: relative; }
.login-input {
    width: 100%;
    border-radius: 10px;
    padding: 12px 15px;
    border: 1.5px solid var(--border-color);
    font-size: 0.9rem;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: var(--transition);
}
.login-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(232,83,63,0.08);
    background: var(--bg-card);
}
.toggle-pwd {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
}
.toggle-pwd:hover { color: var(--primary); }
.login-btn {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 13px;
    margin-top: 4px;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    background: var(--primary);
    box-shadow: var(--shadow-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    cursor: pointer;
}
.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(232,83,63,0.35);
}
.login-demo {
    margin-top: 26px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    line-height: 1.7;
}
.login-demo strong { color: var(--text-primary); }
.login-demo code {
    background: rgba(17,24,39,0.06);
    color: var(--text-primary);
    padding: 1px 6px;
    border-radius: 5px;
    font-size: 0.76rem;
    font-weight: 600;
}
.login-footer {
    margin-top: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.login-footer strong {
    color: var(--text-secondary);
    font-weight: 700;
}

/* Alerts offcanvas content from app.js */
.alert-stock {
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    gap: 10px;
}
.alert-stock.critical {
    background: rgba(239,68,68,0.06);
    border-color: rgba(239,68,68,0.25);
}
.alert-stock .alert-text h6 {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
}
.alert-stock .alert-text p {
    margin: 3px 0 0;
    font-size: 0.76rem;
    color: var(--text-secondary);
}

/* ===================== TABLE ROW ELEMENTS (from JS) ===================== */
/* Entity avatar (round initials) */
.entity-avatar {
    width: 42px; height: 42px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.82rem; color: #fff;
    flex-shrink: 0; letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* Actions container aligned right */
.gap-actions {
    display: flex; align-items: center; gap: 8px;
    justify-content: flex-end;
}

/* Colored square action buttons */
.btn-action {
    width: 38px; height: 38px; border-radius: 11px;
    border: none; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1rem; color: #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    flex-shrink: 0; padding: 0; line-height: 1;
}
.btn-action:hover { transform: translateY(-2px); color: #fff; filter: brightness(1.05); }
.btn-action:active { transform: translateY(0); }
.btn-action.view   { background: #8b5cf6; box-shadow: 0 3px 10px rgba(139,92,246,0.30); }
.btn-action.view:hover { box-shadow: 0 5px 16px rgba(139,92,246,0.42); }
.btn-action.edit   { background: #3b82f6; box-shadow: 0 3px 10px rgba(59,130,246,0.30); }
.btn-action.edit:hover { box-shadow: 0 5px 16px rgba(59,130,246,0.42); }
.btn-action.pay    { background: #f59e0b; box-shadow: 0 3px 10px rgba(245,158,11,0.30); }
.btn-action.pay:hover { box-shadow: 0 5px 16px rgba(245,158,11,0.42); }
.btn-action.delete { background: #ef4444; box-shadow: 0 3px 10px rgba(239,68,68,0.30); }
.btn-action.delete:hover { box-shadow: 0 5px 16px rgba(239,68,68,0.42); }
.btn-action.success { background: #22c55e; box-shadow: 0 3px 10px rgba(34,197,94,0.30); }
.btn-action.info    { background: #06b6d4; box-shadow: 0 3px 10px rgba(6,182,212,0.30); }
.btn-action.print   { background: #6b7280; box-shadow: 0 3px 10px rgba(107,114,128,0.30); }

/* Status pill badges (dot + label) */
.status-badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.74rem; font-weight: 600;
    padding: 5px 12px; border-radius: 999px;
    white-space: nowrap; line-height: 1;
}
.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.status-paye,
.status-livree,
.status-termine   { background: rgba(34,197,94,0.12); color: #16a34a; }
.status-partiel,
.status-chargee,
.status-en_cours  { background: rgba(59,130,246,0.12); color: #2563eb; }
.status-en_attente,
.status-a_preparer,
.status-en_cure   { background: rgba(249,115,22,0.12); color: #ea580c; }
.status-annule    { background: rgba(239,68,68,0.12); color: #dc2626; }

/* ===================== PERMISSIONS TABLE ================= */
#permTable thead th {
    background: var(--bg-subtle); font-weight: 600; white-space: nowrap;
    font-size: .75rem; letter-spacing: .04em; text-transform: uppercase;
    color: var(--text-muted); padding: 8px 12px;
}
#permTable tbody td { padding: 8px 12px; vertical-align: middle; }
#permTable tbody tr:hover { background: var(--primary-lighter); }
#permTable .form-check-input { width: 1.1rem; height: 1.1rem; cursor: pointer; }
#permTable .form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* ===================== THEME SWATCHES ===================== */
.theme-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-swatch {
    width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
    border: 3px solid transparent; position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.theme-swatch:hover { transform: scale(1.15); }
.theme-swatch.active {
    border-color: #fff;
    box-shadow: 0 0 0 2.5px rgba(0,0,0,0.35), 0 3px 10px rgba(0,0,0,0.22);
}
.theme-swatch i { color: #fff; font-size: 1.05rem; opacity: 0; transition: opacity 0.15s; }
.theme-swatch.active i { opacity: 1; }

/* ===================== LOGO UPLOAD ===================== */
.logo-upload-zone {
    border: 2px dashed var(--border-color); border-radius: var(--radius-md);
    padding: 28px 20px; text-align: center; cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.logo-upload-zone:hover { border-color: var(--primary); background: var(--primary-lighter); }
.logo-preview-img { max-height: 90px; max-width: 200px; object-fit: contain; }

/* Logo image dans sidebar et documents */
.logo-icon-img { background: transparent !important; padding: 2px; box-shadow: none !important; }
.logo-icon-img img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; }
.inv-brand-logo-img { width: 52px; height: 52px; border-radius: 14px; object-fit: contain; flex-shrink: 0; }

/* Quotation status badges */
.status-quote-brouillon { background: rgba(107,114,128,0.12); color: #6b7280; }
.status-quote-envoyee   { background: rgba(59,130,246,0.12);  color: #2563eb; }
.status-quote-acceptee  { background: rgba(34,197,94,0.12);   color: #16a34a; }
.status-quote-refusee   { background: rgba(239,68,68,0.12);   color: #dc2626; }
.status-quote-expiree   { background: rgba(249,115,22,0.12);  color: #ea580c; }

/* Count pill (dot + number) used for small numeric cells */
.count-pill {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.78rem; font-weight: 600;
    padding: 4px 12px; border-radius: 999px;
    background: rgba(59,130,246,0.10); color: #2563eb;
}
.count-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.count-pill.purple { background: rgba(139,92,246,0.10); color: #7c3aed; }
.count-pill.green  { background: rgba(34,197,94,0.10); color: #16a34a; }
.count-pill.muted  { background: rgba(107,114,128,0.10); color: #6b7280; }

/* ===================== CURRENCY SWITCHER ===================== */
.currency-switch { position: relative; }
.currency-btn {
    width: auto !important; padding: 0 12px !important;
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 0.82rem; font-weight: 600;
    color: var(--text-secondary);
}
.currency-btn i { font-size: 1rem; }
.currency-btn span { line-height: 1; }
.currency-menu {
    min-width: 260px; padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    background: var(--bg-card);
}
.currency-menu-title {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.6px; color: var(--text-muted);
    margin-bottom: 10px;
}
.currency-opt {
    width: 100%; display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; margin-bottom: 6px;
    border: 1.5px solid var(--border-color); border-radius: 12px;
    background: var(--bg-card); cursor: pointer;
    transition: var(--transition); text-align: left;
}
.currency-opt:hover { border-color: var(--primary); background: var(--primary-lighter); }
.currency-opt .cur-sym {
    width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.9rem;
    background: var(--bg-input); color: var(--text-primary);
}
.currency-opt .cur-name {
    flex: 1; font-size: 0.86rem; font-weight: 600; color: var(--text-primary);
}
.currency-opt .cur-check { color: var(--primary); font-size: 1.1rem; opacity: 0; }
.currency-opt.active { border-color: var(--primary); background: var(--primary-lighter); }
.currency-opt.active .cur-sym { background: var(--primary-gradient); color: #fff; }
.currency-opt.active .cur-check { opacity: 1; }

.currency-rate {
    margin-top: 8px; padding-top: 12px;
    border-top: 1px solid var(--border-light);
}
.currency-rate label {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.6px; color: var(--text-muted);
    margin-bottom: 8px; display: block;
}
.currency-rate .rate-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.84rem; font-weight: 600; color: var(--text-secondary);
}
.currency-rate .rate-row input {
    flex: 1; min-width: 0;
    border: 1.5px solid var(--border-color); border-radius: 9px;
    padding: 8px 12px; font-size: 0.86rem; font-weight: 600;
    background: var(--bg-input); color: var(--text-primary);
}
.currency-rate .rate-row input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(232,83,63,0.10);
}
.currency-rate .rate-save {
    width: 100%; margin-top: 10px;
    border: none; border-radius: 10px; padding: 9px;
    font-size: 0.82rem; font-weight: 700; color: #fff;
    background: var(--primary-gradient); cursor: pointer;
    box-shadow: var(--shadow-primary); transition: var(--transition);
}
.currency-rate .rate-save:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(232,83,63,0.3); }

/* ===================== KANBAN (LIVRAISONS) ===================== */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    align-items: start;
}
.kanban-col {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    --col-accent: #8b5cf6;
    --col-soft: rgba(139,92,246,0.10);
}
.kanban-col.prepare   { --col-accent: #8b5cf6; --col-soft: rgba(139,92,246,0.10); }
.kanban-col.transit   { --col-accent: #3b82f6; --col-soft: rgba(59,130,246,0.10); }
.kanban-col.delivered { --col-accent: #22c55e; --col-soft: rgba(34,197,94,0.10); }

.kanban-col-head {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    background: var(--col-soft);
    border-top: 3px solid var(--col-accent);
}
.kanban-col-icon {
    width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--col-accent); color: #fff; font-size: 0.95rem;
}
.kanban-col-title {
    font-weight: 700; font-size: 0.9rem; color: var(--text-primary);
    flex: 1; min-width: 0;
}
.kanban-col-count {
    min-width: 26px; height: 24px; padding: 0 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 999px; font-size: 0.78rem; font-weight: 700;
    color: #fff; background: var(--col-accent);
}
.kanban-col-body {
    padding: 12px; min-height: 140px;
    display: flex; flex-direction: column; gap: 10px;
}

/* Delivery card */
.delivery-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: var(--shadow-xs);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.delivery-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.dc-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.dc-avatar {
    width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 0.78rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.dc-head { flex: 1; min-width: 0; }
.dc-number { font-weight: 700; font-size: 0.86rem; color: var(--text-primary); }
.dc-client {
    font-size: 0.78rem; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dc-meta {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 10px; border-top: 1px dashed var(--border-light);
}
.dc-amount { font-weight: 700; font-size: 0.92rem; color: var(--text-primary); }
.dc-date {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.76rem; color: var(--text-muted);
}
.dc-transport {
    margin-top: 8px; font-size: 0.76rem; color: var(--text-secondary);
    display: inline-flex; align-items: center; gap: 6px;
}
.dc-advance {
    width: 100%; margin-top: 12px;
    border: none; border-radius: 10px; padding: 9px;
    font-size: 0.82rem; font-weight: 700; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    color: #fff; transition: var(--transition);
}
.dc-advance.a_preparer { background: #3b82f6; box-shadow: 0 3px 10px rgba(59,130,246,0.3); }
.dc-advance.chargee    { background: #22c55e; box-shadow: 0 3px 10px rgba(34,197,94,0.3); }
.dc-advance:hover { transform: translateY(-1px); filter: brightness(1.05); }
.dc-done {
    margin-top: 12px; text-align: center;
    font-size: 0.78rem; font-weight: 600; color: #16a34a;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}

.kanban-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; padding: 32px 16px; color: var(--text-muted);
    font-size: 0.82rem; text-align: center;
    border: 1.5px dashed var(--border-color); border-radius: var(--radius-md);
}
.kanban-empty i { font-size: 1.6rem; opacity: 0.4; }

@media (max-width: 900px) {
    .kanban-board { grid-template-columns: 1fr; }
}


/* ============================================================
   SYNTHÈSE FINANCIÈRE (P&L)
   ============================================================ */
.finance-summary { display: flex; flex-direction: column; }
.fin-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 12px 4px;
    border-bottom: 1px dashed var(--border-light);
}
.fin-row:last-child { border-bottom: none; }
.fin-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.fin-ic {
    width: 34px; height: 34px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px; font-size: 0.95rem;
    background: var(--bg-subtle); color: var(--text-secondary);
}
.fin-ic.pos { background: rgba(34,197,94,0.12); color: #16a34a; }
.fin-ic.neg { background: rgba(239,68,68,0.12); color: #dc2626; }
.fin-label { font-size: 0.9rem; color: var(--text-secondary); font-weight: 500; }
.fin-amount {
    font-weight: 700; font-size: 0.95rem; white-space: nowrap;
    font-variant-numeric: tabular-nums; color: var(--text-primary);
}
.fin-amount.pos { color: #16a34a; }
.fin-amount.neg { color: #dc2626; }
.fin-row.fin-subtotal {
    background: var(--bg-subtle); border-radius: 10px;
    padding: 12px; margin: 6px 0; border-bottom: none;
}
.fin-row.fin-subtotal .fin-label,
.fin-row.fin-subtotal .fin-amount { font-weight: 700; color: var(--text-primary); }

.fin-net {
    margin-top: 16px; padding: 18px 20px;
    border-radius: 14px; color: #fff;
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}
.fin-net.is-positive { background: linear-gradient(135deg, #16a34a, #22c55e); }
.fin-net.is-negative { background: linear-gradient(135deg, #dc2626, #ef4444); }
.fin-net-label {
    font-size: 0.92rem; font-weight: 600; letter-spacing: 0.2px;
    display: inline-flex; align-items: center; gap: 9px;
}
.fin-net-label i { font-size: 1.15rem; }
.fin-net-value {
    font-size: 1.5rem; font-weight: 800; white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
    .fin-net { flex-direction: column; align-items: flex-start; gap: 6px; }
    .fin-net-value { font-size: 1.25rem; }
}


/* ============================================================
   REPORT TABS (segmented)
   ============================================================ */
.report-tabs {
    display: inline-flex; gap: 4px; flex-wrap: wrap;
    padding: 5px; border-radius: 14px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
}
.report-tab {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 16px; border-radius: 10px;
    font-size: 0.88rem; font-weight: 600;
    color: var(--text-secondary); text-decoration: none;
    white-space: nowrap; cursor: pointer;
    transition: var(--transition);
}
.report-tab i { font-size: 1rem; opacity: 0.85; }
.report-tab:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}
.report-tab.active {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(232,83,63,0.32);
}
.report-tab.active i { opacity: 1; }

@media (max-width: 620px) {
    .report-tabs { display: flex; width: 100%; }
    .report-tab { flex: 1 1 auto; justify-content: center; }
    .report-tab span { display: none; }
    .report-tab i { font-size: 1.15rem; }
}


/* ============================================================
   INVOICE MODAL (line items + totals)
   ============================================================ */
.invoice-items-head {
    padding: 0 2px 8px;
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 10px;
}
.item-row {
    padding: 4px 2px;
    border-radius: 10px;
    transition: background-color 0.15s ease;
}
.item-total-box {
    display: flex; align-items: center; justify-content: flex-end;
    background: var(--bg-subtle) !important;
    border: 1px solid var(--border-light) !important;
    color: var(--text-primary) !important;
    font-variant-numeric: tabular-nums;
}
.btn-add-item {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 16px; border-radius: 10px;
    font-size: 0.86rem; font-weight: 600;
    color: var(--primary); background: var(--primary-lighter);
    border: 1px dashed var(--primary);
    cursor: pointer; transition: var(--transition);
}
.btn-add-item:hover { background: var(--primary); color: #fff; border-style: solid; }

.invoice-totals {
    width: 100%; max-width: 320px;
    padding: 16px 18px;
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
}
.invoice-totals .it-row {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.9rem; color: var(--text-secondary);
    padding: 5px 0;
}
.invoice-totals .it-row strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.invoice-totals .it-total {
    margin-top: 8px; padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 1rem;
}
.invoice-totals .it-total span { font-weight: 700; color: var(--text-primary); }
.invoice-totals .it-total strong { font-size: 1.3rem; font-weight: 800; }


/* ============================================================
   INVOICE DOCUMENT (professional printable)
   ============================================================ */
.inv-doc {
    background: var(--bg-card); color: var(--text-primary);
    font-size: 0.9rem;
}
#detailModal .modal-dialog,
#quoteDetailModal .modal-dialog { max-width: 820px; }
#detailModal .modal-body,
#quoteDetailModal .modal-body { padding: 16px; }
.inv-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding-bottom: 22px; margin-bottom: 28px;
    border-bottom: 3px solid var(--primary);
}
.inv-brand { display: flex; flex-direction: column; gap: 0; }
.inv-brand-top { display: flex; align-items: center; gap: 14px; }
.inv-brand-logo {
    width: 52px; height: 52px; border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.05rem; letter-spacing: 0.3px; color: #fff;
    background: linear-gradient(135deg, var(--primary), #c0392b);
    box-shadow: 0 4px 14px rgba(232,83,63,0.28);
    flex-shrink: 0;
}
.inv-brand-text { display: flex; flex-direction: column; }
.inv-brand-name {
    font-size: 1.12rem; font-weight: 800; letter-spacing: 0.6px;
    text-transform: uppercase; color: var(--text-primary); line-height: 1.2;
}
.inv-brand-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 3px; }
.inv-brand-contact {
    margin-top: 12px; padding-top: 10px;
    border-top: 1px solid var(--border-light);
    display: grid; grid-template-columns: 1fr 1fr; gap: 5px 16px;
    font-size: 0.76rem; color: var(--text-secondary);
}
.inv-brand-contact > span {
    display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden;
}
.inv-brand-contact i { color: var(--primary); font-size: 0.82rem; flex-shrink: 0; }
.inv-head-meta { text-align: right; }
.inv-doc-title {
    font-size: 1.9rem; font-weight: 300; letter-spacing: 8px;
    text-transform: uppercase; color: var(--text-primary); line-height: 1;
    margin-bottom: 12px; padding-right: 2px;
}
.inv-meta-box {
    display: inline-block; text-align: left; min-width: 220px;
    border: 1px solid var(--border-light); border-radius: 10px;
    overflow: hidden;
}
.inv-meta-row {
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    padding: 7px 14px; font-size: 0.82rem;
}
.inv-meta-row + .inv-meta-row { border-top: 1px solid var(--border-light); }
.inv-meta-row span { color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; font-size: 0.7rem; }
.inv-meta-row strong { color: var(--text-primary); font-weight: 700; font-variant-numeric: tabular-nums; }

.inv-parties {
    display: flex; justify-content: space-between; gap: 24px;
    padding: 20px 24px; margin-bottom: 26px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary); line-height: 1.6;
}
.inv-party-tag {
    font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.6px;
    font-weight: 700; color: var(--text-muted); margin-bottom: 5px;
}
.inv-party-name { font-size: 1.02rem; font-weight: 700; color: var(--text-primary); margin-bottom: 3px; }

.inv-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.inv-table thead th {
    font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.5px;
    font-weight: 700; color: var(--primary);
    padding: 10px 12px; text-align: left;
    border-bottom: 2px solid var(--primary);
}
.inv-table tbody td {
    padding: 12px; border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary); vertical-align: middle;
}
.inv-table tbody td.fw-bold, .inv-table tbody td.fw-semibold { color: var(--text-primary); }
.inv-c-num { width: 42px; color: var(--text-muted); }
.inv-table-sm thead th { border-bottom-width: 1px; color: var(--text-muted); }
.inv-table-sm tbody td { padding: 8px 12px; font-size: 0.84rem; }

.inv-summary { display: flex; justify-content: flex-end; margin-top: 18px; }
.inv-totals { width: 100%; max-width: 320px; }
.inv-trow {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 6px; font-size: 0.9rem; color: var(--text-secondary);
}
.inv-trow strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.inv-trow.inv-grand {
    margin-top: 4px; padding: 12px 16px; border-radius: 10px;
    background: var(--primary); color: #fff;
}
.inv-trow.inv-grand span { font-weight: 700; }
.inv-trow.inv-grand strong { color: #fff; font-size: 1.15rem; font-weight: 800; }
.inv-trow.inv-paid strong { color: #16a34a; }
.inv-trow.inv-due strong { color: #dc2626; }

.inv-section { margin-top: 28px; }
.inv-section-title {
    font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.6px;
    font-weight: 700; color: var(--primary); margin-bottom: 10px;
}
.inv-footer { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border-light); }
.inv-footer-grid { display: flex; flex-wrap: wrap; gap: 22px; color: var(--text-secondary); }
.inv-footer-grid > div { display: flex; flex-direction: column; font-size: 0.88rem; }
.inv-footer-grid span {
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.4px;
    color: var(--text-muted); margin-bottom: 2px;
}
.inv-footer-notes { flex-basis: 100%; }
.inv-thanks { margin-top: 18px; font-size: 0.86rem; font-style: italic; color: var(--text-muted); }

@media (max-width: 560px) {
    .inv-head, .inv-parties { flex-direction: column; gap: 16px; }
    .inv-head-meta { text-align: left; }
    .inv-party.text-end { text-align: left !important; }
    .inv-summary { justify-content: stretch; }
    .inv-totals { max-width: none; }
}


/* ============================================================
   RECIPE CARDS
   ============================================================ */
.recipe-pro {
    display: flex; flex-direction: column; height: 100%;
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-xs);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.recipe-pro::before {
    content: ""; position: absolute; left: 20px; right: 20px; top: 0; height: 3px;
    background: var(--rc); border-radius: 0 0 3px 3px;
}
.recipe-pro:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: color-mix(in srgb, var(--rc) 35%, var(--border-color));
}

.recipe-pro-top { display: flex; align-items: flex-start; gap: 14px; }
.recipe-pro-icon {
    width: 46px; height: 46px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 12px; font-size: 1.25rem;
    color: var(--rc);
    background: color-mix(in srgb, var(--rc) 12%, transparent);
}
.recipe-pro-head { min-width: 0; flex: 1; }
.recipe-pro-cat {
    font-size: 0.66rem; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase;
    color: var(--rc); margin-bottom: 3px;
}
.recipe-pro-name {
    margin: 0 0 4px; font-weight: 700; font-size: 1.02rem; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recipe-pro-product {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.8rem; color: var(--text-muted);
}

.recipe-pro-yield {
    display: flex; align-items: center; justify-content: space-between;
    margin: 16px 0; padding: 12px 16px;
    border-radius: 12px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
}
.recipe-pro-yield-lbl {
    font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px;
    color: var(--text-muted);
}
.recipe-pro-yield-val {
    font-size: 1.5rem; font-weight: 800; color: var(--text-primary); line-height: 1;
    display: inline-flex; align-items: baseline; gap: 5px;
}
.recipe-pro-yield-val small { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); }

.recipe-pro-desc {
    margin: 0 0 14px; font-size: 0.82rem; color: var(--text-secondary);
    line-height: 1.5;
}

.recipe-pro-ing-title {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted);
}
.recipe-pro-ing-title span:first-child { display: inline-flex; align-items: center; gap: 7px; }
.recipe-pro-count {
    min-width: 20px; height: 20px; padding: 0 6px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px; font-size: 0.7rem; font-weight: 700;
    color: var(--rc); background: color-mix(in srgb, var(--rc) 14%, transparent);
}
.recipe-pro-ing-list { flex: 1; display: flex; flex-direction: column; }
.recipe-pro-ing {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 2px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-light);
}
.recipe-pro-ing:last-child { border-bottom: none; }
.recipe-pro-ing-name { color: var(--text-secondary); }
.recipe-pro-ing-qty {
    font-weight: 700; color: var(--text-primary); white-space: nowrap;
    font-variant-numeric: tabular-nums;
    display: inline-flex; align-items: baseline; gap: 4px;
}
.recipe-pro-ing-qty small { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); }

/* Supprimer les flèches +/- sur les champs quantité ingrédient */
.ing-qty::-webkit-inner-spin-button,
.ing-qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ing-qty { -moz-appearance: textfield; }

.recipe-pro-foot {
    display: flex; align-items: center; gap: 8px;
    margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-light);
}
.recipe-pro-foot .btn-action {
    width: auto; min-height: 38px; padding: 0 14px; gap: 7px;
    font-size: 0.85rem; font-weight: 600;
}
.recipe-pro-foot .btn-action.delete { width: 38px; padding: 0; }



