/* Unified content system for pages, Sveden sections and rich text editors. */
.cms-content {
    --cms-ink: #1b263b;
    --cms-muted: #637083;
    --cms-line: #dfe5ed;
    --cms-soft: #f4f7fa;
    --cms-surface: #fff;
    --cms-accent: #c92b32;
    --cms-navy: #263b59;
    color: var(--cms-ink);
    font-size: 1rem;
    line-height: 1.72;
}

body.dark-mode .cms-content {
    --cms-ink: #e7edf6;
    --cms-muted: #a9b6c8;
    --cms-line: #334155;
    --cms-soft: #1c293a;
    --cms-surface: #172231;
    --cms-accent: #f08387;
    --cms-navy: #a8c3e6;
}

.sveden-content .sveden-content-header {
    justify-content: center;
    text-align: center;
}
.sveden-content .sveden-content-header > div { max-width: 760px; }
.sveden-content .sveden-content-subtitle { margin-left: auto; margin-right: auto; }

.cms-content > :first-child { margin-top: 0; }
.cms-content > :last-child { margin-bottom: 0; }
.cms-content p { margin: 0 0 1em; }
.cms-content .cms-lead {
    max-width: 72ch;
    margin: 0 auto 28px;
    color: var(--cms-muted);
    font-size: 1.12rem;
    line-height: 1.65;
    text-align: center;
}

