/* User profile redesign */
/* Overstyr global .contact-box (max-width 600px) — full bredde på mobil / mer plass på desktop */
.contact-box.user-profile-box {
    max-width: min(980px, 100%);
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.user-profile-box {
    max-width: 980px;
    margin: 28px auto;
    border-radius: 20px;
    background: #fff;
    border: 1px solid #ececec;
    box-shadow: 0 10px 26px rgba(17, 24, 39, 0.06);
    padding: 22px;
}

.user-profile {
    max-width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.page-title {
    margin: 0;
}

.page-subtitle {
    margin: -4px 0 6px;
    color: #636363;
}

.profile-section {
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 18px;
    padding: 22px;
}

.upf-h2 {
    margin: 0 0 14px;
    font-size: 1.95rem;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.form-group input,
.form-group select {
    width: 100%;
}

.profile-hero-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.profile-hero-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.profile-hero-meta h2 {
    margin: 0;
    font-size: 1.95rem;
}

.profile-hero-meta p {
    margin: 4px 0 0;
    color: #646464;
}

.profile-hero-right {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ghost-danger {
    border-color: #ffdbdb !important;
    color: #b72121 !important;
}

.avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.avatar-wrapper {
    position: relative;
    cursor: pointer;
}

.avatar-img {
    width: 84px;
    height: 84px;
    border-radius: 999px;
    background: #e6a63d;
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    font-size: 2rem;
}

.camera-icon {
    position: absolute;
    right: -4px;
    bottom: -2px;
    background: #fff;
    border: 2px solid #ececec;
    border-radius: 999px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

#avatar {
    display: none;
}

.row-action-btn {
    width: 100%;
    border: 1px solid #ececec;
    border-radius: 12px;
    background: #fff;
    padding: 13px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    cursor: pointer;
}

.toggle-row {
    margin-top: 14px;
    border: 1px solid #ececec;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.toggle-row p {
    margin: 4px 0 0;
    color: #646464;
}

/* accessible helper */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.email-preference-label {
    position: relative;
    padding-left: 50px;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
}

.email-preference-label input[type="checkbox"] {
    display: none;
}

.email-preference-label::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 44px;
    height: 24px;
    border-radius: 20px;
    background: #d9d9d9;
    transition: 0.2s ease;
}

.email-preference-label::after {
    content: "";
    position: absolute;
    left: 2px;
    top: 2px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #fff;
    transition: 0.2s ease;
}

.email-preference-label.checked::before {
    background: var(--accent-color);
}

.email-preference-label.checked::after {
    left: 22px;
}

.upf-summary-line {
    border: 1px solid #ececec;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    min-height: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
}

.summary-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: inline-block;
}

.upf-quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.upf-help-compact {
    margin-top: 10px;
    color: #646464;
}

.profile-main-actions {
    display: flex;
    gap: 10px;
}

.profile-save-btn {
    flex: 1;
    margin: 0;
    min-height: 56px;
    font-size: 1.7rem;
}

.profile-more-wrap {
    position: relative;
}

.profile-more-btn {
    width: 56px;
    min-height: 56px;
    margin: 0;
    font-size: 1.4rem;
    line-height: 1;
}

.profile-more-menu {
    position: absolute;
    right: 0;
    top: auto;
    bottom: calc(100% + 8px);
    width: 190px;
    border: 1px solid #ececec;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(17, 24, 39, 0.18);
    padding: 6px;
    z-index: 40;
}

.profile-more-menu button {
    width: 100%;
    padding: 10px 11px;
    border: none;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    font-size: 1rem;
    cursor: pointer;
}

.profile-more-menu button:hover {
    background: #f8f8f8;
}

.profile-more-menu button.danger {
    color: #bf1616;
}

.upf-turnus-modal__inner {
    max-width: 760px;
    width: min(92vw, 760px);
    max-height: 92vh;
    overflow-y: auto;
    padding: 26px;
}

.upf-turnus-modal .form-group label {
    font-weight: 700;
}

.upf-turnus-modal .form-group select,
.upf-turnus-modal .form-group input[type="date"] {
    width: 100%;
}

.upf-step-title {
    margin: 0 0 10px;
    color: #4f4f4f;
    font-size: 1.45rem;
}

.upf-modal-actions-row {
    margin-top: 12px;
}

.color-picker-trigger {
    width: 100%;
    border: 1px solid #ececec;
    border-radius: 12px;
    background: #fff;
    min-height: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    font-weight: 700;
    cursor: pointer;
}

.selected-color-dot {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: #e5e5e5;
}

.color-picker-panel {
    margin-top: 12px;
    border: 1px solid #ececec;
    border-radius: 12px;
    padding: 14px;
}

.color-picker-panel h4 {
    margin: 0 0 8px;
}

.color-dot-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}

.color-dot-btn {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 2px solid transparent;
    cursor: pointer;
}

.color-dot-btn.is-selected {
    border-color: #111;
    box-shadow: 0 0 0 2px #f3b34c;
}

.color-picker-current {
    margin-top: 10px;
    color: #4f4f4f;
}

.upf-ready-status {
    margin: 12px 0 0;
    border-radius: 10px;
    padding: 10px 12px;
    background: #f6f6f6;
    color: #4f4f4f;
}

.upf-ready-status.is-ready {
    background: #ecf8ee;
    color: #218c3d;
}

.upf-more-options {
    margin-top: 14px;
    border: 1px solid #ececec;
    border-radius: 12px;
    padding: 10px 12px;
}

.upf-more-options summary {
    cursor: pointer;
    font-weight: 700;
}

.upf-more-options-content {
    margin-top: 12px;
}

#deviation-section {
    margin-top: 14px;
}

