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;
    }
}

/* PWA / phone notification controls */
.push-notification-nav {
    margin-inline-end: 0.55rem;
}

.push-notification-menu-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 10px;
    white-space: nowrap;
}

.push-notification-bell {
    line-height: 1;
}

.push-notification-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #adb5bd;
    box-shadow: 0 0 0 2px rgba(173, 181, 189, 0.14);
}

.push-notification-indicator.is-enabled {
    background: #198754;
    box-shadow: 0 0 0 2px rgba(25, 135, 84, 0.14);
}

.push-notification-menu {
    width: min(330px, calc(100vw - 28px));
    border: 0;
    border-radius: 14px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.16);
}

.push-notification-title {
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.push-notification-status {
    color: #6c757d;
    font-size: 0.88rem;
    line-height: 1.45;
}

.pwa-standalone body {
    padding-top: env(safe-area-inset-top);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
}

@media (max-width: 991.98px) {
    .push-notification-nav {
        margin: 0.45rem 0 0.25rem;
    }

    .push-notification-menu-button {
        width: 100%;
        justify-content: flex-start;
    }

    .push-notification-menu {
        width: 100%;
        max-width: 100%;
    }
}

/* ============================================================
   Professional application shell - desktop + mobile
   ============================================================ */
:root {
    --app-border: #e7ebf0;
    --app-text: #172033;
    --app-muted: #6b7280;
    --app-surface: #ffffff;
    --app-surface-soft: #f8fafc;
    --app-primary-soft: #edf4ff;
    --app-primary: #0d6efd;
    --app-danger-soft: #fff1f2;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--app-border);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.035);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.app-navbar {
    padding: 0;
    min-height: 70px;
    background: transparent;
}

.app-header-shell {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand-wrap {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    text-decoration: none;
}

.brand-wrap:hover,
.brand-wrap:focus {
    text-decoration: none;
}

.brand-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    flex: 0 0 auto;
}

.brand-text {
    color: var(--app-text);
    font-size: 1.05rem;
    font-weight: 750;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.app-header-user {
    align-items: center;
    gap: 9px;
    min-width: 0;
    max-width: 270px;
    padding: 6px 10px 6px 7px;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: #fff;
}

.app-rtl .app-header-user {
    padding: 6px 7px 6px 10px;
}

.app-user-avatar {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f1f5f9;
    color: #475569;
}

.app-user-avatar svg {
    width: 17px;
    height: 17px;
}

.app-user-summary {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}

.app-user-summary strong,
.app-user-summary small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-user-summary strong {
    color: var(--app-text);
    font-size: 0.82rem;
    font-weight: 700;
}

.app-user-summary small {
    margin-top: 3px;
    color: var(--app-muted);
    font-size: 0.72rem;
}

.app-menu-toggle {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dfe5ec;
    border-radius: 13px;
    background: #fff;
    color: #253044;
    box-shadow: 0 2px 7px rgba(15, 23, 42, 0.04);
    transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.app-menu-toggle:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.07);
}

.app-menu-toggle:active {
    transform: scale(0.96);
}

.app-menu-toggle:focus-visible {
    outline: 3px solid rgba(13, 110, 253, 0.18);
    outline-offset: 2px;
}

.app-menu-toggle svg {
    width: 22px;
    height: 22px;
}

.app-main-container {
    padding-top: 10px;
}

.app-navigation-drawer {
    width: min(330px, 92vw) !important;
    border: 0 !important;
    background: #fff;
    box-shadow: 0 0 42px rgba(15, 23, 42, 0.18);
}

.app-drawer-header {
    min-height: 78px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--app-border);
}

.drawer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.drawer-brand-logo {
    width: 39px;
    height: 39px;
    flex: 0 0 39px;
    object-fit: contain;
}

.drawer-brand-title {
    color: var(--app-text);
    font-size: 0.96rem;
    font-weight: 750;
    line-height: 1.2;
}

.drawer-brand-subtitle {
    margin-top: 3px;
    color: #8a94a4;
    font-size: 0.73rem;
    line-height: 1.2;
}

.app-drawer-header .btn-close {
    flex: 0 0 auto;
    margin: 0;
    opacity: 0.55;
}

.app-drawer-body {
    display: flex;
    flex-direction: column;
    padding: 16px 16px 18px;
    overflow-x: hidden;
}

