html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

body {
    margin: 0;
    background: linear-gradient(to bottom, #F0F4F8, #F1F4F9, #F2F3FA);
}

/* ---------- Card ---------- */
.page-card {
    border: none;
    border-radius: 16px;
    background: #fff;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(20,40,80,.06);
}

    .page-card h3 {
        font-weight: 700;
        margin-bottom: 4px;
        color: #23324A;
    }

    .page-card h4 {
        font-weight: 700;
        margin-bottom: 2px;
        color: #23324A;
    }

    .page-card p {
        color: #8B95A7;
        font-size: 13px;
        margin-bottom: 20px;
    }

/* ---------- Form ---------- */
.form-label {
    font-size: 12px;
    letter-spacing: .4px;
    color: #8B95A7;
    margin-bottom: 6px;
}

.form-control,
.form-select {
    height: 44px;
    border: 1px solid #E5EAF3;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: none;
}

    .form-control:focus,
    .form-select:focus {
        border-color: #3F6FD9;
        box-shadow: none;
    }

/* ---------- Buttons ---------- */
.btn {
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(180deg, #3E7BD7 0%, #2E67C8 100%);
    border: none;
    box-shadow: 0 3px 10px rgba(46,103,200,.22);
}

    .btn-primary:hover {
        background: linear-gradient(180deg, #3670C6 0%, #285BB3 100%);
    }

.btn-outline-primary {
    border-color: #C9D6EE;
    color: #3E7BD7;
}

    .btn-outline-primary:hover {
        background: #3E7BD7;
        border-color: #3E7BD7;
    }

.btn-secondary {
    background: #EEF1F6;
    border: none;
    color: #6E7E95;
}

    .btn-secondary:hover {
        background: #E3E8F0;
        color: #45536B;
    }

.btn-group .btn {
    margin-left: 6px;
}

    .btn-group .btn:first-child {
        margin-left: 0;
    }

/* ---------- Table ---------- */
.table-responsive {
    border-radius: 12px;
    border: 1px solid #EEF1F6;
}

table.table {
    margin-bottom: 0;
}

    table.table thead.table-light th {
        background: #F6F8FC;
        color: #6E7E95;
        font-size: 12px;
        letter-spacing: .3px;
        text-transform: uppercase;
        font-weight: 600;
        border-bottom: 1px solid #EEF1F6;
        vertical-align: middle;
    }

    table.table tbody td {
        font-size: 14px;
        color: #33415C;
        vertical-align: middle;
    }

    table.table tbody tr:hover {
        background: #F8FAFF;
    }

/* ---------- Action icon buttons ---------- */
.action-icons {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    justify-content: center;
}

    .action-icons .btn-icon {
        width: 32px;
        height: 32px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        border: none;
        font-size: 15px;
        transition: .15s;
    }

        .action-icons .btn-icon i {
            pointer-events: none;
        }

        .action-icons .btn-icon:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 10px rgba(20,40,80,.15);
        }

/* Tinted variants — soft background, solid icon color */
.btn-icon-edit {
    background: #E9F0FE;
    color: #2E67C8;
}

.btn-icon-bom {
    background: #EAF6EF;
    color: #2FA360;
}

.btn-icon-process {
    background: #FBEFE3;
    color: #D98324;
}

.btn-icon-supplier {
    background: #FDF1E0;
    color: #C98A12;
}

.btn-icon-packing {
    background: #E7F4FA;
    color: #1B93B8;
}

.btn-icon-qc {
    background: #ECEDF4;
    color: #4B5268;
}

.btn-icon-tax {
    background: #FCEAEC;
    color: #D6455D;
}

.btn-icon-edit:hover {
    background: #2E67C8;
    color: #fff;
}

.btn-icon-bom:hover {
    background: #2FA360;
    color: #fff;
}

.btn-icon-process:hover {
    background: #D98324;
    color: #fff;
}

.btn-icon-supplier:hover {
    background: #C98A12;
    color: #fff;
}

.btn-icon-packing:hover {
    background: #1B93B8;
    color: #fff;
}

.btn-icon-qc:hover {
    background: #4B5268;
    color: #fff;
}

.btn-icon-tax:hover {
    background: #D6455D;
    color: #fff;
}

.badge-type {
    background: #EAF0FD;
    color: #3E7BD7;
    font-weight: 600;
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 6px;
}
:root {
    --accent: #6b7280;
    --accent-dark: #4b5563;
    --accent-light: #e5e7eb;
    --primary: #0d6efd;
    --primary-light: #e8f1ff;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border-light: #e5e7eb;
    --bg-page: #f8fafc;
    --sidebar-w: 264px;
    --sidebar-w-collapsed: 80px;
    --topbar-h: 64px;
    --sidebar-bg: #111827;
    --sidebar-bg-soft: #1a2333;
    --sidebar-text: #b6bfcc;
    --sidebar-text-active: #ffffff;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-page);
    color: var(--text-dark);
}

a {
    text-decoration: none;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-soft));
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: width 0.2s ease, transform 0.2s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

    .sidebar-brand .logo-box {
        width: 36px;
        height: 36px;
        border-radius: 9px;
        background: var(--primary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 800;
        color: #fff;
        font-size: 14px;
        flex-shrink: 0;
    }

    .sidebar-brand .brand-text {
        color: #fff;
        font-weight: 700;
        font-size: 16px;
        letter-spacing: 0.01em;
        white-space: nowrap;
        overflow: hidden;
    }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
}

    .sidebar-nav::-webkit-scrollbar {
        width: 5px;
    }

    .sidebar-nav::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,0.12);
        border-radius: 4px;
    }

.nav-section-label {
    color: #5b6679;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 14px 12px 6px;
}