.deviation-card {
    display: none;
    border: 1px solid #ececec;
    border-radius: 12px;
    padding: 14px;
    background: #fff;
}

.deviation-card.visible {
    display: block;
}

.upf-modal-footer-actions {
    margin-top: 16px;
    display: flex;
    gap: 12px;
}

.upf-modal-footer-actions .btn,
.upf-modal-footer-actions .btn-secondary {
    margin: 0;
    flex: 1;
}

.help-text {
    display: block;
    margin-top: 8px;
    color: #666;
}

.profile-card {
    width: 100%;
    max-width: 400px;
    margin: auto;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 28px;
    text-align: center;
}

.profile-name {
    margin-bottom: 20px;
}

.profile-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.profile-image {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-info {
    text-align: left;
}

#cropper-modal .cropper-content {
    background: var(--card-bg);
    padding: 22px;
    border-radius: var(--border-radius);
}

#cropper-canvas {
    max-width: 400px;
    max-height: 60vh;
    display: block;
    margin: 0 auto 10px auto;
    cursor: crosshair;
    touch-action: none;
}

.upf-pass-modal {
    max-width: 520px;
}

@media (max-width: 760px) {
    .contact-box.user-profile-box {
        max-width: 100%;
        margin: 8px max(10px, env(safe-area-inset-left)) 16px max(10px, env(safe-area-inset-right));
        padding: 12px;
    }

    .user-profile-box {
        margin: 8px max(10px, env(safe-area-inset-left)) 16px max(10px, env(safe-area-inset-right));
        padding: 12px;
    }

    .profile-section {
        padding: 14px;
    }

    .upf-h2 {
        font-size: 1.6rem;
    }

    /* Én rad: bilde | navn/e-post | kamera — ikke stable vertikalt */
    .profile-hero-card {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        min-height: 0;
    }

    .profile-hero-left {
        flex: 1;
        min-width: 0;
        flex-direction: row;
        align-items: center;
    }

    .profile-hero-right {
        width: auto;
        flex-shrink: 0;
        flex-direction: row;
        align-self: center;
    }

    .profile-hero-right .profile-camera-btn {
        flex: 0 0 auto;
        margin: 0;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .upf-quick-actions {
        grid-template-columns: 1fr;
    }

    .profile-main-actions {
        flex-direction: column;
    }

    .profile-more-btn {
        width: 100%;
    }

    .color-dot-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}
/* CSS styling som er spesifikk for brukerprofilen */


/* Sentraler profilboksen — kun denne siden bruker .user-profile; full bredde i ytterboks */
.user-profile {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Ikke dupliser .user-profile-box her med padding: 40px — ødelegger mobilbredde og overstyrer redesign-blokken øverst */

.user-profile-box:hover {
    box-shadow: var(--box-shadow-hover);
}

/* Form group styling for bedre plassering */
.user-profile-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.user-profile-group label {
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--primary-color);
}

/* Styling for inndelinger, som "endre passord" */
.section-divider {
    border-top: 1px solid var(--secondary-color);
    padding-top: 15px;
    margin-top: 15px;
}

.options-inline {
    display: flex;
    gap: 10px;
    margin-top: 5px;
    align-items: center;
}

/* For å gjøre teksten under hver seksjon bedre lesbar */
.description {
    margin-top: 5px;
    font-size: 0.9rem;
    color: #666;
}

/* Tooltip info icon */
.info-icon {
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 4px;
    position: relative;
    user-select: none;
}

.info-icon::after {
    content: attr(data-info);
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: normal;
    width: 240px;
    z-index: 10;
}

.info-icon:hover::after,
.info-icon:focus::after {
    display: block;
}

/* Kort for forhåndsvisning av profil */
.profile-card {
    width: 100%;
    max-width: 400px;
    margin: auto;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 32px;
    text-align: center;
    font-family: var(--font-family);
    border: 1px solid #f0f0f0;
    transition: var(--transition);
}

.profile-card:hover {
    box-shadow: var(--box-shadow-hover);
    transform: translateY(-2px);
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.profile-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
}

.profile-image {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-info {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 1rem;
}

.profile-info p {
    margin: 0;
}

.profile-info strong {
    font-weight: 600;
}

.profile-color-settings {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.profile-color-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
}

.profile-color-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--input-border);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-family);
    font-size: 0.9rem;
    background: var(--input-bg);
    color: var(--text-color);
}

.avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.avatar-wrapper {
    position: relative;
    cursor: pointer;
}

.camera-icon {
    position: absolute;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border-radius: 50%;
    padding: 4px;
    font-size: 20px;
}

