html,
body {
    min-height: 100%;
}

body {
    min-height: 100dvh;
    overflow-x: hidden;
}

button,
a,
input {
    -webkit-tap-highlight-color: transparent;
}

.settings-page {
    width: min(920px, 100%);
    min-height: 100dvh;
    margin: 0 auto;
    padding:
            max(14px, env(safe-area-inset-top))
            max(14px, env(safe-area-inset-right))
            max(28px, env(safe-area-inset-bottom))
            max(14px, env(safe-area-inset-left));
    box-sizing: border-box;
}

/*
|--------------------------------------------------------------------------
| Toppfelt
|--------------------------------------------------------------------------
*/

.settings-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 70px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.34);
    color: #fff;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.settings-back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    text-decoration: none;
}

.settings-back-button:hover {
    background: rgba(255, 255, 255, 0.20);
}

.settings-back-button:active {
    transform: scale(0.96);
}

.settings-back-button svg {
    width: 30px;
    height: 30px;
    fill: currentColor;
}

.settings-topbar-title {
    min-width: 0;
    flex: 1;
}

.settings-topbar-title span {
    display: block;
    margin-bottom: 2px;
    color: rgba(255, 255, 255, 0.68);
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.settings-topbar-title h1 {
    margin: 0;
    overflow: hidden;
    color: #fff;
    font-size: clamp(22px, 5vw, 32px);
    font-weight: 600;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-user {
    flex: 0 0 auto;
    max-width: 180px;
    padding: 8px 11px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/*
|--------------------------------------------------------------------------
| Introduksjon
|--------------------------------------------------------------------------
*/

.settings-summary {
    margin-top: 14px;
    padding: 18px 20px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.30);
    color: #fff;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.settings-summary h2 {
    margin: 0;
    font-size: clamp(21px, 4vw, 27px);
    font-weight: 600;
}

.settings-summary p {
    margin: 5px 0 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 15px;
    line-height: 1.5;
}

/*
|--------------------------------------------------------------------------
| Kort og seksjoner
|--------------------------------------------------------------------------
*/

.settings-grid {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.settings-card {
    padding: 20px;
    scroll-margin-top: 14px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.36);
    color: #fff;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.settings-card-header {
    margin-bottom: 18px;
}

.settings-card h2 {
    margin: 0;
    color: #fff;
    font-size: clamp(21px, 4vw, 26px);
    font-weight: 600;
}

.settings-description {
    margin: 5px 0 0;
    color: rgba(255, 255, 255, 0.70);
    font-size: 15px;
    line-height: 1.5;
}

/*
|--------------------------------------------------------------------------
| Skjema
|--------------------------------------------------------------------------
*/

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

.settings-field-full {
    grid-column: 1 / -1;
}

.settings-field label,
.todo-label {
    display: block;
    margin-bottom: 7px;
    color: rgba(255, 255, 255, 0.92);
    font-size: 15px;
    font-weight: 600;

}

.settings-field input,
.todo-input {
    width: 100%;
    min-height: 50px;
    padding: 11px 13px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 3px;
    outline: none;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font: inherit;
    font-size: 16px;
    transition:
            border-color 120ms ease,
            box-shadow 120ms ease,
            background-color 120ms ease;
}

.settings-field input::placeholder,
.todo-input::placeholder {
    color: #64748b;
}

.settings-field input:focus,
.todo-input:focus {
    border-color: rgba(125, 211, 252, 0.95);
    background: rgba(255, 255, 255, 0.20);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22);
}

/*
|--------------------------------------------------------------------------
| Knapper
|--------------------------------------------------------------------------
*/

.settings-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.settings-save-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 10px 20px;
    border: 1px solid rgba(134, 239, 172, 0.55);
    border-radius: 3px;
    background: rgba(22, 163, 74, 0.52);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    transition:
            transform 100ms ease,
            background-color 120ms ease,
            border-color 120ms ease;
}

.settings-save-button:hover {
    border-color: rgba(134, 239, 172, 0.80);
    background: rgba(22, 163, 74, 0.68);
}

.settings-save-button:active {
    transform: scale(0.98);
}

/*
|--------------------------------------------------------------------------
| Varselmeldinger
|--------------------------------------------------------------------------
*/

.settings-message {
    margin: 0 0 18px;
    padding: 13px 15px;
    border-radius: 3px;
    font-weight: 600;
    line-height: 1.45;
}

.settings-message-success {
    border: 1px solid rgba(134, 239, 172, 0.50);
    background: rgba(22, 101, 52, 0.38);
    color: #dcfce7;
}

