:root {
    --bg: #f5f5f6;
    --card-bg: #ffffff;
    --text: #17181a;
    --text-muted: #6b6d72;
    --text-faint: #9a9ca1;
    --border: #e3e3e6;
    --accent: #17181a;
    --accent-text: #ffffff;
    --green: #1fa26e;
    --green-bg: #e7f7f0;
    --orange: #c07a17;
    --orange-bg: #fdf3e3;
    --red: #b8433a;
    --red-bg: #fbeceb;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    padding-bottom: 24px;
    min-height: 100vh;
}

.page {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0 16px;
}
.topbar h1 { font-size: 18px; margin: 0; }
.topbar .sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: none;
    background: #eeeeef;
    color: var(--text-muted);
}
.icon-btn svg { width: 18px; height: 18px; }

.lang-switch {
    display: inline-flex;
    background: #eeeeef;
    border-radius: 999px;
    padding: 2px;
    gap: 2px;
}
.lang-switch button {
    border: none;
    background: transparent;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
}
.lang-switch button.active { background: var(--accent); color: var(--accent-text); }

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 16px;
}

.card-title {
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-faint);
    margin-bottom: 10px;
}

.status-active { border-left: 4px solid var(--green); }
.status-idle { border-left: 4px solid var(--border); }

.shift-project { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.shift-since { font-size: 13px; color: var(--text-muted); }

.live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    margin-right: 6px;
    animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
}
.btn:first-child { margin-top: 0; }
.btn:disabled { opacity: 0.5; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-secondary { background: #eeeeef; color: var(--text); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-sm { padding: 9px; font-size: 13px; margin-top: 8px; }

.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}
input[type="text"], input[type="tel"], input[type="password"], input[type="number"], select {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.error-box {
    background: var(--red-bg);
    color: var(--red);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 14px;
}

.sync-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--orange-bg);
    color: var(--orange);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 14px;
}
.sync-bar button {
    border: none;
    background: none;
    color: var(--orange);
    font-weight: 700;
    font-size: 12.5px;
    text-decoration: underline;
    padding: 0;
}
.offline-bar {
    background: #eeeeef;
    color: var(--text-muted);
}

.report-list { display: flex; flex-direction: column; gap: 10px; }
.report-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.report-row:last-child { border-bottom: none; padding-bottom: 0; }
.report-name { font-size: 14px; font-weight: 600; }
.report-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.report-pending { color: var(--orange); font-size: 11px; font-weight: 600; margin-top: 2px; }
.report-delete-btn {
    border: none;
    background: #eeeeef;
    color: var(--text-muted);
    border-radius: 999px;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.report-delete-btn svg { width: 14px; height: 14px; }

.state-box {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-faint);
    font-size: 13.5px;
}

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    align-items: flex-end;
    justify-content: center;
    z-index: 100;
}
.overlay.show { display: flex; }
.sheet {
    background: var(--card-bg);
    border-radius: 20px 20px 0 0;
    padding: 20px;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
}
.sheet-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }

.file-input-label {
    display: block;
    text-align: center;
    padding: 24px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13.5px;
    margin-bottom: 14px;
}
.file-input-label input { display: none; }

.req { color: var(--red); }

/* Bottom navigation */
body.has-bottom-nav { padding-bottom: 76px; }
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 50;
}
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-decoration: none;
    color: var(--text-faint);
    font-size: 10.5px;
    font-weight: 600;
}
.bottom-nav-item svg { width: 20px; height: 20px; }
.bottom-nav-item.active { color: var(--text); }

/* Payments / history screens */
.summary-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}
.summary-card {
    flex: 1;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 12px 14px;
}
.summary-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-faint);
    margin-bottom: 4px;
}
.summary-value { font-size: 16px; font-weight: 700; }
.summary-value.debt { color: var(--orange); }
.summary-value.unpaid { color: var(--red); }

.tx-row, .history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.tx-row:last-child, .history-row:last-child { border-bottom: none; padding-bottom: 0; }
.tx-amount { font-size: 15px; font-weight: 700; }
.tx-meta, .history-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.tx-confirm-btn {
    border: none;
    background: var(--accent);
    color: var(--accent-text);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 12.5px;
    font-weight: 600;
    flex-shrink: 0;
}
.tx-confirm-btn:disabled { opacity: 0.5; }

.badge-sm {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
}
.badge-sm.paid { background: var(--green-bg); color: var(--green); }
.badge-sm.unpaid { background: var(--red-bg); color: var(--red); }