.cms-content h2,
.cms-content h3,
.cms-content h4 {
    color: var(--cms-ink);
    letter-spacing: 0;
    overflow-wrap: anywhere;
}
.cms-content h2 {
    margin: 34px 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--cms-line);
    font-size: 1.55rem;
    line-height: 1.25;
}
.cms-content h3 { margin: 28px 0 12px; font-size: 1.25rem; line-height: 1.3; }
.cms-content h4 { margin: 22px 0 9px; font-size: 1.06rem; }
.cms-content a { color: var(--cms-accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.cms-content a:hover { text-decoration: underline; }
.cms-content ul,
.cms-content ol { margin: 0 0 18px; padding-left: 24px; }
.cms-content li { margin: 5px 0; }
.cms-content ul li::marker { color: var(--cms-accent); }
.cms-content ol li::marker { color: var(--cms-navy); font-weight: 700; }

.cms-content .cms-section { margin: 34px 0; }
.cms-content .cms-section > h2:first-child,
.cms-content .cms-section > h3:first-child { margin-top: 0; }

.cms-content .cms-callout {
    margin: 22px 0;
    padding: 18px 20px;
    border: 1px solid #cbd9ea;
    border-left: 4px solid #3d6597;
    border-radius: 8px;
    background: #f3f7fc;
    color: #263b59;
}
.cms-content .cms-callout > :last-child { margin-bottom: 0; }
.cms-content .cms-callout--success { border-color: #b8dfca; border-left-color: #168454; background: #f1faf5; color: #155f42; }
.cms-content .cms-callout--warning { border-color: #ead7a5; border-left-color: #b68118; background: #fffaf0; color: #745514; }
.cms-content .cms-callout--danger { border-color: #efc4c6; border-left-color: #c92b32; background: #fff5f5; color: #8f252a; }
body.dark-mode .cms-content .cms-callout { border-color: #3c536f; background: #1b2c43; color: #c6d8ef; }
body.dark-mode .cms-content .cms-callout--success { border-color: #285a46; background: #153128; color: #a7dfc2; }
body.dark-mode .cms-content .cms-callout--warning { border-color: #735e2d; background: #302919; color: #ebd18e; }
body.dark-mode .cms-content .cms-callout--danger { border-color: #71404b; background: #351d24; color: #f0b4b9; }

.cms-content .cms-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 22px 0;
}
.cms-content .cms-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cms-content .cms-fact {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--cms-line);
    border-radius: 8px;
    background: var(--cms-surface);
}
.cms-content .cms-fact strong { display: block; margin-bottom: 5px; color: var(--cms-ink); }
.cms-content .cms-fact span,
.cms-content .cms-fact p { color: var(--cms-muted); font-size: .93rem; }
.cms-content .cms-fact p:last-child { margin-bottom: 0; }

.cms-content .cms-steps { margin: 22px 0; padding: 0; list-style: none; counter-reset: cms-step; }
.cms-content .cms-steps li {
    position: relative;
    min-height: 44px;
    margin: 0;
    padding: 12px 0 12px 48px;
    border-bottom: 1px solid var(--cms-line);
    counter-increment: cms-step;
}
.cms-content .cms-steps li::before {
    content: counter(cms-step);
    position: absolute;
    top: 10px;
    left: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--cms-navy);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: .82rem;
    font-weight: 800;
}

.cms-table-wrap {
    width: 100%;
    margin: 22px 0 28px;
    overflow-x: auto;
    border: 1px solid var(--cms-line);
    border-radius: 8px;
    background: var(--cms-surface);
    -webkit-overflow-scrolling: touch;
}
.cms-content .cms-table {
    display: table;
    width: 100% !important;
    min-width: 620px;
    margin: 0 !important;
    border: 0 !important;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: .94rem;
}
.cms-content .cms-table--definition { min-width: 0; table-layout: fixed; }
.cms-content .cms-table caption {
    padding: 14px 16px;
    border-bottom: 1px solid var(--cms-line);
    color: var(--cms-ink);
    font-weight: 800;
    text-align: left;
}
.cms-content .cms-table th,
.cms-content .cms-table td {
    height: auto;
    padding: 12px 14px !important;
    border: 0 !important;
    border-right: 1px solid var(--cms-line) !important;
    border-bottom: 1px solid var(--cms-line) !important;
    background: transparent !important;
    color: var(--cms-ink) !important;
    text-align: left;
    vertical-align: top;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
}
.cms-content .cms-table--wide th,
.cms-content .cms-table--wide td { min-width: 132px; }
.cms-content .cms-table--wide th:first-child,
.cms-content .cms-table--wide td:first-child { min-width: 170px; }
.cms-content .cms-table tr:last-child > * { border-bottom: 0 !important; }
.cms-content .cms-table tr > *:last-child { border-right: 0 !important; }
.cms-content .cms-table thead th {
    background: var(--cms-navy) !important;
    color: #fff !important;
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
}
.cms-content .cms-table--definition th {
    width: 34%;
    background: var(--cms-soft) !important;
    color: var(--cms-ink) !important;
    font-weight: 700;
    text-transform: none;
}
.cms-content .cms-table tbody tr:hover td { background: color-mix(in srgb, var(--cms-soft) 72%, transparent) !important; }

.cms-content .cms-file-link,
.cms-content .cms-document {
    display: inline-flex !important;
    align-items: center;
    gap: 10px !important;
    min-height: 40px;
    padding: 9px 12px !important;
    border: 1px solid var(--cms-line);
    border-radius: 7px;
    background: var(--cms-surface) !important;
    color: var(--cms-ink) !important;
    font-weight: 650;
    text-decoration: none !important;
    line-height: 1.35;
    vertical-align: middle;
}
.cms-content .cms-file-link::before {
    content: attr(data-file-type);
    min-width: 34px;
    padding: 3px 5px;
    border-radius: 4px;
    background: var(--cms-accent);
    color: #fff;
    font-size: .62rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
}
.cms-content .cms-file-link[data-file-type="PDF"]::before { background: #cf2e36; }
.cms-content .cms-file-link[data-file-type="DOC"]::before,
.cms-content .cms-file-link[data-file-type="DOCX"]::before { background: #2563b8; }
.cms-content .cms-file-link[data-file-type="XLS"]::before,
.cms-content .cms-file-link[data-file-type="XLSX"]::before,
.cms-content .cms-file-link[data-file-type="CSV"]::before { background: #168451; }
.cms-content .cms-file-link[data-file-type="PPT"]::before,
.cms-content .cms-file-link[data-file-type="PPTX"]::before { background: #c65d22; }
.cms-content .cms-file-link[data-file-type="ZIP"]::before,
.cms-content .cms-file-link[data-file-type="RAR"]::before { background: #596579; }
.cms-content .cms-file-link:hover,
.cms-content .cms-document:hover { border-color: var(--cms-accent); background: var(--cms-soft); text-decoration: none; }
.cms-content .cms-file-group {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
}
.cms-content li.cms-file-group { padding-block: 10px !important; }
.cms-content .cms-documents { display: grid; gap: 8px; margin: 20px 0; }
.cms-content .cms-documents .cms-file-link,
.cms-content .cms-documents .cms-document { width: 100%; }

.cms-content .cms-image {
    max-width: 100%;
    height: auto;
    margin: 20px auto;
    border: 1px solid var(--cms-line);
    border-radius: 8px;
}
.cms-content figure { margin: 24px 0; }
.cms-content figure .cms-image { margin: 0 auto; }
.cms-content figcaption { margin-top: 8px; color: var(--cms-muted); font-size: .84rem; text-align: center; }

.cms-content blockquote {
    margin: 22px 0;
    padding: 14px 18px;
    border: 0;
    border-left: 3px solid var(--cms-navy);
    border-radius: 0;
    background: var(--cms-soft);
    color: var(--cms-muted);
}
.cms-content .cms-legacy-panel { border-radius: 8px !important; box-shadow: none !important; }
.cms-content .cms-legacy-row { border-radius: 0 7px 7px 0 !important; box-shadow: none !important; }

/* Legacy Sveden personnel blocks are normalized into the same readable grid. */
.cms-content .svd-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 2px;
}
.cms-content .svd-card {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--cms-line);
    border-radius: 8px;
    background: var(--cms-surface);
}
.cms-content .svd-f {
    display: grid;
    grid-template-columns: minmax(150px, .55fr) minmax(0, 1.45fr);
    min-width: 0;
    border-bottom: 1px solid var(--cms-line);
}
.cms-content .svd-f:last-child { border-bottom: 0; }
.cms-content .svd-l,
.cms-content .svd-v {
    min-width: 0;
    padding: 10px 12px;
    overflow-wrap: anywhere;
}
.cms-content .svd-l {
    background: var(--cms-soft);
    color: var(--cms-muted);
    font-size: .8rem;
    font-weight: 700;
}
.cms-content .svd-v {
    color: var(--cms-ink);
    font-weight: 550;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
}
.cms-content .svd-v a { color: var(--cms-link) !important; }

/* Specialty descriptions are rebuilt by PageContentFormatter into one stable layout. */
.specialty-description .specialty-overview { display: grid; gap: 16px; }
.specialty-description .specialty-overview-lead {
    margin: 0;
    padding: 18px 20px;
    border: 1px solid var(--cms-line);
    border-left: 4px solid #3d6597;
    border-radius: 7px;
    background: var(--cms-soft);
    color: var(--cms-ink);
    font-size: 1.02rem;
    line-height: 1.68;
}
.specialty-description .specialty-overview-lead > :last-child { margin-bottom: 0; }
.specialty-description .specialty-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.specialty-description .specialty-overview-section {
    min-width: 0;
    padding: 18px 20px;
    border: 1px solid var(--cms-line);
    border-radius: 7px;
    background: var(--cms-surface);
}
.specialty-description .specialty-overview-section h2 {
    margin: 0 0 12px !important;
    padding: 0 0 10px !important;
    border-bottom: 1px solid var(--cms-line) !important;
    color: var(--cms-ink) !important;
    font-size: 1.08rem !important;
    line-height: 1.3 !important;
}
.specialty-description .specialty-overview-section-body > :last-child { margin-bottom: 0; }
.specialty-description .specialty-overview-section ul,
.specialty-description .specialty-overview-section ol { margin: 0; padding-left: 20px; }
.specialty-description .specialty-overview-section p { margin: 0; color: var(--cms-muted); line-height: 1.68; }
.specialty-description .specialty-overview-note {
    padding: 14px 18px;
    border-left: 3px solid #168451;
    background: color-mix(in srgb, #168451 7%, var(--cms-surface));
    color: var(--cms-muted);
}
.specialty-description .specialty-overview-note > :last-child { margin-bottom: 0; }

/* Stable vertical rhythm for old and new page content. */
.cms-content .cms-section + .cms-section,
.cms-content .cms-callout + .cms-section,
.cms-content .cms-legacy-panel + .cms-legacy-panel { margin-top: 22px !important; }
.cms-content p + .cms-legacy-panel,
.cms-content .cms-legacy-panel + p { margin-top: 20px !important; }

@media (max-width: 760px) {
    .cms-content { font-size: .96rem; line-height: 1.65; }
    .cms-content .cms-lead { font-size: 1.02rem; text-align: left; }
    .cms-content .cms-grid,
    .cms-content .cms-grid--3 { grid-template-columns: 1fr; }
    .cms-content .cms-table--definition,
    .cms-content .cms-table--definition tbody,
    .cms-content .cms-table--definition tr,
    .cms-content .cms-table--definition th,
    .cms-content .cms-table--definition td { display: block; width: 100% !important; min-width: 0; }
    .cms-content .cms-table--definition tr { border-bottom: 1px solid var(--cms-line); }
    .cms-content .cms-table--definition tr:last-child { border-bottom: 0; }
    .cms-content .cms-table--definition th {
        padding-bottom: 5px !important;
        border: 0 !important;
        background: var(--cms-soft) !important;
        font-size: .78rem;
    }
    .cms-content .cms-table--definition td {
        padding-top: 7px !important;
        border: 0 !important;
        background: var(--cms-surface) !important;
    }
    .cms-content .cms-file-link { width: 100%; }
    .cms-content .cms-file-group { align-items: stretch !important; }
    .cms-content .svd-cards { grid-template-columns: 1fr; gap: 10px; }
    .cms-content .svd-f { grid-template-columns: minmax(96px, .7fr) minmax(0, 1.3fr); }
    .cms-content .svd-l,
    .cms-content .svd-v { padding: 9px 10px; }
    .sveden-content .sveden-content-header { text-align: left; justify-content: flex-start; }
    .specialty-description .specialty-overview-grid { grid-template-columns: 1fr; }
    .specialty-description .specialty-overview-lead,
    .specialty-description .specialty-overview-section { padding: 15px; }
}

/* TinyMCE preview body */
body.cms-editor-body {
    max-width: 920px;
    margin: 0 auto;
    padding: 24px 28px;
    background: #fff;
}
