:root {
    --bg-app: #f8f9fc;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --text-dark: #2c3e50;
    --gold: #b8860b;
    --green: #1e7e34;
    --muted: #6c757d;
    --border-soft: rgba(44, 62, 80, 0.08);
    --shadow-soft: 0 16px 40px rgba(31, 45, 61, 0.08);
    --shadow-hover: 0 20px 45px rgba(31, 45, 61, 0.12);
}

body {
    font-family: "Inter", system-ui, sans-serif;
    background: linear-gradient(180deg, #fbfcff 0%, var(--bg-app) 100%);
    color: var(--text-dark);
}

h1, h2, h3, h4, h5, .brand-title, .page-title {
    font-family: "Poppins", "Inter", system-ui, sans-serif;
}

.dashboard-body {
    min-height: 100vh;
}

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

.sidebar {
    width: 300px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
    padding: 1.5rem;
    justify-content: space-between;
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 2rem;
}

.brand-badge {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(184, 134, 11, 0.16), rgba(30, 126, 52, 0.14));
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.brand-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.brand-subtitle,
.page-subtitle,
.supplier-empty {
    color: var(--muted);
}

.sidebar-nav .nav-link,
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--text-dark);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    font-weight: 500;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.sidebar-nav .nav-link:hover,
.sidebar-toggle:hover,
.supplier-link:hover {
    background: #e9ecef;
    color: var(--text-dark);
}

.sidebar-nav .nav-link.active,
.supplier-link.active {
    background: linear-gradient(90deg, rgba(184, 134, 11, 0.14), rgba(30, 126, 52, 0.12));
    color: var(--gold);
}

.supplier-list {
    padding-left: 0.75rem;
    margin-top: 0.4rem;
}

.supplier-link {
    display: block;
    padding: 0.6rem 0.8rem;
    color: var(--text-dark);
    border-radius: 12px;
    text-decoration: none;
}

.sidebar-footer {
    background: rgba(248, 249, 252, 0.8);
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    padding: 1rem;
}

.content-shell {
    flex: 1;
    min-width: 0;
}

.content-area {
    padding: 1.5rem;
}

.topbar {
    padding: 1rem 1.25rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-header {
    background: linear-gradient(135deg, rgba(184, 134, 11, 0.08), rgba(255, 255, 255, 0.96));
    border: 1px solid rgba(184, 134, 11, 0.12);
    border-radius: 26px;
    padding: 1.5rem 1.6rem;
    box-shadow: var(--shadow-soft);
}

.eyebrow {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--green);
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.page-title {
    margin: 0;
    font-size: 1.8rem;
}

.app-card,
.kpi-card,
.login-card {
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
}

.app-card,
.kpi-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app-card:hover,
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.kpi-card {
    padding: 1.4rem;
    min-height: 180px;
}

.kpi-icon {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.bg-soft-primary { background: rgba(13, 110, 253, 0.12); color: #0d6efd; }
.bg-soft-success { background: rgba(25, 135, 84, 0.12); color: #198754; }
.bg-soft-warning { background: rgba(255, 193, 7, 0.16); color: #9a6700; }
.bg-soft-danger { background: rgba(220, 53, 69, 0.12); color: #dc3545; }

.kpi-label {
    color: var(--muted);
    margin-bottom: 0.45rem;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
}

.btn-gold {
    background: linear-gradient(135deg, #c99a24, var(--gold));
    border-color: var(--gold);
    color: #fff;
}

.btn-gold:hover,
.btn-gold:focus {
    background: linear-gradient(135deg, #b98c1e, #a67808);
    color: #fff;
}

.search-group .input-group-text,
.search-group .form-control,
.table,
.modal-content,
.form-control,
.form-select {
    border-color: var(--border-soft);
}

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

.inline-edit-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.empty-state {
    min-height: 320px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
}

.empty-state i {
    font-size: 3rem;
    color: rgba(184, 134, 11, 0.6);
}

.match-suggestion-cell {
    min-width: 260px;
}

.invoice-preview-table .invoice-preview-select-col,
.invoice-preview-table .invoice-preview-confidence-col,
.invoice-preview-table .invoice-preview-status-col {
    width: 70px;
    white-space: nowrap;
}

.invoice-preview-table .invoice-preview-match-col,
.invoice-preview-table .invoice-preview-free-col {
    width: 110px;
}

.invoice-preview-table .invoice-preview-sku-col,
.invoice-preview-table .invoice-preview-barcode-col {
    width: 150px;
}

.invoice-preview-table .invoice-preview-price-col,
.invoice-preview-table .invoice-preview-qty-col {
    width: 120px;
}

.invoice-preview-table .invoice-preview-name-col {
    min-width: 280px;
}

.matching-review-table .matching-review-name-cell {
    min-width: 280px;
}

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

.table-sort-button {
    color: inherit;
    font-weight: 600;
    text-decoration: none;
    padding: 0;
}

.table-sort-button:hover,
.table-sort-button:focus {
    color: var(--gold);
    text-decoration: none;
}

.table-sort-button::after {
    content: "";
    margin-left: 0.35rem;
}

.table-sort-button[data-direction="asc"]::after {
    content: "▲";
    font-size: 0.7rem;
}

.table-sort-button[data-direction="desc"]::after {
    content: "▼";
    font-size: 0.7rem;
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    max-width: 520px;
    width: 100%;
}

.flash-stack {
    margin-bottom: 1rem;
}

.auth-flash {
    max-width: 520px;
    width: 100%;
    position: absolute;
    top: 1rem;
}

@media (max-width: 991.98px) {
    .content-area {
        padding: 1rem;
    }

    .page-title {
        font-size: 1.45rem;
    }
}