#avatar {
    display: none;
}

/* Row layout for turnus og første skift */
.form-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.form-row .form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Spacing for floating rig row */
#floating-rig-row {
    margin-top: 12px;
    margin-bottom: 12px;
}

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    /* Ensure button row stacks on mobile for better symmetry */
    .button-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .button-row .btn,
    .button-row .btn-secondary {
        width: 100%;
    }
    
    /* Ensure all buttons have consistent spacing on mobile */
    .user-profile .btn,
    .user-profile .btn-secondary,
    #delete-profile-btn {
        width: 100%;
    }
}

/* Grå ut deaktiverte felt */
.user-profile input:disabled,
.user-profile select:disabled {
    background-color: #eee;
    cursor: not-allowed;
}

.avatar-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--secondary-color);
    display: flex;
    align-items: center;
    background-size: cover;
    background-position: center;
    justify-content: center;
    font-size: 48px;
    overflow: hidden;
}

.password-link {
    margin-top: 5px;
    display: inline-block;
}

#preview-btn {
    margin-top: 0;
}

/* Konsistent knappestyling for profilsiden - bruker original .btn og .btn-secondary fra style.css */
/* Men sørger for at alle knapper har samme størrelse og styling */
.user-profile .btn,
.user-profile .btn-secondary {
    width: 100%;
    padding: 14px 24px;
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    height: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/**
 * Lenke som ser ut som btn-secondary («Manuell turnus»): ikke fast høyde som klipper ramme,
 * og inline-flex gir lik vertikal sentrering uten å ødelegge full border (inkl. understrek).
 */
.user-profile a.btn-secondary.manual-shift-profile-link,
.user-profile #manual-shift-profile-link.btn-secondary {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: auto !important;
    min-height: 48px;
    padding: 12px 24px;
    line-height: 1.3;
    box-sizing: border-box !important;
    overflow: visible;
    text-align: center;
    text-decoration: none;
    border: 2px solid var(--secondary-color) !important;
}

/* Override hover effect for "Lagre profil" button - keep text visible */
.user-profile .btn[type="submit"] {
    position: relative;
}

.user-profile .btn[type="submit"]::before {
    display: none; /* Remove the sliding orange overlay */
}

.user-profile .btn[type="submit"]:hover {
    background: linear-gradient(135deg, #d68910 0%, #b9770e 100%); /* Darker orange on hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(244, 163, 0, 0.3);
}

.user-profile .btn[type="submit"] > * {
    position: relative;
    z-index: 1;
}

/* Fare knapp (Slett profil) - rød knapp for destruktive handlinger */
.user-profile .btn-danger,
#delete-profile-btn {
    width: 100%;
    padding: 14px 24px;
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    font-weight: 600;
    margin-top: 20px; /* Add spacing above delete button */
    margin-bottom: 12px;
    height: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%) !important;
    color: var(--light-color) !important;
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.3) !important;
    border: none !important;
    cursor: pointer;
    transition: var(--transition);
}

.user-profile .btn-danger:hover,
#delete-profile-btn:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4) !important;
}

/* Button row for side-by-side buttons */
.button-row {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    margin-bottom: 20px; /* Add spacing below button row */
}

.button-row .btn,
.button-row .btn-secondary {
    margin-bottom: 0;
    flex: 1;
    height: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    font-size: 15px;
    padding: 14px 16px;
}

/* Avviksseksjon styling */
#deviation-section {
    margin-bottom: 16px;
}

#deviation-section:last-child {
    margin-bottom: 0;
}

.deviation-card {
    margin-top: 16px;
    padding: 24px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: 1px solid #f0f0f0;
    box-shadow: var(--box-shadow);
    display: none;
}

.deviation-card.visible {
    display: block;
}

.deviation-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

.deviation-card .form-group {
    margin-bottom: 20px;
}

.deviation-card label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: var(--primary-color);
}

.deviation-card input[type="date"],
.deviation-card select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--input-border);
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    background: var(--input-bg);
    transition: var(--transition);
    font-family: var(--font-family);
}

.deviation-card input[type="date"]:focus,
.deviation-card select:focus {
    border-color: var(--accent-color);
    outline: none;
    background: var(--light-color);
    box-shadow: 0 0 0 3px rgba(244, 163, 0, 0.1);
}

/* Remove default section margins since profile-section handles it */
.user-profile > section {
    margin-bottom: 0;
}

.user-profile .profile-section:last-of-type {
    margin-bottom: 0;
}

/* Profile section containers with visual separation */
.profile-section {
    padding: 24px;
    margin-bottom: 24px;
    background: rgba(244, 163, 0, 0.03);
    border-radius: var(--border-radius);
    border: 1px solid rgba(244, 163, 0, 0.15);
    position: relative;
}

.profile-section::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--accent-color) 0%, rgba(244, 163, 0, 0.5) 100%);
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

/* Image section specific styling */
.image-section {
    text-align: center;
}

/* Spacing for avatar section */
.avatar-section {
    margin-bottom: 0;
}

