:root {
    --bg: #0f2e26;
    --bg-soft: #163a31;
    --panel: #1c4a3e;
    --panel-2: #245a4b;
    --line: rgba(255, 255, 255, 0.1);
    --text: #f3f7f5;
    --muted: #a8c4ba;
    --accent: #3ecf8e;
    --accent-dark: #2aa86f;
    --warn: #f0b429;
    --danger: #e85d5d;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    --font: "Segoe UI", "Trebuchet MS", Candara, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: var(--font);
    background:
        radial-gradient(ellipse 80% 50% at 10% -10%, rgba(62, 207, 142, 0.18), transparent 55%),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(240, 180, 41, 0.1), transparent 50%),
        linear-gradient(165deg, #0c241e 0%, #12352c 45%, #0f2e26 100%);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}

body {
    min-height: 100vh;
}

.app {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 0 0 2rem;
}

.header {
    padding: 1.25rem 1.1rem 0.75rem;
    position: sticky;
    top: 0;
    z-index: 20;
    background: linear-gradient(180deg, rgba(15, 46, 38, 0.98) 70%, rgba(15, 46, 38, 0.85));
    backdrop-filter: blur(8px);
}

.header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.header-brand {
    min-width: 0;
    flex: 1;
}

.header-brand h1 {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
}

.header-sub {
    margin: 0.15rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.header-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding-top: 0.15rem;
}

.btn-add-users {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: 1px solid rgba(62, 207, 142, 0.55);
    background: rgba(62, 207, 142, 0.2);
    color: #d8ffe9;
    font-weight: 700;
    font-size: 0.82rem;
    line-height: 1;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    white-space: nowrap;
}

.btn-add-users:hover,
.btn-add-users:focus {
    background: rgba(62, 207, 142, 0.35);
    color: #fff;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: 1px solid rgba(255, 140, 140, 0.55);
    background: #c62828;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.btn-logout:hover,
.btn-logout:focus {
    background: #e53935;
    color: #fff;
    border-color: #ffcdd2;
}

/* Material QR */
.mat-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.qr-modal,
.scan-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.qr-modal.hidden,
.scan-modal.hidden {
    display: none !important;
}

.qr-modal-card,
.scan-modal-card {
    width: min(420px, 100%);
    background: #1c4a3e;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    padding: 16px;
    color: #f3f7f5;
}

.qr-modal-card h3,
.scan-modal-card h3 {
    margin: 0 0 6px;
}

.qr-preview {
    margin: 12px auto;
    width: 200px;
    height: 200px;
    background: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.qr-preview img,
.qr-preview canvas {
    max-width: 100%;
    height: auto;
}

.scan-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

#qrReader,
.qr-reader-inline {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 10px;
    background: #000;
    min-height: 220px;
    position: relative;
}

.scan-panel {
    margin-top: 8px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.22);
    max-width: 300px;
}

.scan-panel.hidden {
    display: none !important;
}

.scan-panel #btnStopScan {
    margin-top: 8px;
}

.btn-scan {
    margin-top: 8px;
}

#qrReader video,
.qr-reader-inline video {
    width: 100% !important;
    height: auto !important;
    object-fit: cover;
    border-radius: 10px;
}

#qrReader img,
.qr-reader-inline img {
    max-width: 100%;
}

.nav {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.nav-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.15rem;
}

.nav-scroll::-webkit-scrollbar {
    display: none;
}

.nav-scroll .nav-link {
    flex: 0 0 auto;
    min-width: 5.4rem;
    padding: 0.6rem 0.75rem;
    font-size: 0.86rem;
}

.nav-link {
    flex: 1;
    text-align: center;
    text-decoration: none;
    color: var(--muted);
    padding: 0.65rem 0.5rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 0.95rem;
    transition: 0.15s ease;
}

.nav-link.active {
    color: #0c241e;
    background: var(--accent);
    border-color: var(--accent);
}

.nav-link:not(.active):hover {
    color: var(--text);
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.04);
}

