:root {
    --hero-bg: #f7f8fb;
    --hero-surface: rgba(255, 255, 255, 0.92);
    --hero-surface-solid: #ffffff;
    --hero-border: #e6e9f0;
    --hero-border-strong: #d8deea;
    --hero-text: #111827;
    --hero-muted: #64748b;
    --hero-primary: #006fee;
    --hero-primary-dark: #005bc4;
    --hero-success: #17c964;
    --hero-warning: #f5a524;
    --hero-danger: #f31260;
    --hero-radius: 8px;
    --hero-shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
    --hero-shadow-soft: 0 6px 18px rgba(17, 24, 39, 0.05);
}

* {
    letter-spacing: 0;
}

body {
    background:
        radial-gradient(circle at top left, rgba(0, 111, 238, 0.08), transparent 32rem),
        linear-gradient(180deg, #fbfcff 0%, var(--hero-bg) 42%, #f5f7fb 100%);
    color: var(--hero-text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    text-decoration: none;
}

.navbar {
    min-height: 64px;
    background: rgba(255, 255, 255, 0.88) !important;
    border-bottom: 1px solid var(--hero-border);
    box-shadow: 0 1px 0 rgba(17, 24, 39, 0.02);
    backdrop-filter: blur(16px);
}

.navbar .navbar-brand,
.navbar .text-white,
.navbar .link-light {
    color: var(--hero-text) !important;
}

.navbar .navbar-brand {
    font-weight: 800;
}

.navbar .link-light {
    color: var(--hero-primary) !important;
    font-weight: 600;
}

.layout {
    display: flex;
    padding-top: 64px;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 64px;
    bottom: 0;
    width: 246px;
    padding: 14px 12px;
    background: rgba(255, 255, 255, 0.84);
    border-right: 1px solid var(--hero-border);
    overflow-y: auto;
    backdrop-filter: blur(16px);
}

.sidebar .list-group {
    gap: 6px;
}

.sidebar .list-group-item {
    border: 0;
    border-radius: var(--hero-radius) !important;
    color: #42526e;
    font-weight: 650;
    padding: 11px 13px;
    background: transparent;
}

.sidebar .list-group-item:hover {
    background: #f0f5ff;
    color: var(--hero-primary);
}

.sidebar .list-group-item.active {
    background: #e8f1ff;
    color: var(--hero-primary);
}

.content {
    width: 100%;
    padding: 26px;
}

@media (min-width: 992px) {
    .content {
        margin-left: 246px;
    }
}

.content h1 {
    font-weight: 800;
    color: var(--hero-text);
}

.panel,
.stat-card {
    background: var(--hero-surface);
    border: 1px solid var(--hero-border);
    border-radius: var(--hero-radius);
    padding: 18px;
    box-shadow: var(--hero-shadow-soft);
}

.panel-title {
    color: var(--hero-text);
    font-weight: 800;
    margin-bottom: 14px;
}

.stat-card {
    min-height: 112px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--hero-shadow);
}

.stat-value {
    margin-top: 6px;
    font-size: 30px;
    line-height: 1.3;
    font-weight: 850;
    color: var(--hero-primary);
}

.chart {
    width: 100%;
    height: 360px;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
    background:
        radial-gradient(circle at 20% 20%, rgba(0, 111, 238, 0.16), transparent 30rem),
        radial-gradient(circle at 80% 12%, rgba(23, 201, 100, 0.12), transparent 26rem),
        linear-gradient(135deg, #fbfcff 0%, #f4f7fb 100%);
}

.login-card {
    width: min(430px, calc(100vw - 32px));
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--hero-border);
    border-radius: var(--hero-radius);
    padding: 30px;
    box-shadow: 0 24px 70px rgba(17, 24, 39, 0.14);
    backdrop-filter: blur(18px);
}

.captcha-question {
    min-width: 118px;
    justify-content: center;
    font-weight: 800;
    color: var(--hero-primary);
}

.form-label {
    color: #344054;
    font-weight: 650;
}

.form-control,
.form-select,
.input-group-text {
    border-color: var(--hero-border);
    border-radius: var(--hero-radius);
    background-color: #fbfcff;
    color: var(--hero-text);
}

.input-group > .form-control,
.input-group > .input-group-text {
    border-radius: var(--hero-radius);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--hero-primary);
    box-shadow: 0 0 0 4px rgba(0, 111, 238, 0.12);
}