/* Name and password section */
.name-password-section {
    background: rgba(52, 152, 219, 0.03);
    border-color: rgba(52, 152, 219, 0.15);
}

.name-password-section::before {
    background: linear-gradient(180deg, #3498db 0%, rgba(52, 152, 219, 0.5) 100%);
}

/* Styling for link buttons that should look like btn-secondary */
.name-password-section a.btn-secondary {
    display: block;
    text-decoration: none;
    margin-top: 12px;
    /* Override any link styling to match button appearance */
    color: var(--primary-color) !important;
    background-color: var(--light-color) !important;
    border: 2px solid var(--secondary-color) !important;
    text-align: center;
    transition: var(--transition);
}

.name-password-section a.btn-secondary:hover {
    text-decoration: none;
    background-color: var(--accent-color) !important;
    color: var(--light-color) !important;
    border-color: var(--accent-color) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(244, 163, 0, 0.2);
}

/* Work section styling */
.work-section {
    background: rgba(46, 204, 113, 0.03);
    border-color: rgba(46, 204, 113, 0.15);
}

.work-section::before {
    background: linear-gradient(180deg, #2ecc71 0%, rgba(46, 204, 113, 0.5) 100%);
}

/* Buttons section styling */
.buttons-section {
    background: rgba(155, 89, 182, 0.03);
    border-color: rgba(155, 89, 182, 0.15);
}

.buttons-section::before {
    background: linear-gradient(180deg, #9b59b6 0%, rgba(155, 89, 182, 0.5) 100%);
}

/* Cropper modal adjustments */
#cropper-modal .cropper-content {
    background: var(--card-bg);
    padding: 32px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--box-shadow-hover);
    border: 1px solid #f0f0f0;
}

#cropper-canvas {
    max-width: 400px;
    max-height: 60vh;
    display: block;
    margin: 0 auto 10px auto;
    cursor: crosshair;
    touch-action: none;
}

/* Email preference toggle switch - matching "Nær kollega" style */
.email-preference-label {
    font-size: 0.95rem !important;
    white-space: nowrap !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0 !important;
    cursor: pointer !important;
    user-select: none !important;
    position: relative !important;
    padding-left: 52px !important;
    min-height: 24px !important;
    line-height: 24px !important;
}

/* Hide the default checkbox completely */
.email-preference-label input[type="checkbox"] {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    display: none !important;
    visibility: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
}

/* Toggle switch track */
.email-preference-label::before {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 44px !important;
    height: 24px !important;
    background: var(--input-border) !important;
    border-radius: 12px !important;
    transition: var(--transition) !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
    z-index: 1 !important;
    display: block !important;
    visibility: visible !important;
}

/* Toggle switch thumb */
.email-preference-label::after {
    content: '' !important;
    position: absolute !important;
    left: 2px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 20px !important;
    height: 20px !important;
    background: var(--light-color) !important;
    border-radius: 50% !important;
    transition: var(--transition) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    pointer-events: none !important;
    z-index: 2 !important;
    display: block !important;
    visibility: visible !important;
}

/* Checked state - switch ON (orange/yellow) */
.email-preference-label:has(input[type="checkbox"]:checked)::before,
.email-preference-label.checked::before {
    background: var(--accent-color) !important;
}

.email-preference-label:has(input[type="checkbox"]:checked)::after,
.email-preference-label.checked::after {
    left: 22px !important;
    background: var(--light-color) !important;
}

/* Hover state */
.email-preference-label:hover::before {
    box-shadow: 0 0 0 4px rgba(244, 163, 0, 0.1) !important;
}

/* Active/pressed state */
.email-preference-label:active::after {
    width: 22px !important;
}

/* Help text styling for turnus selection */
.help-text {
    display: block;
    margin-top: 6px;
    color: #666;
    font-size: 0.875rem;
    line-height: 1.4;
}

.help-text a {
    color: var(--accent-color);
    text-decoration: underline;
    transition: var(--transition);
}

.help-text a:hover {
    color: var(--accent-color-dark);
    text-decoration: none;
}

/* Turnus på profil-/kollegakort: egendefinert PATTERN (manuell) */
.shift-display.shift-display--custom {
    display: inline;
    padding: 3px 10px;
    border-radius: 8px;
    background: rgba(244, 163, 0, 0.14);
    border: 1px solid rgba(244, 163, 0, 0.35);
    color: var(--text-color, #333);
}

.shift-display__text {
    font-weight: 500;
}

/* —— Profil med turnus i modal (hovedside = oppsummering + snarveier) —— */
.user-profile--shift-modal .profile-section.upf-card-job,
.user-profile--shift-modal .profile-section.upf-card-turnus-main {
    border: 1px solid #f0f0f0;
    border-radius: var(--border-radius);
    padding: 20px 20px 8px;
    margin-bottom: 20px;
    background: var(--card-bg);
    box-shadow: var(--box-shadow);
}

.user-profile--shift-modal .upf-h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}

#upf-turnus-summary.upf-summary-line {
    margin: 0 0 14px;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--text-color, #333);
}

.upf-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

