:root {
    --primary-color: #1c3f94;
    --secondary-color: #f5a623;
    --bg: #f4f6fb;
    --card-bg: #ffffff;
    --text: #202531;
    --muted: #6b7280;
    --border: #e2e5ec;
    --system-font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--body-font-family, var(--system-font-stack));
    background: var(--bg);
    color: var(--text);
}

.container { max-width: 1000px; margin: 0 auto; padding: 24px 16px; }

.topbar { background: var(--primary-color); color: #fff; }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.brand { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand-logo { height: 32px; width: auto; }
.nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.nav a { color: #fff; text-decoration: none; opacity: 0.9; font-size: 14px; }
.nav a:hover { opacity: 1; text-decoration: underline; }
.nav-user { opacity: 0.75; font-size: 13px; }


.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 20px; }
.card h2 { margin-top: 0; }

.btn { display: inline-block; background: var(--primary-color); color: #fff; border: none; padding: 10px 18px; border-radius: 6px; cursor: pointer; text-decoration: none; font-size: 14px; }
.btn:hover { opacity: 0.9; }
.btn-secondary { background: var(--secondary-color); }
.btn-danger { background: #c0392b; }
.btn-outline { background: transparent; border: 1px solid var(--primary-color); color: var(--primary-color); }
.btn-sm { padding: 6px 12px; font-size: 13px; }

form .field { margin-bottom: 16px; }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=file], select, textarea {
    width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; font-family: inherit;
}
.help-text { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* Tables can be wider than a phone screen (several columns of claim
   data, action buttons, etc). Rather than let them squash illegibly or
   overflow the page, .table-scroll lets the table itself scroll
   horizontally within its card, keeping row height and text readable. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; white-space: nowrap; }
table.list th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
/* Key-value detail tables (e.g. a single claim's fields) hold longer
   free text like descriptions and admin notes — that should wrap
   normally rather than forcing horizontal scroll to read a sentence. */
table.detail td { white-space: normal; }

@media (max-width: 640px) {
    .container { padding: 16px 12px; }
    .card { padding: 14px; }
    table.list th, table.list td { padding: 8px 10px; font-size: 13px; }
    table.list td form, table.list td > a.btn, table.list td > button.btn {
        display: block !important;
        margin: 4px 0;
    }
}

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-paid { background: #d1fae5; color: #065f46; }
.badge-declined { background: #fee2e2; color: #991b1b; }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-info { background: #dbeafe; color: #1e40af; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }

.crop-wrap { max-width: 100%; margin-top: 10px; }
#receiptPreviewWrap { display: none; }
#cropCanvas { max-width: 100%; border: 1px solid var(--border); border-radius: 6px; }

.color-swatch { display: inline-block; width: 20px; height: 20px; border-radius: 4px; vertical-align: middle; margin-right: 8px; border: 1px solid var(--border); }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 16px; text-align: center; }
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--primary-color); }
.stat-card .label { color: var(--muted); font-size: 13px; margin-top: 4px; }

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters .field { margin-bottom: 0; min-width: 160px; }

/* Uploaded site heading font (Admin -> Settings -> Site fonts), if any.
   Falls back to the system font stack and normal-weight browser default
   (700 for h1-h4, matching .brand/.stat-card .num's original weight)
   when no heading font is active. */
h1, h2, h3, h4, .brand, .stat-card .num {
    font-family: var(--heading-font-family, var(--system-font-stack));
    font-weight: var(--heading-font-weight, 700);
}
