:root {
    --primary: #0B3D4A;
    --primary-dark: #072C36;
    --accent: #1B7F5A;
    --accent-soft: #E6F4EE;
    --background: #F5F7F6;
    --surface: #FFFFFF;
    --text-primary: #12252B;
    --text-secondary: #5A6B70;
    --divider: #DDE4E2;
    --danger: #B42318;
    --warning: #B54708;
    --chip-pending: #FFF4E5;
    --chip-active: #E6F4EE;
    --chip-suspended: #FEE4E2;
    --header-subtle: #D7E8EC;
    --radius: 10px;
    --shadow: 0 2px 8px rgba(11, 61, 74, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
}

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

/* Login */
.login-page {
    min-height: 100vh;
    background: var(--background);
}

.login-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 48px 28px 32px;
    min-height: 220px;
}

.login-header h1 {
    margin: 0;
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
}

.login-header p {
    margin: 6px 0 0;
    color: var(--header-subtle);
    font-size: 1rem;
}

.login-form {
    padding: 24px;
    max-width: 420px;
    margin: 0 auto;
}

/* App shell */
.app-header {
    background: var(--primary);
    color: #fff;
    padding: 14px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.app-header h1 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.app-header .subtitle {
    font-size: 0.8rem;
    opacity: 0.85;
    margin-top: 2px;
}

.app-content {
    padding: 16px;
    padding-bottom: 88px;
    max-width: 960px;
    margin: 0 auto;
}

/* Bottom nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--divider);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 100;
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    border-radius: 8px;
    min-width: 56px;
}

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

.bottom-nav .nav-icon {
    font-size: 1.25rem;
    line-height: 1;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--divider);
}

.card-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.money {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.money-sm {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
}

/* Stats row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.stat-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    border: 1px solid var(--divider);
}

.stat-box .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.stat-box .value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 4px;
}

/* Forms */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--divider);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--surface);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(11, 61, 74, 0.12);
}

select.form-control {
    appearance: auto;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-accent {
    background: var(--accent);
    color: #fff;
}

.btn-accent:hover {
    background: #156b4a;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Lists */
.list-item {
    display: block;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 8px;
    border: 1px solid var(--divider);
    color: inherit;
    transition: border-color 0.15s;
}

.list-item:hover {
    border-color: var(--primary);
}

.list-item .title {
    font-weight: 600;
    margin-bottom: 4px;
}

.list-item .meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Chips */
.chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.chip-active { background: var(--chip-active); color: var(--accent); }
.chip-pending { background: var(--chip-pending); color: var(--warning); }
.chip-suspended { background: var(--chip-suspended); color: var(--danger); }

/* Toolbar */
.page-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.page-toolbar .back-link {
    color: var(--primary);
    font-weight: 600;
    padding: 8px 0;
}

/* Toggle */
.toggle-group {
    display: flex;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--divider);
    overflow: hidden;
    margin-bottom: 12px;
}

.toggle-group button {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
}

.toggle-group button.active {
    background: var(--primary);
    color: #fff;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    margin-bottom: 16px;
    padding-bottom: 4px;
}

.tabs button {
    padding: 8px 14px;
    border: 1px solid var(--divider);
    background: var(--surface);
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.tabs button.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Search */
.search-box {
    margin-bottom: 16px;
}

.search-box input {
    width: 100%;
}

/* FAB */
.fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(27, 127, 90, 0.4);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid var(--divider);
}

.data-table th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
}

/* Utilities */
.text-danger { color: var(--danger); }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.hidden { display: none !important; }
.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-secondary);
}

.loading {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
}

.error-msg {
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 12px;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 20px 0 10px;
    color: var(--text-primary);
}

.row-line {
    padding: 10px 0;
    border-bottom: 1px solid var(--divider);
    font-size: 0.9rem;
}

.row-line:last-child {
    border-bottom: none;
}

.row-line .sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

@media (min-width: 768px) {
    .app-content {
        padding: 24px;
        padding-bottom: 100px;
    }

    .login-form {
        background: var(--surface);
        border-radius: var(--radius);
        margin-top: -40px;
        box-shadow: var(--shadow);
        border: 1px solid var(--divider);
    }
}
