/* ===== Karyon Parcel Design System ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Montserrat:wght@500;600;800&display=swap');

:root {
    /* Brand palette (Karyon Parcel brand sheet) */
    --brand-navy: #0B2D5B;      /* Trust */
    --brand-blue: #1E88E5;      /* Growth */
    --brand-cyan: #00B4DB;      /* Innovation */
    --brand-mist: #E6EEF5;      /* Balance */
    --brand-navy-deep: #061B3A;
    --brand-ink: var(--brand-navy);
    --brand-font: 'Montserrat', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Interactive blue: one step deeper than Growth so white text on it meets 4.5:1 */
    --primary: #1976D2;
    --primary-light: #42A5F5;
    --primary-dark: #1565C0;
    --primary-50: #EBF4FD;
    --primary-100: #D4E7FA;
    --primary-solid: #1976D2;
    --primary-solid-hover: #1565C0;
    --accent: #00B4DB;
    --accent-light: #5DD5EE;
    --gray-50: #F5F8FC;
    --gray-100: #E6EEF5;
    --gray-200: #D6E1EC;
    --gray-300: #B9C8D8;
    --gray-400: #8B9DB3;
    --gray-500: #5F728B;
    --gray-600: #46586F;
    --gray-700: #304157;
    --gray-800: #1B2A40;
    --gray-900: #0B1B33;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #0091C2;
    --info-light: #DDF4FA;

    /* Sidebar (always navy, in both themes) */
    --sidebar-bg: linear-gradient(180deg, #0B2D5B 0%, #071F42 100%);
    --sidebar-text: #B4C6DC;
    --sidebar-muted: #7F97B5;
    --sidebar-border: rgba(255,255,255,0.08);
    --sidebar-hover: rgba(255,255,255,0.06);
    --sidebar-active: rgba(30,136,229,0.24);
    --sidebar-active-bar: #42A5F5;

    /* Logo mark colours (see Views/Shared/_BrandLogo.cshtml) */
    --km-speed-1: #2B98F3; --km-speed-2: #1A80E0;
    --km-top-1: #2E97F2;   --km-top-2: #1B83E2;
    --km-stem-1: #1261B5;  --km-stem-2: #0B2D5B;
    --km-arm-1: #0A5FC0;   --km-arm-2: #1E88E5; --km-arm-3: #47A8F8;
    --km-leg-1: #114F9A;   --km-leg-2: #0B2D5B;

    /* Bootstrap utilities (bg-primary, text-info, bg-dark, ...) */
    --bs-primary: #1976D2;
    --bs-primary-rgb: 25, 118, 210;
    --bs-info: #00B4DB;
    --bs-info-rgb: 0, 180, 219;
    --bs-dark: #0B1B33;
    --bs-dark-rgb: 11, 27, 51;

    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    --transition: all 0.2s ease;
}

