:root {
    color: #172033;
    background: #eef3fb;
    font-family: Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background: linear-gradient(135deg, #eaf2ff 0%, #f8fbff 48%, #e9f7f5 100%);
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    display: grid;
    min-height: 100vh;
    padding: 32px 20px;
    place-items: center;
}

.login-panel,
.registration-card,
.client-card {
    background: #fff;
    border: 1px solid #dce5f2;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgb(50 85 130 / 12%);
}

.login-panel {
    width: min(100%, 430px);
    padding: 40px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: #1769e0;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.panel-kicker {
    margin: 28px 0 8px;
    color: #1769e0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.panel-title,
.dashboard-title,
.registration-card h2,
.client-card h2 {
    margin: 0;
    color: #172033;
}

.panel-title {
    font-size: 2rem;
}

.panel-description,
.registration-card > p,
.client-card-heading p,
.empty-state {
    color: #69768c;
    line-height: 1.5;
}

.panel-description {
    margin: 12px 0 28px;
}

.access-form,
.client-form {
    display: grid;
    gap: 18px;
}

.form-field {
    display: grid;
    gap: 8px;
    color: #31415d;
    font-size: 0.9rem;
    font-weight: 700;
}

.form-field input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #cbd7e8;
    border-radius: 9px;
    outline: 0;
    color: #172033;
    background: #fff;
    font-weight: 400;
}

.phone-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.contact-picker-button {
    padding: 10px 12px;
    border: 1px solid #b9c9df;
    border-radius: 9px;
    background: #f5f8fc;
    color: #31415d;
    font-weight: 700;
}

.contact-picker-button:hover {
    background: #eaf2fb;
}

.form-field input:focus,
.message-input:focus {
    border-color: #1769e0;
    box-shadow: 0 0 0 3px rgb(23 105 224 / 14%);
}

.message-input {
    width: 100%;
    min-height: 170px;
    padding: 12px 14px;
    border: 1px solid #cbd7e8;
    border-radius: 9px;
    outline: 0;
    resize: vertical;
    color: #172033;
    background: #fff;
    font-weight: 400;
    line-height: 1.5;
}

.form-help {
    margin: -8px 0 4px;
    color: #69768c;
    font-size: 0.82rem;
    line-height: 1.45;
}

.remember-access {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 20px;
    color: #69768c;
    font-size: 0.9rem;
}

.remember-access input {
    width: 16px;
    height: 16px;
    accent-color: #1769e0;
}

.primary-button,
.logout-button,
.secondary-button,
.danger-button,
.whatsapp-button {
    border: 0;
    border-radius: 9px;
    font-weight: 700;
}

.primary-button {
    padding: 13px 18px;
    background: #1769e0;
    color: #fff;
}

.primary-button:hover {
    background: #0f58c0;
}

.secondary-button,
.danger-button,
.whatsapp-button {
    display: inline-block;
    padding: 9px 12px;
    border: 1px solid #b9c9df;
    background: transparent;
    color: #31415d;
    font-size: 0.85rem;
    text-decoration: none;
}

.secondary-button:hover {
    background: #f5f8fc;
}

.danger-button {
    border-color: #f0b8b5;
    color: #b42318;
}

.whatsapp-button {
    border-color: #a8d8b5;
    background: #eaf8ed;
    color: #187c35;
    text-decoration: none;
}

.danger-button:hover {
    background: #fff1f1;
}

.whatsapp-button:hover {
    background: #d9f2df;
}

.whatsapp-button--sent {
    border-color: #1769e0;
    background: #1769e0;
    color: #fff;
}

.whatsapp-button--sent:hover {
    background: #0f58c0;
}

.image-link {
    display: inline-block;
    padding: 9px 12px;
    border: 1px solid #b9c9df;
    border-radius: 9px;
    color: #31415d;
    font-size: 0.85rem;
    text-decoration: none;
}

.image-link:hover {
    background: #f5f8fc;
}

.feedback-message {
    margin: 0 0 20px;
    padding: 11px 13px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.feedback-message--error {
    background: #fff1f1;
    color: #b42318;
}

.feedback-message--success {
    background: #ecfdf3;
    color: #067647;
}

.dashboard {
    width: min(100%, 1080px);
}

.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.header-actions form {
    margin: 0;
}

.dashboard-header .panel-kicker {
    margin-top: 16px;
}

.dashboard-title {
    font-size: 2.25rem;
}

.logout-button {
    padding: 10px 14px;
    border: 1px solid #b9c9df;
    background: transparent;
    color: #31415d;
}

.logout-button:hover {
    background: #fff;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.4fr);
    gap: 24px;
    align-items: start;
}

.registration-card,
.client-card {
    padding: 28px;
}

.whatsapp-settings-card {
    grid-column: 1;
}

.dashboard-grid > .client-card {
    grid-column: 2;
    grid-row: 1 / span 2;
}

.registration-card > p {
    margin: 8px 0 24px;
}

.registration-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    list-style: none;
}

.registration-toggle::-webkit-details-marker {
    display: none;
}

.registration-toggle-title {
    color: #172033;
    font-size: 1.2rem;
    font-weight: 700;
}

.registration-toggle-icon {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border: 1px solid #b9c9df;
    border-radius: 8px;
    color: #1769e0;
    font-size: 1.35rem;
    line-height: 1;
}

.registration-card[open] .registration-toggle-icon {
    transform: rotate(45deg);
}

.client-card-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

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

.client-name {
    display: block;
    margin-bottom: 8px;
}

.client-actions {
    flex-wrap: wrap;
}

.search-field input {
    width: 180px;
    padding: 9px 11px;
    border: 1px solid #c9d5e6;
    border-radius: 8px;
    color: #172033;
}

.client-actions form,
.payment-status-form {
    margin: 0;
}

.payment-status-button {
    padding: 8px 10px;
    border: 1px solid;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
}

.payment-status-button--paid {
    border-color: #a8d8b5;
    background: #eaf8ed;
    color: #187c35;
}

.payment-status-button--pending {
    border-color: #f0b8b5;
    background: #fff1f1;
    color: #b42318;
}


.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.client-card-heading p {
    margin: 6px 0 0;
}

.payment-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 12px;
    font-size: 0.85rem;
    font-weight: 700;
}

