/* ==========================================================================
   Clove Technologies theme
   Orange ramp taken from the brand swoosh, charcoal from the wordmark,
   plus a set of accent colours for stats and charts.
   ========================================================================== */

:root {
    --clove-900: #c25e0a;
    --clove-700: #e8730f;
    --clove-600: #f3821f;   /* deepest swoosh tone */
    --clove-500: #f79433;
    --clove-400: #f9a64a;
    --clove-300: #fab967;
    --clove-200: #fdce7d;   /* lightest swoosh tone */
    --clove-100: #fff1dc;
    --clove-50:  #fff8ef;

    --ink:       #1d1d1f;   /* wordmark charcoal */
    --ink-soft:  #4b4b52;
    --surface:   #ffffff;
    --page:      #fbf8f4;
    --line:      #efe6db;

    --accent-teal:   #14b8a6;
    --accent-violet: #8b5cf6;
    --accent-sky:    #0ea5e9;
    --accent-rose:   #f43f5e;
    --accent-green:  #22c55e;
    --accent-amber:  #f59e0b;

    --clove-gradient: linear-gradient(135deg, var(--clove-200) 0%, var(--clove-400) 45%, var(--clove-600) 100%);

    /* Bootstrap overrides */
    --bs-primary: var(--clove-600);
    --bs-primary-rgb: 243, 130, 31;
    --bs-link-color: var(--clove-700);
    --bs-link-color-rgb: 232, 115, 15;
    --bs-link-hover-color: var(--clove-900);
    --bs-link-hover-color-rgb: 194, 94, 10;
    --bs-body-font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--page);
    --bs-border-color: var(--line);
    --bs-info-rgb: 14, 165, 233;
    --bs-success-rgb: 34, 197, 94;
    --bs-danger-rgb: 244, 63, 94;
    --bs-warning-rgb: 245, 158, 11;
    --bs-secondary-rgb: 139, 92, 246;
}

html, body {
    min-height: 100%;
}

body {
    min-height: 100vh;
    background: var(--page);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* Decorative swoosh in the top-right corner */
.bg-swoosh {
    position: fixed;
    top: -40px;
    right: -60px;
    width: 340px;
    max-width: 45vw;
    opacity: .14;
    pointer-events: none;
    z-index: 0;
}

/* No z-index here: it would trap Bootstrap modals beneath their backdrop. */
.app-wrap {
    position: relative;
    flex: 1 0 auto;
}

.app-main {
    position: relative;
    padding-top: 1.75rem;
    padding-bottom: 2.5rem;
}

/* ---------- Sidebar layout (signed in) ---------- */
.app-navbar-inner {
    max-width: 1600px;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.app-shell {
    display: flex;
    align-items: flex-start;
    gap: 1.75rem;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.app-main-shell {
    flex: 1 1 auto;
    min-width: 0;
}

.app-sidebar {
    --sidebar-top: 88px;
}

@media (min-width: 992px) {
    .app-sidebar {
        flex: 0 0 236px;
        width: 236px;
        position: sticky;
        top: var(--sidebar-top);
        margin-top: 1.75rem;
        align-self: flex-start;
    }

    .app-sidebar .offcanvas-body {
        padding: 0;
        overflow: visible;
    }
}

@media (max-width: 991.98px) {
    .app-shell {
        display: block;
        padding: 0 1rem;
    }

    .app-sidebar {
        --bs-offcanvas-width: 270px;
        background: var(--page);
    }

    .app-sidebar .offcanvas-header {
        border-bottom: 1px solid var(--line);
    }
}

/* The floating card holding the tabs */
.sidebar-card {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    padding: 1rem .75rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 14px 36px rgba(194, 94, 10, .10), 0 2px 6px rgba(29, 29, 31, .04);
    position: relative;
    overflow: hidden;
}

.sidebar-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: var(--clove-gradient);
}

.sidebar-section {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #a39a90;
    padding: .25rem .6rem .35rem;
}

.side-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .5rem .6rem;
    border-radius: 14px;
    color: var(--ink-soft);
    font-weight: 500;
    text-decoration: none;
    transition: background-color .15s, color .15s, transform .15s;
}

.side-link:hover {
    color: var(--clove-900);
    background: var(--clove-50);
    transform: translateX(2px);
}

.side-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--icon-color);
    background: var(--icon-bg);
    transition: background .15s, color .15s;
}