/* ===== Dark Mode ===== */
[data-theme="dark"] {
    --brand-ink: #FFFFFF;
    --primary: #4DA6F2;
    --primary-light: #90CAF9;
    --primary-dark: #2F93EC;
    --primary-50: rgba(30,136,229,0.14);
    --primary-100: rgba(30,136,229,0.22);
    --primary-solid: #1976D2;
    --primary-solid-hover: #1E88E5;
    --accent: #2CC7E8;
    --accent-light: #7FDDF2;
    --gray-50: #0A1A2F;
    --gray-100: #13253F;
    --gray-200: #1E3454;
    --gray-300: #2C4669;
    --gray-400: #8DA2BC;
    --gray-500: #8DA2BC;
    --gray-600: #BFCDDE;
    --gray-700: #DCE5EF;
    --gray-800: #EDF2F8;
    --gray-900: #F7FAFD;
    --success: #34d399;
    --success-light: rgba(16,185,129,0.15);
    --warning: #fbbf24;
    --warning-light: rgba(245,158,11,0.15);
    --danger: #f87171;
    --danger-light: rgba(239,68,68,0.15);
    --info: #38C6E6;
    --info-light: rgba(0,180,219,0.15);
    --sidebar-bg: linear-gradient(180deg, #0A1E3A 0%, #050F20 100%);
    --sidebar-border: rgba(255,255,255,0.06);
    --km-speed-1: #3AA0F5; --km-speed-2: #1E88E5;
    --km-top-1: #FFFFFF;   --km-top-2: #FFFFFF;
    --km-stem-1: #FFFFFF;  --km-stem-2: #E3EBF5;
    --km-arm-1: #1270D6;   --km-arm-2: #1E88E5; --km-arm-3: #4AAAF8;
    --km-leg-1: #F7FAFD;   --km-leg-2: #DCE6F2;
    --bs-dark: #050F20;
    --bs-dark-rgb: 5, 15, 32;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -4px rgba(0,0,0,0.3);
    color-scheme: dark;
}

[data-theme="dark"] body { background: #06101F; color: var(--gray-800); }
[data-theme="dark"] .app-header { background: #0E1F37; border-bottom-color: #1E3454; }

[data-theme="dark"] .card,
[data-theme="dark"] .metric-card,
[data-theme="dark"] .table-card,
[data-theme="dark"] .filter-bar { background: #0E1F37; border-color: #1E3454; }
[data-theme="dark"] .card-header { border-bottom-color: #1E3454; color: var(--gray-800); }
[data-theme="dark"] .table thead th { background: #0A1A2F; border-bottom-color: #1E3454 !important; }
[data-theme="dark"] .table tbody td { border-bottom-color: #192E4C; }
[data-theme="dark"] .table tbody tr:hover { background: rgba(255,255,255,0.03); }

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select { background: #0A1A2F; border-color: #1E3454; color: #DCE5EF; }
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus { border-color: var(--primary); background: #0E2139; box-shadow: 0 0 0 3px rgba(30,136,229,0.25); }

[data-theme="dark"] .auth-panel { background: #0E1F37; box-shadow: -10px 0 40px rgba(0,0,0,0.4); }
[data-theme="dark"] .auth-panel .form-control { background: #0A1A2F; border-color: #1E3454; color: #DCE5EF; }
[data-theme="dark"] .auth-panel .form-control:focus { background: #0E2139; }

[data-theme="dark"] .alert-success { background: rgba(16,185,129,0.15); color: #6ee7b7; }
[data-theme="dark"] .alert-danger  { background: rgba(239,68,68,0.15);  color: #fca5a5; }
[data-theme="dark"] .alert-warning { background: rgba(245,158,11,0.15); color: #fcd34d; }

[data-theme="dark"] .badge-delivered, [data-theme="dark"] .badge-paid    { background: rgba(16,185,129,0.2); color: #6ee7b7; }
[data-theme="dark"] .badge-intransit, [data-theme="dark"] .badge-issued  { background: rgba(0,180,219,0.18); color: #7FDDF2; }
[data-theme="dark"] .badge-exception, [data-theme="dark"] .badge-overdue { background: rgba(239,68,68,0.2);  color: #fca5a5; }
[data-theme="dark"] .badge-pending, [data-theme="dark"] .badge-draft,
[data-theme="dark"] .badge-cancelled { background: rgba(141,162,188,0.15); color: #8DA2BC; }
[data-theme="dark"] .badge-labelcreated { background: rgba(168,85,247,0.2); color: #c084fc; }

[data-theme="dark"] .landing-page { background: #06101F; }
[data-theme="dark"] .landing-footer { border-top-color: #13253F; }
[data-theme="dark"] .feature-card { background: #0E1F37; border-color: #1E3454; }
[data-theme="dark"] .btn-hero-secondary { background: #0E1F37; color: #DCE5EF; border-color: #1E3454; }
[data-theme="dark"] .btn-hero-secondary:hover { background: #1E3454; border-color: #2C4669; }
[data-theme="dark"] .btn-light { background: #1E3454; color: #DCE5EF; border-color: #2C4669; }
[data-theme="dark"] .btn-light:hover { background: #2C4669; color: #F7FAFD; }

[data-theme="dark"] .api-key-item { background: #0A1A2F; border-color: #1E3454; }
[data-theme="dark"] .api-key-item .key-value { background: #0E1F37; border-color: #1E3454; color: #8DA2BC; }

[data-theme="dark"] .progress { background: #1E3454; }

[data-theme="dark"] .list-group-item { background: #0E1F37; border-color: #1E3454; color: #DCE5EF; }
[data-theme="dark"] .list-group-item-action:hover { background: #192E4C; color: #F7FAFD; }

[data-theme="dark"] pre.bg-dark { background: #050F20 !important; }

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--gray-600);
    transition: var(--transition);
}
.theme-toggle:hover { background: var(--gray-100); color: var(--gray-800); }
[data-theme="dark"] .theme-toggle { border-color: #2C4669; color: #fbbf24; }
[data-theme="dark"] .theme-toggle:hover { background: #1E3454; }

/* ===== Brand Lockup (Views/Shared/_BrandLogo.cshtml) ===== */
/* Proportions follow the brand sheet; size it with font-size on the lockup. */
.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 0.24em;
    font-family: var(--brand-font);
    line-height: 1;
    color: var(--brand-ink);
    text-transform: uppercase;
    white-space: nowrap;
}

.brand-lockup .brand-mark { height: 1.86em; width: auto; flex: none; display: block; overflow: visible; }

.brand-lockup .brand-words {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-top: 0.26em;
}

.brand-lockup .brand-name {
    font-weight: 800;
    line-height: 0.7;
    letter-spacing: -0.03em;
}

.brand-lockup .brand-sub {
    font-size: 0.57em;
    font-weight: 600;
    line-height: 0.7;
    letter-spacing: 0.47em;
    margin: 0.32em -0.47em 0 0.04em;
    color: var(--brand-blue);
}

.brand-reversed {
    --brand-ink: #FFFFFF;
    --km-speed-1: #3AA0F5; --km-speed-2: #1E88E5;
    --km-top-1: #FFFFFF;   --km-top-2: #FFFFFF;
    --km-stem-1: #FFFFFF;  --km-stem-2: #E3EBF5;
    --km-arm-1: #1270D6;   --km-arm-2: #1E88E5; --km-arm-3: #4AAAF8;
    --km-leg-1: #F7FAFD;   --km-leg-2: #DCE6F2;
}

.brand-reversed .brand-sub,
[data-theme="dark"] .brand-lockup .brand-sub { color: #4DA6F2; }

.brand-tagline {
    font-family: var(--brand-font);
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--gray-500);
    margin: 0;
}

.brand-tagline .dot { margin: 0 0.3em; opacity: 0.8; }

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--gray-800);
    background: var(--gray-50);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.3;
}

/* ===== Auth Pages (Login / Register) ===== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    background:
        radial-gradient(ellipse 70% 60% at 30% 0%, rgba(30,136,229,0.45) 0%, rgba(30,136,229,0) 70%),
        radial-gradient(ellipse 50% 45% at 0% 100%, rgba(0,180,219,0.18) 0%, rgba(0,180,219,0) 70%),
        linear-gradient(160deg, var(--brand-navy) 0%, var(--brand-navy-deep) 100%);
    position: relative;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 50%);
    animation: authFloat 25s infinite linear;
}

@keyframes authFloat {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.auth-brand {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    color: white;
    position: relative;
    z-index: 1;
}

.auth-brand .auth-logo { margin: 0; line-height: 1; }
.auth-brand .brand-lockup { font-size: 3.1rem; }

.auth-brand .brand-tagline {
    font-size: 0.7rem;
    max-width: none;
    opacity: 1;
    line-height: 1.6;
    color: rgba(255,255,255,0.72);
    margin: 1.5rem 0 2.25rem;
}

.auth-brand p {
    font-size: 1.15rem;
    opacity: 0.9;
    max-width: 400px;
    text-align: center;
    line-height: 1.7;
}

.auth-features {
    list-style: none;
    padding: 0;
    margin-top: 2.5rem;
}

.auth-features li {
    padding: 0.6rem 0;
    font-size: 1rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.auth-features .feat-icon {
    width: 36px; height: 36px;
    background: rgba(30,136,229,0.28);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    backdrop-filter: blur(4px);
}

.auth-panel {
    width: 520px;
    min-height: 100vh;
    background: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 3.5rem;
    position: relative;
    z-index: 1;
    box-shadow: -10px 0 40px rgba(0,0,0,0.12);
}

.auth-panel h2 {
    font-size: 1.75rem;
    margin-bottom: 0.4rem;
}

.auth-panel .auth-subtitle {
    color: var(--gray-500);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.auth-panel .form-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-panel .form-control {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    transition: var(--transition);
    background: var(--gray-50);
}

.auth-panel .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-100);
    background: white;
    outline: none;
}

.auth-panel .form-check-input {
    border: 2px solid var(--gray-300);
    border-radius: 4px;
    width: 1.1rem; height: 1.1rem;
}

.auth-panel .form-check-input:checked {
    background-color: var(--primary-solid);
    border-color: var(--primary-solid);
}

.auth-panel .btn-auth {
    background: var(--primary-solid);
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.8rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    color: white;
    width: 100%;
    margin-top: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.auth-panel .btn-auth:hover {
    background: var(--primary-solid-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.auth-panel .auth-footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--gray-500);
    font-size: 0.9rem;
}

.auth-panel .auth-footer a { font-weight: 600; }

.auth-panel .text-danger { font-size: 0.8rem; margin-top: 0.2rem; }

.auth-panel .auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--gray-400);
    font-size: 0.8rem;
}

.auth-panel .auth-divider::before,
.auth-panel .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}

/* Shown in place of the brand panel on narrow screens */
.auth-mobile-brand { display: none; margin-bottom: 2rem; }
.auth-mobile-brand .brand-lockup { font-size: 1.6rem; }

@media (max-width: 992px) {
    .auth-brand { display: none; }
    .auth-panel { width: 100%; padding: 2rem 1.5rem; }
    .auth-mobile-brand { display: block; }
}

/* ===== App Layout (Sidebar + Main) ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: white;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
}

.sidebar-brand .brand-lockup { font-size: 1.45rem; }

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.sidebar-nav .nav-section {
    padding: 0.75rem 1.5rem 0.4rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--sidebar-muted);
    font-weight: 700;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.5rem;
    color: var(--sidebar-text);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
    margin: 1px 0;
    text-decoration: none;
}

.sidebar-nav .nav-link:hover {
    color: white;
    background: var(--sidebar-hover);
}

.sidebar-nav .nav-link.active {
    color: white;
    background: var(--sidebar-active);
    border-left-color: var(--sidebar-active-bar);
}

.sidebar-nav .nav-link .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    opacity: 0.7;
}

.sidebar-nav .nav-link.active .nav-icon,
.sidebar-nav .nav-link:hover .nav-icon {
    opacity: 1;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--sidebar-border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0;
}

.sidebar-user .user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--brand-blue), var(--brand-cyan));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    flex-shrink: 0;
}

.sidebar-user .user-info { flex: 1; min-width: 0; }

.sidebar-user .user-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #E6EEF5;
}

.sidebar-user .user-company {
    font-size: 0.7rem;
    color: var(--sidebar-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer .btn-logout {
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.45rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-footer .btn-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.app-header .page-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    color: var(--gray-900);
}

.app-header .page-subtitle {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin: 0;
}

.app-content {
    flex: 1;
    padding: 1.75rem 2rem;
}

.app-footer {
    padding: 1.25rem 2rem;
    text-align: center;
    color: var(--gray-400);
    font-size: 0.75rem;
    border-top: 1px solid var(--gray-100);
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--gray-700);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
}

@media (max-width: 992px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.show { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .app-main { margin-left: 0; }
    .app-content { padding: 1.25rem; }
    .mobile-toggle { display: block !important; }
}

/* ===== Cards ===== */
.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card-header {
    background: none;
    border-bottom: 1px solid var(--gray-100);
    padding: 1.15rem 1.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--gray-800);
}

.card-body { padding: 1.5rem; }

/* Metric Cards */
.metric-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

.metric-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.metric-card.mc-primary::before { background: var(--primary); }
.metric-card.mc-success::before { background: var(--success); }
.metric-card.mc-info::before    { background: var(--info); }
.metric-card.mc-warning::before { background: var(--warning); }
.metric-card.mc-danger::before  { background: var(--danger); }

.metric-card .mc-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.mc-primary .mc-icon { background: var(--primary-50); color: var(--primary); }
.mc-success .mc-icon { background: var(--success-light); color: var(--success); }
.mc-info    .mc-icon { background: var(--info-light);    color: var(--info); }
.mc-warning .mc-icon { background: var(--warning-light); color: var(--warning); }
.mc-danger  .mc-icon { background: var(--danger-light);  color: var(--danger); }

.metric-card .mc-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    margin-bottom: 0.2rem;
}

.metric-card .mc-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.2;
}

.metric-card .mc-sub {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-top: 0.2rem;
}

/* ===== Tables ===== */
.table-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-card .table-card-header {
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-card .table-card-header h5 {
    margin: 0;
    font-weight: 700;
    font-size: 0.95rem;
}

.table { margin: 0; }

.table thead th {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200) !important;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    padding: 0.8rem 1rem;
    white-space: nowrap;
    border-top: none;
}

.table tbody td {
    padding: 0.8rem 1rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }

.table .tracking-link {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.85rem;
}

.table .tracking-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ===== Badges ===== */
.badge {
    font-weight: 600;
    font-size: 0.7rem;
    padding: 0.3rem 0.65rem;
    border-radius: 50px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-delivered, .badge-paid    { background: var(--success-light); color: #065f46; }
.badge-intransit, .badge-issued  { background: var(--info-light);    color: #065A78; }
.badge-exception, .badge-overdue { background: var(--danger-light);  color: #991b1b; }
.badge-pending, .badge-draft,
.badge-cancelled                 { background: var(--gray-100);      color: var(--gray-600); }
.badge-labelcreated              { background: #fae8ff;              color: #86198f; }
.badge-disputed                  { background: var(--warning-light); color: #92400e; }
.badge-test                      { background: var(--warning-light); color: #92400e; }
.badge-live                      { background: var(--success-light); color: #065f46; }
.badge-admin                     { background: var(--primary-100);   color: var(--primary-dark); }

/* ===== Buttons ===== */
.btn {
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1.25rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn-primary { background: var(--primary-solid); color: white; }
.btn-primary:focus { background: var(--primary-solid); color: white; box-shadow: 0 0 0 3px var(--primary-100); }
.btn-primary:hover { background: var(--primary-solid-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); color: white; }
.btn-primary:active, .btn-primary.active { background: var(--primary-solid-hover); color: white; }

.btn-outline-primary { border: 2px solid var(--primary); color: var(--primary); background: transparent; }
.btn-outline-primary:hover,
.btn-outline-primary:active,
.btn-outline-primary.active { background: var(--primary-solid); border-color: var(--primary-solid); color: white; }
.btn-outline-primary:focus { box-shadow: 0 0 0 3px var(--primary-100); }

.btn-light { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-light:hover { background: var(--gray-200); color: var(--gray-800); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; color: white; }

/* ===== Forms ===== */
.form-control, .form-select {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    transition: var(--transition);
    color: var(--gray-800);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-100);
    outline: none;
}

.form-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-bottom: 0.35rem;
}

.form-check-input:checked { background-color: var(--primary-solid); border-color: var(--primary-solid); }
.form-check-input:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px var(--primary-100); }

/* ===== Filter Bar ===== */
.filter-bar {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.15rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.filter-bar .form-control,
.filter-bar .form-select {
    background: var(--gray-50);
}

/* ===== Pagination ===== */
.pagination { gap: 0.25rem; }

.page-link {
    border-radius: var(--radius-sm) !important;
    border: none;
    color: var(--gray-600);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.45rem 0.8rem;
    background: transparent;
    transition: var(--transition);
}

.page-link:hover { background: var(--gray-100); color: var(--gray-900); }
.page-link:focus { box-shadow: 0 0 0 3px var(--primary-100); }
.page-item.active .page-link { background: var(--primary-solid); color: white; }
.page-item.disabled .page-link { color: var(--gray-300); }

/* ===== Alerts ===== */
.alert {
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.85rem 1.25rem;
}

.alert-success { background: var(--success-light); color: #065f46; }
.alert-danger  { background: var(--danger-light);  color: #991b1b; }
.alert-warning { background: var(--warning-light); color: #92400e; }

/* ===== Landing Page ===== */
.landing-page {
    min-height: 100vh;
    background: white;
}

.landing-nav {
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

.landing-nav .brand { text-decoration: none; }
.landing-nav .brand .brand-lockup { font-size: 1.5rem; }

.landing-nav .nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.landing-hero {
    text-align: center;
    padding: 5rem 2rem 4rem;
    max-width: 800px;
    margin: 0 auto;
}

.landing-hero h1 {
    font-size: 3.25rem;
    font-weight: 800;
    line-height: 1.12;
    margin-bottom: 1.5rem;
    letter-spacing: -1.5px;
    background: linear-gradient(135deg, var(--brand-ink) 0%, var(--brand-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-hero p {
    font-size: 1.15rem;
    color: var(--gray-500);
    max-width: 520px;
    margin: 0 auto 2.5rem;
    line-height: 1.7;
}

.landing-hero .brand-tagline {
    font-size: 0.7rem;
    max-width: none;
    line-height: 1.6;
    margin: 0 0 1.5rem;
}

.hero-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-hero {
    padding: 0.8rem 2rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
}

.btn-hero-primary {
    background: var(--primary-solid);
    color: white;
}

.btn-hero-primary:hover {
    background: var(--primary-solid-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: white;
}

.btn-hero-secondary {
    background: white;
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
}

.btn-hero-secondary:hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
    color: var(--gray-900);
}

.landing-features {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 2rem 5rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.feature-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover {
    border-color: var(--primary-100);
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.feature-card .feat-icon-lg {
    width: 56px; height: 56px;
    border-radius: 14px;
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.feature-card:nth-child(1) .feat-icon-lg { background: var(--primary-100); color: var(--primary); }
.feature-card:nth-child(2) .feat-icon-lg { background: var(--info-light); color: var(--info); }
.feature-card:nth-child(3) .feat-icon-lg { background: var(--gray-100); color: var(--brand-ink); }

.feature-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.feature-card p  { color: var(--gray-500); font-size: 0.9rem; line-height: 1.6; margin: 0; }

/* Brand message band: value icons + "More than parcels." */
.brand-values {
    max-width: 1100px;
    margin: 0 auto;
    padding: 3rem 2rem 4rem;
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 2.5rem;
    align-items: center;
}

.value-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
}

.value-list li {
    text-align: center;
    font-family: var(--brand-font);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    line-height: 1.6;
    text-transform: uppercase;
    color: var(--gray-500);
}

.value-list svg {
    display: block;
    height: 40px;
    width: auto;
    margin: 0 auto 0.85rem;
    fill: none;
    stroke: var(--brand-ink);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.brand-message {
    font-family: var(--brand-font);
    font-weight: 600;
    font-size: 1.85rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
    padding-left: 2.5rem;
    border-left: 1px solid var(--gray-200);
}

.brand-message p { margin: 0; color: var(--brand-ink); }
.brand-message p + p { color: var(--brand-blue); }
[data-theme="dark"] .brand-message p + p { color: #4DA6F2; }

.landing-footer {
    text-align: center;
    padding: 2rem;
    color: var(--gray-400);
    font-size: 0.8rem;
    border-top: 1px solid var(--gray-100);
}

@media (max-width: 992px) {
    .brand-values { grid-template-columns: 1fr; }
    .brand-message { border-left: 0; padding-left: 0; text-align: center; }
}

@media (max-width: 768px) {
    .landing-hero h1 { font-size: 2.25rem; }
    .landing-features { grid-template-columns: 1fr; }
    .value-list { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 2rem; }
    .brand-message { font-size: 1.45rem; }
}

@media (max-width: 576px) {
    .landing-nav { padding: 1rem; }
    .landing-nav .brand .brand-lockup { font-size: 1.15rem; }
    .landing-nav .nav-actions { gap: 0.5rem; }
    .landing-nav .nav-actions .btn { padding: 0.45rem 0.8rem; white-space: nowrap; }
    .landing-hero .brand-tagline { letter-spacing: 0.2em; }
}

/* ===== Shipment Detail ===== */
.detail-grid {
    display: grid;
    grid-template-columns: 1.3fr 0.7fr;
    gap: 1.5rem;
}

@media (max-width: 992px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.detail-item {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.detail-item:last-child { border-bottom: none; }

.detail-item .dl {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    margin-bottom: 0.15rem;
}

.detail-item .dv {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-900);
}

.address-block h6 {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    margin-bottom: 0.35rem;
}

.address-block p {
    font-size: 0.9rem;
    color: var(--gray-700);
    line-height: 1.5;
    margin: 0;
}

/* Timeline */
.tracking-timeline {
    position: relative;
    padding-left: 2rem;
}

.tracking-timeline::before {
    content: '';
    position: absolute;
    left: 7px; top: 0; bottom: 0;
    width: 2px;
    background: var(--gray-200);
}

.timeline-event {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-event:last-child { padding-bottom: 0; }

.timeline-event .t-dot {
    position: absolute;
    left: -2rem;
    top: 0.15rem;
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: var(--shadow);
}

.t-dot.dot-success { background: var(--success); }
.t-dot.dot-info    { background: var(--info); }
.t-dot.dot-warning { background: var(--warning); }
.t-dot.dot-danger  { background: var(--danger); }
.t-dot.dot-default { background: var(--gray-400); }

.timeline-event h6 {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.1rem;
    color: var(--gray-800);
}

.timeline-event p,
.timeline-event .t-meta {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin: 0;
}

/* ===== Settings ===== */
.settings-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.5rem;
}

@media (max-width: 992px) { .settings-grid { grid-template-columns: 1fr; } }

.api-key-item {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.api-key-item:last-child { margin-bottom: 0; }

.api-key-item .key-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.api-key-item .key-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-700);
}

.api-key-item .key-value {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.78rem;
    color: var(--gray-600);
    background: white;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    word-break: break-all;
}

.api-key-item .key-meta {
    font-size: 0.7rem;
    color: var(--gray-400);
    margin-top: 0.35rem;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
    background: none;
    padding: 0;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.breadcrumb-item a { color: var(--gray-500); }
.breadcrumb-item a:hover { color: var(--primary); }
.breadcrumb-item.active { color: var(--gray-800); font-weight: 600; }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--gray-400);
}

.empty-state .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
}

.empty-state p { font-size: 0.9rem; margin: 0; }

/* ===== Misc ===== */
.text-muted { color: var(--gray-500) !important; }
.fw-semibold { font-weight: 600; }

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 992px) { .metrics-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 576px) { .metrics-grid { grid-template-columns: 1fr; } }
