@font-face {
    font-family: "PortalHeading";
    src: url("../fonts/IBMPlexSans-Medium_1.ttf") format("truetype");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

:root {
    --navy: #002c54;
    --navy-dark: #00263f;
    --sky: #e4eef6;
    --sand: #f5f7fa;
    --accent: #F7A600;
    --accent-dark: #c66111;
    --text: #1a1e24;
    --muted: #5b6673;
    --border: #dfe4eb;
    --surface: #ffffff;
    --shadow: 4px 6px 12px rgba(0, 25, 55, 0.06);
    --heading-font: "PortalHeading", sans-serif;
    --body-font: "PortalHeading", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--body-font);
    background: var(--sand);
    color: var(--text);
    line-height: 1.6;
}

a {
    color: var(--navy);
    text-decoration: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--heading-font);
}

.site-header {
    background: var(--navy-dark);
    color: #fff;
    padding-bottom: 20px;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.topbar {
    max-width: 1080px;
    margin: 0 auto;
    padding: 14px 20px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brandmark {
    display: flex;
    align-items: center;
    gap: 34px;
    color: #bcd7ea;
}

.brandmark-logo {
    display: inline-flex;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.brandmark-logo img {
    height: 72px;
    width: auto;
    display: block;
}

.hero-copy {
    display: grid;
    gap: 10px;
    max-width: 680px;
}

.main-nav {
    background-color: transparent;
    background-image: url("../images/dekorelement-bakgrund.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 100%;
    clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
}

.main-nav-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 8px 20px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.main-nav-inner .nav-links {
    display: inline-flex;
    gap: 12px;
    flex-wrap: wrap;
}

.main-nav a {
    color: #f7f2e7;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 999px;
    transition: background 120ms ease, color 120ms ease;
}

.main-nav a.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.main-nav a:hover {
    background: rgba(255, 255, 255, 0.12);
}

.main-nav .btn-ghost {
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
    padding: 8px 16px;
}

.site-footer {
    width: 100%;
}

.footer-mail-link {
    color: #ffffff;
    font-weight: 700;
}

.hero-copy h1 {
    margin: 0;
    font-family: var(--heading-font);
    font-size: clamp(24px, 4vw, 34px);
    color: #f7a600;
    letter-spacing: -0.5px;
}

.hero-copy p {
    margin: 0;
    color: #d9e8f7;
    font-size: 14px;
    max-width: 620px;
}

.layout {
    width: 100%;
    max-width: 1080px;
    margin: 32px auto 48px;
    padding: 0 20px;
    display: grid;
    gap: 20px;
    position: relative;
    z-index: 2;
    flex: 1;
}

body.auth-page .layout {
    display: flex;
    align-items: center;
    justify-content: center;
}

.card {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.brand h1 {
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.2px;
}

.subtle {
    color: var(--muted);
    font-size: 14px;
    margin: 0;
}

.btn {
    appearance: none;
    border: none;
    border-radius: 999px;
    padding: 12px 20px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
    font-family: inherit;
    background-image: none;
    box-shadow: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: none;
}

.btn-ghost {
    background: transparent;
    color: var(--navy);
    border: 1px solid var(--border);
}

.btn-icon {
    padding: 6px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: none;
}

.stack {
    display: grid;
    gap: 14px;
}

.status-row {
    margin: 0 0 10px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
}

.status-row-success {
    color: #1d7b53;
    background: rgba(44, 177, 121, 0.08);
    border-color: rgba(44, 177, 121, 0.2);
}

.status-row-error {
    color: #b0304c;
    background: rgba(255, 99, 132, 0.08);
    border-color: rgba(255, 99, 132, 0.2);
}

.login-reset-panel summary {
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    color: var(--navy);
    list-style: none;
}

.login-reset-panel summary::-webkit-details-marker {
    display: none;
}

.login-reset-panel summary::before {
    content: "▾";
    display: inline-block;
    margin-right: 8px;
    transition: transform 120ms ease;
}

.login-reset-panel:not([open]) summary::before {
    transform: rotate(-90deg);
}

.login-reset-panel[open] summary {
    margin-bottom: 8px;
}

.login-reset-notice {
    margin-bottom: 8px;
}

.form-error-slot {
    min-height: 20px;
    margin: -4px 0 0;
}

.form-error-label {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    color: #b74a55;
}

.grid {
    display: grid;
    gap: 16px;
}

.account-card {
    position: relative;
}

.account-brand {
    padding-right: 150px;
}

.account-logo-top {
    position: absolute;
    top: 24px;
    right: 24px;
    text-align: center;
}

.account-logo-label {
    display: block;
    font-size: 11px;
    margin-bottom: 4px;
}

.account-logo-preview {
    border: 1px dashed var(--border);
    border-radius: 16px;
    background: var(--sky);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.account-logo-preview-compact {
    min-height: 70px;
    max-width: 120px;
}

.account-logo-preview img {
    max-width: 100%;
    max-height: 60px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.account-logo-placeholder {
    color: var(--muted);
    font-style: italic;
    text-align: center;
}

.file-upload-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.file-upload-name {
    font-size: 14px;
    color: var(--muted);
}

.dashboard-action-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.dashboard-action-row-end {
    justify-content: flex-end;
    margin-top: 18px;
}

.dashboard-section-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

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

.contacts-table-empty {
    text-align: left;
}

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

.events-table-empty {
    text-align: left;
}

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

.articles-table-empty {
    text-align: left;
}

.card input[type="text"],
.card input[type="email"],
.card input[type="url"],
.card select,
.card textarea {
    width: 100%;
    max-width: 100%;
}

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

@media (max-width: 640px) {
    .account-brand {
        padding-right: 0;
    }

    .account-logo-top {
        position: static;
        margin-left: auto;
        margin-bottom: 12px;
    }
}

@media (min-width: 900px) {
    .grid.two {
        grid-template-columns: 1fr 1fr;
    }
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.open {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.modal-dialog {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    width: min(90%, 800px);
    z-index: 1001;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

#contact-modal .modal-dialog,
#contact-create-modal .modal-dialog {
    min-height: 560px;
}

.modal-dialog .stack,
.modal-dialog .stack > * {
    min-width: 0;
}

.modal-dialog input[type="text"],
.modal-dialog input[type="email"],
.modal-dialog input[type="url"],
.modal-dialog input[type="date"],
.modal-dialog input[type="time"],
.modal-dialog input[type="file"],
.modal-dialog select,
.modal-dialog textarea {
    width: 100%;
    max-width: 100%;
}

.modal-dialog .ck,
.modal-dialog .ck-editor,
.modal-dialog .ck-editor__main,
.modal-dialog .ck-editor__editable_inline {
    max-width: 100%;
    min-width: 0;
}

.modal-dialog h3 {
    margin-top: 0;
    margin-bottom: 12px;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

/* Increase spacing for Intresseomraden multi-select items (Chosen). */
#contact-create-interests_chosen .chosen-results li,
#contact-interests_chosen .chosen-results li {
    padding-top: 8px;
    padding-bottom: 8px;
    line-height: 1.45;
}


.chosen-container-multi .chosen-choices li.search-choice {
    margin: 6px 6px 6px 0;
    padding-top: 6px;
    padding-bottom: 6px;
    padding-right: 24px;
}

.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
    top: 50%;
    transform: translateY(-50%);
}

@media (max-width: 768px) {
    .modal {
        align-items: flex-start;
        overflow-y: auto;
        padding: 12px;
    }

    .modal-dialog {
        width: 100%;
        max-width: none;
        max-height: none;
        margin: 0;
        border-radius: 14px;
        padding: 16px 14px 18px;
    }

    .modal-dialog .ck.ck-toolbar {
        flex-wrap: wrap;
    }

    .modal-dialog .ck-editor__editable_inline {
        min-height: 220px !important;
    }

    .topbar {
        flex-direction: column;
        text-align: center;
    }

    .brandmark {
        flex-direction: column;
        text-align: center;
        gap: 14px;
    }

    .brandmark-logo img {
        height: 56px;
    }

    .main-nav {
        padding: 12px 0;
    }

    .main-nav-inner {
        flex-direction: column;
    }

    .main-nav .nav-links {
        justify-content: center;
    }

    .layout {
        margin: 24px auto 32px;
        padding: 0 14px;
    }

    .card {
        padding: 20px;
    }

    .brand {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .table-wrapper table:not(.contacts-table):not(.events-table):not(.articles-table) {
        min-width: 600px;
    }

    .dashboard-action-row .btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .dashboard-action-row-end {
        justify-content: stretch;
    }

    .dashboard-add-contact-btn {
        width: 100%;
    }

    .articles-header {
        align-items: flex-start;
    }

    .articles-add-btn {
        width: 100%;
    }

    .ck-editor__editable_inline {
        min-height: 400px;
    }
}

@media (max-width: 900px) {
    .contacts-table {
        min-width: 0;
    }

    .events-table {
        min-width: 0;
    }

    .articles-table {
        min-width: 0;
    }

    .contacts-card .table-wrapper,
    .events-card .table-wrapper,
    .articles-card .table-wrapper {
        overflow-x: visible;
    }

    .contacts-table thead,
    .events-table thead,
    .articles-table thead {
        display: none;
    }

    .contacts-table tbody,
    .contacts-table tr,
    .contacts-table td,
    .events-table tbody,
    .events-table tr,
    .events-table td,
    .articles-table tbody,
    .articles-table tr,
    .articles-table td {
        display: block;
        width: 100%;
    }

    .contacts-table tr,
    .events-table tr,
    .articles-table tr {
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 6px 10px;
        margin-bottom: 10px;
        background: #fff;
    }

    .contacts-table td,
    .events-table td,
    .articles-table td {
        border: none;
        padding: 8px 4px !important;
        white-space: normal !important;
    }

    .contacts-table td::before,
    .events-table td::before,
    .articles-table td::before {
        content: attr(data-label);
        display: block;
        color: var(--muted);
        font-size: 12px;
        margin-bottom: 2px;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    .contacts-table td.actions-cell::before,
    .contacts-table-empty-row .contacts-table-empty::before,
    .events-table-empty-row .events-table-empty::before,
    .articles-table-empty-row .articles-table-empty::before,
    .articles-table td.articles-actions-cell::before {
        content: "";
        display: none;
    }

    .contacts-table td.actions-cell {
        display: flex;
        gap: 8px;
        align-items: center;
        padding-top: 12px !important;
    }

    .articles-table td.articles-actions-cell {
        padding-top: 12px !important;
    }
}
.ck-editor__editable_inline {
    min-height: 400px;
}
