* {
    box-sizing: border-box;
}

:root {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    color: #172033;
    background: #f5f7fb;
}

body {
    margin: 0;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

/* LOGIN */

.login-body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.login-wrap {
    width: 100%;
    max-width: 430px;
}

.login-card {
    background: white;
    padding: 42px;
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(20,30,50,.08);
}

.brand-mark {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 32px;
    background: #111827;
    color: white;
}

.brand-mark.small {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    font-size: 21px;
}

.login-card h1 {
    margin: 22px 0 4px;
    font-size: 34px;
}

.muted {
    color: #6b7280;
}

.login-card label {
    display: block;
    font-weight: 700;
    margin-top: 22px;
}

.login-card input {
    width: 100%;
    height: 58px;
    margin-top: 8px;
    padding: 0 16px;
    border: 1px solid #d8dde7;
    border-radius: 14px;
    font-size: 18px;
}

.primary {
    border: 0;
    background: #111827;
    color: white;
    border-radius: 14px;
    font-weight: 800;
}

.huge {
    width: 100%;
    min-height: 62px;
    margin-top: 28px;
    font-size: 19px;
}

.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-top: 20px;
}

.alert.error {
    background: #fff0f0;
    color: #a52020;
}

/* MAMMA */

.mom-layout {
    max-width: 620px;
    margin: auto;
    padding:
        max(28px, env(safe-area-inset-top))
        20px
        max(40px, env(safe-area-inset-bottom));
}

.mom-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hello {
    color: #667085;
    font-size: 18px;
}

.mom-header h1 {
    margin: 2px 0 0;
    font-size: 34px;
}

.link-button {
    border: 0;
    background: transparent;
    color: #667085;
    padding: 8px;
}

.balance-card {
    margin-top: 28px;
    background: #172033;
    color: white;
    border-radius: 28px;
    padding: 28px;
}

.balance-card span {
    display: block;
    font-size: 19px;
    opacity: .8;
}

.balance-card strong {
    display: block;
    margin-top: 8px;
    font-size: clamp(40px, 10vw, 58px);
    letter-spacing: -2px;
}

.simple-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.simple-stats > div {
    background: white;
    border-radius: 20px;
    padding: 20px;
}

.simple-stats span {
    color: #667085;
    font-size: 16px;
}

.simple-stats strong {
    display: block;
    margin-top: 6px;
    font-size: 23px;
}

.mom-actions {
    display: grid;
    gap: 14px;
    margin-top: 28px;
}

.mom-action {
    min-height: 88px;
    background: white;
    border-radius: 22px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: 0 4px 16px rgba(20,30,50,.04);
}

.mom-action.camera {
    background: #172033;
    color: white;
}

.action-icon {
    width: 50px;
    text-align: center;
    font-size: 31px;
}

.mom-action strong {
    font-size: 19px;
}

.mom-section {
    margin-top: 34px;
}

.mom-section h2 {
    font-size: 25px;
}

.due-simple {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 18px;
    border-radius: 17px;
    margin-bottom: 10px;
}

.due-simple span {
    display: block;
    color: #667085;
    margin-top: 4px;
}

/* ADMIN */

.admin-body {
    background: #f6f8fb;
}

.admin-shell {
    display: grid;
    grid-template-columns: 245px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #111827;
    color: white;
    padding: 24px 16px;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 26px;
}

.admin-brand span {
    display: block;
    color: #9ca3af;
    font-size: 13px;
    margin-top: 2px;
}

.sidebar nav {
    display: grid;
    gap: 3px;
}

.sidebar nav a {
    padding: 11px 13px;
    border-radius: 10px;
    color: #cbd1dc;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: #202938;
    color: white;
}

.nav-separator {
    height: 1px;
    background: #283142;
    margin: 12px 5px;
}

.admin-main {
    padding: 34px;
    max-width: 1600px;
    width: 100%;
}