.main {
    padding: 0.75rem 1.1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.panel {
    background: linear-gradient(160deg, var(--panel) 0%, var(--bg-soft) 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.panel-head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 650;
}

.label {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.input {
    width: 100%;
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.22);
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s;
}

.input:focus {
    border-color: var(--accent);
}

.input::placeholder {
    color: rgba(168, 196, 186, 0.55);
}

select.input {
    cursor: pointer;
}

.field {
    margin-bottom: 0.85rem;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.hint {
    margin: 0 0 1rem;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.4;
}

.form-actions {
    display: flex;
    gap: 0.6rem;
}

.btn {
    border: none;
    border-radius: 10px;
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.1s, opacity 0.15s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--accent);
    color: #0c241e;
}

.btn-primary:hover {
    background: var(--accent-dark);
    color: #fff;
}

.btn-block {
    width: 100%;
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-sm {
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(232, 93, 93, 0.35);
}

.btn-edit {
    background: transparent;
    color: var(--warn);
    border: 1px solid rgba(240, 180, 41, 0.35);
}

.hidden {
    display: none !important;
}

.badge {
    background: rgba(62, 207, 142, 0.2);
    color: var(--accent);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
}

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 1.5rem 0.75rem;
    font-size: 0.92rem;
    line-height: 1.45;
}

/* Search */
.search-wrap {
    position: relative;
    margin-bottom: 0.75rem;
}

.search-results {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    background: #163a31;
    border: 1px solid var(--line);
    border-radius: 10px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 30;
    box-shadow: var(--shadow);
}

.search-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.75rem 0.9rem;
    border: none;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover,
.search-item:focus {
    background: rgba(62, 207, 142, 0.12);
}

.search-item .item-name {
    font-weight: 650;
    display: block;
}

.search-item .item-meta {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.15rem;
}

.selected-material {
    margin-top: 0.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--line);
}

.selected-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: 0.85rem;
}

.muted {
    color: var(--muted);
    font-size: 0.85rem;
}

.qty-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.55rem;
    margin-bottom: 0.85rem;
}

.price-preview {
    background: rgba(62, 207, 142, 0.12);
    border: 1px solid rgba(62, 207, 142, 0.35);
    border-radius: 10px;
    padding: 0.75rem 0.5rem;
    font-weight: 750;
    color: var(--accent);
    text-align: center;
    font-size: 0.95rem;
    min-height: 2.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Bill list */
.bill-list,
.materials-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bill-item,
.mat-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--line);
}

.bill-item:last-child,
.mat-item:last-child {
    border-bottom: none;
}

.bill-item-info,
.mat-item-info {
    flex: 1;
    min-width: 0;
}

.bill-item-info strong,
.mat-item-info strong {
    display: block;
    font-size: 0.98rem;
    word-break: break-word;
}

.bill-item-info span,
.mat-item-info span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    margin-top: 0.2rem;
}

.bill-item-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.bill-item-price {
    font-weight: 750;
    color: var(--accent);
    white-space: nowrap;
}

.bill-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    padding-top: 0.85rem;
    border-top: 2px solid rgba(62, 207, 142, 0.35);
    font-size: 1.1rem;
}

.bill-total strong {
    color: var(--accent);
    font-size: 1.35rem;
}

.mat-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.mat-actions .btn {
    padding: 0.4rem 0.55rem;
    font-size: 0.75rem;
}

.bill-save {
    margin-top: 0.9rem;
}

.save-status {
    margin: 0.55rem 0 0;
}

.save-status.ok {
    color: var(--accent);
}

.save-status.warn {
    color: var(--warn);
}

.bill-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--line);
}

.btn-wa {
    background: rgba(37, 211, 102, 0.18);
    border-color: rgba(37, 211, 102, 0.45);
    color: #7dffb2;
}

.btn-wa:hover {
    background: #25d366;
    color: #062816;
}

.customer-results {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: 0.35rem;
}

.customer-card-wrap {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.45rem;
    align-items: stretch;
}

.customer-del-btn {
    align-self: center;
}

.history-top-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}

.history-top-actions .btn {
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.customer-card {
    width: 100%;
    text-align: left;
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.85rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.18);
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
}

.customer-card:hover {
    border-color: rgba(62, 207, 142, 0.45);
    background: rgba(62, 207, 142, 0.08);
}