.btn {
    border-radius: var(--hero-radius);
    font-weight: 700;
    box-shadow: none !important;
}

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

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

.btn-success {
    background: var(--hero-success);
    border-color: var(--hero-success);
    color: #073b1d;
}

.btn-outline-primary {
    color: var(--hero-primary);
    border-color: rgba(0, 111, 238, 0.38);
    background: #f7fbff;
}

.btn-outline-primary:hover {
    background: #e8f1ff;
    color: var(--hero-primary);
    border-color: var(--hero-primary);
}

.btn-outline-secondary,
.btn-secondary {
    border-color: var(--hero-border-strong);
}

.btn-outline-danger {
    color: var(--hero-danger);
    border-color: rgba(243, 18, 96, 0.32);
    background: #fff7fb;
}

.badge {
    border-radius: var(--hero-radius);
    padding: 0.45em 0.65em;
}

.nav-tabs {
    border-bottom: 0;
    gap: 8px;
}

.nav-tabs .nav-link {
    border: 1px solid var(--hero-border);
    border-radius: var(--hero-radius);
    color: var(--hero-muted);
    font-weight: 750;
    background: var(--hero-surface-solid);
}

.nav-tabs .nav-link.active {
    color: var(--hero-primary);
    background: #e8f1ff;
    border-color: #c7dcff;
}

.table {
    margin-bottom: 0;
    --bs-table-hover-bg: #f6f9ff;
}

.table th {
    white-space: nowrap;
    color: #475569;
    font-size: 14px;
    font-weight: 800;
    background: #f5f7fb;
}

.table td,
.table th {
    border-color: var(--hero-border);
    vertical-align: middle;
}

.table-responsive {
    border-radius: var(--hero-radius);
}

.modal-content {
    border: 1px solid var(--hero-border);
    border-radius: var(--hero-radius);
    box-shadow: 0 24px 80px rgba(17, 24, 39, 0.2);
}

.modal-header,
.modal-footer {
    border-color: var(--hero-border);
}

.alert {
    border-radius: var(--hero-radius);
}

.qr-box,
.qr-preview {
    min-height: 180px;
    display: grid;
    place-items: center;
    border: 1px dashed #c8d3e3;
    border-radius: var(--hero-radius);
    background: #f8fbff;
    padding: 14px;
}

.qr-box img,
.qr-preview img {
    max-width: 180px;
    max-height: 180px;
    object-fit: contain;
}

.record-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
}

.record-head {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--hero-muted);
    font-size: 14px;
    font-weight: 800;
}

.record-help,
.record-price-bar span,
.record-total,
.option-item,
.unsettled-summary > div,
.bill-summary > div {
    border: 1px solid var(--hero-border);
    border-radius: var(--hero-radius);
    background: #f8fbff;
}

.record-help {
    color: #475569;
    padding: 10px 12px;
}

.record-amounts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(150px, 0.8fr);
    gap: 12px;
    align-items: end;
    padding-top: 14px;
    border-top: 1px solid var(--hero-border);
}

.record-amounts-single {
    grid-template-columns: minmax(260px, 360px) minmax(220px, 1fr);
}

.record-total {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 12px;
}

.record-total strong {
    color: #b91c1c;
    font-size: 18px;
}

.record-price-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: #475569;
}

.record-price-bar span {
    padding: 8px 10px;
}

.record-batch-total {
    max-width: 420px;
    margin-left: auto;
}

.unsettled-preview {
    border-top: 1px solid var(--hero-border);
    padding-top: 18px;
}