.drawer-user-card {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid #e8edf3;
    border-radius: 15px;
    background: linear-gradient(135deg, #fbfcfe 0%, #f5f8fc 100%);
}

.drawer-user-icon {
    width: 39px;
    height: 39px;
    flex: 0 0 39px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: #325d99;
    background: #eaf2ff;
}

.drawer-user-icon svg {
    width: 20px;
    height: 20px;
}

.drawer-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.drawer-user-label {
    color: #8b95a5;
    font-size: 0.7rem;
    font-weight: 600;
}

.drawer-user-info strong {
    margin-top: 2px;
    color: var(--app-text);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drawer-user-info small {
    margin-top: 3px;
    color: var(--app-muted);
    font-size: 0.74rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drawer-section-label {
    margin: 0 8px 8px;
    color: #9aa3b1;
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.app-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.app-menu-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 48px;
    padding: 10px 12px;
    border-radius: 13px;
    color: #3b4658;
    font-size: 0.91rem;
    font-weight: 650;
    text-decoration: none;
    transition: color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.app-menu-link:hover {
    color: #1e293b;
    background: #f5f7fa;
    text-decoration: none;
}

.app-menu-link.active {
    color: #0b5ed7;
    background: var(--app-primary-soft);
}

.app-menu-link.active::before {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 5px;
    background: var(--app-primary);
}

.app-ltr .app-menu-link.active::before {
    left: 0;
}

.app-rtl .app-menu-link.active::before {
    right: 0;
}

.app-menu-icon {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    color: #667085;
}

.app-menu-icon svg {
    width: 19px;
    height: 19px;
}

.app-menu-link.active .app-menu-icon {
    color: #0b5ed7;
    background: rgba(13, 110, 253, 0.07);
}

.drawer-spacer {
    flex: 1 1 auto;
    min-height: 24px;
}

.app-menu-logout {
    margin-top: 18px;
    border-top: 1px solid var(--app-border);
    border-radius: 0;
    padding-top: 17px;
    color: #c73545;
}

.app-menu-logout:hover {
    color: #a91f30;
    background: transparent;
}

.app-menu-logout .app-menu-icon {
    color: #c73545;
    background: var(--app-danger-soft);
}

/* ============================================================
   Invoice deletion notification control
   ============================================================ */
.delete-notification-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 15px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: linear-gradient(135deg, #ffffff 0%, #fbfcfe 100%);
    box-shadow: 0 5px 18px rgba(15, 23, 42, 0.045);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.delete-notification-card.push-enabled {
    border-color: #cce7d8;
    box-shadow: 0 5px 18px rgba(25, 135, 84, 0.055);
}

.delete-notification-icon {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: #fff7df;
    color: #9a6b00;
}

.delete-notification-card.push-enabled .delete-notification-icon {
    color: #16744a;
    background: #eaf8f0;
}

.delete-notification-icon svg {
    width: 23px;
    height: 23px;
}

.delete-notification-content {
    min-width: 0;
}

.delete-notification-heading {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    justify-content: space-between;
}

.delete-notification-title {
    color: var(--app-text);
    font-size: 0.97rem;
    font-weight: 750;
    line-height: 1.25;
}

.delete-notification-subtitle {
    margin-top: 3px;
    color: #7b8493;
    font-size: 0.78rem;
    line-height: 1.4;
}

.push-notification-state {
    flex: 0 0 auto;
    padding-top: 3px;
}

.push-notification-indicator {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #adb5bd;
    box-shadow: 0 0 0 3px rgba(173, 181, 189, 0.14);
}

.push-notification-indicator.is-enabled {
    background: #198754;
    box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.13);
}

.push-notification-status {
    margin-top: 7px;
    color: #667085;
    font-size: 0.8rem;
    line-height: 1.45;
}

.delete-notification-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.delete-notification-actions .btn {
    min-width: 120px;
    padding: 0.58rem 0.85rem;
    font-size: 0.82rem;
    border-radius: 11px;
}

/* Old header notification dropdown is intentionally no longer used. */
.push-notification-nav,
.push-notification-menu {
    display: none !important;
}

@media (max-width: 767.98px) {
    .app-navbar,
    .app-header-shell {
        min-height: 62px;
    }

    .app-header-shell {
        gap: 10px;
    }

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

    .brand-text {
        max-width: calc(100vw - 112px);
        font-size: 0.92rem;
        line-height: 1.1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .app-menu-toggle {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
        border-radius: 12px;
    }

    .app-main-container {
        padding-top: 5px;
    }

    .app-drawer-header {
        min-height: 70px;
        padding: 14px 15px;
    }

    .app-drawer-body {
        padding: 14px;
    }

    .delete-notification-card {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 11px 12px;
        padding: 13px;
        border-radius: 16px;
    }

    .delete-notification-icon {
        width: 42px;
        height: 42px;
        border-radius: 13px;
    }

    .delete-notification-actions {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
        padding-top: 2px;
    }

    .delete-notification-actions .btn {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 420px) {
    .brand-text {
        font-size: 0.87rem;
    }

    .delete-notification-card {
        grid-template-columns: 1fr;
    }

    .delete-notification-icon {
        display: none;
    }

    .delete-notification-actions {
        grid-column: auto;
        grid-template-columns: 1fr;
    }
}
