:root {
    --primary: #c0392b;
    --primary-dark: #96281b;
    --secondary: #2c3e50;
    --sidebar-width: 260px;
    --bg-body: #f4f6f9;
    --bg-card: #ffffff;
    --text-main: #2c3e50;
    --border-color: #dee2e6;
}

[data-theme="dark"] {
    --bg-body: #1a1d21;
    --bg-card: #212529;
    --text-main: #e9ecef;
    --border-color: #495057;
}

body { font-family: 'Segoe UI', system-ui, sans-serif; color: var(--text-main); }
.app-body { background: var(--bg-body); min-height: 100vh; }
.wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--secondary) 0%, #1a252f 100%);
    color: #fff;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    overflow-y: auto;
}
.sidebar-brand {
    padding: 1.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    gap: .5rem;
    text-decoration: none;
    color: #fff;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.sidebar-brand:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}
.sidebar-brand-gif,
.sidebar-brand-icon {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    object-fit: contain;
    display: block;
    font-size: 1.5rem;
    line-height: 1;
}
.sidebar-nav { padding: .5rem 0; }
.sidebar-nav .nav-link {
    color: rgba(255,255,255,.75);
    padding: .5rem 1rem;
    margin: 0 .5rem;
    border-radius: .5rem;
    border-left: 4px solid transparent;
    display: flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 1.35rem;
    text-align: center;
    transition: transform 0.2s ease, color 0.2s ease;
}
.sidebar-nav .nav-link:hover:not(.active) {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}
.sidebar-nav .nav-link.active {
    background: linear-gradient(90deg, rgba(192, 57, 43, 0.55) 0%, rgba(192, 57, 43, 0.18) 100%);
    color: #fff;
    font-weight: 700;
    border-left-color: #e74c3c;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.sidebar-nav .nav-link.active i {
    color: #fff;
    transform: scale(1.08);
}

.main-content { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.app-footer-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}
.app-footer-link:hover {
    color: var(--primary);
}
[data-theme="dark"] .app-footer-link:hover {
    color: #ff8a80;
}
.top-navbar { background: var(--bg-card); border-bottom: 1px solid var(--border-color); height: 60px; }
.content-area { flex: 1; }

.stat-card {
    background: var(--bg-card);
    border-radius: .75rem;
    padding: 1.35rem 1.25rem;
    border-left: 4px solid var(--primary);
    box-shadow: 0 4px 16px rgba(44, 62, 80, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
    height: 100%;
    transition: transform 0.28s ease, box-shadow 0.28s ease, border-left-width 0.28s ease;
    will-change: transform, box-shadow;
}
.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 32px rgba(44, 62, 80, 0.14), 0 6px 12px rgba(192, 57, 43, 0.08);
    border-left-width: 5px;
}
.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    transition: transform 0.28s ease;
}
.stat-card:hover .stat-value {
    transform: scale(1.03);
}
.stat-card .stat-label {
    color: #6c757d;
    font-size: .875rem;
    margin-top: .25rem;
}
.stat-card--warning {
    border-left-color: #f39c12;
}
.stat-card--warning .stat-value {
    color: #f39c12;
}
.stat-card--warning:hover {
    box-shadow: 0 16px 32px rgba(243, 156, 18, 0.18), 0 6px 12px rgba(243, 156, 18, 0.1);
}
.stat-card--danger {
    border-left-color: #e74c3c;
}
.stat-card--danger .stat-value {
    color: #e74c3c;
}
.stat-card--danger:hover {
    box-shadow: 0 16px 32px rgba(231, 76, 60, 0.18), 0 6px 12px rgba(231, 76, 60, 0.1);
}

[data-theme="dark"] .stat-card {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.2);
}
[data-theme="dark"] .stat-card:hover {
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45), 0 6px 14px rgba(192, 57, 43, 0.15);
}

.card { background: var(--bg-card); border-color: var(--border-color); }
.table { color: var(--text-main); }

.table-col-total {
    width: 11rem;
    min-width: 11rem;
    max-width: 13rem;
    text-align: right !important;
    white-space: nowrap;
    padding-right: 2.5rem !important;
}

.table-col-status {
    padding-left: 1.25rem !important;
    width: 1%;
    white-space: nowrap;
}

.quotes-list-table {
    table-layout: fixed;
}

.quotes-list-table .table-col-quote-no {
    width: 9rem;
    max-width: 9rem;
    white-space: nowrap;
}

.quotes-list-table .table-col-quote-customer {
    width: 30%;
    min-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.proformas-list-table {
    table-layout: fixed;
}

.proformas-list-table .table-col-proforma-no {
    width: 9rem;
    max-width: 9rem;
    white-space: nowrap;
}

.proformas-list-table .table-col-proforma-customer {
    width: 30%;
    min-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.guest-body {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary-dark) 100%);
    min-height: 100vh;
}

.guest-shell {
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem 1.5rem;
}

.guest-container { width: 100%; max-width: 420px; }
.guest-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0,0,0,.2);
}

.guest-subtitle {
    font-size: 0.95rem;
    letter-spacing: 0.01em;
}

