* { box-sizing: border-box; }
:root {
    --bg: #f5f6f8; --card: #fff; --text: #303236; --muted: #68707a; --line: #ddd; --brand: #272a2c; --brand2: #3b3f42; --radius: 16px;
}
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); }
a { color: #1d4ed8; text-decoration: none; } a:hover { text-decoration: underline; }
h1,h2,h3,p { margin-top: 0; }
.topbar { position: sticky; top: 0; z-index: 5; background: var(--brand); color: white; padding: 14px 28px; display: flex; justify-content: space-between; align-items: center; gap: 20px; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.brand a { color: white; font-weight: 700; font-size: 18px; } .brand span { margin-left: 8px; color: #ddd; font-size: 13px; }
.nav { display:flex; align-items:center; gap:14px; flex-wrap:wrap; } .nav a { color:#f3f4f6; } .nav .logout { color:#fecaca; }
.container { width: min(1300px, calc(100% - 32px)); margin: 28px auto; }
.login-container { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(420px, 100%); background: white; border-radius: var(--radius); padding: 32px; box-shadow: 0 18px 50px rgba(0,0,0,.12); }
.hint { margin-top:18px; padding:12px; border-radius:12px; background:#f9fafb; color:var(--muted); font-size:14px; }
.page-head { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; margin-bottom:20px; }
.muted { color: var(--muted); }
.card { background: white; border:1px solid var(--line); border-radius: var(--radius); padding:20px; margin-bottom:18px; box-shadow: 0 8px 24px rgba(15,23,42,.05); }
.cards { display:grid; grid-template-columns: repeat(4, 1fr); gap:16px; margin-bottom:18px; }
.stat span { display:block; color:var(--muted); margin-bottom:10px; } .stat strong { font-size:28px; }
.section-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; margin-bottom:12px; }
.section-head h2 { font-size:18px; margin-bottom:6px; }
.form { display:grid; gap:16px; } .grid-form { display:grid; grid-template-columns: 1fr 1fr; gap:16px; }
label { display:grid; gap:7px; font-weight:600; }
input,select,textarea { width:100%; border:1px solid #d1d5db; border-radius:12px; padding:11px 12px; font:inherit; background:white; color:var(--text); }
textarea { resize: vertical; } input:focus,select:focus,textarea:focus { outline:2px solid #93c5fd; border-color:#60a5fa; }
.span-2 { grid-column: span 2; }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; background:var(--brand); color:white; border:1px solid var(--brand); border-radius:12px; padding:10px 14px; font-weight:700; cursor:pointer; text-decoration:none; }
.btn:hover { background:var(--brand2); text-decoration:none; } .btn.small { padding:7px 10px; border-radius:10px; } .btn.full { width:100%; }
.btn.ghost { background:white; color:var(--brand); border-color:#d1d5db; } .btn.ghost:hover { background:#f9fafb; }
.btn.danger-btn { background:#fee2e2; color:#991b1b; border-color:#fecaca; padding:8px 10px; }
.button-row,.form-actions,.filter-actions { display:flex; gap:10px; flex-wrap:wrap; }
.alert { padding:12px 14px; border-radius:12px; margin-bottom:16px; border:1px solid transparent; } .alert.success { background:#ecfdf5; color:#065f46; border-color:#a7f3d0; } .alert.danger { background:#fef2f2; color:#991b1b; border-color:#fecaca; }
.filters { display:grid; grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr auto; gap:12px; align-items:end; }
.table-wrap { width:100%; overflow-x:auto; } table { width:100%; border-collapse:collapse; } th,td { text-align:left; padding:12px 10px; border-bottom:1px solid var(--line); vertical-align:top; }
th { color:#4b5563; font-size:13px; text-transform:uppercase; letter-spacing:.04em; background:#f9fafb; } .right { text-align:right; } .center { text-align:center; }
td.actions { white-space:nowrap; text-align:right; } td.actions a { margin-left:10px; }
.empty { color:var(--muted); margin-bottom:0; }
.badge { display:inline-flex; padding:5px 9px; border-radius:999px; font-size:12px; font-weight:700; text-transform:capitalize; }
.badge.unpaid { background:#fee2e2; color:#991b1b; } .badge.partially_paid { background:#fef3c7; color:#92400e; } .badge.fully_paid { background:#dcfce7; color:#166534; }
.item-table input,.item-table select { min-width:140px; } .item-table input[name="item_description[]"] { min-width:250px; } .row-amount { white-space:nowrap; font-weight:700; }
.summary-box { display:grid; grid-template-columns: repeat(4, 1fr); gap:12px; margin-top:18px; } .summary-box div { border:1px solid var(--line); border-radius:14px; padding:14px; background:#f9fafb; } .summary-box span { display:block; color:var(--muted); margin-bottom:7px; font-size:13px; } .summary-box strong { font-size:18px; }
.footer { width:min(1300px, calc(100% - 32px)); margin:0 auto 28px; color:var(--muted); font-size:13px; }

/* Document styles */
.document { background:white; width: min(1060px, 100%); margin:0 auto; padding:42px 42px 52px; border:1px solid var(--line); box-shadow:0 8px 24px rgba(15,23,42,.05); color:#333; }
.invoice-top { display:grid; grid-template-columns: 1fr 360px; gap:40px; min-height:300px; align-items:start; }
.doc-title-block h1 { font-size:56px; letter-spacing:1px; font-weight:400; margin:24px 0 8px; color:#000; } .doc-title-block h3 { color:#666; margin-bottom:40px; }
.balance-large span { display:block; font-weight:700; margin-bottom:6px; } .balance-large strong { font-size:26px; }
.company { color:#555; } .company h2 { font-size:18px; margin:8px 0 6px; color:#333; } .company p { margin:3px 0; line-height:1.35; }
.right-company { text-align:right; } .doc-logo { width:250px; max-width:100%; display:block; object-fit:contain; margin-bottom:10px; } .right-company .doc-logo { margin-left:auto; }
.doc-info-grid { display:grid; grid-template-columns: 1fr 1fr; gap:60px; margin:28px 0 30px; } .doc-info-grid span { display:inline-block; color:#666; margin-right:18px; } .doc-info-grid strong { font-weight:700; } .doc-info-grid p { margin:4px 0 0; }
.doc-table { margin-top:10px; } .doc-table th { background:#383a36; color:#fff; font-size:16px; text-transform:none; letter-spacing:0; } .doc-table td { font-size:16px; }
.totals-wrap { width: 520px; margin: 0 0 40px auto; } .totals-wrap table td, .receipt-totals table td { border-bottom:none; padding:12px 14px; font-size:16px; } .grand td { font-weight:800; font-size:18px; } .balance td { background:#f4f4f4; font-weight:800; font-size:18px; }
.invoice-bottom-grid { display:grid; grid-template-columns: 1fr 520px; gap:42px; align-items:start; margin-top:10px; } .invoice-bottom-grid .totals-wrap { width:100%; margin:0 0 28px; } .invoice-payment-box { margin-top:0; }
.notes-block { margin-top:36px; color:#555; } .notes-block h3 { color:#777; font-weight:400; margin-bottom:10px; } .notes-block p { white-space:normal; line-height:1.45; }
.terms-pagebreak { margin-top:32px; padding-top:20px; border-top:1px solid #eee; color:#444; line-height:1.35; font-size:12px; } .terms-pagebreak h3 { margin-top:22px; color:#777; font-weight:400; font-size:15px; } .terms-pagebreak p { font-size:12px; line-height:1.35; }
.receipt-company-row { display:grid; grid-template-columns: 1fr 320px; gap:40px; align-items:start; min-height:330px; } .receipt-company-row .company h2 { font-size:28px; } .receipt-logo { margin-left:auto; width:300px; }
.document hr { border:none; border-top:1px solid #ccc; margin:0 0 36px; }
.receipt-title-row h1 { font-size:38px; margin-bottom:4px; } .receipt-title-row h3 { font-weight:400; margin-bottom:32px; }
.receipt-info { align-items:start; margin:0 0 34px; } .receipt-info > div:last-child { text-align:right; }
.receipt-lower-grid { display:grid; grid-template-columns: 1.1fr .8fr; gap:48px; align-items:start; margin-top:18px; } .payment-box { border:1px solid #ddd; border-radius:14px; padding:24px; } .payment-box h3 { font-size:16px; margin-bottom:18px; } .payment-box div { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:12px; } .payment-box span { color:#444; }
.receipt-totals table { width:100%; } .receipt-totals .grand td { border-top:1px solid #ccc; border-bottom:1px solid #ccc; }

@media screen and (max-width: 1000px) {
    .topbar,.page-head,.section-head { flex-direction:column; align-items:stretch; }
    .cards,.grid-form,.filters,.summary-box,.invoice-top,.doc-info-grid,.receipt-company-row,.receipt-lower-grid,.invoice-bottom-grid { grid-template-columns:1fr; }
    .span-2 { grid-column:span 1; } .right-company,.receipt-info > div:last-child { text-align:left; } .right-company .doc-logo,.receipt-logo { margin-left:0; } .totals-wrap { width:100%; }
}
@media print {
    @page { size:A4; margin:12mm; }
    html, body { background:white; width:210mm; min-height:297mm; }
    body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .no-print,.topbar,.footer,.alert { display:none !important; }
    .container { width:100%; margin:0; }
    .document { width:100%; max-width:none; border:none; box-shadow:none; padding:0; }
    .invoice-top { display:grid !important; grid-template-columns:1fr 72mm !important; gap:14mm; min-height:72mm; align-items:start; }
    .doc-info-grid { display:grid !important; grid-template-columns:1fr 1fr !important; gap:20mm; margin:10mm 0 10mm; }
    .invoice-bottom-grid { display:grid !important; grid-template-columns:1fr 72mm !important; gap:12mm; align-items:start; }
    .receipt-company-row { display:grid !important; grid-template-columns:1fr 68mm !important; gap:12mm; min-height:72mm; }
    .receipt-lower-grid { display:grid !important; grid-template-columns:1.1fr .8fr !important; gap:12mm; }
    .right-company { text-align:right !important; }
    .right-company .doc-logo, .receipt-logo { margin-left:auto !important; }
    .doc-logo { width:52mm; }
    .doc-title-block h1 { font-size:36px; margin:6mm 0 2mm; }
    .doc-title-block h3 { margin-bottom:12mm; }
    .doc-table th, .doc-table td { font-size:10px; padding:7px 8px; }
    .payment-box { padding:12px; }
    .payment-box div { grid-template-columns:1fr 1fr; gap:8px; margin-top:7px; }
    .totals-wrap table td, .receipt-totals table td { font-size:11px; padding:8px 10px; }
    .grand td, .balance td, .balance-row td { font-size:12px; }
    .terms-pagebreak { font-size:10px; line-height:1.25; margin-top:10mm; padding-top:6mm; }
    .terms-pagebreak p { font-size:10px; line-height:1.25; }
    .terms-pagebreak h3 { font-size:12px; margin-top:7mm; }
    a { color:inherit; text-decoration:none; }
}


/* Force invoice payment information and terms to start on a new printed/PDF page */
.invoice-payment-page {
    break-before: page;
    page-break-before: always;
}

@media print {
    .invoice-payment-page {
        break-before: page;
        page-break-before: always;
        padding-top: 0 !important;
        margin-top: 0 !important;
    }
}


/* Receipt header fix: only right logo, larger logo, and spacing before divider */
.receipt-company-row {
    grid-template-columns: 1fr 300px;
    align-items: center;
    min-height: 300px;
    margin-bottom: 34px;
}

.receipt-company-info {
    padding-top: 20px;
}

.receipt-company-info h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.receipt-company-info p {
    line-height: 1.35;
}

.receipt-company-info .company-email {
    margin-bottom: 34px;
}

.receipt-logo {
    width: 300px;
    max-width: 100%;
    margin-left: auto;
}

@media print {
    .receipt-company-row {
        display: grid !important;
        grid-template-columns: 1fr 58mm !important;
        gap: 14mm !important;
        align-items: center !important;
        min-height: 78mm !important;
        margin-bottom: 10mm !important;
    }

    .receipt-company-info {
        padding-top: 0 !important;
    }

    .receipt-company-info h2 {
        font-size: 18px !important;
        margin-bottom: 5px !important;
    }

    .receipt-company-info p {
        line-height: 1.28 !important;
        margin: 2px 0 !important;
    }

    .receipt-company-info .company-email {
        margin-bottom: 8mm !important;
    }

    .receipt-logo {
        width: 58mm !important;
        max-width: 58mm !important;
        margin-left: auto !important;
    }

    .receipt-doc hr {
        margin-top: 0 !important;
    }
}


/* V7 deposit return + complete booking */
.complete-check {
    display: flex;
    align-items: center;
    gap: 10px;
    align-self: end;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f9fafb;
}
.complete-check input { width: auto; }
.badge.complete { background: #ede9fe; color: #5b21b6; }


/* V8 Dashboard + calendar + delete controls */
.dashboard-cards { grid-template-columns: repeat(6, 1fr); }
.total-sales-card small { display:block; margin-top:8px; color:var(--muted); }
.mini-filter label { display:block; font-weight:400; }
.mini-filter span { display:block; color:var(--muted); margin-bottom:8px; }
.mini-filter input[type="month"] { margin-bottom:10px; padding:8px 10px; }
.calendar-card { margin-top:18px; }
.calendar-controls { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.calendar-controls input[type="month"] { width:auto; }
.calendar-legend { display:flex; gap:18px; flex-wrap:wrap; margin-bottom:14px; color:var(--muted); font-size:14px; }
.dot { display:inline-block; width:11px; height:11px; border-radius:999px; margin-right:6px; }
.available-dot { background:#dcfce7; }
.booked-dot { background:#fee2e2; }
.complete-dot { background:#ede9fe; }
.calendar-grid { display:grid; grid-template-columns:repeat(7,1fr); border:1px solid var(--line); border-radius:14px; overflow:hidden; background:white; }
.calendar-weekday { padding:10px; background:#111827; color:white; font-weight:700; text-align:center; font-size:13px; }
.calendar-day { min-height:130px; border-right:1px solid var(--line); border-bottom:1px solid var(--line); padding:8px; background:#fff; }
.calendar-day.empty-day { background:#f3f4f6; }
.calendar-day.available { background:#f8fff9; }
.calendar-day.has-event { background:#fffafa; }
.calendar-day.today { outline:3px solid #93c5fd; outline-offset:-3px; }
.calendar-date { font-weight:800; margin-bottom:6px; }
.calendar-available { color:#15803d; font-size:12px; font-weight:700; }
.calendar-event { display:block; padding:6px; border-radius:8px; margin-bottom:5px; font-size:12px; text-decoration:none; border:1px solid #fecaca; background:#fff1f2; color:#7f1d1d; }
.calendar-event:hover { text-decoration:none; }
.calendar-event b,.calendar-event span { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.calendar-event.complete { border-color:#ddd6fe; background:#f5f3ff; color:#5b21b6; }
.calendar-more { font-size:12px; color:var(--muted); font-weight:700; }
.bulk-actions { display:flex; gap:12px; align-items:center; margin-bottom:12px; flex-wrap:wrap; }
.check-col { width:42px; text-align:center; }
.check-col input { width:auto; }
.hidden-delete-form { display:none; }
.link-delete { border:none; background:transparent; color:#b91c1c; cursor:pointer; font:inherit; padding:0; margin-left:10px; }
.link-delete:hover { text-decoration:underline; }
.btn.danger-btn { background:#b91c1c; border-color:#b91c1c; color:white; }
.btn.danger-btn:hover { background:#991b1b; }
.badge.complete { background:#ede9fe; color:#5b21b6; }
@media (max-width:1150px) { .dashboard-cards { grid-template-columns:repeat(3,1fr); } .calendar-grid { display:block; border:none; background:transparent; } .calendar-weekday,.calendar-day.empty-day { display:none; } .calendar-day { min-height:auto; border:1px solid var(--line); border-radius:12px; margin-bottom:10px; } }
@media (max-width:700px) { .dashboard-cards { grid-template-columns:1fr; } }

/* V9 advanced dashboard polish */
.dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 28px;
    margin-bottom: 18px;
    border-radius: 24px;
    background: linear-gradient(135deg, #111827 0%, #334155 55%, #7c5c2e 100%);
    color: #fff;
    box-shadow: 0 18px 44px rgba(15, 23, 42, .20);
}

.dashboard-hero h1 {
    font-size: 38px;
    margin-bottom: 8px;
}

.dashboard-hero p {
    color: #e5e7eb;
    max-width: 760px;
    margin-bottom: 0;
}

.eyebrow {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    color: #fef3c7;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dashboard-hero .btn.ghost {
    background: rgba(255,255,255,.12);
    border-color: rgba(255,255,255,.28);
    color: #fff;
}

.v9-cards {
    grid-template-columns: repeat(5, 1fr);
}

.smart-card {
    position: relative;
    overflow: hidden;
    min-height: 145px;
    color: var(--text);
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease;
}

.smart-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 34px rgba(15,23,42,.10);
    text-decoration: none;
}

.smart-card::after {
    content: "";
    position: absolute;
    width: 90px;
    height: 90px;
    right: -22px;
    top: -22px;
    border-radius: 999px;
    background: #e5e7eb;
    opacity: .7;
}

.smart-card small {
    color: var(--muted);
    font-weight: 600;
}

.unpaid-card::after { background: #fecaca; }
.partial-card::after { background: #fde68a; }
.paid-card::after { background: #bbf7d0; }
.complete-card::after { background: #ddd6fe; }

.dashboard-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, .8fr);
    gap: 18px;
    margin-bottom: 18px;
}

.sales-panel,
.status-panel {
    border: none;
}

.sales-head {
    align-items: flex-start;
}

.sales-filter {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.sales-filter label {
    min-width: 150px;
    font-size: 13px;
    color: var(--muted);
}

.sales-filter select,
.sales-filter input[type="month"] {
    padding: 9px 10px;
}

.month-picker.is-muted {
    opacity: .55;
}

.sales-total-box {
    padding: 24px;
    border-radius: 22px;
    background: linear-gradient(135deg, #f8fafc 0%, #fff7ed 100%);
    border: 1px solid #fed7aa;
    margin: 14px 0;
}

.sales-total-box span {
    color: var(--muted);
    font-weight: 700;
}

.sales-total-box strong {
    display: block;
    font-size: clamp(34px, 5vw, 56px);
    margin: 8px 0;
    letter-spacing: -0.04em;
}

.sales-total-box small {
    color: var(--muted);
    font-weight: 700;
}

.sales-mini-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.sales-mini-grid div {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}

.sales-mini-grid span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 7px;
}

.sales-mini-grid b {
    font-size: 18px;
}

.progress-row {
    margin-bottom: 18px;
}

.progress-row > div:first-child {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    margin-bottom: 8px;
}

.progress-track {
    height: 12px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
    background: #94a3b8;
}

.progress-fill.unpaid { background: #ef4444; }
.progress-fill.partially-paid { background: #f59e0b; }
.progress-fill.fully-paid { background: #22c55e; }
.progress-fill.complete { background: #8b5cf6; }

.dashboard-lists {
    align-items: start;
}

.booking-timeline {
    display: grid;
    gap: 12px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
}

.timeline-date {
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: #111827;
    color: #fff;
    min-height: 64px;
}

.timeline-date b {
    font-size: 24px;
    line-height: 1;
}

.timeline-date span {
    font-size: 12px;
    text-transform: uppercase;
    color: #d1d5db;
}

.timeline-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.timeline-top h3 {
    margin-bottom: 4px;
    font-size: 16px;
}

.timeline-content p {
    margin-bottom: 5px;
}

.timeline-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
    font-weight: 700;
}

.clean-table td {
    vertical-align: middle;
}

.advanced-calendar .calendar-grid {
    box-shadow: inset 0 0 0 1px var(--line);
}

.calendar-date-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 7px;
}

.calendar-date-row b {
    font-size: 16px;
}

.calendar-date-row span {
    font-size: 11px;
    color: var(--muted);
    font-weight: 800;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 7px;
    white-space: nowrap;
}

.calendar-day.fully-booked {
    background: #fff1f2;
}

@media (max-width: 1180px) {
    .v9-cards,
    .sales-mini-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-main-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .dashboard-hero {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-actions,
    .sales-filter {
        justify-content: stretch;
    }

    .hero-actions .btn,
    .sales-filter label,
    .sales-filter .btn {
        width: 100%;
    }

    .v9-cards,
    .sales-mini-grid {
        grid-template-columns: 1fr;
    }

    .timeline-item {
        grid-template-columns: 1fr;
    }

    .timeline-date {
        display: flex;
        justify-content: center;
        gap: 8px;
        min-height: auto;
        padding: 10px;
    }
}


/* V10 booking records readability update */
.records-head .button-row {
    align-items: center;
}

.record-summary {
    grid-template-columns: repeat(5, 1fr);
}

.summary-link {
    color: inherit;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease;
}

.summary-link:hover {
    transform: translateY(-2px);
    text-decoration: none;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .08);
}

.records-filter {
    grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr auto;
}

.records-card {
    padding: 0;
    overflow: hidden;
}

.records-toolbar {
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff, #f9fafb);
}

.records-toolbar h2 {
    margin-bottom: 4px;
    font-size: 18px;
}

.records-toolbar p {
    margin-bottom: 0;
}

.records-table-wrap {
    margin: 0;
}

.booking-table th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.booking-table tbody tr {
    transition: background .15s ease;
}

.booking-table tbody tr:hover {
    background: #f9fafb;
}

.booking-table td {
    padding: 16px 12px;
}

.record-main,
.customer-block,
.booking-detail-block,
.payment-stack {
    display: grid;
    gap: 5px;
}

.record-main strong {
    font-size: 14px;
}

.record-main span,
.customer-block span,
.record-main small {
    color: var(--muted);
}

.customer-block strong {
    font-size: 15px;
}

.items-line {
    max-width: 360px;
    font-weight: 700;
    line-height: 1.35;
}

.record-chips {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.record-chips span {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    background: #f9fafb;
    color: #374151;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 700;
}

.payment-stack {
    white-space: nowrap;
}

.payment-stack span:not(.badge) {
    color: #374151;
    font-size: 13px;
}

.action-buttons {
    min-width: 245px;
}

.action-buttons .btn {
    margin: 2px;
}

.edit-btn {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.edit-btn:hover {
    background: #1e40af;
}

.hidden-delete-form {
    display: none;
}

@media (max-width: 1150px) {
    .record-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .records-filter {
        grid-template-columns: 1fr;
    }

    .records-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 700px) {
    .record-summary {
        grid-template-columns: 1fr;
    }
}


/* V11 rates, IC, and deposit checkbox improvements */
.customer-meta { font-size: 12px; color: #555; line-height: 1.35; margin-top: 4px; }
.small-text { font-size: 12px; }
.item-table .rate-type-select { min-width: 190px; }
.item-table .rate-input { min-width: 110px; }
@media print { .customer-meta { font-size: 9.5px !important; color: #444 !important; line-height: 1.25 !important; } }

/* V12 dashboard no-refresh controls, reordered sections, and checkout-date calendar */
.dashboard-hero p {
    max-width: 820px;
}

.dashboard-section {
    margin-bottom: 18px;
}

.upcoming-section,
.recent-section,
.advanced-calendar {
    border: none;
}

.wide-timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sales-filter {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 10px;
}

.sales-filter select,
.sales-filter input[type="month"],
.calendar-controls input[type="month"] {
    cursor: pointer;
}

.sales-filter label {
    margin-bottom: 0;
}

.checkout-dot {
    background: #bfdbfe;
}

.calendar-event.checkout-marker {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
}

.calendar-event.checkout-marker.complete {
    border-color: #c4b5fd;
    background: #f5f3ff;
    color: #5b21b6;
}

.calendar-controls .btn {
    white-space: nowrap;
}

.calendar-day.has-event.available-checkout-only {
    background: #f8fff9;
}

.recent-section .clean-table td:nth-child(4) {
    min-width: 220px;
}

@media (max-width: 1180px) {
    .wide-timeline {
        grid-template-columns: 1fr;
    }
}


/* V13 topbar, booking checklist, sort, and document label updates */
.modern-topbar {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(18px);
    color: #111827;
    border-bottom: 1px solid rgba(209, 213, 219, .85);
    box-shadow: 0 10px 32px rgba(15, 23, 42, .08);
    padding: 10px 28px;
}
.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #111827 !important;
    text-decoration: none;
}
.topbar-logo {
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 3px;
}
.brand-text {
    display: grid;
    gap: 2px;
}
.brand-text strong {
    font-size: 17px;
    line-height: 1.1;
}
.brand-text small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}
.modern-nav {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 6px;
    gap: 4px;
}
.modern-nav a {
    color: #374151;
    padding: 9px 12px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 14px;
}
.modern-nav a:hover {
    background: #fff;
    color: #111827;
    text-decoration: none;
}
.nav-add-btn {
    background: linear-gradient(135deg, #111827, #374151) !important;
    color: #fff !important;
    box-shadow: 0 8px 18px rgba(17, 24, 39, .18);
}
.nav-divider {
    width: 1px;
    height: 28px;
    background: #d1d5db;
    margin: 0 4px;
}
.logout-btn {
    background: #fff1f2 !important;
    color: #be123c !important;
    border: 1px solid #fecdd3;
}
.logout-btn:hover {
    background: #ffe4e6 !important;
}
.records-filter {
    grid-template-columns: 1.3fr 1fr 1fr 1fr 1fr 1fr auto;
}
.record-checklist {
    margin-top: 10px;
    display: grid;
    gap: 6px;
    font-size: 12px;
    color: #374151;
}
.record-checklist label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 700;
}
.record-checklist input[type="checkbox"],
.deposit-paid-indicator input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #16a34a;
}
.customer-block small {
    color: var(--muted);
}
.record-highlight {
    animation: recordPulse 1.8s ease-in-out infinite;
    background: #fff7ed !important;
    outline: 3px solid #fb923c;
    outline-offset: -3px;
}
.record-highlight.record-highlight-fade {
    animation: none;
    background: transparent !important;
    outline: none;
    transition: background .8s ease, outline .8s ease;
}
@keyframes recordPulse {
    0%, 100% { background: #fff7ed; }
    50% { background: #ffedd5; }
}
.customer-meta-inline {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
}
.customer-meta-inline span {
    display: inline-block;
}
.deposit-paid-indicator {
    align-self: end;
}
@media (max-width: 1150px) {
    .records-filter { grid-template-columns: 1fr; }
    .modern-topbar { border-radius: 0; }
    .modern-nav { border-radius: 18px; align-self: stretch; justify-content: center; }
}
@media print {
    .customer-meta-inline { display: flex !important; gap: 12mm !important; }
}


/* V14 fixed admin topbar: prevents logo from expanding and keeps navigation clean */
.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
    padding: 0 24px;
}

.admin-topbar-inner {
    width: min(1300px, 100%);
    min-height: 74px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.admin-brand {
    display: inline-flex !important;
    align-items: center !important;
    gap: 12px !important;
    color: #111827 !important;
    text-decoration: none !important;
    min-width: 0;
}

.admin-logo-box {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    max-width: 56px !important;
    min-height: 56px !important;
    max-height: 56px !important;
    display: grid !important;
    place-items: center !important;
    background: #fff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 16px !important;
    box-shadow: 0 6px 16px rgba(15, 23, 42, .08) !important;
    overflow: hidden !important;
    flex: 0 0 56px !important;
}

.admin-logo {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
    min-height: 46px !important;
    max-height: 46px !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    position: static !important;
}

.admin-brand-text {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    margin: 0 !important;
    color: #111827 !important;
    line-height: 1.12 !important;
}

.admin-brand-text strong {
    display: block !important;
    color: #111827 !important;
    font-size: 17px !important;
    font-weight: 900 !important;
    letter-spacing: .01em !important;
    white-space: nowrap !important;
}

.admin-brand-text small {
    display: block !important;
    color: #6b7280 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
}

.admin-nav {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
}

.admin-nav a {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 40px !important;
    padding: 9px 13px !important;
    border-radius: 999px !important;
    color: #374151 !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    text-decoration: none !important;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease !important;
}

.admin-nav a:hover {
    background: #f3f4f6 !important;
    color: #111827 !important;
    text-decoration: none !important;
}

.admin-nav .admin-add-btn {
    background: linear-gradient(135deg, #111827, #3f3f46) !important;
    color: #fff !important;
    box-shadow: 0 10px 20px rgba(17, 24, 39, .18) !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
}

.admin-nav .admin-add-btn:hover {
    background: linear-gradient(135deg, #000, #27272a) !important;
    color: #fff !important;
    transform: translateY(-1px) !important;
}

.admin-nav .admin-logout-btn {
    margin-left: 10px !important;
    background: #fff1f2 !important;
    color: #be123c !important;
    border: 1px solid #fecdd3 !important;
}

.admin-nav .admin-logout-btn:hover {
    background: #ffe4e6 !important;
    color: #9f1239 !important;
}

@media (max-width: 850px) {
    .admin-topbar {
        padding: 10px 16px !important;
    }

    .admin-topbar-inner {
        min-height: unset !important;
        align-items: flex-start !important;
        flex-direction: column !important;
    }

    .admin-nav {
        width: 100% !important;
        justify-content: flex-start !important;
    }

    .admin-nav .admin-logout-btn {
        margin-left: 0 !important;
    }
}

@media print {
    .admin-topbar {
        display: none !important;
    }
}


/* V16 add booking deposit paid + favorite customers */
.favorite-picker-wrap small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

.favorite-customer-list {
    border: 1px solid var(--line);
    background: #f9fafb;
    border-radius: 14px;
    padding: 12px;
}

.favorite-customer-list > strong {
    display: block;
    margin-bottom: 10px;
}

.favorite-customer-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.favorite-chip {
    border: 1px solid var(--line);
    background: #ffffff;
    border-radius: 12px;
    padding: 8px 10px;
    cursor: pointer;
    text-align: left;
    display: grid;
    gap: 2px;
    min-width: 210px;
}

.favorite-chip:hover {
    border-color: #b88a47;
    box-shadow: 0 6px 16px rgba(0,0,0,.08);
}

.favorite-chip span {
    color: var(--muted);
    font-size: 12px;
}

.favorites-check {
    align-self: end;
}


/* V17 public invoice item names + removable favorite customers */
.hidden-form {
    display: none !important;
}

.favorite-chip-wrap {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.favorite-chip-wrap .favorite-chip {
    border: 0;
    border-radius: 0;
    min-width: 210px;
}

.favorite-chip-wrap:hover {
    border-color: #b88a47;
    box-shadow: 0 6px 16px rgba(0,0,0,.08);
}

.favorite-chip-wrap:hover .favorite-chip {
    box-shadow: none;
}

.favorite-remove-btn {
    border: 0;
    border-left: 1px solid var(--line);
    background: #fff7f7;
    color: #b91c1c;
    padding: 0 12px;
    cursor: pointer;
    font-weight: 700;
}

.favorite-remove-btn:hover {
    background: #fee2e2;
}


/* V18 responsive mobile improvements */
html {
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
}

img,
video,
canvas {
    max-width: 100%;
    height: auto;
}

.table-wrap,
.records-table-wrap {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.mobile-scroll-hint {
    display: none;
}

@media screen and (max-width: 900px) {
    .container {
        width: min(100% - 20px, 1300px);
        margin: 14px auto;
    }

    .footer {
        width: min(100% - 20px, 1300px);
        margin-bottom: 18px;
        text-align: center;
    }

    .page-head,
    .section-head,
    .records-toolbar,
    .dashboard-hero,
    .timeline-top,
    .sales-head {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .page-head h1,
    .dashboard-hero h1 {
        font-size: 26px;
        line-height: 1.12;
    }

    .page-head p,
    .dashboard-hero p,
    .muted {
        line-height: 1.45;
    }

    .card {
        padding: 14px;
        border-radius: 14px;
        margin-bottom: 12px;
    }

    .cards,
    .record-summary,
    .dashboard-cards,
    .v9-cards,
    .sales-mini-grid,
    .summary-box,
    .grid-form,
    .filters,
    .records-filter,
    .dashboard-main-grid,
    .wide-timeline,
    .receipt-lower-grid,
    .invoice-bottom-grid,
    .doc-info-grid,
    .invoice-top,
    .receipt-company-row {
        grid-template-columns: 1fr !important;
    }

    .span-2 {
        grid-column: span 1 !important;
    }

    input,
    select,
    textarea,
    button {
        font-size: 16px;
    }

    .button-row,
    .form-actions,
    .filter-actions,
    .hero-actions,
    .sales-filter,
    .calendar-controls,
    .bulk-actions {
        width: 100%;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    .button-row .btn,
    .form-actions .btn,
    .filter-actions .btn,
    .hero-actions .btn,
    .sales-filter .btn,
    .calendar-controls .btn,
    .bulk-actions .btn {
        width: 100%;
    }

    .sales-filter label,
    .sales-filter select,
    .sales-filter input[type="month"],
    .calendar-controls input[type="month"] {
        width: 100% !important;
        min-width: 0 !important;
    }

    .stat strong {
        font-size: 24px;
    }

    .dashboard-hero {
        padding: 18px;
        border-radius: 18px;
    }

    .sales-total-box {
        padding: 16px;
        border-radius: 16px;
    }

    .sales-total-box strong {
        font-size: 34px;
        word-break: break-word;
    }

    .timeline-item {
        grid-template-columns: 1fr !important;
    }

    .timeline-date {
        display: flex;
        justify-content: center;
        gap: 8px;
        min-height: auto;
        padding: 10px;
    }

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

    .timeline-links a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 38px;
        padding: 8px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: #f9fafb;
    }

    .calendar-grid {
        display: block !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .calendar-weekday,
    .calendar-day.empty-day {
        display: none !important;
    }

    .calendar-day {
        min-height: auto !important;
        border: 1px solid var(--line) !important;
        border-radius: 14px !important;
        margin-bottom: 10px !important;
        background: #fff !important;
    }

    .calendar-day.available {
        background: #f8fff9 !important;
    }

    .calendar-date-row,
    .calendar-date {
        font-size: 15px;
    }

    .calendar-event {
        font-size: 13px;
        padding: 8px;
    }

    .records-table-wrap,
    .table-wrap {
        overflow-x: auto;
        border-radius: 12px;
    }

    .records-table-wrap::before,
    .table-wrap::before {
        content: "Swipe left/right to view full table";
        display: block;
        position: sticky;
        left: 0;
        margin-bottom: 8px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
    }

    .booking-table,
    .item-table,
    .clean-table,
    table {
        min-width: 760px;
    }

    .booking-table {
        min-width: 1120px;
    }

    .item-table {
        min-width: 920px;
    }

    .booking-table th {
        position: static !important;
    }

    .booking-table td,
    .booking-table th,
    .item-table td,
    .item-table th {
        padding: 10px 8px;
    }

    .action-buttons {
        min-width: 210px;
    }

    .action-buttons .btn {
        width: calc(50% - 6px);
        margin: 3px;
        padding: 8px 9px;
        font-size: 13px;
    }

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

    .record-checklist label {
        padding: 7px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: #fff;
    }

    .favorite-customer-chips,
    .favorite-chip-wrap {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .favorite-chip,
    .favorite-chip-wrap .favorite-chip {
        min-width: 0;
        width: 100%;
    }

    .favorite-remove-btn {
        border-left: 0;
        border-top: 1px solid var(--line);
        min-height: 38px;
    }

    .login-card {
        padding: 22px;
        border-radius: 18px;
    }
}

@media screen and (max-width: 680px) {
    .admin-topbar {
        padding: 8px 10px !important;
    }

    .admin-topbar-inner {
        width: 100% !important;
        gap: 10px !important;
        align-items: stretch !important;
        flex-direction: column !important;
    }

    .admin-brand {
        width: 100% !important;
        gap: 10px !important;
    }

    .admin-logo-box {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        max-width: 48px !important;
        min-height: 48px !important;
        max-height: 48px !important;
        border-radius: 14px !important;
    }

    .admin-logo {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
    }

    .admin-brand-text {
        min-width: 0 !important;
    }

    .admin-brand-text strong {
        white-space: normal !important;
        font-size: 15px !important;
    }

    .admin-brand-text small {
        white-space: normal !important;
        font-size: 11px !important;
    }

    .admin-nav {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 7px !important;
    }

    .admin-nav a {
        width: 100% !important;
        min-height: 40px !important;
        padding: 9px 8px !important;
        border-radius: 12px !important;
        background: #f8fafc !important;
        border: 1px solid #e5e7eb !important;
        font-size: 13px !important;
    }

    .admin-nav .admin-add-btn {
        grid-column: 1 / -1 !important;
        border-radius: 14px !important;
        order: -1;
    }

    .admin-nav .admin-logout-btn {
        margin-left: 0 !important;
    }

    .container {
        width: calc(100% - 14px);
        margin-top: 10px;
    }

    .card {
        padding: 12px;
    }

    .page-head h1,
    .dashboard-hero h1 {
        font-size: 23px;
    }

    .section-head h2 {
        font-size: 17px;
    }

    .stat strong {
        font-size: 22px;
    }

    .summary-box div,
    .sales-mini-grid div {
        padding: 12px;
    }

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

    .timeline-links {
        grid-template-columns: 1fr;
    }

    .customer-meta-inline {
        gap: 8px;
        display: grid;
        grid-template-columns: 1fr;
    }

    .document {
        width: 100%;
        padding: 16px 12px 22px;
        border-radius: 12px;
        overflow: hidden;
    }

    .invoice-top,
    .receipt-company-row,
    .doc-info-grid,
    .invoice-bottom-grid,
    .receipt-lower-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        min-height: auto !important;
    }

    .right-company,
    .receipt-info > div:last-child {
        text-align: left !important;
    }

    .right-company .doc-logo,
    .receipt-logo {
        margin-left: 0 !important;
    }

    .doc-title-block h1 {
        font-size: 34px;
        margin: 10px 0 6px;
    }

    .receipt-title-row h1 {
        font-size: 30px;
    }

    .balance-large strong {
        font-size: 22px;
    }

    .doc-logo,
    .receipt-logo {
        width: 150px !important;
        max-width: 150px !important;
    }

    .doc-table,
    .receipt-table,
    .invoice-table {
        display: block;
        overflow-x: auto;
        min-width: 0;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    .doc-table thead,
    .doc-table tbody,
    .doc-table tr {
        min-width: 720px;
    }

    .doc-table th,
    .doc-table td {
        font-size: 13px;
        padding: 8px;
        white-space: nowrap;
    }

    .totals-wrap,
    .receipt-totals {
        width: 100% !important;
        margin-left: 0 !important;
    }

    .totals-wrap table,
    .receipt-totals table {
        min-width: 0;
    }

    .payment-box {
        padding: 14px;
    }

    .payment-box div {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .terms-pagebreak {
        font-size: 11px;
        line-height: 1.35;
    }
}

@media screen and (max-width: 420px) {
    .admin-nav {
        grid-template-columns: 1fr !important;
    }

    .admin-nav .admin-add-btn {
        grid-column: auto !important;
    }

    .dashboard-hero {
        padding: 14px;
    }

    .sales-total-box strong {
        font-size: 28px;
    }

    .booking-table {
        min-width: 1040px;
    }

    .item-table {
        min-width: 860px;
    }
}
