html {
    font-size: 15px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 0;
    background-color: #f6f8fb;
    color: #212529;
}

.app-container {
    max-width: 1180px;
}

.app-navbar {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.brand-wrap {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 10px;
    min-width: 0;
}

.brand-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    flex-shrink: 0;
}

.brand-text {
    font-weight: 700;
    font-size: 1.05rem;
    color: #1f2937;
    white-space: nowrap;
}

.app-user-text {
    font-weight: 500;
}

.page-header-wrap {
    margin-top: 1rem;
    margin-bottom: 1.25rem;
}

.page-title {
    margin-bottom: 0.35rem;
    font-size: 1.9rem;
    font-weight: 700;
}

.login-page-wrap {
    min-height: calc(100vh - 150px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0 2rem;
}

.login-card {
    width: 100%;
    max-width: 460px;
    border: 0;
    border-radius: 18px;
}

.login-logo {
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
}

.login-title {
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.action-buttons-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.action-btn {
    min-width: 170px;
}

.scanner-frame {
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 16px;
    background: #fff;
}

.invoice-details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.invoice-detail-box {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px 16px;
    background: #fafafa;
}

.invoice-detail-label {
    font-size: 0.88rem;
    color: #6b7280;
    margin-bottom: 6px;
    font-weight: 600;
}

.invoice-detail-value {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    word-break: break-word;
}

.dashboard-card {
    border: 0;
    border-radius: 18px;
    min-height: 180px;
}

.dashboard-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.reports-action-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.reports-action-btn {
    min-width: 180px;
}

.reports-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.reports-chart-type-wrap {
    width: 220px;
}

.report-table-wrap {
    border-radius: 12px;
}

.report-meta-strip,
.report-meta-inline {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    color: #4b5563;
    font-size: 0.94rem;
}

.report-meta-strip {
    margin-bottom: 1rem;
}

.report-meta-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.division-filter-wrap {
    margin-top: 1.25rem;
    padding: 1rem 1rem 0.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #fafafa;
}

.division-filter-title {
    font-weight: 700;
    margin-bottom: 0.85rem;
    color: #1f2937;
}

.division-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.division-check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-weight: 500;
    color: #374151;
}

    .division-check-item input[type="checkbox"] {
        width: 18px;
        height: 18px;
        margin: 0;
    }

.division-filter-note {
    margin-top: 0.85rem;
    color: #6b7280;
    font-size: 0.92rem;
}

.card {
    border: 0;
    border-radius: 18px;
}

    .card .card-body {
        padding: 1.25rem;
    }

.form-control,
.form-select {
    border-radius: 12px;
}

.btn {
    border-radius: 12px;
    font-weight: 600;
}

.table {
    margin-bottom: 0;
}

.chart-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    height: 320px;
    margin: 0 auto;
}

@media (max-width: 991.98px) {
    .brand-text {
        font-size: 0.98rem;
    }

    .action-btn,
    .reports-action-btn {
        min-width: 150px;
    }

    .division-checkbox-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .app-container {
        padding-left: 14px;
        padding-right: 14px;
    }

    .brand-logo {
        width: 34px;
        height: 34px;
    }

    .brand-text {
        font-size: 0.95rem;
        white-space: normal;
        line-height: 1.15;
    }

    .page-title {
        font-size: 1.55rem;
    }

    .login-page-wrap {
        min-height: auto;
        padding-top: 1.2rem;
    }

    .login-card {
        max-width: 100%;
        border-radius: 16px;
    }

    .login-logo {
        max-width: 90px;
        max-height: 90px;
    }

    .card .card-body {
        padding: 1rem;
    }

    .action-buttons-wrap,
    .reports-action-wrap {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .action-btn,
    .reports-action-btn {
        width: 100%;
        min-width: 0;
    }

    .scanner-frame {
        max-width: 100%;
        padding: 8px;
        border-radius: 14px;
    }

    .invoice-details-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .invoice-detail-box {
        padding: 12px 14px;
    }

    .invoice-detail-label {
        font-size: 0.82rem;
    }

    .invoice-detail-value {
        font-size: 0.98rem;
    }

    .dashboard-card {
        min-height: auto;
    }

    .dashboard-card-title {
        font-size: 1.15rem;
        margin-bottom: 0.9rem;
    }

    .reports-chart-header,
    .report-meta-header {
        flex-direction: column;
        align-items: stretch;
    }

    .reports-chart-type-wrap {
        width: 100%;
    }

    .division-checkbox-grid {
        grid-template-columns: 1fr;
    }

    .chart-container {
        max-width: 100%;
        height: 260px;
    }

    .table-responsive {
        border-radius: 12px;
    }

    .btn-lg,
    .form-control-lg,
    .form-select-lg {
        font-size: 1rem;
    }
}

@media (max-width: 575.98px) {
    .app-navbar {
        padding-top: 0.55rem;
        padding-bottom: 0.55rem;
    }

    .brand-wrap {
        gap: 8px;
        max-width: calc(100% - 56px);
    }

    .brand-text {
        font-size: 0.9rem;
    }

    .page-title {
        font-size: 1.4rem;
    }

    .chart-container {
        height: 230px;
    }
}

.app-rtl {
    direction: rtl;
    text-align: right;
}

.app-rtl .brand-wrap,
.app-rtl .reports-chart-header,
.app-rtl .report-meta-header,
.app-rtl .report-meta-strip,
.app-rtl .report-meta-inline,
.app-rtl .division-check-item,
.app-rtl .action-buttons-wrap,
.app-rtl .reports-action-wrap {
    direction: rtl;
}

.app-rtl .navbar-nav {
    padding-right: 0;
}

.chart-container canvas {
    max-width: 100% !important;
}

@media (max-width: 575.98px) {
    .chart-container {
        min-height: 300px;
        overflow: visible;
    }

    .report-meta-strip,
    .report-meta-inline {
        gap: 8px;
        font-size: 0.88rem;
    }
}
