:root {
    --bg1: #f7f8fc;
    --bg2: #eef1f8;
    --text: #0f172a;
    --muted: #64748b;
    --card: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 12px 35px rgba(15, 23, 42, 0.12);
    --accent: linear-gradient(135deg, #2563eb, #22c55e);
    --accent-solid: #2563eb;
    --danger: #f97316;
}

* {
    font-family: 'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background: radial-gradient(1400px at 20% 20%, rgba(37, 99, 235, 0.08), transparent 45%),
                radial-gradient(1400px at 80% 0%, rgba(34, 197, 94, 0.07), transparent 40%),
                linear-gradient(145deg, var(--bg1) 0%, var(--bg2) 60%);
    color: var(--text);
    min-height: 100vh;
}

.layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-shell {
    width: 100%;
    max-width: 1280px;
    padding: 14px;
}

.glass-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 24px 22px;
    box-shadow: var(--shadow);
}

h1, h2, h3 {
    color: var(--text);
    margin: 0 0 12px;
}

.muted {
    color: var(--muted);
    margin: 0;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 4px;
}

.badge-soft {
    background: rgba(37, 99, 235, 0.08);
    color: #1e40af;
    padding: 8px 12px;
    border-radius: 12px;
    font-weight: 700;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.topbar {
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
    backdrop-filter: blur(6px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
    letter-spacing: 0.02em;
    font-size: 1.05rem;
    padding: 8px 0;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent);
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
}

.brand-text {
    color: var(--text);
}

.offcanvas {
    background: #ffffff;
    color: var(--text);
}

.offcanvas .nav-link {
    color: var(--text);
    padding: 10px 0;
    font-weight: 600;
}

.offcanvas .nav-link i {
    margin-right: 8px;
}

.top-links .nav-link {
    padding: 10px 14px;
    color: #475569;
    font-weight: 700;
    border-radius: 12px;
    transition: all 0.2s ease;
    position: relative;
    text-decoration: none;
}

.top-links .nav-link:hover {
    color: #0f172a;
    background: rgba(37, 99, 235, 0.08);
}

.top-links .nav-link::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 6px;
    height: 2px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 999px;
}

.top-links .nav-link:hover::after {
    opacity: 1;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
}

.action-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #ffffff;
    box-shadow: var(--shadow);
    color: var(--text);
    text-decoration: none;
    overflow: hidden;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 14px 16px;
}

.stat-main {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 0 4px;
}
.value-leader-name {
    display: block;
    white-space: normal;
    word-break: break-word;
    line-height: 1.25;
}

.action-card::before {
    content: "";
    position: absolute;
    inset: -1px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 0;
}

.action-card:hover::before {
    opacity: 0.08;
}

.action-card * {
    position: relative;
    z-index: 1;
}

.action-card .icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
    font-size: 1.3rem;
}

.action-card h2 {
    margin: 0;
    font-size: 1.05rem;
}

.action-card p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.action-card .chevron {
    margin-left: auto;
    color: var(--muted);
    font-weight: 800;
}

.table {
    color: var(--text);
}

.table thead th {
    border-color: var(--border);
    padding: 10px 12px;
    font-size: 14px;
    background: #f8fafc;
}

.table tbody td {
    border-color: var(--border);
    padding: 10px 12px;
    font-size: 14px;
    word-break: break-word;
    vertical-align: middle;
}

.table-striped tbody tr:hover {
    background-color: #f8fafc;
}

#stockFilterRow th {
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 5;
    border-bottom: 1px solid var(--border);
}

.table-warning {
    background-color: #fff7ed !important;
}

.table-warning td {
    border-color: #fed7aa !importanт;
}

.table-responsive {
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.fade-out {
    opacity: 0;
    transition: opacity 0.25s ease;
}

.modal.custom-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1050;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal.custom-modal .modal-dialog {
    max-width: 520px;
    width: 100%;
}
.nowrap {
    white-space: nowrap;
}

input, textarea, select {
    border-radius: 10px !important;
    border: 1px solid var(--border);
}

.input-group > .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

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

datalist {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 6px 0;
    color: var(--text);
}

input[list]::-webkit-calendar-picker-indicator {
    display: none !important;
}

.autocomplete-suggestions {
    position: absolute;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    z-index: 15;
    max-height: 220px;
    overflow-y: auto;
    width: 100%;
}

.autocomplete-suggestion {
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text);
}

.autocomplete-suggestion:hover {
    background: rgba(37, 99, 235, 0.08);
}

.form-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr;
}

.price-row {
    display: grid;
    gap: 8px;
}

.currency-toggle label {
    border-radius: 10px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-weight: 700;
    color: #1f2937;
    font-size: 0.95rem;
}

.helper {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0;
}

.form-shell {
    max-width: 820px;
    margin: 0 auto;
}

button:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    box-shadow: 0 0 0 0.18rem rgba(37, 99, 235, 0.25);
}

.btn-outline-primary, .btn-outline-secondary, .btn-danger, .btn-primary, .btn-info, .btn-success {
    border-radius: 10px;
    transition: 0.25s;
    white-space: nowrap;
}

.btn-primary {
    background: #2563eb;
    border: none;
    color: #fff;
}

.btn-success {
    background: #16a34a;
    border: none;
}

.btn-danger {
    background: #f97316;
    border: none;
}

.btn-outline-primary:hover, .btn-outline-secondary:hover, .btn-danger:hover, .btn-primary:hover, .btn-info:hover, .btn-success:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.alert-info {
    background-color: rgba(37, 99, 235, 0.1);
    color: #1e40af;
    border-color: rgba(37, 99, 235, 0.2);
}

.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

footer {
    margin-top: 2rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.9rem;
}

#reader__scan_region {
    border: 2px dashed var(--accent-solid) !important;
    border-radius: 8px;
}

/* Responsive tables to cards on mobile */
@media (max-width: 768px) {
    .table.responsive-table thead {
        display: none;
    }
    .table.responsive-table, .table.responsive-table tbody, .table.responsive-table tr, .table.responsive-table td {
        display: block;
        width: 100%;
    }
    .table.responsive-table tr {
        margin-bottom: 12px;
        background: #ffffff;
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 12px;
        box-shadow: var(--shadow);
    }
    .table.responsive-table td {
        border: none;
        padding: 6px 0;
        position: relative;
    }
    .table.responsive-table td::before {
        content: attr(data-label);
        font-weight: 700;
        display: block;
        margin-bottom: 2px;
        color: var(--muted);
    }
    .table.responsive-table td:last-child {
        padding-bottom: 0;
    }
    .glass-card {
        padding: 16px 14px;
    }
    h1 {
        font-size: 1.35rem;
    }
    .action-card {
        padding: 14px;
    }
}
/* autocomplete */
.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.autocomplete-wrapper-group {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
}

.autocomplete-wrapper input {
    width: 100%;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    z-index: 20;
    max-height: 220px;
    overflow-y: auto;
    margin-top: 4px;
}

.autocomplete-suggestion {
    padding: 10px 12px;
    cursor: pointer;
    color: var(--text);
    font-weight: 600;
}

.autocomplete-suggestion:hover {
    background: rgba(37, 99, 235, 0.08);
}