.icon-orange { --icon-color: var(--clove-700);    --icon-bg: var(--clove-100); }
.icon-teal   { --icon-color: #0f766e;             --icon-bg: #ddf7f3; }
.icon-sky    { --icon-color: #0369a1;             --icon-bg: #e0f2fe; }
.icon-amber  { --icon-color: #b45309;             --icon-bg: #fef3c7; }
.icon-violet { --icon-color: #6d28d9;             --icon-bg: #ede9fe; }
.icon-rose   { --icon-color: #be123c;             --icon-bg: #ffe4e6; }

.side-link.active {
    color: #fff;
    background: var(--clove-gradient);
    box-shadow: 0 8px 18px rgba(243, 130, 31, .32);
}

.side-link.active .side-icon {
    color: #fff;
    background: rgba(255, 255, 255, .25);
}

.sidebar-toggler {
    border: none;
    padding: .25rem .4rem;
    color: var(--ink);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--ink);
}

h3 {
    position: relative;
}

/* Small orange bar under page titles */
.app-main > div:first-of-type h3::after,
.app-main > h3::after {
    content: "";
    display: block;
    width: 44px;
    height: 4px;
    margin-top: 6px;
    border-radius: 4px;
    background: var(--clove-gradient);
}

/* Titles that carry badges (flex rows) don't get the underline. */
.app-main h3.d-flex::after {
    display: none;
}

/* ---------- Navbar ---------- */
.app-navbar {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 2px 18px rgba(243, 130, 31, .08);
    padding-top: .6rem;
    padding-bottom: .6rem;
    z-index: 1030;
}

.app-navbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -3px;
    height: 3px;
    background: linear-gradient(90deg, var(--clove-200), var(--clove-400), var(--clove-600), var(--clove-400), var(--clove-200));
}

.brand-logo {
    height: 36px;
    width: auto;
}

.brand-divider {
    width: 1px;
    height: 26px;
    background: var(--line);
}

.brand-app {
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--clove-600);
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-weight: 500;
    color: var(--ink);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-violet), var(--accent-sky));
}

.role-badge {
    background: var(--clove-100);
    color: var(--clove-900);
    border: 1px solid var(--clove-300);
    font-weight: 600;
}

/* ---------- Footer ---------- */
.app-footer {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    padding: 1rem 0;
    font-size: .85rem;
    color: var(--ink-soft);
    border-top: 1px solid var(--line);
    background: var(--surface);
}

.footer-dots {
    display: inline-flex;
    gap: 6px;
}

.footer-dots i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.footer-dots i:nth-child(1) { background: var(--clove-600); }
.footer-dots i:nth-child(2) { background: var(--accent-teal); }
.footer-dots i:nth-child(3) { background: var(--accent-violet); }
.footer-dots i:nth-child(4) { background: var(--accent-sky); }
.footer-dots i:nth-child(5) { background: var(--accent-rose); }

/* ---------- Buttons ---------- */
.btn {
    border-radius: 10px;
    font-weight: 500;
}

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--clove-600);
    --bs-btn-border-color: var(--clove-600);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--clove-700);
    --bs-btn-hover-border-color: var(--clove-700);
    --bs-btn-active-bg: var(--clove-900);
    --bs-btn-active-border-color: var(--clove-900);
    --bs-btn-disabled-bg: var(--clove-300);
    --bs-btn-disabled-border-color: var(--clove-300);
    --bs-btn-focus-shadow-rgb: 243, 130, 31;
    background-image: linear-gradient(135deg, var(--clove-400), var(--clove-600));
    border: none;
    box-shadow: 0 4px 14px rgba(243, 130, 31, .28);
}

.btn-primary:hover {
    background-image: linear-gradient(135deg, var(--clove-500), var(--clove-700));
}

.btn-outline-primary {
    --bs-btn-color: var(--clove-700);
    --bs-btn-border-color: var(--clove-400);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--clove-600);
    --bs-btn-hover-border-color: var(--clove-600);
    --bs-btn-active-bg: var(--clove-700);
    --bs-btn-active-border-color: var(--clove-700);
    --bs-btn-focus-shadow-rgb: 243, 130, 31;
}

.btn-secondary {
    --bs-btn-color: var(--ink);
    --bs-btn-bg: #f1ece6;
    --bs-btn-border-color: #f1ece6;
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-bg: #e6ded4;
    --bs-btn-hover-border-color: #e6ded4;
}

/* Scan / Upload buttons next to fields */
.btn-outline-secondary {
    --bs-btn-color: var(--ink-soft);
    --bs-btn-border-color: var(--bs-border-color);
    --bs-btn-bg: var(--surface);
}

.scan-btn {
    --bs-btn-color: var(--clove-700);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--clove-600);
    --bs-btn-hover-border-color: var(--clove-600);
    --bs-btn-active-bg: var(--clove-700);
}

.upload-btn,
.upload-item {
    --bs-btn-color: #0f766e;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--accent-teal);
    --bs-btn-hover-border-color: var(--accent-teal);
    --bs-btn-active-bg: #0f766e;
}

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

