:root {
    --primary: #1a73e8;
    --primary-dark: #0d47a1;
    --green: #1e8e3e;
    --red: #d93025;
    --bg: #f5f6f8;
    --card-bg: #ffffff;
    --text: #202124;
    --muted: #5f6368;
    --border: #e0e0e0;
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    padding-bottom: 72px; /* space for bottom nav */
}

a { color: var(--primary); text-decoration: none; }

header.topbar {
    background: var(--primary);
    color: #fff;
    padding: 14px 16px;
    font-size: 18px;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

main {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-card .label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
}

.stat-card .value {
    font-size: 20px;
    font-weight: 700;
}

.stat-card .value.profit { color: var(--green); }
.stat-card .value.due { color: var(--red); }

.btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 14px 18px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    width: 100%;
}

.btn.secondary { background: var(--muted); }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.small { width: auto; padding: 8px 14px; font-size: 14px; }

.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row .btn { flex: 1; }

form .field { margin-bottom: 14px; }

label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

input, select {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
}

/* Date-range / filter forms */
.filter-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-form .field {
    flex: 1;
    min-width: 130px;
    margin-bottom: 0;
}

.filter-form .btn { flex: 0 0 auto; padding-top: 12px; padding-bottom: 12px; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 1px solid var(--border);
}

th { color: var(--muted); font-weight: 600; font-size: 12px; }

.table-wrap { overflow-x: auto; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge.green { background: #e6f4ea; color: var(--green); }
.badge.red { background: #fce8e6; color: var(--red); }
.badge.gray { background: #eee; color: var(--muted); }

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.list-item:last-child { border-bottom: none; }

.item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.section-title {
    font-size: 15px;
    font-weight: 700;
    margin: 4px 0 12px;
}

.muted { color: var(--muted); font-size: 13px; }

nav.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 10;
}

nav.bottom-nav a {
    flex: 1;
    text-align: center;
    padding: 10px 4px 8px;
    font-size: 11px;
    color: var(--muted);
}

nav.bottom-nav a.active { color: var(--primary); font-weight: 700; }

nav.bottom-nav .icon { display: block; font-size: 20px; margin-bottom: 2px; }

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 24px 12px;
}

.alert {
    background: #fef7e0;
    border: 1px solid #f9c74f;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 14px;
}

.flash {
    background: #e6f4ea;
    color: var(--green);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    margin-bottom: 14px;
}

.highlight-box {
    background: #fff8e1;
    border: 2px solid #f9c74f;
    border-radius: var(--radius);
    padding: 16px;
    margin: 20px 0;
}

.highlight-box .section-title {
    margin-bottom: 4px;
}

.highlight-box .stat-grid {
    margin-bottom: 0;
    margin-top: 10px;
}

/* Quick action tiles (same clean card look) */
.action-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.action-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.action-tile .icon { font-size: 24px; line-height: 1; }

/* Closing sheet rows */
.sheet-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.sheet-row:last-of-type { border-bottom: none; }

.sheet-info { flex: 1; min-width: 0; }

.sheet-input {
    width: 110px;
    flex-shrink: 0;
    text-align: center;
    font-weight: 600;
}