.nav-link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

    .nav-link-item i.bi {
        font-size: 16px;
        width: 18px;
        text-align: center;
        flex-shrink: 0;
    }

    .nav-link-item:hover {
        background: rgba(255,255,255,0.06);
        color: #fff;
    }

    .nav-link-item.active {
        background: var(--primary);
        color: #fff;
    }

    .nav-link-item .chevron {
        margin-left: auto;
        font-size: 12px;
        transition: transform 0.2s ease;
    }

    .nav-link-item .chevron {
        transition: .25s;
    }


.nav-submenu {
    display: none;
    padding-left: 30px;
}

    .nav-submenu.open {
        display: block;
    }

.menu-toggle.open .chevron {
    transform: rotate(90deg);
}

.menu-toggle .chevron {
    transition: .25s;
}

.nav-submenu {
    margin-top: 2px;
    margin-bottom: 6px;
}

    .nav-submenu .nav-link-item {
        font-size: 13.5px;
        padding: 8px 12px;
    }

.sidebar-user {
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.18);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

    .sidebar-user .avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: var(--accent);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 14px;
        flex-shrink: 0;
    }

    .sidebar-user .user-meta {
        overflow: hidden;
        line-height: 1.25;
    }

    .sidebar-user .user-name {
        color: #fff;
        font-size: 13.5px;
        font-weight: 600;
        white-space: nowrap;
    }

    .sidebar-user .user-company {
        color: #8b95a5;
        font-size: 11.5px;
        white-space: nowrap;
    }

    .sidebar-user .logout-link {
        margin-left: auto;
        color: #b6bfcc;
        font-size: 16px;
        padding: 6px;
        border-radius: 6px;
        flex-shrink: 0;
    }

        .sidebar-user .logout-link:hover {
            color: #fff;
            background: rgba(255,255,255,0.08);
        }

/* ===================== TOPBAR ===================== */
.topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-w);
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    z-index: 1030;
    transition: left 0.2s ease;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    background: var(--bg-page);
    border: 1px solid var(--border-light);
    color: var(--text-dark);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
}

    .sidebar-toggle:hover {
        background: var(--accent-light);
    }

.breadcrumb-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
}

.breadcrumb-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    border: none;
    background: transparent;
    position: relative;
}

    .topbar-icon-btn:hover {
        background: var(--bg-page);
        color: var(--text-dark);
    }

.topbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-light);
    margin: 0 4px;
}

.topbar-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
}

    .topbar-user-btn:hover {
        background: var(--bg-page);
    }

    .topbar-user-btn .avatar-sm {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: var(--primary);
        color: #fff;
        font-weight: 700;
        font-size: 13px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

/* Quick access grid dropdown */
.quick-grid {
    width: 320px;
    padding: 16px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

.quick-grid-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.quick-grid-items {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.quick-grid-box {
    background: var(--bg-page);
    border-radius: 10px;
    text-align: center;
    padding: 16px 8px;
    color: var(--text-dark);
    font-size: 12.5px;
    font-weight: 600;
    transition: all 0.15s ease;
}

    .quick-grid-box i {
        font-size: 22px;
        display: block;
        margin-bottom: 6px;
        color: var(--primary);
    }

    .quick-grid-box:hover {
        background: var(--primary);
        color: #fff;
    }

        .quick-grid-box:hover i {
            color: #fff;
        }

.history-dropdown {
    width: 280px;
    padding: 8px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

    .history-dropdown .dropdown-header {
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--text-muted);
        letter-spacing: 0.05em;
    }

    .history-dropdown .dropdown-item {
        font-size: 13.5px;
        border-radius: 8px;
        padding: 8px 10px;
    }

        .history-dropdown .dropdown-item:hover {
            background: var(--bg-page);
        }

.user-dropdown-menu {
    width: 220px;
    padding: 8px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

    .user-dropdown-menu .dropdown-item {
        font-size: 13.5px;
        border-radius: 8px;
        padding: 9px 10px;
        display: flex;
        align-items: center;
        gap: 10px;
    }

        .user-dropdown-menu .dropdown-item:hover {
            background: var(--bg-page);
        }

        .user-dropdown-menu .dropdown-item.text-danger:hover {
            background: #fdecea;
        }

/* ===================== CONTENT ===================== */
.app-content {
    margin-left: var(--sidebar-w);
    padding-top: var(--topbar-h);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.2s ease;
}

.content-body {
    flex: 1;
    padding: 22px 26px;
}

.app-footer {
    padding: 14px 26px;
    font-size: 12.5px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

    .app-footer a {
        color: var(--primary);
        font-weight: 600;
    }

/* ===================== COLLAPSED SIDEBAR (desktop) ===================== */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-w-collapsed);
}

body.sidebar-collapsed .topbar {
    left: var(--sidebar-w-collapsed);
}

body.sidebar-collapsed .app-content {
    margin-left: var(--sidebar-w-collapsed);
}

body.sidebar-collapsed .sidebar-brand .brand-text,
body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .nav-link-item span,
body.sidebar-collapsed .nav-link-item .chevron,
body.sidebar-collapsed .nav-submenu,
body.sidebar-collapsed .sidebar-user .user-meta,
body.sidebar-collapsed .sidebar-user .logout-link {
    display: none;
}

body.sidebar-collapsed .nav-link-item {
    justify-content: center;
}

body.sidebar-collapsed .sidebar-user {
    justify-content: center;
}

/* ===================== MOBILE ===================== */
@@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-mobile-open .sidebar {
        transform: translateX(0);
    }

    .topbar, .app-content {
        left: 0;
        margin-left: 0;
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1035;
    }

    body.sidebar-mobile-open .sidebar-backdrop {
        display: block;
    }

    .breadcrumb-sub {
        display: none;
    }
}