@media (min-width: 520px) {
    .upf-quick-actions {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: stretch;
    }

    .upf-quick-actions .btn,
    .upf-quick-actions .btn-secondary {
        flex: 1;
        min-width: 160px;
        margin-bottom: 0;
    }
}

/* Turnus-modal: over hovedinnhold, under eksport/import-nested modaler */
#upf-turnus-modal.modal.upf-turnus-modal,
#upf-turnus-modal.modal {
    z-index: 3500;
}

#export-modal.modal,
#import-modal.modal {
    z-index: 4600;
}

.upf-turnus-modal .modal-content.upf-turnus-modal__inner {
    margin: 2vh auto;
    max-width: min(640px, 96vw);
    width: 100%;
    max-height: min(92vh, 920px);
    overflow-y: auto;
    overflow-x: hidden;
    /* Ekstra luft nederst slik at siste knapps ramme ikke klippes av scroll-container */
    padding: 28px 24px 32px;
}

.upf-turnus-modal .upf-modal-lead {
    margin: 0 0 20px;
    font-size: 0.9rem;
    color: #555;
    line-height: 1.45;
}

.upf-block-turnus .form-row,
.upf-turnus-details .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.upf-block-turnus .form-group,
.upf-turnus-details .form-group {
    flex: 1;
    min-width: 200px;
}

/*
 * Turnus-modal skjema: full bredde på alle skjermer (flex + Safari trenger min-width:0).
 * Smal skjerm: én kolonne så hvert felt fyller viewport – ikke «innholdsbredd» på <select>.
 */
#upf-turnus-modal .upf-block-turnus .form-row,
#upf-turnus-modal .upf-turnus-details .form-row {
    width: 100%;
}

#upf-turnus-modal .upf-block-turnus .form-group,
#upf-turnus-modal .upf-turnus-details .form-group {
    align-items: stretch;
}

#upf-turnus-modal .form-group select,
#upf-turnus-modal .form-group input[type="date"] {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    box-sizing: border-box;
    display: block;
    -webkit-appearance: none;
    appearance: none;
}

/* Nedtrekks-pil (native pil skjules med appearance:none) */
#upf-turnus-modal .form-group select {
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23333' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 8px;
}

@media (max-width: 899px) {
    #upf-turnus-modal .upf-block-turnus .form-row,
    #upf-turnus-modal .upf-turnus-details .form-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    #upf-turnus-modal .upf-block-turnus .form-group,
    #upf-turnus-modal .upf-turnus-details .form-group {
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }
}

.upf-modal-actions-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin: 20px 0;
    padding: 16px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

@media (min-width: 600px) {
    .upf-modal-actions-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: stretch;
    }

    .upf-modal-actions-cell {
        justify-content: flex-start;
        min-height: 100%;
    }
}

/* Unngå ekstra luft under knapper i raden (kommer fra .user-profile .btn-secondary) */
.upf-turnus-modal .upf-modal-actions-row .btn-secondary,
.upf-turnus-modal .upf-modal-actions-row a.btn-secondary {
    margin-bottom: 0;
}

.upf-modal-actions-cell {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.upf-modal-actions-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.upf-modal-actions-slot {
    flex: 1;
    min-height: 52px;
    display: flex;
    align-items: stretch;
}

.upf-modal-actions-control {
    width: 100%;
    align-self: stretch;
}

/* Fargevalg (select utenfor .form-group): samme bredde og stil som øvrige felt */
#upf-turnus-modal #user-color.upf-modal-actions-control {
    flex: 1;
    width: 100% !important;
    min-height: 48px;
    height: auto;
    padding: 12px 36px 12px 14px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--primary-color);
    background-color: var(--light-color);
    border: 2px solid var(--secondary-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23333' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 8px;
}

#upf-turnus-modal #user-color.upf-modal-actions-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(244, 163, 0, 0.2);
}

@media (min-width: 600px) {
    #upf-turnus-modal #user-color.upf-modal-actions-control {
        min-height: 72px;
    }
}

/**
 * Knapp-lenke i modal: ikke bruk fast 48px høyde fra .user-profile .btn-secondary
 * (to linjer + ramme ble klippet). «Ekte» ramme med box-shadow så nederst ikke forsvinner i WebKit.
 */
#upf-turnus-modal .upf-modal-actions-row .btn-secondary,
#upf-turnus-modal .upf-modal-actions-row a.btn-secondary {
    flex: 1;
    height: auto !important;
    min-height: 72px !important;
    padding: 12px 14px !important;
    align-self: stretch;
    text-align: center;
    border-radius: var(--border-radius-sm);
    border: 2px solid var(--secondary-color) !important;
    box-sizing: border-box !important;
    line-height: 1.3;
}

#upf-turnus-modal .upf-modal-actions-row .btn-secondary:hover {
    transform: none;
    border-color: var(--accent-color) !important;
}

.user-profile .upf-turnus-modal a.upf-modal-manual-link.btn-secondary {
    display: flex !important;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    width: 100%;
    margin-bottom: 0;
    overflow: visible;
    color: var(--primary-color) !important;
    background-color: var(--light-color) !important;
}