.customer-card-main strong {
    display: block;
    font-size: 1rem;
}

.customer-card-main .muted {
    display: block;
    margin-top: 0.2rem;
}

.customer-card-meta {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.small {
    font-size: 0.75rem;
}

.history-sub {
    margin: 0.2rem 0 0;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.history-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.85rem;
    background: rgba(0, 0, 0, 0.16);
}

.history-card-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 0.65rem;
}

.history-date {
    display: block;
    font-size: 0.95rem;
}

.history-total {
    color: var(--accent);
    white-space: nowrap;
}

.history-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.history-items li {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.4rem 0;
    border-top: 1px solid var(--line);
    font-size: 0.88rem;
}

.history-items li span {
    color: var(--muted);
}

.history-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.45rem;
    margin-top: 0.75rem;
}

.receipt-customer {
    margin-bottom: 12px;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.45;
}

.receipt-pay {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    font-size: 13px;
}

.receipt-pay div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.existing-customer {
    margin: 0.35rem 0 0.85rem;
    padding: 0.85rem;
    border-radius: 12px;
    border: 1px solid rgba(240, 180, 41, 0.45);
    background: rgba(240, 180, 41, 0.1);
}

.existing-title {
    margin: 0;
    font-weight: 750;
    color: var(--warn);
}

.existing-info {
    margin: 0.35rem 0 0.7rem;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.4;
}

.existing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.payment-panel {
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--line);
}

.balance-preview.due {
    color: var(--warn);
    border-color: rgba(240, 180, 41, 0.45);
    background: rgba(240, 180, 41, 0.12);
}

.balance-preview.paid {
    color: var(--accent);
}

.customer-due-banner {
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    background: rgba(240, 180, 41, 0.12);
    border: 1px solid rgba(240, 180, 41, 0.4);
    color: var(--warn);
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.pay-summary {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.88rem;
    color: var(--muted);
    margin-bottom: 0.55rem;
}

.due-text {
    color: var(--warn) !important;
}

.pay-status {
    display: inline-block;
    margin-top: 0.3rem;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
}

.status-due {
    color: #3a2a00;
    background: var(--warn);
}

.status-paid {
    color: #0c241e;
    background: var(--accent);
}

.due-tag {
    color: var(--warn);
    font-size: 0.75rem;
    font-weight: 700;
}

.collect-payment {
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px dashed var(--line);
}

.collect-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
}

.payment-log {
    margin-top: 0.55rem;
}

.payment-log .label {
    margin-bottom: 0.2rem;
}

.mini-dash {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

.mini-card {
    background: linear-gradient(160deg, var(--panel) 0%, var(--bg-soft) 100%);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.8rem 0.9rem;
    box-shadow: var(--shadow);
}

.mini-card span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.mini-card strong {
    display: block;
    margin-top: 0.25rem;
    font-size: 1.15rem;
    color: var(--accent);
}

.qty-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 0.85rem;
}

.chip {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border-radius: 999px;
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 650;
    cursor: pointer;
    font-family: inherit;
}

.chip:hover {
    border-color: rgba(62, 207, 142, 0.5);
    background: rgba(62, 207, 142, 0.12);
}

.bill-totals-box {
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--line);
}

.bill-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.55rem;
    color: var(--muted);
}

.discount-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
    margin-bottom: 0.35rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
}

.stat-card {
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.75rem;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
}

.stat-card strong {
    display: block;
    margin-top: 0.3rem;
    font-size: 1.05rem;
}

.dues-list,
.dues-full-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.dues-card {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.8rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.16);
}

.dues-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.file-btn {
    text-align: center;
    display: block;
}

.receipt-money {
    margin-top: 8px;
    font-size: 13px;
}

.receipt-money > div {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}

.receipt-total-line {
    border-top: 2px solid #111;
    margin-top: 6px;
    padding-top: 8px !important;
    font-size: 15px;
}

.receipt-note {
    margin: 10px 0 0;
    font-size: 12px;
    color: #555;
}

.btn-action {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid var(--line);
    padding: 0.75rem 0.4rem;
    font-size: 0.88rem;
}

.btn-action:hover {
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.1);
}