.admin-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.admin-top h1 {
    margin: 3px 0 0;
    font-size: 32px;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.eyebrow {
    color: #7a8495;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.kpi,
.panel {
    background: white;
    border: 1px solid #e8ebf0;
    border-radius: 18px;
    padding: 22px;
}

.kpi span {
    color: #727b8b;
    font-size: 14px;
}

.kpi strong {
    display: block;
    margin-top: 8px;
    font-size: 27px;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 16px 0;
}

.panel h2 {
    margin: 4px 0 10px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.count-badge {
    background: #fff0ef;
    color: #b42318;
    padding: 7px 11px;
    border-radius: 999px;
    font-weight: 800;
}

.empty-state {
    color: #768091;
    padding: 25px 0 8px;
}

.review-button {
    display: inline-block;
    margin-top: 14px;
    background: #fff3e8;
    color: #9a4b0b;
    font-weight: 700;
    padding: 12px 16px;
    border-radius: 11px;
}

.text-link {
    color: #3457c9;
    font-weight: 700;
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
}

th,
td {
    padding: 14px 10px;
    border-bottom: 1px solid #edf0f4;
    text-align: left;
}

th {
    font-size: 12px;
    color: #7c8594;
    text-transform: uppercase;
}

.right {
    text-align: right;
}

.status-pill {
    display: inline-block;
    padding: 5px 9px;
    background: #eef1f5;
    border-radius: 999px;
    font-size: 12px;
}

.status-pill.paid {
    background: #e9f8ef;
    color: #187541;
}

.status-pill.overdue {
    background: #fff0ef;
    color: #b42318;
}

.status-pill.due {
    background: #fff7e5;
    color: #8a5700;
}

@media (max-width: 1000px) {

    .admin-shell {
        display: block;
    }

    .sidebar {
        display: none;
    }

    .admin-main {
        padding: 22px;
    }

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

@media (max-width: 600px) {

    .login-card {
        padding: 28px 22px;
    }

    .simple-stats {
        grid-template-columns: 1fr;
    }

    .admin-main {
        padding: 16px;
    }

    .kpi-grid,
    .admin-grid {
        grid-template-columns: 1fr;
    }
}

/* UTENTI ADMIN */

.alert.success {
    background: #eaf8ef;
    color: #176b3a;
    margin-bottom: 18px;
}

.admin-form {
    margin-top: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.admin-form label,
.password-form label {
    display: block;
    color: #5d6675;
    font-size: 14px;
    font-weight: 700;
}

.admin-form input,
.admin-form select,
.password-form input {
    width: 100%;
    min-height: 48px;
    margin-top: 7px;
    padding: 0 13px;
    border: 1px solid #d9dee7;
    border-radius: 10px;
    background: white;
    color: #172033;
}

.form-actions {
    margin-top: 20px;
}

.admin-button,
.secondary-button,
.danger-button {
    min-height: 44px;
    border-radius: 10px;
    padding: 0 17px;
    font-weight: 800;
    border: 0;
}

.secondary-button {
    background: #edf1f6;
    color: #263249;
}

.danger-button {
    background: #fff0ef;
    color: #b42318;
}

.users-panel {
    margin-top: 18px;
}

.user-card {
    display: grid;
    grid-template-columns:
        minmax(0,1fr)
        auto;
    gap: 18px;
    padding: 19px 0;
    border-bottom: 1px solid #edf0f4;
}

.user-card:last-child {
    border-bottom: 0;
}

.user-main {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: #eef1f6;
    font-size: 20px;
    font-weight: 800;
}

.user-name {
    font-size: 17px;
}

.user-meta,
.user-last-login {
    margin-top: 3px;
    color: #7a8494;
    font-size: 13px;
}

.status-active,
.status-disabled {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.status-active {
    background: #e9f8ef;
    color: #187541;
}

.status-disabled {
    background: #eef1f5;
    color: #667085;
}

.user-details {
    grid-column: 1 / -1;
}

.user-details summary {
    cursor: pointer;
    color: #3457c9;
    font-weight: 700;
}

.user-management {
    display: grid;
    gap: 22px;
    padding: 22px;
    margin-top: 14px;
    background: #f8f9fb;
    border-radius: 14px;
}

.inline-form {
    display: flex;
    align-items: end;
    gap: 10px;
    margin-top: 7px;
}

.inline-form input {
    margin-top: 0;
}

@media (max-width: 700px) {

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

    .inline-form {
        display: grid;
    }

    .user-card {
        grid-template-columns: 1fr;
    }
}