.guest-footer {
    margin-top: 1.75rem;
    padding-top: 1rem;
    text-align: center;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.72);
    letter-spacing: 0.02em;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    width: min(100%, 420px);
}

.guest-footer-sep {
    margin: 0 0.45rem;
    opacity: 0.55;
}

.guest-footer-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: color 0.2s ease;
}

.guest-footer-link:hover {
    color: #ff8a80;
}
.brand-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 6.5rem;
    margin-bottom: 0.25rem;
}

.brand-fire-gif {
    width: 6rem;
    height: auto;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 2px 12px rgba(255, 87, 34, 0.28)) drop-shadow(0 6px 20px rgba(192, 57, 43, 0.18));
}

.brand-title { color: var(--secondary); font-weight: 700; }

.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-new-account {
    background: transparent;
    border: 1px solid transparent;
    color: var(--primary);
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.btn-new-account--outline {
    border-color: var(--primary);
}

.btn-new-account:hover,
.btn-new-account:focus {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

[data-theme="dark"] .btn-new-account {
    color: #ff8a80;
}

[data-theme="dark"] .btn-new-account--outline {
    border-color: #ff8a80;
}

[data-theme="dark"] .btn-new-account:hover,
[data-theme="dark"] .btn-new-account:focus {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

.btn-transaction-pulse {
    animation: transaction-pulse 2.4s ease-in-out infinite;
    font-weight: 600;
}

.btn-transaction-pulse:hover,
.btn-transaction-pulse:focus {
    animation: none;
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(192, 57, 43, 0.35);
}

@keyframes transaction-pulse {
    0%, 100% {
        color: var(--primary);
        background-color: transparent;
        border-color: rgba(192, 57, 43, 0.55);
        box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.25);
    }
    50% {
        color: #fff;
        background-color: var(--primary);
        border-color: var(--primary);
        box-shadow: 0 0 0 10px rgba(192, 57, 43, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn-transaction-pulse {
        animation: none;
    }
}

[data-theme="dark"] .btn-transaction-pulse {
    animation-name: transaction-pulse-dark;
}

@keyframes transaction-pulse-dark {
    0%, 100% {
        color: #ff8a80;
        background-color: transparent;
        border-color: rgba(231, 76, 60, 0.65);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.3);
    }
    50% {
        color: #fff;
        background-color: var(--primary);
        border-color: #e74c3c;
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
    }
}

.qr-verify-card {
    max-width: 600px;
    margin: 0 auto;
    border-top: 5px solid var(--primary);
}
.verified-badge {
    background: #27ae60;
    color: #fff;
    padding: .5rem 1rem;
    border-radius: 2rem;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); transition: transform .3s; }
    .sidebar.show { transform: translateX(0); }
    .main-content {
        margin-left: 0;
        max-width: 100%;
        overflow-x: clip;
    }
    .content-area {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    .extinguishers-page {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
        width: calc(100% + 1.5rem);
    }
    .extinguishers-page > .card,
    .extinguishers-page > form.card {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    .extinguishers-page .card-body.table-responsive {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    .extinguishers-page .dataTables_wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .extinguishers-page .dataTables_wrapper > .row {
        margin-left: 0;
        margin-right: 0;
    }
    .extinguishers-page .dataTables_wrapper .col-sm-12,
    .extinguishers-page .dataTables_wrapper .col-md-6 {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    .extinguisher-list-table .col-customer,
    .extinguisher-list-table .col-type {
        max-width: none;
        width: auto;
    }
}

.public-body { background: var(--bg-body); }

.extinguisher-list-table {
    font-size: 0.82rem;
}

.extinguisher-list-table th,
.extinguisher-list-table td {
    padding: 0.32rem 0.38rem;
    vertical-align: middle;
}

.extinguisher-list-table .col-customer {
    max-width: 7.5rem;
    width: 7.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.extinguisher-list-table .col-type {
    max-width: 7.5rem;
    width: 7.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.extinguisher-list-table .col-date {
    white-space: nowrap;
    width: 1%;
}

.extinguisher-list-table .col-narrow {
    white-space: nowrap;
    width: 1%;
    text-align: center;
}

.extinguisher-list-table .col-check {
    width: 1%;
    text-align: center;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.extinguisher-list-table .col-actions {
    width: 1%;
    white-space: nowrap;
    padding-left: 0.2rem;
    padding-right: 0.2rem;
}

.extinguisher-list-table .col-actions .btn {
    font-size: 0.74rem;
    line-height: 1.2;
}

.extinguisher-list-table .badge {
    font-size: 0.74rem;
    font-weight: 600;
}

.statement-print .table th,
.statement-print .table td {
    font-size: 0.875rem;
    vertical-align: middle;
}

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

    .wrapper,
    .main-content,
    .content-area {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .account-statement-card {
        border: none !important;
        box-shadow: none !important;
    }

    .account-statement-table {
        font-size: 0.8rem;
    }

    .extinguisher-list-table {
        font-size: 0.74rem;
    }

    .extinguisher-list-table th,
    .extinguisher-list-table td {
        padding: 0.2rem 0.25rem;
    }

    .text-danger {
        color: #000 !important;
    }

    a[href]:after {
        content: none !important;
    }
}