.btn-pdf {
    background: rgba(62, 207, 142, 0.15);
    border-color: rgba(62, 207, 142, 0.4);
    color: var(--accent);
}

.btn-pdf:hover {
    background: var(--accent);
    color: #0c241e;
}

.btn-action:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Receipt used for print + PDF */
.receipt {
    position: fixed;
    left: -9999px;
    top: 0;
    width: 190mm;
    background: #fff;
    color: #111;
    z-index: -1;
    pointer-events: none;
}

.receipt-inner {
    padding: 18px 20px;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: #111;
    background: #fff;
}

.receipt-head {
    text-align: center;
    margin-bottom: 16px;
    border-bottom: 2px solid #111;
    padding-bottom: 12px;
}

.receipt-head h1 {
    margin: 0;
    font-size: 22px;
    color: #111;
}

.receipt-head p {
    margin: 4px 0 0;
    color: #444;
    font-size: 13px;
}

.receipt-meta {
    margin-top: 8px !important;
    font-size: 12px !important;
}

.receipt-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 14px;
}

.receipt-table th,
.receipt-table td {
    padding: 8px 6px;
    border-bottom: 1px solid #ddd;
    text-align: left;
    font-size: 13px;
    vertical-align: top;
}

.receipt-table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #555;
    border-bottom: 2px solid #111;
}

.receipt-table .c-no {
    width: 28px;
    color: #666;
}

.receipt-table .c-amt {
    text-align: right;
    white-space: nowrap;
    font-weight: 700;
}

.receipt-table .c-sub {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
}

.receipt-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 2px solid #111;
    padding-top: 12px;
    font-size: 16px;
}

.receipt-total strong {
    font-size: 20px;
}

.receipt-foot {
    text-align: center;
    margin: 18px 0 0;
    color: #666;
    font-size: 12px;
}

.receipt-credit {
    text-align: center;
    margin: 14px 0 0;
    padding-top: 10px;
    border-top: 1px dashed #ccc;
    color: #777;
    font-size: 10px;
    line-height: 1.45;
}

.pagination {
    margin-top: 0.9rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--line);
}

.pagination-info {
    margin: 0 0 0.55rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
}

.pagination-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
}

.page-btn {
    min-width: 2.2rem;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 650;
    cursor: pointer;
}

.page-btn:hover:not(:disabled) {
    border-color: rgba(62, 207, 142, 0.45);
    background: rgba(62, 207, 142, 0.12);
}

.page-btn.active {
    background: var(--accent);
    color: #0c241e;
    border-color: var(--accent);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.app-credit {
    margin: 0.5rem 1.1rem 1.5rem;
    padding: 0.85rem 0.75rem;
    text-align: center;
    border-top: 1px solid var(--line);
    color: var(--muted);
}

.app-credit p {
    margin: 0.15rem 0;
    font-size: 0.78rem;
    line-height: 1.4;
}

.app-credit strong {
    color: var(--text);
    font-weight: 650;
}

.app-credit a {
    color: var(--accent);
    text-decoration: none;
}

.app-credit a:hover {
    text-decoration: underline;
}

@media (max-width: 380px) {
    .qty-row {
        grid-template-columns: 1fr 1fr;
    }

    .price-preview-field {
        grid-column: 1 / -1;
    }

    .field-row {
        grid-template-columns: 1fr;
    }

    .bill-actions {
        grid-template-columns: 1fr;
    }

    .history-actions {
        grid-template-columns: 1fr;
    }
}

/* Print: show only the receipt (fallback if iframe print is unavailable) */
@media print {
    @page {
        margin: 12mm;
    }

    html,
    body {
        background: #ffffff !important;
        color: #111111 !important;
    }

    body.printing .app,
    body.printing .app-credit,
    body.printing header,
    body.printing nav,
    body.printing footer,
    body.printing #pdfCaptureRoot,
    body.printing #printFrame {
        display: none !important;
    }

    body.printing #receipt,
    #receipt {
        display: block !important;
        position: static !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
        max-width: 190mm;
        margin: 0 auto !important;
        z-index: 1 !important;
        pointer-events: auto !important;
        background: #ffffff !important;
        color: #111111 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body.printing * {
        visibility: visible !important;
    }
}