.user-profile .upf-turnus-modal a.upf-modal-manual-link.btn-secondary:hover {
    text-decoration: none;
    background-color: var(--accent-color) !important;
    color: var(--light-color) !important;
    border-color: var(--accent-color) !important;
    transform: none;
}

.upf-modal-h3 {
    font-size: 1.05rem;
    margin: 0 0 6px;
    color: var(--primary-color);
}

.upf-modal-muted {
    margin: 0 0 12px;
    font-size: 0.85rem;
    color: #666;
}

.upf-modal-kalender {
    margin-top: 8px;
    padding-top: 12px;
}

.upf-modal-footer-actions {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.upf-modal-footer-actions .btn {
    width: 100%;
}

/* =========================================================
   Compact SaaS profile layout (design only, keep JS/backend)
   ========================================================= */

/* Page container: max-w-2xl with mobile-first spacing */
.contact-box.user-profile-box {
    max-width: 42rem !important;
    width: 100%;
    margin: 24px auto;
    padding: 24px 16px;
    border-radius: 16px;
    box-sizing: border-box;
    background: var(--card-bg);
}

@media (min-width: 640px) {
    .contact-box.user-profile-box {
        margin: 30px auto;
        padding: 28px 24px;
    }
}

/* Vertical rhythm */
.user-profile {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Title hierarchy */
.user-profile .page-title {
    font-size: clamp(1.6rem, 3.4vw, 2rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin: 0;
}

.user-profile .page-subtitle {
    margin: 2px 0 4px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Section card pattern */
.user-profile .profile-section {
    border-radius: 12px;
    border: 1px solid var(--input-border) !important;
    background: var(--card-bg) !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    padding: 16px;
    margin: 0;
}

.user-profile .profile-section::before {
    content: none !important;
}

.user-profile .upf-h2 {
    margin: 0 0 10px;
    font-size: 0.95rem;
    font-weight: 600;
}

/* Compact profile header */
.profile-hero-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 0;
}

.profile-hero-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.avatar-img {
    width: 60px;
    height: 60px;
    border-radius: 999px;
    flex-shrink: 0;
    font-size: 1.15rem;
    font-weight: 600;
}

.avatar-delete-btn {
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    font-size: 13px;
}

.profile-hero-meta {
    min-width: 0;
    flex: 1;
}

.profile-hero-meta h2,
#profile-display-name {
    margin: 0;
    font-size: 1rem;
    line-height: 1.2;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-hero-meta p,
#profile-display-email {
    margin: 2px 0 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-hero-right {
    width: auto;
    display: flex;
    align-items: center;
}

/* Endre bilde: Lucide-lignende kamera i kvadrat, lik luft (Lovable-referanse) */
.profile-hero-right .profile-camera-btn {
    margin: 0;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
    padding: 0;
    line-height: 0;
    border-radius: 12px;
    border: 1px solid var(--input-border) !important;
    background: var(--card-bg) !important;
    color: var(--primary-color) !important;
    box-shadow: none !important;
}

.profile-hero-right .profile-camera-btn:hover {
    border-color: var(--secondary-color) !important;
    background: var(--light-color) !important;
}

.profile-camera-icon {
    display: block;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

/* Field layout */
.profile-info-card .form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 640px) {
    .profile-info-card .form-row {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}

.profile-info-card .form-group {
    margin-bottom: 0;
}

.profile-info-card label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.profile-info-card input[type="text"],
.profile-info-card input[type="email"] {
    min-height: 40px;
    height: 40px;
    padding: 10px 12px;
    border-radius: 10px;
    box-sizing: border-box;
}

.profile-info-card .form-group:has(#email) {
    grid-column: 1 / -1;
}

/* Compact list rows */
.row-action-btn,
.toggle-row {
    border-radius: 10px;
    border: 1px solid var(--input-border);
    background: color-mix(in srgb, var(--input-bg) 70%, white 30%);
    padding: 10px 12px;
}

.row-action-btn {
    margin-top: 10px;
    min-height: 42px;
}

.toggle-row {
    margin-top: 10px;
}

/* Bottom actions */
.profile-main-actions {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.profile-save-btn {
    flex: 1;
    min-height: 46px;
    font-size: 1rem;
}

.profile-more-btn {
    width: 46px;
    min-width: 46px;
    min-height: 46px;
}

@media (max-width: 639px) {
    .contact-box.user-profile-box {
        margin: 8px 8px 14px;
        padding: 12px;
        max-width: calc(100% - 16px) !important;
    }

    .profile-hero-card {
        align-items: flex-start;
    }

    /* Avoid forced truncation on very narrow phones */
    .profile-hero-meta h2,
    #profile-display-name,
    .profile-hero-meta p,
    #profile-display-email {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        overflow-wrap: anywhere;
    }
}

/* =========================================================
   Profile page conflict fix (scoped + final override)
   ========================================================= */

/* Neutralize global typography/layout bleed on profile page */
.user-profile-box h1,
.user-profile-box h2,
.user-profile-box h3,
.user-profile-box p,
.user-profile-box section,
.user-profile-box label {
    text-align: left;
}

/* Page header: left aligned, dark title, muted subtitle */
.user-profile .page-title {
    text-align: left !important;
    color: var(--text-color) !important;
    background: none !important;
    -webkit-text-fill-color: currentColor !important;
    font-size: clamp(1.45rem, 3vw, 1.85rem) !important;
    font-weight: 600 !important;
    letter-spacing: -0.02em;
    margin: 0 0 2px !important;
}

.user-profile .page-subtitle {
    text-align: left !important;
    color: var(--text-secondary) !important;
    font-size: 0.875rem !important;
    margin: 0 0 8px !important;
}

/* Compact section titles */
.user-profile .upf-h2 {
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    margin: 0 0 10px !important;
}

/* Compact labels + inputs */
.user-profile .form-group label {
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    color: var(--text-secondary) !important;
    margin-bottom: 6px !important;
}

.user-profile .form-group {
    margin-bottom: 10px !important;
}

.user-profile .form-group input,
.user-profile .form-group select {
    min-height: 40px !important;
    height: 40px !important;
    padding: 9px 12px !important;
    font-size: 0.95rem !important;
    border-radius: 10px !important;
}

/* Keep sections compact, including Arbeid */
.user-profile .profile-section {
    padding: 14px !important;
}

.user-profile .form-row {
    gap: 10px !important;
}

.profile-hero-card .camera-icon {
    display: none !important;
}

/* Turnus summary row */
.upf-summary-line {
    min-height: 40px !important;
    padding: 10px 12px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.summary-color-dot {
    width: 10px !important;
    height: 10px !important;
    flex: 0 0 auto;
}

/* Turnus-knapper: ikon + tekst (SVG i HTML), alltid vertikal stack — se .user-profile .upf-quick-actions nederst */
#upf-open-turnus-modal,
#manual-shift-profile-link {
    min-height: 38px !important;
    padding: 8px 12px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.upf-turnus-btn-icon {
    flex-shrink: 0;
    color: var(--accent-color);
}

.upf-help-compact,
.help-text.upf-help-compact {
    text-align: left !important;
    margin-top: 8px !important;
}

/* Footer actions: always same row */
.profile-main-actions {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch;
    gap: 8px !important;
}

.profile-save-btn {
    flex: 1 1 auto !important;
    min-height: 42px !important;
    height: 42px !important;
    font-size: 0.95rem !important;
    margin: 0 !important;
}

.profile-more-wrap {
    flex: 0 0 auto;
}

.profile-more-btn {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    margin: 0 !important;
}

@media (max-width: 760px) {
    .contact-box.user-profile-box {
        margin: 8px 8px 14px !important;
        padding: 10px !important;
        max-width: calc(100% - 16px) !important;
    }

    .user-profile .profile-section {
        padding: 12px !important;
    }

    .profile-hero-card {
        gap: 8px !important;
    }

    .avatar-img {
        width: 60px !important;
        height: 60px !important;
        font-size: 1.05rem !important;
    }

    .profile-hero-meta h2,
    #profile-display-name {
        font-size: 0.98rem !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .profile-hero-meta p,
    #profile-display-email {
        font-size: 0.74rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .profile-hero-right .profile-camera-btn {
        width: 46px !important;
        min-width: 46px !important;
        height: 46px !important;
        min-height: 46px !important;
        padding: 0 !important;
    }
}

.avatar-delete-modal-content {
    max-width: 420px;
    text-align: left;
}

.avatar-delete-modal-content h3 {
    margin: 0 0 8px;
}

.avatar-delete-modal-content p {
    margin: 0 0 16px;
    color: #525252;
}

.delete-profile-modal-content .delete-profile-hint {
    margin: -8px 0 16px;
    font-size: 0.9rem;
    color: #404040;
}

.delete-profile-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}

.delete-profile-actions #delete-profile-cancel {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    font-size: 1rem;
    font-weight: 600;
}

.btn-delete-profile-confirm {
    width: 100%;
    min-height: 40px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    box-sizing: border-box;
    background: transparent;
    color: #b71c1c;
    border: 1px solid rgba(183, 28, 28, 0.45);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-delete-profile-confirm:hover {
    background: rgba(183, 28, 28, 0.06);
    border-color: rgba(183, 28, 28, 0.65);
    color: #8b0000;
}

.btn-delete-profile-confirm:focus-visible {
    outline: 2px solid var(--accent-color, #f57c00);
    outline-offset: 2px;
}

/* Final compact overrides (last in file on purpose) */
.contact-box.user-profile-box {
    max-width: 42rem !important;
    width: 100%;
    margin: 24px auto;
    padding: 24px 16px;
    box-sizing: border-box;
}

.user-profile {
    max-width: 100%;
    margin: 0;
    padding: 0;
    gap: 16px;
}

.user-profile .profile-section {
    background: var(--card-bg) !important;
    border: 1px solid var(--input-border) !important;
    border-radius: 12px;
    padding: 16px;
}

.user-profile .profile-section::before {
    content: none !important;
}

.profile-hero-card .camera-icon {
    display: none !important;
}

.profile-hero-card {
    min-height: 0;
    gap: 12px;
}

.profile-hero-left {
    flex: 1;
    min-width: 0;
    gap: 10px;
}

.avatar-img {
    width: 60px;
    height: 60px;
    font-size: 1.15rem;
}

.profile-hero-meta h2,
#profile-display-name {
    font-size: 1rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-hero-meta p,
#profile-display-email {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-info-card .form-group input {
    min-height: 40px;
    height: 40px;
    border-radius: 10px;
    box-sizing: border-box;
}

@media (min-width: 640px) {
    .contact-box.user-profile-box {
        margin: 30px auto;
        padding: 28px 24px;
    }
}

@media (max-width: 639px) {
    .contact-box.user-profile-box {
        margin: 8px 8px 14px;
        padding: 12px;
        max-width: calc(100% - 16px) !important;
    }

    .profile-hero-card {
        align-items: center;
    }

    .profile-hero-right .profile-camera-btn {
        width: 46px;
        min-width: 46px;
        height: 46px;
        min-height: 46px;
        padding: 0;
        border-radius: 12px;
        margin: 0;
    }

    /* No forced ellipsis on narrow phones */
    .profile-hero-meta h2,
    #profile-display-name,
    .profile-hero-meta p,
    #profile-display-email {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        overflow-wrap: anywhere;
    }
}

/* —— Dropdown «…», vertikale turnus-knapper, Arbeid full bredde, avatar kryss —— */
.profile-actions-card {
    overflow: visible !important;
}

.profile-more-wrap {
    overflow: visible !important;
}

/* «⋯» til høyre; meny over knappen, høyrejustert mot ⋯ */
.user-profile .profile-actions-card .profile-more-menu {
    z-index: 10050 !important;
    right: 0 !important;
    left: auto !important;
    top: auto !important;
    bottom: calc(100% + 8px) !important;
    min-width: 208px;
}

.profile-more-item {
    display: flex !important;
    align-items: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

/* Vanlige menyrader: venstrejustert slik at ikon ligger i loddrett linje */
.profile-more-item--menu-row {
    justify-content: flex-start !important;
    text-align: left !important;
}

.profile-more-item--menu-row > .profile-more-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    display: block;
}

.profile-more-item--center {
    justify-content: center !important;
}

.profile-more-item--danger {
    justify-content: flex-start !important;
}

.profile-more-icon {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.profile-more-item--danger,
.profile-more-item--danger .profile-more-icon {
    color: #b91c1c !important;
}

.profile-more-separator {
    height: 1px;
    margin: 6px 4px;
    background: var(--input-border);
    border: 0;
    padding: 0;
}

.profile-more-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
}

/* Turnus: alltid loddrett stack (overstyr @media min-width:520px i fila) */
.user-profile .upf-card-turnus-main .upf-quick-actions {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    width: 100% !important;
    margin-bottom: 10px !important;
}

.user-profile .upf-card-turnus-main .upf-quick-actions .btn-secondary,
.user-profile .upf-card-turnus-main .upf-quick-actions a.btn-secondary {
    width: 100% !important;
    flex: none !important;
    min-width: 0 !important;
    margin-bottom: 0 !important;
}

/* Turnus: innhold helt til venstre */
.user-profile .upf-card-turnus-main .upf-turnus-btn,
.user-profile .upf-card-turnus-main a.upf-turnus-btn {
    justify-content: flex-start !important;
    align-items: center !important;
    text-align: left !important;
}

.user-profile .upf-card-turnus-main .upf-turnus-btn span,
.user-profile .upf-card-turnus-main a.upf-turnus-btn span {
    text-align: left !important;
}

/* Arbeid: samme bredde som Personlig informasjon */
.user-profile .upf-card-job .form-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

@media (min-width: 640px) {
    .user-profile .upf-card-job .form-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    }
}

.user-profile .upf-card-job .form-group {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

.user-profile .upf-card-job .form-group input {
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Slett profilbilde: rød knapp øverst til høyre */
.avatar-delete-btn {
    display: none !important;
    position: absolute !important;
    top: -4px !important;
    right: -4px !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 999px !important;
    background: #dc2626 !important;
    color: #fff !important;
    z-index: 6 !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.avatar-wrapper.has-image .avatar-delete-btn {
    display: inline-flex !important;
}

.avatar-delete-btn:hover {
    background: #b91c1c !important;
}

/* Kamera-knapp: vertikalt sentrert med avatar */
.profile-hero-card {
    align-items: center !important;
}

.profile-hero-right {
    align-self: center !important;
    flex-shrink: 0 !important;
    margin-left: 8px !important;
}

/* Lagre profil: ikon + tekst */
.user-profile .profile-save-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.user-profile .profile-save-btn .profile-save-icon {
    flex-shrink: 0;
    opacity: 0.95;
}

@media (max-width: 760px) {
    .user-profile .profile-more-wrap .profile-more-menu {
        width: min(92vw, 240px) !important;
        left: auto !important;
        right: 0 !important;
        top: auto !important;
        bottom: calc(100% + 8px) !important;
    }

    .profile-main-actions {
        flex-direction: row !important;
        align-items: stretch !important;
    }

    .profile-more-btn {
        width: 42px !important;
        min-width: 42px !important;
    }
}
