* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: #0f0f13;
    color: #e8e8f0;
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: 220px;
    min-height: 100vh;
    background: #18181f;
    border-right: 1px solid #2a2a35;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
}

.sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid #2a2a35;
}

.sidebar-logo img {
    width: 100%;
    max-width: 160px;
    border-radius: 8px;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
}

.nav-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #555560;
    padding: 0 8px;
    margin-bottom: 8px;
    margin-top: 16px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: #9090a0;
    text-decoration: none;
    transition: all 0.15s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.nav-item:hover {
    background: #22222c;
    color: #e8e8f0;
}

.nav-item.active {
    background: #534AB7;
    color: white;
}

.nav-icon {
    font-size: 16px;
    width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid #2a2a35;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #22222c;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #534AB7;
    color: white;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #e8e8f0;
    flex: 1;
}

.user-role {
    font-size: 11px;
    color: #555560;
}

/* ── Main content ── */
.main {
    margin-left: 220px;
    flex: 1;
    min-height: 100vh;
    padding: 32px 32px 80px;
}

.page-header {
    margin-bottom: 28px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: #e8e8f0;
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 13px;
    color: #555560;
}

/* ── Stats ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: #18181f;
    border: 1px solid #2a2a35;
    border-radius: 12px;
    padding: 18px 20px;
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #555560;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #e8e8f0;
}

.stat-overdue .stat-value { color: #f87171; }
.stat-due .stat-value { color: #fbbf24; }
.stat-paid .stat-value { color: #34d399; }

/* ── Cards ── */
.card {
    background: #18181f;
    border: 1px solid #2a2a35;
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 20px;
}

.card h2 {
    font-size: 14px;
    font-weight: 600;
    color: #e8e8f0;
    margin-bottom: 16px;
}

.forms-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.forms-row > .card {
    flex: 1;
    min-width: 300px;
    margin-bottom: 0;
}

/* ── Forms ── */
.add-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.add-form input,
.add-form select {
    flex: 1;
    min-width: 110px;
    padding: 10px 12px;
    border: 1px solid #2a2a35;
    border-radius: 8px;
    font-size: 13px;
    background: #0f0f13;
    color: #e8e8f0;
}

.add-form input:focus,
.add-form select:focus {
    outline: none;
    border-color: #534AB7;
}

.add-form input::placeholder {
    color: #555560;
}

.add-form button {
    width: 100%;
    margin-top: 10px;
    padding: 10px 20px;
    background: #534AB7;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.add-form button:hover {
    background: #6259c7;
}

/* ── Table ── */
.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.card-header-row h2 {
    margin-bottom: 0;
}

.search-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-form input {
    padding: 8px 12px;
    border: 1px solid #2a2a35;
    border-radius: 8px;
    font-size: 13px;
    background: #0f0f13;
    color: #e8e8f0;
    min-width: 200px;
}