.settings-message-error {
    border: 1px solid rgba(254, 202, 202, 0.50);
    background: rgba(153, 27, 27, 0.40);
    color: #fee2e2;
}

/*
|--------------------------------------------------------------------------
| Todo-lister
|--------------------------------------------------------------------------
*/

.todo-fields {
    display: grid;
    gap: 10px;
}

.todo-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 9px;
    align-items: end;
}

.todo-row:first-child {
    grid-template-columns: minmax(0, 1fr);
}

.todo-remove-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    min-height: 50px;
    padding: 0;
    border: 1px solid rgba(254, 202, 202, 0.38);
    border-radius: 3px;
    background: rgba(220, 38, 38, 0.24);
    color: #fee2e2;
    cursor: pointer;
    font: inherit;
    font-size: 27px;
    line-height: 1;
}

.todo-remove-button:hover {
    background: rgba(220, 38, 38, 0.38);
}

.todo-add-button {
    min-height: 46px;
    margin-top: 12px;
    padding: 8px 15px;
    border: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
}

.todo-add-button:hover {
    background: rgba(255, 255, 255, 0.20);
}

.todo-add-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}



/*
|--------------------------------------------------------------------------
| Husstanden
|--------------------------------------------------------------------------
*/

.household-members {
    display: grid;
    gap: 10px;
}

.household-empty {
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.10);
}

.household-empty p {
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.5;
}

.household-member {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.10);
}

.household-member-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.household-member-info strong {
    overflow-wrap: anywhere;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.household-member-info span {
    overflow-wrap: anywhere;
    color: rgba(255, 255, 255, 0.66);
    font-size: 14px;
    line-height: 1.4;
}

.household-manage-button,
.household-add-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 46px;
    padding: 9px 15px;
    border: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition:
            transform 100ms ease,
            background-color 120ms ease,
            border-color 120ms ease;
}

.household-manage-button:hover,
.household-add-button:hover {
    border-color: rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.20);
}

.household-manage-button:active,
.household-add-button:active {
    transform: scale(0.98);
}

.household-add-button {
    border-color: rgba(134, 239, 172, 0.55);
    background: rgba(22, 163, 74, 0.52);
}

.household-add-button:hover {
    border-color: rgba(134, 239, 172, 0.80);
    background: rgba(22, 163, 74, 0.68);
}

/*
|--------------------------------------------------------------------------
| Kontoinformasjon
|--------------------------------------------------------------------------
*/

.account-info {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.account-info-item {
    min-width: 0;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.10);
}

.account-info-item span {
    display: block;
    margin-bottom: 7px;
    color: rgba(255, 255, 255, 0.66);
    font-size: 14px;
}

.account-info-item strong {
    display: block;
    overflow-wrap: anywhere;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

/*
|--------------------------------------------------------------------------
| Nettbrett og datamaskin
|--------------------------------------------------------------------------
*/

@media (min-width: 900px) {
    .settings-page {
        padding-top: 24px;
    }

    .settings-grid {
        gap: 12px;
    }
}

/*
|--------------------------------------------------------------------------
| Mobil
|--------------------------------------------------------------------------
*/

@media (max-width: 600px) {
    .settings-page {
        padding-left: 8px;
        padding-right: 8px;
    }

    .settings-topbar {
        gap: 8px;
        min-height: 62px;
        padding: 7px;
    }

    .settings-back-button {
        flex-basis: 44px;
        width: 44px;
        height: 44px;
    }

    .settings-back-button svg {
        width: 28px;
        height: 28px;
    }

    .settings-user {
        max-width: 105px;
        padding: 7px 8px;
        font-size: 13px;
    }

    .settings-summary {
        padding: 15px 14px;
    }

    .settings-card {
        padding: 17px 14px;
    }

    .settings-form-grid,
    .account-info {
        grid-template-columns: 1fr;
    }

    .settings-field-full {
        grid-column: auto;
    }

    .settings-actions {
        justify-content: stretch;
    }

    .settings-save-button {
        width: 100%;
    }


    .household-member {
        align-items: stretch;
        flex-direction: column;
    }

    .household-manage-button,
    .household-add-button {
        width: 100%;
    }

}

@media (max-width: 390px) {
    .settings-user {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .settings-back-button,
    .settings-save-button,
    .settings-field input,
    .todo-input,
    .household-manage-button,
    .household-add-button {
        transition: none !important;
    }
}