.input-group > .btn:last-child {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

/* ---------- Forms ---------- */
.form-control,
.form-select {
    border-radius: 10px;
    border-color: #e7ddd1;
    background-color: var(--surface);
    padding-top: .55rem;
    padding-bottom: .55rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--clove-400);
    box-shadow: 0 0 0 .2rem rgba(243, 130, 31, .18);
}

.form-check-input:checked {
    background-color: var(--clove-600);
    border-color: var(--clove-600);
}

/* "+ Add new…" dropdown entry and its inline box */
select[data-allow-new] option[value="__new__"] {
    font-weight: 600;
    color: var(--clove-700);
}

.add-option-box {
    max-width: 640px;
    padding: .6rem .75rem .5rem;
    margin-top: .5rem;
    border: 1px dashed var(--clove-300);
    border-radius: 12px;
    background: var(--clove-50);
}

.add-option-box .input-group {
    margin-top: 0 !important;
}

.add-option-box .input-group-text {
    background: var(--surface);
    color: var(--clove-900);
    font-weight: 500;
}

.validation-summary-valid {
    display: none;
}

.form-label {
    font-weight: 500;
    color: var(--ink-soft);
    margin-bottom: .35rem;
}

/* Forms posted on a plain page get a card look */
.app-main > form {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 6px 24px rgba(29, 29, 31, .04);
}

/* ---------- Cards ---------- */
.card {
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 6px 24px rgba(29, 29, 31, .04);
    background: var(--surface);
}

.card.border-0 {
    border: 1px solid var(--line) !important;
}

.card-title {
    font-weight: 600;
}

/* ---------- Tables ---------- */
.table {
    --bs-table-hover-bg: var(--clove-50);
}

.table > thead th {
    background: var(--clove-50);
    color: var(--clove-900);
    font-weight: 600;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-bottom: 2px solid var(--clove-200);
}

table.table td, table.table th {
    vertical-align: middle;
}

.table-responsive,
.app-main > .table {
    border-radius: 14px;
    background: var(--surface);
}

/* ---------- Misc Bootstrap tweaks ---------- */
.badge.bg-secondary {
    background: var(--accent-violet) !important;
}

.progress {
    background: #f3ece4;
    border-radius: 999px;
}

.progress-bar {
    background: var(--clove-gradient);
    border-radius: 999px;
}