.search-form input::placeholder { color: #555560; }

.search-form input:focus {
    outline: none;
    border-color: #534AB7;
}

.search-form button {
    padding: 8px 14px;
    background: #534AB7;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #555560;
    font-weight: 600;
    border-bottom: 1px solid #2a2a35;
}

td {
    text-align: left;
    padding: 14px 12px;
    font-size: 13px;
    border-bottom: 1px solid #1e1e28;
    color: #c8c8d8;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: #1c1c25; }

.client-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2a2060;
    color: #8b80f9;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.client-name {
    font-weight: 600;
    color: #e8e8f0;
}

.muted { color: #555560; }

/* ── Badges ── */
.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 99px;
    white-space: nowrap;
}

.badge-overdue { background: #3b1515; color: #f87171; }
.badge-due-soon { background: #2d2010; color: #fbbf24; }
.badge-on-track { background: #0f2d1f; color: #34d399; }
.badge-paid { background: #1e1e28; color: #6060a0; }
.badge-no-payment { background: #1e1e28; color: #555560; }

/* ── Buttons ── */
.actions { white-space: nowrap; }
.inline-form { display: inline; }

.btn-small {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border: 1px solid #2a2a35;
    border-radius: 6px;
    color: #9090a0;
    text-decoration: none;
    background: #22222c;
    cursor: pointer;
    font-family: inherit;
    margin-right: 4px;
    transition: all 0.15s;
}

.btn-small:hover {
    border-color: #534AB7;
    color: #8b80f9;
    background: #1e1a40;
}

.btn-paid-action {
    border-color: #1a3d2a;
    color: #34d399;
    background: #0f2d1f;
}

.btn-paid-action:hover {
    background: #1a3d2a;
}

.btn-unpaid {
    border-color: #2d2010;
    color: #fbbf24;
    background: #1c1a0a;
}

.btn-unpaid:hover { background: #2d2010; }

.btn-alert {
    border-color: #3b1515;
    color: #f87171;
    background: #1e0f0f;
}

.btn-alert:hover { background: #3b1515; }

.btn-delete {
    border-color: #2a2a35;
    color: #555560;
    background: #18181f;
}

.btn-delete:hover {
    background: #3b1515;
    color: #f87171;
    border-color: #3b1515;
}

/* ── Alert page ── */
.message-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.toggle-active {
    background: #534AB7;
    color: white;
    border-color: #534AB7;
}

.toggle-active:hover { background: #6259c7; }

.alert-form label {
    font-size: 12px;
    color: #9090a0;
    display: block;
    margin-bottom: 6px;
}

.alert-form textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid #2a2a35;
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
    background: #0f0f13;
    color: #e8e8f0;
    resize: vertical;
    min-height: 120px;
}

.alert-form textarea:focus {
    outline: none;
    border-color: #534AB7;
}

.alert-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    justify-content: flex-end;
}

.btn-send {
    padding: 10px 24px;
    background: #534AB7;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-send:hover { background: #6259c7; }

/* ── Login ── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f0f13;
    width: 100%;
}

.login-card {
    background: #18181f;
    border: 1px solid #2a2a35;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 380px;
}

.login-card .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-bottom: 6px;
}

.login-card .brand img {
    width: 180px;
    border-radius: 8px;
}

.login-card p.muted {
    text-align: center;
    margin-bottom: 28px;
    font-size: 13px;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #9090a0;
    margin-bottom: 6px;
}

.login-form input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #2a2a35;
    border-radius: 8px;
    font-size: 14px;
    background: #0f0f13;
    color: #e8e8f0;
    box-sizing: border-box;
}

.login-form input::placeholder { color: #555560; }

.login-form input:focus {
    outline: none;
    border-color: #534AB7;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: #534AB7;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.15s;
}

.btn-login:hover { background: #6259c7; }

.error-msg {
    background: #3b1515;
    color: #f87171;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* ── Edit page ── */
.edit-form .form-group {
    margin-bottom: 16px;
}

.edit-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #9090a0;
    margin-bottom: 6px;
}

.edit-form input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #2a2a35;
    border-radius: 8px;
    font-size: 14px;
    background: #0f0f13;
    color: #e8e8f0;
    box-sizing: border-box;
}

.edit-form input:focus {
    outline: none;
    border-color: #534AB7;
}

.btn-primary {
    padding: 11px 24px;
    background: #534AB7;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary:hover { background: #6259c7; }

hr.divider {
    border: none;
    border-top: 1px solid #2a2a35;
    margin: 28px 0;
}

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main { margin-left: 0; padding: 20px 16px 60px; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .forms-row { flex-direction: column; }
}
.stats-row {
    grid-template-columns: repeat(3, 1fr);
}

@media (min-width: 900px) {
    .stats-row {
        grid-template-columns: repeat(6, 1fr);
    }
}

.stat-pending-amount .stat-value { color: #fbbf24; font-size: 20px; }
.stat-collected-amount .stat-value { color: #34d399; font-size: 20px; }

.flash-messages {
    margin-bottom: 20px;
}

.flash {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.flash-success {
    background: #0f2d1f;
    color: #34d399;
    border: 1px solid #1a3d2a;
}

.flash-info {
    background: #1a1a35;
    color: #8b80f9;
    border: 1px solid #2a2a50;
}

.flash-error {
    background: #3b1515;
    color: #f87171;
    border: 1px solid #5a2020;
}

.filter-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.pill {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 99px;
    border: 1px solid #2a2a35;
    color: #9090a0;
    text-decoration: none;
    background: #22222c;
    transition: all 0.15s;
}

.pill:hover { border-color: #534AB7; color: #8b80f9; }
.pill-active { background: #534AB7 !important; color: white !important; border-color: #534AB7 !important; }
.pill-overdue { color: #f87171; border-color: #3b1515; background: #1e0f0f; }
.pill-due { color: #fbbf24; border-color: #2d2010; background: #1c1a0a; }
.pill-paid { color: #34d399; border-color: #1a3d2a; background: #0f2d1f; }