.paid-total {
    color: #187c35;
}

.pending-total {
    color: #b42318;
}

.empty-state {
    margin: 0;
    padding: 36px 0;
    text-align: center;
}

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

.client-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
    text-align: left;
}

.client-table th,
.client-table td {
    padding: 14px 10px;
    border-bottom: 1px solid #e5ebf4;
    white-space: nowrap;
}

.client-table th {
    color: #69768c;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.client-table td {
    color: #31415d;
}

.client-table tr.client-row--paid td {
    background: #eefaf1;
}

.client-table tr.client-row--overdue td {
    background: #fff3f2;
}

.client-table tr.client-row--whatsapp-sent td,
.client-table tr.client-row--whatsapp-sent td:first-child {
    background: #eaf2ff;
}

.client-table td:first-child {
    color: #172033;
    font-weight: 700;
}

.client-billing-details {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-top: 8px;
    color: #69768c;
    font-size: 0.78rem;
    font-weight: 400;
}

@media (max-width: 760px) {
    .app-shell {
        padding: 24px 16px;
    }

    .login-panel,
    .registration-card,
    .client-card {
        padding: 24px;
    }

    .dashboard-header {
        align-items: flex-end;
    }

    .header-actions {
        justify-content: flex-start;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .whatsapp-settings-card,
    .dashboard-grid > .client-card {
        grid-column: auto;
        grid-row: auto;
    }

    .client-card-heading {
        flex-direction: column;
    }

    .search-form {
        flex-wrap: wrap;
    }

    .phone-input-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 460px) {
    .login-panel {
        padding: 28px 22px;
    }

    .panel-title,
    .dashboard-title {
        font-size: 1.8rem;
    }

    .dashboard-header {
        gap: 14px;
    }
}