.unsettled-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.unsettled-summary > div,
.bill-summary > div {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 12px;
    color: var(--hero-muted);
}

.unsettled-summary strong {
    color: #475569;
}

.unsettled-summary .unsettled-total,
.bill-summary-total {
    background: #fff8ed !important;
    border-color: #ffd8a8 !important;
}

.unsettled-summary .unsettled-total strong,
.bill-summary-total strong {
    color: #b91c1c;
    font-size: 20px;
}

.table-pager .btn {
    min-width: 38px;
}

.option-list {
    display: grid;
    gap: 8px;
}

.option-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
}

.option-item span {
    min-width: 0;
    word-break: break-word;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
}

.bill-sheet {
    background: #ffffff;
    border: 1px solid var(--hero-border-strong);
    border-radius: var(--hero-radius);
    padding: 28px;
}

.bill-title-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding-bottom: 18px;
    border-bottom: 3px solid #0f766e;
    margin-bottom: 20px;
}

.bill-title-row h2 {
    margin: 4px 0 0;
    font-size: 30px;
    font-weight: 850;
    color: var(--hero-text);
}

.bill-brand {
    color: #0f766e;
    font-weight: 800;
    font-size: 14px;
}

.bill-meta {
    text-align: right;
    color: #475569;
    line-height: 1.9;
}

.bill-customer,
.bill-private-info {
    display: grid;
    gap: 10px 18px;
    background: #f8fbff;
    border: 1px solid var(--hero-border);
    border-radius: var(--hero-radius);
}

.bill-customer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 14px;
    margin-bottom: 18px;
}

.bill-private-info {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 12px;
    margin-bottom: 14px;
}

.bill-private-info > div,
.bill-customer > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.bill-private-info span,
.bill-customer span,
.bill-summary span {
    color: var(--hero-muted);
    font-size: 13px;
}

.bill-private-info strong {
    color: var(--hero-text);
}

.bill-section-title {
    margin: 18px 0 10px;
    font-weight: 850;
    color: var(--hero-text);
}

.bill-table th {
    background: #f1f5f9;
    color: #334155;
}

.bill-total {
    font-size: 20px;
    color: #b91c1c;
}

.bill-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.bill-summary-total {
    font-size: 20px;
}

.bill-payment {
    display: flex;
    flex-wrap: nowrap;
    gap: 14px;
    margin-top: 18px;
}

.bill-payment .qr-box {
    flex: 1 1 0;
    min-width: 0;
}

.bill-payment .qr-box img {
    max-width: min(160px, 100%);
    max-height: 160px;
}

@media (max-width: 575.98px) {
    .content {
        padding: 16px 12px;
    }

    .panel,
    .stat-card {
        padding: 14px;
    }

    .record-row {
        grid-template-columns: 1fr;
    }

    .record-amounts,
    .bill-summary,
    .unsettled-summary {
        grid-template-columns: 1fr;
    }

    .bill-title-row,
    .bill-customer,
    .bill-private-info {
        grid-template-columns: 1fr;
    }

    .bill-payment {
        gap: 8px;
    }

    .bill-payment .qr-box {
        padding: 8px;
        min-height: 150px;
    }

    .bill-payment .qr-box img {
        max-height: 125px;
    }

    .bill-title-row {
        display: block;
    }

    .bill-meta {
        text-align: left;
        margin-top: 10px;
    }
}

@media print {
    body {
        background: #ffffff;
    }

    .navbar,
    .sidebar,
    .no-print,
    .modal-header {
        display: none !important;
    }

    .layout {
        display: block;
        padding-top: 0;
    }

    .content {
        margin: 0 !important;
        padding: 0 !important;
    }

    .modal {
        position: static !important;
        display: block !important;
    }

    .modal-dialog {
        max-width: none;
        margin: 0;
    }

    .modal-content {
        border: 0;
        box-shadow: none;
    }

    .bill-sheet {
        border: 0;
        border-radius: 0;
        padding: 0;
    }
}
