:root {
    --sidebar-width: 248px;
    --brand: #2563eb;
    --brand-dark: #1e40af;
    --ink: #0f172a;
    --muted: #64748b;
    --bg: #f1f5f9;
    --card-shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.app-shell { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: #0f172a;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: .6rem;
    font-size: 1.25rem; font-weight: 700; color: #fff;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-brand i { color: #60a5fa; font-size: 1.5rem; }
.sidebar-nav { padding: 1rem .75rem; display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.sidebar-footer { padding: .75rem; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar .nav-link {
    display: flex; align-items: center; gap: .75rem;
    color: #cbd5e1; padding: .6rem .85rem; border-radius: .5rem;
    font-weight: 500; text-decoration: none; transition: background .15s, color .15s;
}
.sidebar .nav-link i { font-size: 1.1rem; width: 1.25rem; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar .nav-link.active { background: var(--brand); color: #fff; }

/* Main column */
.main { flex: 1; margin-left: var(--sidebar-width); display: flex; flex-direction: column; min-width: 0; }
.topbar {
    display: flex; align-items: center; gap: 1rem;
    background: #fff; padding: .85rem 1.5rem;
    border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; z-index: 1030;
}
.page-title { font-size: 1.25rem; font-weight: 600; margin: 0; flex: 1; }
.content { padding: 1.5rem; }

/* Cards & tables */
.card { border: none; box-shadow: var(--card-shadow); border-radius: .75rem; }
.card-header { background: #fff; border-bottom: 1px solid #eef2f7; font-weight: 600; }
.table > :not(caption) > * > * { padding: .7rem .9rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); border-bottom-width: 1px; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.stat-card { background: #fff; border-radius: .75rem; padding: 1.25rem; box-shadow: var(--card-shadow); }
.stat-card .stat-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; margin-top: .25rem; }
.stat-card .stat-icon { float: right; font-size: 1.6rem; opacity: .25; }

.text-muted-2 { color: var(--muted); }
.table-actions { white-space: nowrap; }
.cred-mask { font-family: monospace; letter-spacing: .1em; }

/* Household owner pills — identical width (overrides Bootstrap .badge sizing) */
.badge.owner-badge {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 7.25rem;
    min-width: 7.25rem;
    max-width: 7.25rem;
    flex: 0 0 7.25rem;
    padding: 0.38em 0 !important;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}
.badge.owner-badge.owner-badge--unassigned {
    background-color: #e2e8f0 !important;
    color: #64748b !important;
    border: 1px solid #cbd5e1;
}
#billsTable th:nth-child(2),
#billsTable td:nth-child(2) {
    width: 7.5rem;
    max-width: 7.5rem;
    padding-left: 1rem;
    padding-right: 1rem;
    text-align: center;
}
#billsTable td:nth-child(2) .badge.owner-badge {
    margin: 0 auto;
}

/* Dashboard due bills — extra horizontal rhythm between columns */
#dashboardDueBills > :not(caption) > * > * {
    padding: 0.8rem 1.15rem;
}
#dashboardDueBills thead th {
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
}
#dashboardDueBills th:nth-child(1),
#dashboardDueBills td:nth-child(1) {
    padding-left: 1.35rem;
    padding-right: 1rem;
    min-width: 10rem;
}
#dashboardDueBills th:nth-child(2),
#dashboardDueBills td:nth-child(2) {
    width: 8.5rem;
    min-width: 8.5rem;
    max-width: 8.5rem;
    padding-left: 1rem;
    padding-right: 1.75rem;
    text-align: center;
}
#dashboardDueBills td:nth-child(2) .badge.owner-badge {
    margin: 0 auto;
}
#dashboardDueBills th:nth-child(3),
#dashboardDueBills td:nth-child(3) {
    padding-left: 1.75rem;
    padding-right: 1.15rem;
    min-width: 7rem;
}
#dashboardDueBills th:nth-child(4),
#dashboardDueBills td:nth-child(4) {
    padding-left: 1rem;
    padding-right: 1rem;
}
#dashboardDueBills th:nth-child(5),
#dashboardDueBills td:nth-child(5) {
    padding-left: 1rem;
    padding-right: 1.15rem;
}
#dashboardDueBills th:nth-child(6),
#dashboardDueBills td:nth-child(6) {
    padding-left: 1rem;
    padding-right: 1.35rem;
}
.table-group-header td { border-bottom: none; }
.table-group-subtotal td {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}
.table-total-row td {
    background: #fff;
    font-size: 1rem;
}

/* Auth screen */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a8a, #2563eb); padding: 1rem; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 1rem; box-shadow: 0 20px 45px rgba(0,0,0,.25); padding: 2.25rem; }
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-brand i { font-size: 2.5rem; color: var(--brand); }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
}

/* Report tiles */
.report-tile { transition: transform .12s ease, box-shadow .12s ease; }
.report-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(15,23,42,.12); }
.report-tile-icon {
    width: 2.75rem; height: 2.75rem; border-radius: .65rem;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem;
}
.report-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.report-print-head { display: none; }
.print-only { display: none; }

/* Monthly pay sheet: compact columns for screen and print */
.report-paysheet .paysheet-check { width: 2.5rem; }
.report-paysheet .paysheet-due { width: 3.25rem; white-space: nowrap; }
.report-paysheet .paysheet-amt { width: 5.5rem; white-space: nowrap; }
.report-paysheet .paysheet-site { max-width: 10rem; word-break: break-all; }
.report-paysheet .paysheet-user,
.report-paysheet .paysheet-pass { max-width: 8rem; word-break: break-all; }
.report-paysheet .paysheet-print-box {
    display: none;
    width: .85rem; height: .85rem;
    border: 1px solid #333;
    margin: 0 auto;
}

/* Print: drop the app chrome and show a clean document */
@media print {
    .sidebar, .topbar, .report-toolbar, .no-print, .alert-dismissible .btn-close { display: none !important; }
    .app-shell, .main { display: block; margin: 0; }
    .content { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    .report-print-head { display: block; margin-bottom: 1rem; }
    .report-print-head h2 { margin: 0; font-size: 1.4rem; }
    .report-print-head .small { color: #555; }
    a { color: #000 !important; text-decoration: none !important; }
    table { font-size: 11px; }
    thead { display: table-header-group; }
    tr { page-break-inside: avoid; }
    body { background: #fff; }
    .print-only { display: inline-block !important; }
    .report-paysheet .paysheet-site { max-width: none; }
}