.progress-bar.bg-success { background: linear-gradient(90deg, #86efac, var(--accent-green)) !important; }
.progress-bar.bg-info    { background: linear-gradient(90deg, #7dd3fc, var(--accent-sky)) !important; }
.progress-bar.bg-warning { background: linear-gradient(90deg, var(--clove-200), var(--accent-amber)) !important; }
.progress-bar.bg-danger  { background: linear-gradient(90deg, #fda4af, var(--accent-rose)) !important; }

.alert {
    border-radius: 12px;
    border: none;
}

.alert-success { background: #e9f9ef; color: #166534; }
.alert-danger  { background: #fdecef; color: #9f1239; }
.alert-warning { background: var(--clove-100); color: var(--clove-900); }

.modal-content {
    border-radius: 18px;
    border: none;
    overflow: hidden;
}

.modal-header {
    background: var(--clove-gradient);
    color: #fff;
    border-bottom: none;
}

.modal-header .modal-title {
    color: #fff;
}

.modal-header .btn-close {
    filter: invert(1) grayscale(1) brightness(2);
}

.list-group-item-action:hover {
    background: var(--clove-50);
}

.page-link {
    color: var(--clove-700);
}

.active > .page-link,
.page-link.active {
    background: var(--clove-600);
    border-color: var(--clove-600);
}

/* ---------- Dashboard stat cards ---------- */
.stat-card {
    overflow: hidden;
    position: relative;
    transition: transform .15s, box-shadow .15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(29, 29, 31, .08);
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: var(--stat-color, var(--clove-600));
}

.stat-card .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
    background: var(--stat-color, var(--clove-600));
    box-shadow: 0 6px 14px var(--stat-shadow, rgba(243, 130, 31, .3));
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ink);
}

.stat-card .text-uppercase {
    letter-spacing: .04em;
    font-size: .72rem;
}

.stat-orange { --stat-color: linear-gradient(135deg, var(--clove-400), var(--clove-600)); --stat-shadow: rgba(243, 130, 31, .3); }
.stat-teal   { --stat-color: linear-gradient(135deg, #5eead4, var(--accent-teal));        --stat-shadow: rgba(20, 184, 166, .3); }
.stat-sky    { --stat-color: linear-gradient(135deg, #7dd3fc, var(--accent-sky));         --stat-shadow: rgba(14, 165, 233, .3); }
.stat-violet { --stat-color: linear-gradient(135deg, #c4b5fd, var(--accent-violet));      --stat-shadow: rgba(139, 92, 246, .3); }
.stat-amber  { --stat-color: linear-gradient(135deg, var(--clove-200), var(--accent-amber)); --stat-shadow: rgba(245, 158, 11, .3); }
.stat-rose   { --stat-color: linear-gradient(135deg, #fda4af, var(--accent-rose));        --stat-shadow: rgba(244, 63, 94, .3); }

/* ---------- Login ---------- */
.auth-body .bg-swoosh {
    width: 620px;
    max-width: 70vw;
    top: -80px;
    right: -120px;
    opacity: .9;
}

.auth-wrap {
    min-height: calc(100vh - 220px);
    display: flex;
    align-items: center;
}

.auth-card {
    border: none;
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(194, 94, 10, .18);
    overflow: hidden;
}

.auth-card .auth-side {
    background: var(--clove-gradient);
    color: #fff;
    padding: 2.5rem 2rem;
    position: relative;
}

.auth-card .auth-side h2 {
    color: #fff;
    font-weight: 700;
}

.auth-card .auth-side ul {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0;
}

.auth-card .auth-side li {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .75rem;
}

.auth-card .auth-side li i {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .22);
}

.auth-logo {
    height: 48px;
}

/* ---------- Scanner ---------- */
.scan-stage {
    position: relative;
    width: 100%;
    min-height: 280px;
    border-radius: 14px;
    overflow: hidden;
    background: #111;
}

#fieldReader {
    width: 100%;
    min-height: 280px;
    border: none !important;
}

#fieldReader video {
    width: 100% !important;
    display: block;
    object-fit: cover;
}

/* The library draws the scan box with these shaded borders */
#fieldReader #qr-shaded-region {
    border-color: rgba(0, 0, 0, .45) !important;
}

#fieldReader #qr-shaded-region > div {
    background-color: var(--clove-400) !important;
}

.scan-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: 1.5rem;
    text-align: center;
    color: #f5efe8;
    background: radial-gradient(circle at 50% 40%, #3a2a1c 0%, #141210 70%);
}

.scan-placeholder i {
    font-size: 2.4rem;
    color: var(--clove-400);
}

.scan-placeholder span {
    max-width: 420px;
    font-size: .95rem;
}

.scan-camera-picker {
    width: auto;
    flex: 1 1 220px;
    max-width: 340px;
}

/* Batch Scan: tabs, inline camera, item list */
.scan-tabs {
    display: flex;
    gap: .35rem;
    padding: .3rem;
    background: var(--clove-50);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.scan-tabs .nav-item {
    flex: 1 1 0;
}

.scan-tabs .nav-link {
    width: 100%;
    border: none;
    border-radius: 11px;
    padding: .55rem .75rem;
    font-weight: 600;
    color: var(--ink-soft);
    background: transparent;
    transition: background .15s, color .15s;
}

.scan-tabs .nav-link:hover {
    color: var(--clove-900);
}

.scan-tabs .nav-link.active {
    color: #fff;
    background: var(--clove-gradient);
    box-shadow: 0 6px 14px rgba(243, 130, 31, .3);
}

.batch-camera-picker {
    width: auto;
    flex: 1 1 220px;
    max-width: 360px;
}

#batchReader {
    width: 100%;
    min-height: 280px;
    border: none !important;
}

#batchReader video {
    width: 100% !important;
    display: block;
    object-fit: cover;
}

#batchReader #qr-shaded-region > div {
    background-color: var(--clove-400) !important;
}

.scan-placeholder .btn {
    margin-top: .25rem;
}

.photo-video {
    width: 100%;
    min-height: 280px;
    max-height: 420px;
    display: block;
    object-fit: cover;
    background: #111;
}

.photo-flash {
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: 0;
    pointer-events: none;
}

.photo-flash.on {
    animation: photo-flash .35s ease-out;
}

@keyframes photo-flash {
    from { opacity: .85; }
    to   { opacity: 0; }
}

.batch-items {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-height: 340px;
    overflow-y: auto;
}

.batch-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .4rem .5rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.batch-thumb {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid var(--clove-200);
}

.batch-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b9aea3;
    background: var(--clove-50);
    border: 2px dashed #e7ddd1;
}

.batch-tag {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.batch-index {
    flex: 0 0 auto;
    min-width: 24px;
    height: 24px;
    padding: 0 .35rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 600;
    color: var(--clove-900);
    background: var(--clove-100);
}

.camera-badge {
    background: #ddf7f3;
    color: #0f766e;
    font-weight: 600;
}

.scan-result {
    min-height: 1.5rem;
    font-weight: 500;
    font-size: .95rem;
}

.scan-result-ok {
    color: #15803d;
}

.scan-result-ok::before {
    content: "\2713  ";
}

.scan-result-error {
    color: #be123c;
}

/* ---------- Images ---------- */
.thumb {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 10px;
}

.preview-box {
    position: relative;
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
}

.preview-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    object-position: center;
    display: block;
    border-radius: 12px;
    border: 2px solid var(--clove-200);
    background: var(--clove-50);
    box-shadow: 0 4px 10px rgba(243, 130, 31, .15);
}

.preview-remove {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 20px;
    height: 20px;
    padding: 0;
    line-height: 1;
    font-size: 14px;
    border: none;
    border-radius: 50%;
    background: var(--accent-rose);
    color: #fff;
    cursor: pointer;
}

.gallery-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    object-position: center;
    display: block;
}

.edit-thumb {
    width: 100%;
    height: 120px;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Let field rows shrink instead of pushing the page wider */
.input-group.flex-grow-1 {
    min-width: 0;
}

/* ---------- Asset movement (Incoming / Outgoing / Approvals) ---------- */
.icon-green { --icon-color: #15803d; --icon-bg: #dcfce7; }

.side-count {
    margin-left: auto;
    min-width: 22px;
    height: 22px;
    padding: 0 .4rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    color: #fff;
    background: var(--accent-rose);
    box-shadow: 0 3px 8px rgba(244, 63, 94, .35);
}

.side-link.active .side-count {
    background: #fff;
    color: var(--accent-rose);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .22rem .6rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 500;
    white-space: nowrap;
}

.status-pill.strong {
    font-weight: 700;
}

.status-pending   { background: #fef3c7; color: #92400e; }
.status-approved  { background: #dcfce7; color: #166534; }
.status-rejected  { background: #ffe4e6; color: #9f1239; }
.status-cancelled { background: #f1f0ee; color: #57534e; }
.status-all       { background: var(--clove-100); color: var(--clove-900); }

.status-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.status-filter {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .5rem .4rem .9rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: .9rem;
    text-decoration: none;
    border: 2px solid transparent;
    opacity: .75;
    transition: opacity .15s, border-color .15s, transform .15s;
}

.status-filter:hover {
    opacity: 1;
    transform: translateY(-1px);
}

.status-filter.active {
    opacity: 1;
    border-color: currentColor;
}

.status-filter .count {
    min-width: 26px;
    padding: .05rem .45rem;
    border-radius: 999px;
    text-align: center;
    background: rgba(255, 255, 255, .75);
}

.movement-table tbody tr.needs-me {
    background: #fffbeb;
    box-shadow: inset 4px 0 0 var(--accent-amber);
}

.needs-me-badge {
    background: var(--accent-amber);
    color: #fff;
}

.dir-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .6rem;
    border-radius: 8px;
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
}

.dir-in  { background: #dcfce7; color: #15803d; }
.dir-out { background: #ffe4e6; color: #be123c; }

.loc-chip {
    display: inline-block;
    padding: .1rem .5rem;
    border-radius: 6px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    vertical-align: middle;
}

.loc-in  { background: #dcfce7; color: #15803d; }
.loc-out { background: #ffe4e6; color: #be123c; }
.loc-new { background: #e0f2fe; color: #0369a1; }

/* Send assets for approval (Assets page) */
.send-out {
    --bs-btn-color: #be123c;
    --bs-btn-bg: #fff1f2;
    --bs-btn-border-color: #fecdd3;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--accent-rose);
    --bs-btn-hover-border-color: var(--accent-rose);
    --bs-btn-active-bg: #be123c;
    --bs-btn-disabled-color: #be123c;
    --bs-btn-disabled-bg: #fff1f2;
    --bs-btn-disabled-border-color: #fecdd3;
}

.send-in {
    --bs-btn-color: #15803d;
    --bs-btn-bg: #f0fdf4;
    --bs-btn-border-color: #bbf7d0;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--accent-green);
    --bs-btn-hover-border-color: var(--accent-green);
    --bs-btn-active-bg: #15803d;
    --bs-btn-disabled-color: #15803d;
    --bs-btn-disabled-bg: #f0fdf4;
    --bs-btn-disabled-border-color: #bbf7d0;
}

.send-out .badge,
.send-in .badge {
    background: rgba(0, 0, 0, .08);
    color: inherit;
}

.pending-btn {
    --bs-btn-color: #92400e;
    --bs-btn-bg: #fef3c7;
    --bs-btn-border-color: #fde68a;
    --bs-btn-hover-color: #78350f;
    --bs-btn-hover-bg: #fde68a;
    --bs-btn-hover-border-color: #fcd34d;
}

.send-bar {
    position: sticky;
    top: 76px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    padding: .55rem .8rem;
    margin-bottom: .75rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 4px 14px rgba(29, 29, 31, .04);
    transition: border-color .15s, box-shadow .15s;
}

.send-bar.has-selection {
    border-color: var(--clove-300);
    box-shadow: 0 8px 22px rgba(243, 130, 31, .16);
}

.send-bar-text {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--ink-soft);
    font-size: .92rem;
}

.send-bar-text i {
    color: var(--clove-600);
    font-size: 1.1rem;
}

.pending-chip {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    margin-left: .25rem;
    padding: .1rem .45rem;
    border-radius: 6px;
    font-size: .72rem;
    font-weight: 600;
    color: #92400e;
    background: #fef3c7;
    text-decoration: none;
}

.pending-chip:hover {
    background: #fde68a;
    color: #78350f;
}

tr.row-picked > td {
    background: var(--clove-50) !important;
}

/* ---------- Dashboard: asset movement ---------- */
.flow-card {
    border-top: 4px solid var(--flow-color) !important;
}

.flow-in  { --flow-color: var(--accent-green); --flow-bg: #dcfce7; --flow-fg: #15803d; }
.flow-out { --flow-color: var(--accent-rose);  --flow-bg: #ffe4e6; --flow-fg: #be123c; }

.flow-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--flow-fg, #6d28d9);
    background: var(--flow-bg, #ede9fe);
}

.flow-icon-violet { --flow-fg: #6d28d9; --flow-bg: #ede9fe; }

.approvals-card {
    border-top: 4px solid var(--accent-violet) !important;
}

.flow-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
}

.flow-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: .55rem .25rem;
    border-radius: 12px;
    font-size: .75rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform .15s;
}

.flow-stat:hover {
    transform: translateY(-2px);
}

.flow-num {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.team-row {
    margin-top: .6rem;
}

.team-admin .progress-bar    { background: var(--clove-gradient); }
.team-security .progress-bar { background: linear-gradient(90deg, #c4b5fd, var(--accent-violet)); }
.team-it .progress-bar       { background: linear-gradient(90deg, #5eead4, var(--accent-teal)); }

.inout-bar {
    display: flex;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: #f3ece4;
}

.inout-in  { background: var(--accent-green); }
.inout-out { background: var(--accent-rose); }

/* ---------- Columns: drag and drop ---------- */
.column-palette {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.palette-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .75rem;
    border: 1px dashed var(--clove-300);
    border-radius: 999px;
    background: var(--clove-50);
    color: var(--ink);
    font-size: .88rem;
    font-weight: 500;
    cursor: grab;
    user-select: none;
    transition: background .15s, border-color .15s, transform .15s, box-shadow .15s;
}

.palette-chip:hover,
.palette-chip:focus-visible {
    background: var(--clove-100);
    border-style: solid;
    border-color: var(--clove-500);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(243, 130, 31, .18);
    outline: none;
}

.palette-chip i {
    color: var(--clove-700);
}

.palette-opts {
    min-width: 20px;
    padding: 0 .35rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
    text-align: center;
    color: #fff;
    background: var(--clove-500);
}

.palette-chip-dropped {
    opacity: .6;
    pointer-events: none;
}

.column-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    min-height: 60px;
}

.column-item {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    transition: box-shadow .15s, border-color .15s;
}

.column-item:hover {
    border-color: var(--clove-200);
    box-shadow: 0 4px 12px rgba(29, 29, 31, .05);
}

/* A ready-made chip dropped into the list, shown as a row while it is created */
.column-list > .palette-chip {
    display: flex;
    border-radius: 14px;
    padding: .7rem .9rem;
}

.column-row {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem .7rem;
}

.drag-handle {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 36px;
    border-radius: 8px;
    color: #b9aea3;
    font-size: 1.2rem;
    cursor: grab;
    touch-action: none;
}

.drag-handle:hover {
    color: var(--clove-700);
    background: var(--clove-50);
}

.column-pos {
    flex: 0 0 auto;
    min-width: 26px;
    height: 26px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    font-weight: 700;
    color: var(--clove-900);
    background: var(--clove-100);
}

.column-main {
    flex: 1 1 auto;
    min-width: 0;
}

.column-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.column-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    margin-top: .15rem;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .05rem .5rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 500;
    color: var(--ink-soft);
    background: #f4efe9;
}

.meta-dropdown { color: #0369a1; background: #e0f2fe; }
.meta-required { color: #92400e; background: #fef3c7; }
.meta-count    { color: #6d28d9; background: #ede9fe; }

.column-actions {
    flex: 0 0 auto;
    display: flex;
    gap: .3rem;
}

.column-edit {
    padding: .25rem .9rem .9rem 4.6rem;
}

.drag-ghost {
    opacity: .45;
    border: 2px dashed var(--clove-400) !important;
    background: var(--clove-50) !important;
}

.drag-chosen {
    box-shadow: 0 12px 28px rgba(243, 130, 31, .25) !important;
}

.column-drop-hint {
    display: none;
    margin-top: .5rem;
    padding: .9rem;
    border: 2px dashed var(--clove-300);
    border-radius: 14px;
    text-align: center;
    color: var(--clove-700);
    background: var(--clove-50);
    font-weight: 500;
}

body.is-dragging .column-drop-hint,
.column-list.is-empty + .column-drop-hint {
    display: block;
}

.save-state {
    font-size: .85rem;
    font-weight: 500;
    color: var(--ink-soft);
}

.save-ok    { color: #15803d; }
.save-error { color: #be123c; }

@media (max-width: 575.98px) {
    .column-edit {
        padding-left: .9rem;
    }
}

/* ---------- Assets: List / Grid ---------- */
.view-switch {
    display: inline-flex;
    padding: .2rem;
    gap: .2rem;
    border-radius: 11px;
    background: var(--clove-50);
    border: 1px solid var(--line);
}

.view-switch button {
    border: none;
    background: transparent;
    padding: .35rem .75rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: .9rem;
    color: var(--ink-soft);
}

.view-switch button.active {
    color: #fff;
    background: var(--clove-gradient);
    box-shadow: 0 3px 8px rgba(243, 130, 31, .3);
}

.btn-xs {
    --bs-btn-padding-y: .2rem;
    --bs-btn-padding-x: .45rem;
    --bs-btn-font-size: .8rem;
    --bs-btn-border-radius: 8px;
}

/* List: columns size to their content, table fills the width, grid lines */
.assets-table-wrap {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    max-height: calc(100vh - 260px);
    overflow: auto;
}

.assets-table {
    width: 100%;
    table-layout: auto;
    font-size: .88rem;
    --bs-table-border-color: #eee5da;
    border-collapse: separate;
    border-spacing: 0;
}

.assets-table > :not(caption) > * > * {
    padding: .4rem .5rem;
}

.assets-table > thead th.col-pick,
.assets-table > thead th.col-num,
.assets-table > thead th.col-pics,
.assets-table > thead th.col-actions {
    min-width: 0;
}

.assets-table > thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    /* Long headings wrap so empty columns stay narrow */
    white-space: normal;
    min-width: 58px;
    line-height: 1.25;
    vertical-align: bottom;
    font-size: .72rem;
    background: var(--clove-50);
}

.assets-table.table-bordered > :not(caption) > * {
    border-width: 0;
}

.assets-table.table-bordered > :not(caption) > * > * {
    border-width: 0 1px 1px 0;
}

.assets-table .cell-clip {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.assets-table .col-pick,
.assets-table .col-num,
.assets-table .col-pics {
    width: 1%;
    white-space: nowrap;
    text-align: center;
}

.assets-table .col-actions {
    width: 1%;
    white-space: nowrap;
}

/* Keep the tick box and the actions visible while scrolling sideways */
.assets-table .col-pick {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--surface);
}

.assets-table .col-actions {
    position: sticky;
    right: 0;
    z-index: 1;
    background: var(--surface);
    box-shadow: -6px 0 8px -6px rgba(29, 29, 31, .15);
}

.assets-table > thead .col-pick,
.assets-table > thead .col-actions {
    z-index: 3;
    background: var(--clove-50);
}

.row-actions {
    display: flex;
    gap: .25rem;
}

.thumb-sm {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 8px;
}

/* Grid: cards fill the row and wrap automatically */
.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1rem;
}

.asset-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 6px 18px rgba(29, 29, 31, .04);
    overflow: hidden;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}

.asset-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(29, 29, 31, .08);
}

.asset-card.row-picked {
    border-color: var(--clove-400);
    box-shadow: 0 0 0 3px rgba(243, 130, 31, .18);
}

.asset-card-media {
    position: relative;
    aspect-ratio: 16 / 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--clove-50), var(--clove-100));
    color: var(--clove-300);
    font-size: 2.4rem;
}

.asset-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.asset-card-pick {
    position: absolute;
    top: .5rem;
    left: .5rem;
    padding: .25rem .35rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, .92);
    line-height: 1;
    cursor: pointer;
}

.asset-card-pick .form-check-input {
    margin: 0;
}

.asset-card-status {
    position: absolute;
    top: .55rem;
    right: .55rem;
}

.asset-card-pics {
    position: absolute;
    bottom: .5rem;
    right: .5rem;
    padding: .1rem .45rem;
    border-radius: 999px;
    font-size: .72rem;
    color: #fff;
    background: rgba(0, 0, 0, .45);
}

.asset-card-body {
    flex: 1 1 auto;
    padding: .75rem .85rem .5rem;
    min-width: 0;
}

.asset-card-tag {
    display: block;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asset-card-tag:hover {
    color: var(--clove-700);
}

.asset-card-name {
    font-size: .88rem;
    color: var(--ink-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asset-card-specs {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .15rem .6rem;
    margin: .6rem 0 0;
    font-size: .8rem;
}

.asset-card-specs dt {
    font-weight: 500;
    color: #a39a90;
    white-space: nowrap;
}

.asset-card-specs dd {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asset-card-actions {
    display: flex;
    align-items: center;
    gap: .25rem;
    padding: .55rem .85rem .75rem;
    border-top: 1px solid var(--line);
}

/* Incoming / Outgoing switch on the create page */
.dir-switch {
    display: inline-flex;
    padding: .25rem;
    gap: .25rem;
    border-radius: 12px;
    background: var(--clove-50);
    border: 1px solid var(--line);
}

.dir-switch a {
    padding: .45rem .9rem;
    border-radius: 9px;
    font-weight: 600;
    color: var(--ink-soft);
    text-decoration: none;
}

.dir-switch a.active {
    color: #fff;
    background: var(--clove-gradient);
    box-shadow: 0 4px 10px rgba(243, 130, 31, .3);
}

.returnable-box {
    padding: .75rem .9rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--clove-50);
}

.movement-items {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.movement-item {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .6rem .7rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.mi-index {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    color: var(--clove-900);
    background: var(--clove-100);
}

.mi-main {
    flex: 1 1 auto;
    min-width: 0;
}

.mi-tag {
    font-weight: 600;
}

.mi-name {
    font-size: .88rem;
    color: var(--ink-soft);
}

.movement-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    padding: 2rem 1rem;
    border: 2px dashed #e7ddd1;
    border-radius: 14px;
    color: #a39a90;
    text-align: center;
}

.movement-empty i {
    font-size: 1.8rem;
    color: var(--clove-300);
}

.approval-note {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .7rem .9rem;
    border-radius: 12px;
    background: #ede9fe;
    color: #4c1d95;
}

.approval-note i {
    font-size: 1.25rem;
}

.approval-card {
    border-left: 5px solid #f59e0b;
    background: var(--surface) !important;
}

.approval-card.status-approved  { border-left-color: var(--accent-green); }
.approval-card.status-rejected  { border-left-color: var(--accent-rose); }
.approval-card.status-cancelled { border-left-color: #a8a29e; }

.approval-comment {
    padding: .5rem .7rem;
    border-radius: 10px;
    background: var(--clove-50);
    font-size: .9rem;
}

.btn-approve {
    --bs-btn-color: #fff;
    --bs-btn-bg: #16a34a;
    --bs-btn-border-color: #16a34a;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #15803d;
    --bs-btn-hover-border-color: #15803d;
    --bs-btn-active-bg: #166534;
}

.btn-reject {
    --bs-btn-color: #be123c;
    --bs-btn-bg: #fff;
    --bs-btn-border-color: #fda4af;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--accent-rose);
    --bs-btn-hover-border-color: var(--accent-rose);
    --bs-btn-active-bg: #be123c;
}

.movement-dl dt {
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #a39a90;
}

.movement-dl dd {
    margin-bottom: .8rem;
}

/* Roles on the Users page */
.role-admin    { --role-color: var(--clove-600); }
.role-security { --role-color: var(--accent-violet); }
.role-it       { --role-color: var(--accent-teal); }

.role-badge-pill {
    background: var(--role-color);
    color: #fff;
    margin-right: .35rem;
}

.role-dot {
    flex: 0 0 10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--role-color);
}

.denied-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fff;
    background: linear-gradient(135deg, #c4b5fd, var(--accent-violet));
}

/* ---------- Print (gate pass) ---------- */
.print-only {
    display: none;
}

@media print {
    .app-navbar, .app-sidebar, .app-footer, .bg-swoosh, .no-print, .alert {
        display: none !important;
    }

    .app-shell {
        display: block;
        padding: 0;
    }

    body {
        background: #fff;
    }

    .card {
        box-shadow: none;
        break-inside: avoid;
    }

    .print-only {
        display: block;
    }

    .print-signatures {
        display: flex;
        justify-content: space-between;
        gap: 2rem;
        margin-top: 3rem;
    }

    .print-signatures div {
        flex: 1;
        font-size: .85rem;
    }

    .print-signatures span {
        display: block;
        border-bottom: 1px solid #000;
        margin-bottom: .3rem;
        height: 2.5rem;
    }
}

/* ---------- Small screens ---------- */
@media (max-width: 575.98px) {
    /* Icon-only Scan / Upload buttons */
    .scan-btn,
    .upload-btn {
        font-size: 0;
        padding-left: .7rem;
        padding-right: .7rem;
    }

    .scan-btn .bi,
    .upload-btn .bi {
        font-size: 1.05rem;
    }

    .preview-box,
    .preview-thumb {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    .app-navbar-inner {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .app-main > form {
        padding: 1rem;
    }

    .brand-logo {
        height: 30px;
    }

    .bg-swoosh {
        opacity: .08;
    }
}
