/* =====================================================================
   NEXUS DEVELOPER CLOUD – Default theme
   Utseendet från prototypen (Helvetica, #004080-blått, vita kort på ljusgrå
   bakgrund), samlat på ett ställe och byggt på variabler så att andra
   teman bara behöver byta värdena i :root.
   ===================================================================== */

:root {
    --font:            'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-mono:       'Courier New', Courier, monospace;

    --bg:              #f4f7f9;
    --surface:         #ffffff;
    --surface-alt:     #f8f9fa;
    --surface-muted:   #f1f4f8;
    --text:            #333333;
    --text-strong:     #111111;
    --text-muted:      #666666;
    --border:          #dddddd;
    --border-light:    #eeeeee;

    --primary:         #004080;
    --primary-hover:   #0059b3;
    --primary-active:  #003366;
    --primary-deep:    #00264d;   /* hover on module-editor / portal buttons (original shade) */
    --primary-soft:    #e6f0fa;
    --on-primary:      #ffffff;

    --accent:          #f0ad4e;
    --accent-hover:    #ec971f;
    --danger:          #d9534f;
    --danger-hover:    #c9302c;
    --success:         #5cb85c;
    --success-hover:   #4cae4c;

    --success-bg:      #dff0d8; --success-text: #3c763d; --success-border: #c3e6cb;
    --danger-bg:       #f2dede; --danger-text:  #a94442; --danger-border:  #ebccd1;
    --warning-bg:      #fff3cd; --warning-text: #856404; --warning-border: #ffeeba;
    --info-bg:         #d9edf7; --info-text:    #31708f; --info-border:    #bce8f1;

    --input-bg:        #ffffff;
    --input-border:    #cccccc;
    --shadow:          0 4px 12px rgba(0, 0, 0, 0.10);
    --shadow-sm:       0 2px 5px rgba(0, 0, 0, 0.04);
    --radius:          8px;
    --radius-sm:       4px;

    --login-card-bg:   rgba(15, 25, 45, 0.45);
    --login-card-text: #d6e0e9;
}

/* ---------- Bas ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}
a { color: var(--primary); }
a:hover { color: var(--primary-hover); }
code { font-family: var(--font-mono); font-size: 13px; background: var(--surface-muted); padding: 1px 5px; border-radius: 3px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Skal (inloggade sidor) --------------------------------- */
.ndc-body { padding: 40px 20px; }
.ndc-shell {
    max-width: 1240px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
}

.ndc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 15px;
    margin-bottom: 20px;
    gap: 20px;
}
.ndc-header h1 {
    color: var(--primary);
    margin: 0;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.ndc-powered { display: block; color: var(--text-muted); font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; margin-top: 2px; }
.ndc-header-right { display: flex; align-items: center; gap: 16px; }
.ndc-user { text-align: right; line-height: 1.3; }
.ndc-user-name { display: block; font-weight: bold; color: var(--text-strong); }
.ndc-user-role { display: block; font-size: 11px; color: var(--text-muted); letter-spacing: 1px; }
.ndc-logo {
    height: 60px; width: 60px; object-fit: contain;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ---------- Navigering (prototypens .nav-bar) ---------------------- */
.ndc-nav {
    display: flex;
    flex-wrap: wrap;
    background: var(--primary);
    border-radius: var(--radius-sm);
    margin-bottom: 30px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.ndc-nav a {
    color: var(--on-primary);
    text-decoration: none;
    padding: 14px 18px;
    font-size: 14px;
    font-weight: bold;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ndc-nav a:hover { background: var(--primary-hover); color: var(--on-primary); }
.ndc-nav a.active { background: var(--primary-active); box-shadow: inset 0 -3px 0 var(--accent); }
.ndc-nav .admin-link { margin-left: auto; background: var(--danger); }
.ndc-nav .admin-link:hover { background: var(--danger-hover); }
.ndc-nav .ndc-nav-logout { background: rgba(0, 0, 0, 0.15); }
.ndc-mail-icon { font-size: 16px; line-height: 1; }
.ndc-mail-count {
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ---------- Innehållsblock ----------------------------------------- */
.ndc-main { min-height: 200px; }
.section-title {
    font-size: 18px;
    color: var(--primary);
    margin: 0 0 15px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}
.api-status { font-size: 11px; font-family: var(--font-mono); color: var(--text-muted); font-weight: normal; letter-spacing: 0; }

.info-grid { display: flex; gap: 20px; margin-bottom: 30px; flex-wrap: wrap; }
.info-box {
    flex: 1 1 280px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    padding: 20px;
    border-radius: 6px;
    box-shadow: var(--shadow-sm);
}
.info-box h3 {
    margin: 0 0 12px;
    color: var(--primary);
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.info-box p { margin: 8px 0; }
.info-box-danger  { border-left-color: var(--danger); }
.info-box-warning { border-left-color: var(--accent); }
.info-row { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-size: 14px; }
.info-row span:first-child { color: var(--text-muted); font-weight: 600; }
.info-row span:last-child { font-weight: bold; color: var(--text-strong); text-align: right; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---------- Banderoller (pilot, fx, tep) --------------------------- */
.banner {
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 20px;
    border: 1px solid transparent;
}
.banner-success { background: var(--success-bg); color: var(--success-text); border-color: var(--success-border); }
.banner-warning { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning-border); }
.banner-danger  { background: var(--danger-bg);  color: var(--danger-text);  border-color: var(--danger-border); }
.banner-info    { background: var(--info-bg);    color: var(--info-text);    border-color: var(--info-border); }
.banner-pilot   { background: var(--success-bg); color: var(--success-text); border-color: var(--success-border); text-align: center; padding: 15px; }
.banner-pilot strong { font-size: 16px; letter-spacing: 0.5px; text-transform: uppercase; display: block; margin-bottom: 4px; }

/* ---------- Tabeller (prototypens .metric-table) -------------------- */
.metric-table, .ndc-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    margin-bottom: 30px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.metric-table th, .ndc-table th {
    background: var(--primary);
    color: var(--on-primary);
    padding: 13px 15px;
    font-size: 13px;
    text-transform: uppercase;
    text-align: left;
    font-weight: 900;
    letter-spacing: 0.5px;
}
.metric-table td, .ndc-table td {
    border-bottom: 1px solid var(--border-light);
    padding: 12px 15px;
    font-size: 14px;
    vertical-align: top;
}
.metric-table td:first-child { font-weight: 600; }
.metric-table .num, .ndc-table .num { text-align: right; font-family: var(--font-mono); font-weight: bold; color: var(--text-strong); }
/* Kolumnrubriker med .num ärver tabellhuvudets färg (vit på blått) – inte brödtextens */
.metric-table th.num, .ndc-table th.num, .metric-table thead .num, .ndc-table thead .num { color: var(--on-primary); font-family: var(--font); font-weight: 900; }
.metric-table tr.sub-header-row td { background: var(--surface-muted); font-weight: 900; color: var(--primary); text-transform: uppercase; font-size: 12px; letter-spacing: 1px; }
.metric-table tr.total-row td { background: var(--primary-soft); font-weight: 900; color: var(--primary); font-size: 16px; border-top: 3px solid var(--primary); }

/* ---------- Statusmarkörer ----------------------------------------- */
.status { display: inline-block; padding: 3px 9px; border-radius: 3px; font-size: 11px; font-weight: bold; letter-spacing: 0.5px; text-transform: uppercase; }
.status-ok   { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--success-border); }
.status-warn { background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning-border); }
.status-bad  { background: var(--danger-bg);  color: var(--danger-text);  border: 1px solid var(--danger-border); }
.live-badge  { background: var(--success-bg); color: var(--success-text); font-size: 10px; padding: 3px 6px; border-radius: 3px; font-weight: bold; letter-spacing: 0.5px; border: 1px solid var(--success-border); animation: ndc-pulse 2s infinite; }
@keyframes ndc-pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
.pulse-btn { animation: ndc-pulse 1.6s infinite; }

/* ---------- Formulär ---------------------------------------------- */
label { display: block; margin-bottom: 8px; color: var(--text-muted); font-weight: bold; font-size: 13px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="search"], input[type="url"], select, textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    background: var(--input-bg);
    color: var(--text-strong);
    margin-bottom: 18px;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary-hover); outline: none; box-shadow: 0 0 0 3px rgba(0, 89, 179, 0.15); }
.form-group { margin-bottom: 18px; }
.form-row { display: flex; gap: 20px; flex-wrap: wrap; }
.form-row > * { flex: 1 1 220px; }
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { margin-bottom: 0; }
.inline-form select, .inline-form input { margin-bottom: 0; width: auto; min-width: 160px; }
.checkbox-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; }
.checkbox-row input { width: auto; margin: 3px 0 0; }
.checkbox-row label { margin: 0; font-weight: normal; color: var(--text); }

/* ---------- Knappar ------------------------------------------------ */
.btn, button.btn {
    display: inline-block;
    padding: 11px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: bold;
    font-family: var(--font);
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s;
    line-height: 1.2;
}
.btn-primary   { background: var(--primary); color: var(--on-primary); box-shadow: 0 2px 6px rgba(0,0,0,0.2); }
.btn-primary:hover { background: var(--primary-hover); color: var(--on-primary); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); color: #fff; }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-hover); color: #fff; }
.btn-secondary { background: var(--surface-muted); color: var(--text-strong); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border-light); }
.btn-sm        { padding: 6px 12px; font-size: 13px; }
.btn-block     { display: block; width: 100%; }
.btn:disabled  { opacity: 0.5; cursor: not-allowed; }

/* ---------- Flash-meddelanden -------------------------------------- */
.ndc-flashes { margin-bottom: 20px; }
.ndc-flash { padding: 12px 15px; border-radius: var(--radius-sm); margin-bottom: 10px; font-size: 13px; text-align: center; border: 1px solid transparent; }
.ndc-flash-success { background: var(--success-bg); color: var(--success-text); border-color: var(--success-border); }
.ndc-flash-error   { background: var(--danger-bg);  color: var(--danger-text);  border-color: var(--danger-border); }
.ndc-flash-warning { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning-border); }
.ndc-flash-info    { background: var(--info-bg);    color: var(--info-text);    border-color: var(--info-border); }
.ndc-minimal .ndc-flashes { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); width: min(560px, 92vw); z-index: 10; }

/* ---------- Portalkort (home.php) ---------------------------------- */
.portal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-bottom: 30px; }
.portal-card {
    display: block;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 6px;
    padding: 22px;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s, box-shadow 0.15s;
}
.portal-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); color: var(--text); }
.portal-card h3 { margin: 0 0 8px; color: var(--primary); font-size: 16px; text-transform: uppercase; letter-spacing: 0.5px; }
.portal-card p  { margin: 0; color: var(--text-muted); font-size: 13px; }
.portal-card.is-admin { border-top-color: var(--danger); }

/* ---------- Paginering --------------------------------------------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin: 20px 0; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); text-decoration: none; font-size: 13px; }
.pagination span.current { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }

/* ---------- Minimal layout (start, inloggning) --------------------- */
.ndc-minimal {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: var(--bg);
}
.ndc-minimal.has-video { background: #0a1220; }
.ndc-video-bg {
    position: fixed; top: 0; left: 0;
    width: 100vw; height: 100vh;
    object-fit: cover;
    z-index: 0;
    pointer-events: none;
}
.login-card {
    position: relative;
    z-index: 1;
    background: var(--surface);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
}
.has-video .login-card {
    background: var(--login-card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--login-card-text);
}
.login-card h2 { color: var(--primary); margin: 0 0 5px; text-align: center; font-size: 22px; }
.has-video .login-card h2 { color: #fff; text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8); }
.powered-by { text-align: center; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 25px; }
.has-video .powered-by { color: var(--login-card-text); text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); }
.login-intro { font-size: 13px; text-align: center; margin: 0 0 24px; color: var(--text-muted); }
.has-video .login-intro { color: var(--login-card-text); }
.has-video .login-card label { color: var(--login-card-text); text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); }
.has-video .login-card input { background: rgba(255, 255, 255, 0.85); border-color: rgba(255, 255, 255, 0.3); color: #000; }
.login-links { display: flex; justify-content: space-between; margin-top: 20px; font-size: 12px; }
.login-links a { text-decoration: none; }
.login-links a:hover { text-decoration: underline; }
.has-video .login-links a { color: var(--login-card-text); text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); }
.has-video .login-links a:hover { color: #fff; }

/* ---------- Sidfot ------------------------------------------------- */
.ndc-footer {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* ---------- Responsivt ---------------------------------------------- */
@media (max-width: 720px) {
    .ndc-body { padding: 12px; }
    .ndc-shell { padding: 18px; }
    .ndc-header { flex-direction: column; align-items: flex-start; }
    .ndc-header h1 { font-size: 22px; }
    .ndc-nav a { padding: 12px 14px; font-size: 13px; }
    .ndc-nav .admin-link { margin-left: 0; }
    .metric-table th, .metric-table td { padding: 10px; font-size: 13px; }
}

/* ---------- Utskrift (fakturor, avtal, meddelanden) ---------------- */
@media print {
    body { background: #fff; padding: 0; }
    .ndc-shell { box-shadow: none; max-width: none; padding: 0; }
    .ndc-nav, .ndc-footer, .ndc-flashes, .no-print { display: none !important; }
}

/* ===================================================================
   Steg 2 – registrering, konto, admin
   =================================================================== */
.login-card.wide { max-width: 760px; }
.honeypot { position: absolute; left: -9999px; top: -9999px; height: 0; overflow: hidden; }
.field-error { color: var(--danger-text); background: var(--danger-bg); border: 1px solid var(--danger-border); border-radius: var(--radius-sm); padding: 6px 10px; font-size: 12px; margin: -12px 0 14px; }
.has-video .field-error { background: rgba(217, 83, 79, 0.35); color: #ffd6d4; border-color: rgba(217, 83, 79, 0.6); }
.form-section { font-size: 13px; color: var(--primary); text-transform: uppercase; letter-spacing: 1px; font-weight: 900; border-bottom: 1px solid var(--border-light); padding-bottom: 6px; margin: 26px 0 16px; }
.has-video .form-section { color: #fff; border-color: rgba(255, 255, 255, 0.2); }

.tier-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 8px; }
.tier-option { display: block; border: 2px solid var(--border); border-radius: 6px; padding: 14px; cursor: pointer; background: var(--surface-alt); color: var(--text); font-weight: normal; margin: 0; }
.tier-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.tier-option input { width: auto; margin: 0 8px 0 0; vertical-align: middle; }
.tier-option .tier-name { font-weight: 900; color: var(--primary); text-transform: uppercase; letter-spacing: 0.5px; }
.tier-option .tier-fee { display: block; font-family: var(--font-mono); font-weight: bold; margin: 6px 0 4px; color: var(--text-strong); }
.tier-option .tier-desc { display: block; font-size: 12px; color: var(--text-muted); }
.has-video .tier-option { background: rgba(255, 255, 255, 0.85); color: #222; }
.has-video .tier-option .tier-desc { color: #555; }

details.terms { margin: 12px 0 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-alt); }
details.terms summary { cursor: pointer; padding: 10px 14px; font-weight: bold; color: var(--primary); list-style: none; }
details.terms summary::before { content: "\25B8"; display: inline-block; margin-right: 8px; transition: transform 0.15s; }
details.terms[open] summary::before { transform: rotate(90deg); }
.terms-box { max-height: 220px; overflow-y: auto; padding: 0 14px 14px; font-size: 13px; line-height: 1.55; color: var(--text); white-space: normal; }
.has-video details.terms { background: rgba(255, 255, 255, 0.88); }
.has-video .terms-box { color: #222; }
.has-video .checkbox-row label { color: var(--login-card-text); text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); }

.sub-nav { display: flex; gap: 4px; flex-wrap: wrap; margin: -10px 0 24px; border-bottom: 1px solid var(--border-light); }
.sub-nav a { padding: 10px 14px; text-decoration: none; font-weight: bold; font-size: 13px; color: var(--text-muted); border-bottom: 3px solid transparent; }
.sub-nav a:hover { color: var(--primary); }
.sub-nav a.active { color: var(--primary); border-bottom-color: var(--accent); }

.filter-form { margin-bottom: 20px; }
.filter-form label { margin-bottom: 4px; }
.table-scroll { overflow-x: auto; }
.ndc-table .compact, .settings-table .compact { margin-bottom: 0; padding: 7px 9px; font-size: 13px; }
.settings-table td:nth-child(2) { min-width: 200px; }
.details-cell { font-family: var(--font-mono); font-size: 12px; word-break: break-all; max-width: 380px; color: var(--text-muted); }
.table-actions { white-space: nowrap; }
.table-actions form { display: inline-block; margin: 0 4px 4px 0; }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.form-actions input { margin-bottom: 0; width: auto; flex: 1 1 140px; }
.portal-card.is-soon { opacity: 0.6; cursor: default; }
.portal-card.is-soon:hover { transform: none; box-shadow: var(--shadow-sm); }
.info-box h3 .status { margin-left: auto; }
input[type="file"] { width: 100%; margin-bottom: 18px; font-size: 13px; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--primary); }

/* ===================================================================
   Steg 3 – gemensamt
   =================================================================== */
.has-video .hint { color: #d6e0e9; text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); }
.has-video .login-intro { color: #e4ebf2; }

/* ===================================================================
   MSA Modules Editor – struktur och värden från prototypens msa_modules.php
   =================================================================== */
:root {
    --metal-gradient:      linear-gradient(135deg, #74828f 0%, #b0bcc6 30%, #b0bcc6 70%, #5b656e 100%);
    --metal-border-light:  #ffffff;
    --metal-border-dark:   #111111;
    --metal-divider:       #a3b1bc;
    --module-title-color:  #ffffff;
    --module-title-shadow: 1px 1px 2px #000000, -1px -1px 1px rgba(255, 255, 255, 0.3);
    --module-chip-bg:      rgba(0, 0, 0, 0.25);
    --module-body-bg:      #eef2f7;
    --category-bg:         #ffffff;
    --category-border:     #dbe2ea;
    --asset-bg:            #ffffff;
    --asset-border:        #dddddd;
    --asset-add-bg:        #f0f4f8;
    --asset-add-hover:     #e2ebf3;
    --uploaded-bg:         #5bc0de;
    --uploaded-border:     #46b8da;
    --toolbar-bg:          #fdfbf7;
    --editor-input-bg:     #ffffff;
    --editor-readonly-bg:  #f4f7f9;
}

.editor-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; background: var(--toolbar-bg); padding: 12px 15px; border-radius: 6px; border: 1px solid var(--border-light); }
.editor-toolbar h2 { margin: 0; font-size: 20px; color: var(--primary); text-transform: uppercase; letter-spacing: 1px; font-weight: 900; }
.editor-toolbar-right { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.editor-toolbar form { margin: 0; }
.view-size { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: bold; color: var(--text-muted); }
.view-size-btn { padding: 5px 10px; font-size: 11px; font-weight: bold; border: none; border-radius: var(--radius-sm); cursor: pointer; background: #e0e6ed; color: #333; font-family: var(--font); }
.view-size-btn.active { background: var(--primary); color: #fff; }
.modules-empty { text-align: center; padding: 50px; background: var(--surface); border-radius: 6px; color: var(--text-muted); border: 1px dashed var(--border); }
.inline { display: inline; margin: 0; }

.btn-action { border: none; border-radius: 4px; font-weight: bold; cursor: pointer; display: inline-block; box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5); transition: all 0.3s; padding: 10px 20px; font-size: 16px; font-family: var(--font); text-decoration: none; line-height: 1.2; background: var(--primary); color: #fff; }
.btn-action:hover { background: var(--primary-deep); color: #fff; }
.btn-edit    { background: var(--primary); color: #fff; }
.btn-edit:hover { background: var(--primary-deep); color: #fff; }
.btn-del     { background: var(--primary); color: #fff; }
.btn-del:hover { background: var(--primary-deep); }
.btn-init    { background: var(--success); color: #fff; font-size: 15px; padding: 8px 15px; }
.btn-init:hover { background: var(--success-hover); }
.btn-publish { background: var(--success); color: #fff; padding: 10px 18px; }
.btn-publish:hover { background: var(--success-hover); }
.btn-warn    { background: var(--accent); color: #fff; padding: 10px 18px; }
.btn-warn:hover { background: var(--accent-hover); }

.module-container { background: var(--metal-gradient); border-top: 2px solid var(--metal-border-light); border-left: 2px solid var(--metal-border-light); border-bottom: 2px solid var(--metal-border-dark); border-right: 2px solid var(--metal-border-dark); border-radius: 4px; box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4); margin-bottom: 25px; overflow: hidden; }
.module-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 15px 20px; background: transparent; border-bottom: 1px solid #333; box-shadow: 0 1px 0 var(--metal-divider); }
.module-info { display: flex; align-items: center; gap: 20px; min-width: 0; }
.module-title { font-weight: bold; color: var(--module-title-color); text-shadow: var(--module-title-shadow); margin: 0 0 5px; letter-spacing: 0.5px; transition: all 0.3s; }
.module-id { font-family: monospace; background: var(--module-chip-bg); color: var(--module-title-color); padding: 3px 7px; border-radius: 3px; border: 1px solid #333; box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.8), 1px 1px 0 rgba(255, 255, 255, 0.3); text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8); transition: all 0.3s; display: inline-block; }
.module-owner { color: var(--module-title-color); text-shadow: var(--module-title-shadow); margin-left: 10px; font-weight: bold; font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; }
.module-total-files { color: var(--module-title-color); text-shadow: var(--module-title-shadow); margin-left: 10px; transition: all 0.3s; }
.module-icon { background: rgba(0, 0, 0, 0.15); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-weight: bold; color: #fff; font-size: 10px; text-align: center; border: 1px solid #444; box-shadow: inset 2px 2px 6px rgba(0, 0, 0, 0.6), 1px 1px 0 rgba(255, 255, 255, 0.3); overflow: hidden; cursor: pointer; position: relative; flex-shrink: 0; transition: all 0.3s; }
.module-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.module-body { padding: 20px; background: var(--module-body-bg); box-shadow: inset 0 5px 10px rgba(0, 0, 0, 0.2); display: none; }
.module-body.open { display: block; animation: slideDown 0.3s ease-out; }
.module-body .banner { margin-bottom: 15px; }

.status-badge { font-weight: bold; border-radius: 4px; text-transform: uppercase; margin-left: 10px; display: inline-block; box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3); text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.6); transition: all 0.3s; color: #fff; }
.status-draft    { background: var(--danger); border: 1px solid #a03532; }
.status-pub      { background: var(--success); border: 1px solid #428e42; }
.status-review   { background: var(--accent); border: 1px solid #b27a2b; }
.status-archived { background: #6c757d; border: 1px solid #454b50; }
.action-btns { display: flex; gap: 10px; flex-shrink: 0; }

.editor-form { display: flex; flex-direction: column; gap: 15px; margin-bottom: 25px; padding-bottom: 20px; border-bottom: 2px dashed var(--category-border); }
.editor-row { display: flex; gap: 10px; flex-wrap: wrap; }
.editor-form .flex-1 { flex: 1 1 140px; }
.editor-form .flex-2 { flex: 2 1 220px; }
.editor-form .flex-3 { flex: 3 1 260px; }
.editor-form .bold { font-weight: bold; }
.editor-form input[type="text"], .editor-form select { width: auto; margin: 0; padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; background: var(--editor-input-bg); color: var(--text-strong); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05); }
.editor-form textarea { width: 100%; margin: 0; padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; font-family: monospace; min-height: 120px; resize: vertical; background: var(--editor-input-bg); color: var(--text-strong); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05); }
.editor-form input[readonly], .editor-form textarea[readonly], .editor-form select[disabled] { background: var(--editor-readonly-bg); color: #666; cursor: not-allowed; }
.editor-actions-wrapper { background: var(--metal-gradient); padding: 15px 20px; border-radius: 4px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; box-shadow: inset 1px 1px 4px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1); border: 1px solid #333; }
.editor-actions-group { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.locked-label { color: #fff; font-size: 13px; font-weight: bold; background: rgba(0, 0, 0, 0.2); padding: 6px 12px; border-radius: 4px; text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.6); }
.editor-form .note-input { padding: 8px 10px; font-size: 13px; min-width: 200px; }
.upload-form { display: none; }

.category-section { margin-bottom: 20px; border: 1px solid var(--category-border); border-radius: 6px; padding: 15px; background: var(--category-bg); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); }
.category-title { font-size: 14px; font-weight: bold; color: var(--primary); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.category-count { font-size: 11px; color: var(--text-muted); font-weight: normal; }
.asset-gallery { display: flex; overflow-x: auto; gap: 12px; padding-bottom: 5px; }
.asset-gallery::-webkit-scrollbar { height: 6px; }
.asset-gallery::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.asset-card { flex-shrink: 0; background: var(--asset-bg); border: 1px solid var(--asset-border); border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; transition: all 0.2s; overflow: hidden; padding-bottom: 2px; }
.asset-card:hover { border-color: var(--primary); box-shadow: 0 4px 8px rgba(0, 64, 128, 0.1); }
.asset-card.add-new { border: 2px dashed var(--primary); background: var(--asset-add-bg); cursor: pointer; }
.asset-card.add-new:hover { background: var(--asset-add-hover); }
.asset-card.add-new .add-plus { font-size: 24px; color: var(--primary); font-weight: bold; line-height: 1; }
.asset-name { font-family: monospace; color: #555; text-align: center; word-break: break-all; padding: 0 4px; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-name.bold { font-weight: bold; margin-top: 3px; }
.asset-thumb { width: 100%; height: 60%; display: flex; align-items: center; justify-content: center; margin-bottom: 2px; cursor: pointer; text-decoration: none; }
.asset-thumb img { max-width: 90%; max-height: 90%; object-fit: contain; }
.asset-card.asset-card-uploaded { background: var(--uploaded-bg); border: 2px solid var(--uploaded-border); }
.asset-card.asset-card-uploaded .asset-name { color: #fff; text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4); }
.asset-card.asset-card-uploaded .file-icon-placeholder { color: #fff; text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2); }
.file-icon-placeholder { font-size: 32px; font-weight: bold; margin-bottom: 5px; }
.asset-form { margin: 0; width: 100%; display: flex; justify-content: center; }

.btn-remove-asset { position: absolute; top: 2px; right: 2px; background: var(--danger); color: #fff; border: none; border-radius: 50%; width: 18px; height: 18px; font-size: 10px; font-weight: bold; cursor: pointer; display: none; align-items: center; justify-content: center; z-index: 10; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); padding: 0; line-height: 1; }
.asset-card:hover .btn-remove-asset { display: flex; }
.btn-set-default { background: #f0f4f8; color: var(--primary); border: 1px solid var(--primary); border-radius: 3px; cursor: pointer; margin-top: 2px; width: 90%; text-align: center; font-weight: bold; font-family: var(--font); }
.btn-set-default:hover { background: var(--primary); color: #fff; }
.default-badge { background: var(--success); color: #fff; border-radius: 3px; margin-top: 2px; width: 90%; text-align: center; font-weight: bold; }
.btn-teaser { background: rgba(255, 255, 255, 0.25); color: #fff; border: 1px solid rgba(255, 255, 255, 0.6); border-radius: 3px; cursor: pointer; margin-top: 2px; width: 90%; text-align: center; font-weight: bold; font-family: var(--font); }
.btn-teaser.on { background: var(--accent); border-color: #c98b2d; }

/* Standardstorlek innan skriptet kört (= small), så att inget blinkar i full storlek */
.module-icon { width: 50px; height: 50px; }
.asset-card { width: 110px; height: 110px; }
.asset-card.add-new { width: 100px; height: 100px; }
.asset-card img { max-height: 60px; }

/* Vystorlekar – exakt som prototypen */
body.view-small .module-header { padding: 10px 15px; }
body.view-small .module-icon { width: 50px; height: 50px; }
body.view-small .module-title { font-size: 16px; margin-bottom: 2px; }
body.view-small .module-id { font-size: 11px; padding: 2px 5px; }
body.view-small .module-total-files, body.view-small .module-owner { font-size: 10px; }
body.view-small .status-badge { font-size: 9px; padding: 2px 6px; }
body.view-small .btn-action { padding: 6px 10px; font-size: 11px; }
body.view-small .asset-card { width: 110px; height: 110px; }
body.view-small .asset-card.add-new { width: 100px; height: 100px; }
body.view-small .asset-card img { max-height: 60px !important; }
body.view-small .asset-name { font-size: 8px; }
body.view-small .btn-set-default, body.view-small .default-badge, body.view-small .btn-teaser { font-size: 8px; padding: 2px 4px; }
body.view-small .file-icon-placeholder { font-size: 22px; }

body.view-medium .module-header { padding: 15px 20px; }
body.view-medium .module-icon { width: 75px; height: 75px; }
body.view-medium .module-title { font-size: 20px; margin-bottom: 5px; }
body.view-medium .module-id { font-size: 13px; padding: 3px 7px; }
body.view-medium .module-total-files, body.view-medium .module-owner { font-size: 12px; }
body.view-medium .status-badge { font-size: 11px; padding: 3px 8px; }
body.view-medium .btn-action { padding: 8px 15px; font-size: 13px; }
body.view-medium .asset-card { width: 150px; height: 150px; }
body.view-medium .asset-card.add-new { width: 140px; height: 140px; }
body.view-medium .asset-card.add-new .add-plus { font-size: 36px; }
body.view-medium .asset-card img { max-height: 90px !important; }
body.view-medium .asset-name { font-size: 10px; }
body.view-medium .btn-set-default, body.view-medium .default-badge, body.view-medium .btn-teaser { font-size: 10px; padding: 4px 6px; }

body.view-large .module-header { padding: 25px 30px; }
body.view-large .module-icon { width: 120px; height: 120px; }
body.view-large .module-title { font-size: 28px; margin-bottom: 8px; }
body.view-large .module-id { font-size: 16px; padding: 4px 10px; }
body.view-large .module-total-files, body.view-large .module-owner { font-size: 15px; }
body.view-large .status-badge { font-size: 14px; padding: 4px 10px; margin-left: 15px; }
body.view-large .btn-action { padding: 12px 20px; font-size: 16px; }
body.view-large .asset-card { width: 300px; height: 300px; }
body.view-large .asset-card.add-new { width: 280px; height: 280px; }
body.view-large .asset-card.add-new .add-plus { font-size: 64px; }
body.view-large .asset-card img { max-height: 220px !important; }
body.view-large .asset-name { font-size: 14px; }
body.view-large .btn-set-default, body.view-large .default-badge, body.view-large .btn-teaser { font-size: 14px; padding: 8px 12px; }
body.view-large .btn-remove-asset { width: 24px; height: 24px; font-size: 14px; top: 5px; right: 5px; }

/* Dialoger, laddningsöverlägg och lightbox */
.custom-modal-overlay { display: none; position: fixed; z-index: 10005; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); justify-content: center; align-items: center; }
.confirm-box { background: var(--surface); width: 480px; max-width: 94vw; border-radius: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); overflow: hidden; animation: slideDown 0.3s ease-out; border: 1px solid var(--category-border); }
.confirm-header { background: var(--primary); color: #fff; padding: 15px 20px; font-weight: bold; font-size: 16px; text-transform: uppercase; letter-spacing: 1px; display: flex; align-items: center; justify-content: space-between; }
.confirm-body { padding: 30px 25px; text-align: center; color: var(--text); font-size: 14px; }
.confirm-module-title { font-weight: 900; color: var(--primary); font-size: 22px; margin-bottom: 4px; text-transform: uppercase; }
.confirm-module-id { font-family: monospace; font-weight: bold; color: var(--text-muted); font-size: 13px; margin-bottom: 20px; border-bottom: 1px solid var(--border-light); padding-bottom: 15px; }
.confirm-question { font-weight: 600; color: var(--text); line-height: 1.5; }
.confirm-actions { background: var(--surface-alt); padding: 15px 25px; display: flex; justify-content: flex-end; gap: 12px; border-top: 1px solid var(--border-light); }
.confirm-actions-center { justify-content: center; }
.btn-yes { background: var(--danger); color: #fff; border: none; padding: 10px 20px; font-weight: bold; border-radius: 4px; cursor: pointer; transition: 0.2s; font-size: 14px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); text-transform: uppercase; letter-spacing: 0.5px; font-family: var(--font); }
.btn-yes:hover { background: var(--danger-hover); }
.btn-no { background: var(--primary); color: #fff; border: 1px solid var(--primary-deep); padding: 10px 20px; font-weight: bold; border-radius: 4px; cursor: pointer; transition: 0.2s; font-size: 14px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05); text-transform: uppercase; letter-spacing: 0.5px; font-family: var(--font); }
.btn-no:hover { background: var(--primary-deep); }
.btn-wide { width: 140px; }

#image-modal { display: none; position: fixed; z-index: 10000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.85); justify-content: center; align-items: center; cursor: pointer; }
#image-modal img { max-width: 90%; max-height: 90%; border-radius: 6px; box-shadow: 0 5px 30px rgba(0, 0, 0, 0.5); cursor: pointer; }
.modal-close { position: absolute; top: 20px; right: 30px; color: #fff; font-size: 40px; font-weight: bold; cursor: pointer; }

#loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); display: none; justify-content: center; align-items: center; z-index: 9999; flex-direction: column; }
.loading-box { background: #fff; padding: 25px 35px; border-radius: 8px; text-align: center; color: #333; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); width: 380px; max-width: 92vw; position: relative; }
.loading-text { font-size: 15px; font-weight: bold; color: var(--primary); margin-bottom: 15px; }
.loading-bar-container { width: 100%; height: 8px; background: #e0e6ed; border-radius: 4px; overflow: hidden; margin-bottom: 15px; }
.loading-bar { width: 0%; height: 100%; background: var(--success); border-radius: 4px; transition: width 0.1s; }
.infinite-loader { width: 30% !important; animation: loadingMove 1.2s infinite ease-in-out !important; }
.upload-filename-title { font-size: 13px; font-family: monospace; color: var(--primary); font-weight: bold; margin-bottom: 10px; word-break: break-all; }
.upload-sub { font-size: 12px; font-weight: normal; color: #888; }
.upload-ok { color: var(--success); }
.btn-cancel-upload { background: var(--danger); color: #fff; border: none; padding: 8px 15px; font-weight: bold; border-radius: 4px; cursor: pointer; display: none; width: 100%; font-family: var(--font); }
.btn-cancel-upload:hover { background: var(--danger-hover); }

@keyframes loadingMove { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 720px) {
    .module-header { flex-direction: column; align-items: flex-start; }
    .action-btns { width: 100%; }
    .action-btns .btn-action { flex: 1; }
}

/* ===================================================================
   Search Portal – struktur och värden från prototypens search.php
   =================================================================== */
:root {
    --portal-viewport-bg:   #f4f6f9;
    --portal-panel-bg:      #ffffff;
    --portal-panel-border:  #dbe2ea;
    --portal-input-border:  #e0e6ed;
    --doc-block-bg:         #ffffff;
    --doc-block-text:       #444444;
    --popup-bg:             #ffffff;
    --popup-text:           #333333;
    --popup-hover:          #f0f4f8;
    --pagination-num-bg:    #ffffff;
    --pagination-num-hover: #f0f4f8;
    --scroll-track:         #e2e8f0;
    --scroll-thumb:         #909ea8;
    --scroll-thumb-hover:   #5b656e;
}

.search-panel { background: var(--portal-panel-bg); padding: 15px; border-radius: 6px; border: 1px solid var(--portal-panel-border); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05); margin-bottom: 25px; }
.search-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search-form .search-input { flex: 2 1 260px; padding: 8px 12px; border: 2px solid var(--portal-input-border); border-radius: 4px; font-size: 13px; color: var(--text-strong); background: var(--editor-input-bg); margin: 0; width: auto; transition: border 0.3s; }
.search-form .search-input:focus { border-color: var(--primary); outline: none; box-shadow: none; }
.search-form .search-select { flex: 1 1 150px; padding: 8px 10px; border: 2px solid var(--portal-input-border); border-radius: 4px; font-size: 12px; font-weight: bold; color: var(--primary); cursor: pointer; background: var(--editor-input-bg); margin: 0; width: auto; }
.search-btn { background: var(--success); color: #fff; padding: 8px 18px; font-size: 13px; font-weight: bold; border: none; border-radius: 4px; cursor: pointer; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: background 0.2s; font-family: var(--font); }
.search-btn:hover { background: var(--success-hover); }

.results-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; background: var(--toolbar-bg); padding: 12px 15px; border-radius: 6px; border: 1px solid var(--border-light); }
.results-bar h2 { margin: 0; font-size: 20px; color: var(--primary); text-transform: uppercase; letter-spacing: 1px; font-weight: 900; }
.results-count { font-size: 14px; color: var(--text-muted); text-transform: none; letter-spacing: 0; font-weight: normal; }
.results-bar-right { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }

.favorites-btn { background: var(--toolbar-bg); border: 1px solid #ccd5df; color: var(--primary); padding: 5px 12px; border-radius: 4px; font-weight: bold; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); transition: all 0.2s; text-decoration: none; font-family: var(--font); }
.favorites-btn:hover, .favorites-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
#favorites-view-container { display: none; margin-bottom: 30px; }
.favorites-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; background: var(--portal-panel-bg); padding: 12px 20px; border-radius: 6px; border: 1px solid var(--portal-panel-border); }
.favorites-header h3 { margin: 0; color: var(--primary); font-size: 16px; }
.btn-clear-favs { background: var(--danger); color: #fff; padding: 6px 14px; font-size: 13px; font-weight: bold; border: none; border-radius: 4px; cursor: pointer; font-family: var(--font); }
.btn-clear-favs:hover { background: var(--danger-hover); }
.favorite-item-row { background: var(--portal-panel-bg); border: 1px solid var(--portal-panel-border); border-radius: 6px; padding: 15px 20px; margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; gap: 12px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04); }
.favorite-item-info { display: flex; align-items: center; gap: 15px; }
.favorite-title { font-weight: bold; color: var(--primary); font-size: 16px; }
.favorite-meta { font-family: monospace; font-size: 13px; color: var(--text-muted); }
.btn-delete-fav { background: var(--danger); color: #fff; border: none; border-radius: 50%; width: 24px; height: 24px; font-size: 14px; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.btn-delete-fav:hover { background: var(--danger-hover); }
.btn-view-fav { background: var(--primary); color: #fff; padding: 6px 14px; text-decoration: none; border-radius: 4px; font-size: 13px; font-weight: bold; }
.btn-view-fav:hover { background: var(--primary-deep); color: #fff; }

.modules-scroll-viewport { max-height: 520px; overflow-y: auto; padding: 15px 20px 15px 15px; margin-bottom: 20px; background: var(--portal-viewport-bg); border: 1px solid var(--portal-panel-border); border-radius: 8px; box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.05); user-select: none; }
.modules-scroll-viewport::-webkit-scrollbar { width: 16px; }
.modules-scroll-viewport::-webkit-scrollbar-track { background: var(--scroll-track); border-radius: 8px; }
.modules-scroll-viewport::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; border: 3px solid var(--scroll-track); }
.modules-scroll-viewport::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); }
.modules-scroll-viewport .module-container { margin-bottom: 30px; }
.modules-scroll-viewport .module-container:last-child { margin-bottom: 0; }

.module-top-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: rgba(0, 0, 0, 0.3); border-bottom: 1px solid #222; padding: 6px 15px; }
.module-publisher { font-weight: 800; color: #fff; text-transform: uppercase; letter-spacing: 1px; font-size: 11px; text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); text-align: left; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.publisher-star { color: #5b6875; font-size: 13px; text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8); margin: 0 3px; }
.module-badge-wrap { flex: 1; text-align: center; position: relative; }
.module-id-badge { font-family: monospace; background: rgba(0, 0, 0, 0.4); color: #fff; padding: 3px 8px; border-radius: 4px; border: 1px solid #444; font-size: 12px; cursor: pointer; position: relative; display: inline-block; box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.8); transition: all 0.2s; text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8); user-select: text; }
.module-id-badge:hover { background: var(--primary); border-color: var(--success); }
.id-popup-menu { display: none; position: fixed; background: var(--popup-bg); color: var(--popup-text); border: 1px solid #ccd5df; border-radius: 4px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); z-index: 10001; min-width: 190px; text-align: left; font-size: 12px; font-weight: normal; margin-top: 6px; }
.id-popup-menu div { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; gap: 8px; }
.id-popup-menu div:last-child { border-bottom: none; }
.id-popup-menu div:hover { background: var(--popup-hover); color: var(--primary); }
.telemetry-rating-box { display: flex; align-items: center; justify-content: flex-end; flex: 1; gap: 3px; }
.star-rating { display: inline-flex; align-items: center; }
.star { font-size: 15px; margin-right: 2px; text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.9); display: inline-block; cursor: default; }
.star-gold { color: #ffcc00; text-shadow: 0 0 6px rgba(255, 204, 0, 0.6), 1px 1px 2px #000; }
.star-gray { color: #5b6875; text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8); }

.module-meta-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 0; }
.module-meta-info { color: var(--module-title-color); text-shadow: var(--module-title-shadow); font-size: 13px; margin-left: 10px; font-weight: bold; transition: all 0.3s; }
.status-badge.status-locked { background: #6f42c1; border: 1px solid #4b2a8a; }
.btn-action.disabled { background: #b0bcc6; color: #fff; cursor: not-allowed; opacity: 0.7; box-shadow: none; }
.btn-action.disabled:hover { background: #b0bcc6; }
.module-container.is-locked .module-icon img { filter: saturate(0.5); }

.doc-block { background: var(--doc-block-bg); padding: 15px 20px; border-radius: 4px; border-left: 4px solid var(--primary); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); margin-bottom: 25px; white-space: pre-wrap; font-size: 14px; line-height: 1.5; color: var(--doc-block-text); user-select: text; }
.lock-panel { background: var(--doc-block-bg); border-left: 4px solid #6f42c1; border-radius: 4px; padding: 25px; text-align: center; color: var(--doc-block-text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.lock-panel-title { font-size: 18px; font-weight: 900; color: #6f42c1; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }

.asset-card.portal-card { cursor: pointer; text-decoration: none; }
.asset-card.portal-card .asset-thumb { height: 75%; cursor: inherit; }
.asset-card.portal-card.is-blocked { cursor: not-allowed; opacity: 0.75; }
.open-file-btn, .download-file-btn { font-size: 16px; font-weight: bold; color: #fff; background: var(--primary); text-align: center; padding: 10px 16px; border-radius: 4px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: background 0.2s; display: inline-block; line-height: 1.3; }
.asset-card:hover .open-file-btn, .asset-card:hover .download-file-btn { background: var(--primary-deep); }
.download-file-btn.blocked { background: #6c757d; }
.asset-card:hover .download-file-btn.blocked { background: #6c757d; }
.play-video-btn { font-size: 16px; font-weight: bold; color: #fff; background: var(--danger); text-align: center; padding: 10px 16px; border-radius: 4px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: background 0.2s; display: inline-block; line-height: 1.3; }
.asset-card:hover .play-video-btn { background: var(--danger-hover); }
.btn-sub { font-size: 10px; font-weight: normal; color: #fdfbf7; }

.pagination-container { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 20px 0 40px; flex-wrap: wrap; }
.pagination-btn { background: var(--primary); color: #fff; padding: 10px 16px; text-decoration: none; border-radius: 4px; font-weight: bold; font-size: 14px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); transition: background 0.2s; }
.pagination-btn:hover { background: var(--primary-deep); color: #fff; }
.pagination-btn.disabled { background: #b0bcc6; color: #fff; cursor: not-allowed; pointer-events: none; opacity: 0.6; }
.pagination-number { background: var(--pagination-num-bg); color: var(--primary); border: 1px solid #ccd5df; padding: 10px 14px; text-decoration: none; border-radius: 4px; font-weight: bold; font-size: 14px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); transition: all 0.2s; }
.pagination-number.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination-number:hover:not(.active) { background: var(--pagination-num-hover); }

#media-modal { display: none; position: fixed; z-index: 10000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.85); justify-content: center; align-items: center; cursor: pointer; }
#media-modal #modal-img { max-width: 90%; max-height: 90%; border-radius: 6px; box-shadow: 0 5px 30px rgba(0, 0, 0, 0.5); display: none; }
#media-modal #modal-video { max-width: 90%; max-height: 90%; border-radius: 6px; box-shadow: 0 5px 30px rgba(0, 0, 0, 0.5); display: none; outline: none; cursor: default; background: #000; }

/* Vystorlekar – portalens tillägg */
body.view-small .module-meta-info { font-size: 10px; margin-left: 5px; }
body.view-small .open-file-btn, body.view-small .play-video-btn, body.view-small .download-file-btn { font-size: 10px; padding: 5px 8px; }
body.view-medium .module-meta-info { font-size: 12px; margin-left: 8px; }
body.view-medium .open-file-btn, body.view-medium .play-video-btn, body.view-medium .download-file-btn { font-size: 12px; padding: 6px 10px; }
body.view-large .module-meta-info { font-size: 15px; margin-left: 12px; }
body.view-large .open-file-btn, body.view-large .play-video-btn, body.view-large .download-file-btn { font-size: 16px; padding: 10px 16px; }

@media (max-width: 720px) {
    .module-top-bar { flex-wrap: wrap; }
    .module-publisher, .module-badge-wrap, .telemetry-rating-box { flex: 1 1 100%; text-align: center; justify-content: center; }
}

/* ---------- Portal: licensnivå i toppraden, klickbar MSA-kod under titeln ---------- */
.tier-badge { display: inline-block; padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; color: #fff; border: 1px solid transparent; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6); box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.15); }
.tier-badge.tier-1 { background: #7d8791; border-color: #5f6972; color: #ffffff; }
.tier-badge.tier-2 { background: #0d3b75; border-color: #082a55; }
.tier-badge.tier-3 { background: #6f42c1; border-color: #4b2a8a; }
.section-title .tier-badge { margin-left: 8px; vertical-align: middle; }
.module-badge-inline { position: relative; display: inline-block; }
.module-id.is-clickable { cursor: pointer; transition: all 0.2s; user-select: text; }
.module-id.is-clickable:hover { background: var(--primary); border-color: var(--success); }
body.view-small .tier-badge { font-size: 9px; padding: 3px 7px; }
body.view-large .tier-badge { font-size: 13px; padding: 5px 12px; }

/* Moduleditorn: scrollbart fönster för hundratals containrar */
.editor-viewport { max-height: 72vh; user-select: auto; }
.editor-viewport .module-container { margin-bottom: 25px; }
.editor-viewport .module-container:last-child { margin-bottom: 0; }

/* ---------- Tooltips (hjälptexter) --------------------------------- */
.help-term { position: relative; display: inline-block; border-bottom: 1px dotted var(--text-muted); cursor: help; outline: none; }
.help-icon { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; margin-left: 5px; border-radius: 50%; border: 1px solid var(--text-muted); color: var(--text-muted); font-size: 9px; font-weight: bold; font-family: Georgia, serif; font-style: italic; vertical-align: 1px; line-height: 1; transition: all 0.15s; }
.help-term:hover .help-icon, .help-term.is-open .help-icon { background: var(--primary); border-color: var(--primary); color: #fff; }
.help-term.help-large { border-bottom: none; cursor: help; }
.help-term.help-large .help-icon { width: 20px; height: 20px; font-size: 12px; margin-left: 8px; vertical-align: middle; }
.help-tip { visibility: hidden; opacity: 0; position: fixed; left: 0; top: 0; width: 300px; max-width: 90vw; background: #1f2430; color: #f0f2f5; padding: 10px 12px; border-radius: 6px; font-size: 12px; font-weight: normal; line-height: 1.5; text-transform: none; letter-spacing: 0; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); z-index: 10000; transition: opacity 0.15s ease; white-space: normal; text-align: left; pointer-events: none; --arrow-left: 16px; }
.help-tip::after { content: ""; position: absolute; left: var(--arrow-left); border: 6px solid transparent; }
.help-tip.tip-above::after { top: 100%; border-top-color: #1f2430; }
.help-tip.tip-below::after { bottom: 100%; border-bottom-color: #1f2430; }
.help-term.is-open .help-tip { visibility: visible; opacity: 1; }
.help-tip-large { width: 480px; font-size: 13px; line-height: 1.6; padding: 14px 18px; }
.help-tip .help-heading { display: block; font-weight: 900; letter-spacing: 0.8px; font-size: 12px; color: #9fd0f0; margin-bottom: 4px; }
.help-tip .help-step { color: #ffd60a; font-weight: 900; }
.help-term:focus-visible { outline: none; }
td .help-term, th .help-term { border-bottom-color: currentColor; }
th .help-tip { text-transform: none; font-weight: normal; letter-spacing: 0; color: #f0f2f5; }
.section-title .help-term { vertical-align: middle; margin-left: 4px; }
.info-box h3 .help-term { border-bottom: none; text-transform: none; letter-spacing: 0; }
.h3-right { display: inline-flex; align-items: center; gap: 10px; font-weight: normal; text-transform: none; letter-spacing: 0; }
.btn-copy { background: var(--surface-muted); color: var(--text-strong); border: 1px solid var(--border); border-radius: 4px; padding: 4px 10px; font-size: 12px; font-weight: bold; cursor: pointer; font-family: var(--font); }
.btn-copy:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-copy.is-copied { background: var(--success); color: #fff; border-color: var(--success); }

/* Editorns sökfält */
.editor-search { display: flex; gap: 6px; align-items: center; flex: 1 1 320px; margin: 0; }
.editor-search input[type="search"], .editor-search select { margin: 0; width: auto; padding: 6px 10px; font-size: 13px; }
.editor-search input[type="search"] { flex: 1 1 200px; }
.editor-search .view-size-btn { padding: 7px 12px; text-decoration: none; }
.editor-search .editor-clear { background: var(--danger); color: #fff; }
.editor-count { font-size: 12px; color: var(--text-muted); margin: -10px 0 12px 4px; }

/* ---------- Steg 4: dashboard, API-sida, tabeller ------------------ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 6px 0 14px; }
.kpi { background: var(--surface-alt); border: 1px solid var(--border); border-top: 4px solid var(--primary); border-radius: 6px; padding: 14px 16px; box-shadow: var(--shadow-sm); }
.kpi-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 900; margin-bottom: 8px; }
.kpi-value { font-size: 22px; font-weight: 900; color: var(--text-strong); font-family: var(--font-mono); letter-spacing: -0.5px; }
.kpi-sub, .local-amount { display: block; font-size: 12px; color: var(--text-muted); margin-top: 4px; font-family: var(--font-mono); }
.kpi-primary { border-top-color: var(--success); background: var(--primary-soft); }
.fx-note { margin: -4px 0 18px; }
.row-provisional td { opacity: 0.75; font-style: italic; }
.row-closed td { opacity: 0.55; }
.row-admin td { background: var(--warning-bg); }
.code-block { background: #1f2430; color: #e6edf3; padding: 14px 16px; border-radius: 6px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; overflow-x: auto; white-space: pre; margin: 10px 0 16px; }
.api-key-display { font-size: 14px; padding: 6px 10px; user-select: all; }
.kpi-label .help-term { border-bottom-color: var(--text-muted); }

/* Kodblock med kopieringsikon, scrollbara listor */
.code-wrap { position: relative; }
.btn-copy-icon { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.08); color: #cfd6df; border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 6px; cursor: pointer; padding: 0; transition: all 0.15s; }
.btn-copy-icon:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-copy-icon.is-copied { background: var(--success); color: #fff; border-color: var(--success); }
.code-wrap .code-block { padding-right: 48px; }
.list-scroll { max-height: 320px; overflow-y: auto; margin-bottom: 14px; border-radius: 6px; }

/* ---------- Fakturadokument ------------------------------------------ */
.invoice-doc { background: #fff; color: #111; border: 1px solid var(--border); border-radius: 6px; padding: 32px 36px; font-size: 13px; line-height: 1.5; }
.invoice-head { display: flex; justify-content: space-between; gap: 24px; border-bottom: 2px solid var(--primary); padding-bottom: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.invoice-brand { font-size: 18px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; color: var(--primary); margin-bottom: 8px; }
.invoice-seller { color: #333; }
.invoice-meta { text-align: right; }
.invoice-title { font-size: 26px; font-weight: 900; letter-spacing: 2px; color: var(--primary); margin-bottom: 8px; }
.invoice-meta-table { border-collapse: collapse; }
.invoice-meta-table td { padding: 2px 8px; color: #333; }
.invoice-meta-table td:first-child { color: #666; }
.invoice-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: #666; font-weight: 900; margin-bottom: 4px; }
.invoice-buyer { margin-bottom: 18px; color: #111; }
.invoice-notes { background: #f4f7f9; border-left: 4px solid var(--accent); padding: 10px 12px; margin: 12px 0; color: #333; }
.invoice-lines { width: 100%; border-collapse: collapse; margin: 12px 0; color: #111; }
.invoice-lines th { background: var(--primary); color: #fff; text-align: left; padding: 8px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.invoice-lines td { padding: 8px 10px; border-bottom: 1px solid #e3e8ee; vertical-align: top; }
.invoice-lines .num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.invoice-line-detail { font-size: 11px; color: #555; margin-top: 3px; font-family: var(--font-mono); }
.invoice-lines tfoot td { border-bottom: none; padding: 5px 10px; }
.invoice-lines tfoot .invoice-total td { font-weight: 900; font-size: 15px; border-top: 2px solid var(--primary); color: var(--primary); }
.invoice-vat-note { font-size: 12px; color: #444; margin: 6px 0 12px; }
.invoice-display { font-size: 12px; color: #666; margin-bottom: 14px; }
.invoice-payment { border-top: 1px solid #e3e8ee; padding-top: 14px; margin-top: 8px; }
.invoice-terms { font-size: 11px; color: #555; margin-top: 10px; line-height: 1.5; }
.invoice-payments { margin-top: 14px; }
.invoice-foot { margin-top: 24px; font-size: 10px; color: #777; border-top: 1px solid #e3e8ee; padding-top: 8px; }
.kpi-danger { border-top-color: var(--danger); }
@media print { .ndc-shell .section-title, .ndc-shell .info-grid, .ndc-shell .ndc-nav { display: none; } }

/* Avstämning */
.stack-form { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.stack-form select.compact, .stack-form input.compact { margin: 0; width: auto; min-width: 120px; max-width: 240px; }

/* Avstämning: beslut på egen rad, ingen sidledsscroll */
.decision-row td.decision-cell { padding: 8px 12px 12px; border-bottom: 2px solid var(--border); }
.decision-cell { display: table-cell; }
.decision-cell .stack-form { display: inline-flex; margin: 4px 14px 4px 0; vertical-align: middle; }
.decision-label { display: inline-block; font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); font-weight: 900; margin-right: 12px; vertical-align: middle; }
.ndc-table td.details-cell { max-width: 320px; word-break: break-word; }
.settings-group { margin-top: 26px; }
.settings-table td:first-child .help-term { font-family: var(--font-mono); font-size: 12.5px; }
.switch-label { display: inline-flex; align-items: center; gap: 6px; }

.invoice-basis { margin: 4px 0 12px; padding: 8px 10px; background: #f4f7f9; border-left: 4px solid var(--primary); font-size: 12px; }
.invoice-basis .invoice-meta-table td { padding: 2px 8px 2px 0; }
.period-form input[type="date"].compact { width: auto; }
.tier-name .help-term { vertical-align: middle; }

/* ---------- Steg 6c: hash, fingerprint, dokumentpanel ------------------ */
.module-fingerprint { display: inline-block; margin-left: 10px; padding: 2px 8px; border-radius: 3px; background: rgba(0, 0, 0, 0.35); color: #e5e5ea; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.5px; cursor: pointer; border: 1px solid rgba(0, 0, 0, 0.5); text-shadow: 0 1px 1px rgba(0, 0, 0, 0.8); }
.module-fingerprint:hover { background: var(--primary); border-color: #8ccaff; }
.module-fingerprint.is-copied { background: var(--success); }
.asset-hash { font-family: var(--font-mono); font-size: 9px; color: var(--text-muted); cursor: pointer; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-hash:hover { color: var(--primary); }
.asset-hash.is-copied { color: var(--success); }
.master-badge { position: absolute; top: 6px; left: 6px; background: #b8860b; color: #fff; font-size: 8px; font-weight: 900; letter-spacing: 1px; padding: 2px 6px; border-radius: 3px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); z-index: 2; }
.asset-card { position: relative; }
.btn-asset-edit { position: absolute; bottom: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 11px; cursor: pointer; padding: 0; line-height: 1; z-index: 2; }
.btn-asset-edit:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.asset-desc { font-size: 9px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-meta-form { display: none; width: 100%; margin: 8px 0 4px; padding: 10px 14px; background: var(--surface-alt); border: 1px solid var(--border); border-left: 4px solid #b8860b; border-radius: 4px; }
.asset-meta-form.is-open { display: block; }
.asset-meta-head { margin-bottom: 8px; font-size: 12px; word-break: break-all; }
.asset-meta-form .form-row { gap: 10px; }
.asset-meta-form input[type="text"] { margin-bottom: 6px; }

.bank-redirect { max-width: 520px; margin: 60px auto; text-align: center; }
.log-block { max-height: 70vh; overflow: auto; font-size: 11.5px; white-space: pre-wrap; word-break: break-all; }

/* Bankkopplingar: verktygsfält överst, flikar, scrollfönster */
.conn-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin: 4px 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border-light); }
.conn-tabs { display: inline-flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.conn-tab { padding: 5px 12px; font-size: 12px; font-weight: bold; color: var(--text-muted); text-decoration: none; border-right: 1px solid var(--border); background: var(--surface); }
.conn-tab:last-child { border-right: none; }
.conn-tab span { font-weight: normal; opacity: 0.8; margin-left: 4px; }
.conn-tab:hover { color: var(--text-strong); text-decoration: none; }
.conn-tab.active { background: var(--primary); color: #fff; }
.conn-list { max-height: 360px; }

/* Banklogg: block per anrop */
.log-entries { display: flex; flex-direction: column; gap: 8px; max-height: 75vh; overflow-y: auto; padding-right: 4px; }
.log-entry { border: 1px solid var(--border); border-left: 4px solid var(--success); border-radius: 4px; background: var(--surface); padding: 8px 12px; }
.log-entry.log-warn { border-left-color: var(--accent); }
.log-entry.log-bad { border-left-color: var(--danger); }
.log-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.log-date { font-family: var(--font-mono); color: var(--text-muted); font-size: 12px; }
.log-time { font-family: var(--font-mono); font-weight: bold; font-size: 13px; }
.log-msg { font-weight: bold; }
.log-detail { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border-light); font-size: 12px; }
.log-kv { display: flex; gap: 10px; padding: 2px 0; }
.log-k { color: var(--text-muted); min-width: 80px; flex-shrink: 0; font-family: var(--font-mono); }
.log-v { font-family: var(--font-mono); white-space: pre-wrap; word-break: break-all; }

/* ---------- Steg 6d – Nexus Mail ---------- */
.mail-toolbar { align-items: flex-start; }
.mail-search { gap: 8px; }
.mail-search input[type="search"] { min-width: 220px; }
.mail-list { border: 1px solid var(--border); border-radius: 6px; overflow-y: auto; max-height: 62vh; min-height: 120px; background: var(--surface); margin-bottom: 10px; }
.mail-row { display: grid; grid-template-columns: 14px 200px 1fr 120px; gap: 12px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--border-light); color: var(--text); text-decoration: none; }
.mail-row:last-child { border-bottom: none; }
.mail-row:hover { background: var(--surface-alt); text-decoration: none; }
.mail-dot { width: 9px; height: 9px; border-radius: 50%; background: transparent; border: 1px solid var(--border); display: inline-block; }
.mail-unread .mail-dot { background: var(--primary); border-color: var(--primary); }
.mail-unread .mail-from, .mail-unread .mail-subject { font-weight: bold; color: var(--text-strong); }
.mail-from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-from small, .mail-count { display: block; font-weight: normal; color: var(--text-muted); font-size: 11px; }
.mail-count { display: inline; margin-left: 4px; }
.mail-subject { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mail-type { margin-right: 6px; font-size: 10px; vertical-align: middle; }
.mail-clip { margin-left: 4px; font-size: 12px; }
.mail-preview { color: var(--text-muted); font-weight: normal; margin-left: 8px; font-size: 13px; }
.mail-date { text-align: right; color: var(--text-muted); font-size: 12px; font-family: var(--font-mono); white-space: nowrap; }
@media (max-width: 760px) {
    .mail-row { grid-template-columns: 12px 1fr 90px; }
    .mail-row .mail-from { display: none; }
}
.mail-thread-actions { margin-bottom: 16px; }
.mail-thread { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.mail-msg { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 14px 16px; max-width: 900px; }
.mail-msg.mail-mine { border-left: 4px solid var(--primary); background: var(--surface-alt); }
.mail-msg-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; font-size: 13px; }
.mail-msg-from { font-weight: bold; color: var(--text-strong); }
.mail-msg-meta { display: inline-flex; gap: 8px; align-items: center; color: var(--text-muted); }
.mail-msg-date { font-family: var(--font-mono); font-size: 12px; }
.mail-msg-subject { font-weight: bold; margin-bottom: 6px; }
.mail-msg-body { line-height: 1.55; white-space: normal; word-break: break-word; }
.mail-msg-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border-light); }
.mail-file { display: inline-flex; gap: 6px; align-items: center; padding: 5px 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-muted); font-size: 13px; text-decoration: none; color: var(--text-strong); }
.mail-file:hover { border-color: var(--primary); text-decoration: none; }
.mail-file small { color: var(--text-muted); }
.mail-reply textarea, .mail-compose textarea { width: 100%; }
.company-picker { max-height: 220px; padding: 8px 10px; border: 1px solid var(--border); background: var(--surface); }
.check-row { display: block; font-weight: normal; margin: 0; padding: 4px 0; cursor: pointer; }
.check-row input { width: auto; margin-right: 6px; }
.bc-recipients { max-height: 200px; }
.bc-preview { margin: 14px 0; }

/* ---------- Flikar (API-kodexempel m.m.) ---------- */
.tabs-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.tabs-head h3 { flex: 1 1 auto; }
.tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; border: 1px solid var(--border); border-radius: 6px; padding: 3px; background: var(--surface-muted); margin-bottom: 10px; }
.tab { border: none; background: transparent; color: var(--text-muted); font-family: var(--font); font-size: 12px; font-weight: bold; padding: 6px 12px; border-radius: 4px; cursor: pointer; transition: all 0.15s; }
.tab:hover { color: var(--text-strong); background: var(--surface); }
.tab.active { background: var(--primary); color: var(--on-primary); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
.tab-panel[hidden] { display: none; }
.code-filename { position: absolute; top: 8px; left: 14px; font-family: var(--font-mono); font-size: 11px; color: #9fb0c3; background: rgba(255, 255, 255, 0.06); padding: 3px 8px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, 0.1); }
.code-wrap .code-tall { padding-top: 40px; max-height: 520px; overflow: auto; }

/* ---------- Fakturalistor: rullbar ram + status-info ---------- */
.invoice-scroll { max-height: 480px; }
.invoice-scroll thead th { position: sticky; top: 0; z-index: 1; }
.status-cell { white-space: nowrap; }
.status-cell .help-term { vertical-align: middle; }
.help-icon-inline { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--text-muted); font-size: 9px; font-style: italic; font-weight: bold; font-family: Georgia, serif; vertical-align: middle; }

/* ---------- Full modul-hash på containern ---------- */
.module-hash { display: flex; width: fit-content; align-items: center; gap: 8px; margin-top: 8px; padding: 3px 8px 3px 4px; border-radius: 3px; background: rgba(0, 0, 0, 0.32); border: 1px solid rgba(0, 0, 0, 0.5); cursor: pointer; max-width: 100%; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.25); transition: background 0.15s; }
.module-hash:hover { background: var(--primary); }
.module-hash.is-copied { background: var(--success); }
.module-hash-label { font-size: 10px; font-weight: bold; letter-spacing: 0.6px; color: #ffd60a; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.8); white-space: nowrap; }
.module-hash-value { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.3px; color: #f2f5f8; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.8); word-break: break-all; line-height: 1.3; user-select: all; }
.module-hash.is-copied .module-hash-value, .module-hash.is-copied .module-hash-label { color: #fff; }

/* ---------- Bredare ram + tätare admin-tabeller (inga horisontella rullister) ---------- */
.ndc-table.dense th { padding: 10px 10px; font-size: 12px; letter-spacing: 0.3px; }
.ndc-table.dense td { padding: 9px 10px; font-size: 13px; }
.ndc-table.dense td code { font-size: 12px; padding: 1px 4px; }
.ndc-table.dense .hint { font-size: 11px; }
.ndc-table.dense .nowrap, .ndc-table.dense code { white-space: nowrap; }
@media (min-width: 1500px) { .ndc-shell.wide { max-width: 1400px; } }
.source-row { padding: 6px 0; border-bottom: 1px dashed var(--border-light); }
.source-row:last-of-type { border-bottom: none; }

/* ---------- Ljudguider (6d.3) ---------- */
.play-audio-btn { font-size: 16px; font-weight: bold; color: #fff; background: #6f42c1; text-align: center; padding: 10px 16px; border-radius: 4px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: background 0.2s; display: inline-block; line-height: 1.3; }
.asset-card:hover .play-audio-btn, .asset-audio:hover .play-audio-btn { background: #5a32a3; }
[data-audio].is-playing .play-audio-btn { background: var(--success); }
.asset-audio { cursor: pointer; }
.asset-dl-link { display: block; font-size: 10px; color: var(--text-muted); text-decoration: none; margin-top: 2px; }
.asset-dl-link:hover { color: var(--primary); text-decoration: underline; }
body.view-small .play-audio-btn { font-size: 10px; padding: 5px 8px; }
body.view-medium .play-audio-btn { font-size: 12px; padding: 6px 10px; }
body.view-large .play-audio-btn { font-size: 16px; padding: 10px 16px; }
.audio-dock { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 9000; display: flex; align-items: center; gap: 14px; width: min(760px, calc(100vw - 32px)); padding: 10px 14px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35); }
.audio-dock[hidden] { display: none; }
.audio-dock-icon { font-size: 22px; color: #6f42c1; }
.audio-dock-text { display: flex; flex-direction: column; min-width: 0; flex: 0 1 240px; }
.audio-dock-title { font-weight: bold; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-dock-sub { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-dock audio { flex: 1 1 320px; min-width: 200px; height: 36px; }
.audio-dock-close { border: none; background: var(--surface-muted); color: var(--text-strong); width: 30px; height: 30px; border-radius: 50%; font-size: 18px; cursor: pointer; line-height: 1; }
.audio-dock-close:hover { background: var(--danger); color: #fff; }
body.has-audio-dock { padding-bottom: 90px; }
@media (max-width: 640px) { .audio-dock { flex-wrap: wrap; } .audio-dock-text { flex-basis: 100%; } }

/* ---------- 6d.5 – pilot onboarding ---------- */
.tier-badge.tier-granted { background: #2e7d32; color: #fff; }
.invite-link { word-break: break-all; font-size: 12px; }
.steps-list { margin: 10px 0 0; padding-left: 20px; line-height: 1.7; }

/* ---------- Nexus Ledger (L1) ---------- */
.journal { display: flex; flex-direction: column; gap: 12px; }
.journal-entry { border: 1px solid var(--border); border-radius: 6px; background: var(--surface); overflow: hidden; }
.journal-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 12px; background: var(--surface-muted); border-bottom: 1px solid var(--border-light); font-size: 13px; }
.journal-ver { font-family: var(--font-mono); font-weight: bold; color: var(--primary); }
.journal-date { font-family: var(--font-mono); color: var(--text-muted); }
.journal-desc { font-weight: bold; color: var(--text-strong); }
.journal-meta { margin-left: auto; color: var(--text-muted); font-size: 12px; }
.journal-lines { margin-bottom: 0; border: none; border-radius: 0; box-shadow: none; }
.journal-lines td { font-size: 13px; }
.journal-lines tr.total-row td { font-size: 12px; border-top: 1px solid var(--border); background: var(--surface-alt); color: var(--text-muted); font-weight: normal; }
.invoice-vat-sek td { font-style: italic; }

.issue-list { margin: 8px 0 0; padding-left: 18px; font-size: 12px; line-height: 1.6; }
.issue-list li { margin-bottom: 2px; }

/* ---------- 6b – Progression & Compliance Report ---------- */
.chart-box { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px 4px; margin: 0 0 18px; box-shadow: var(--shadow-sm); color: var(--text); }
.chart-box svg { display: block; max-height: 340px; }
.chart-box rect, .chart-box circle { transition: opacity 0.15s; }
.chart-box rect:hover, .chart-box circle:hover { opacity: 0.75; }
.section-title.sub { margin-top: 6px; }
.section-title.sub > span:first-child { font-size: 15px; }
.info-grid.two > .info-box { flex: 1 1 420px; min-width: 0; }
.metric-table.compact td, .metric-table.compact th { padding: 6px 8px; font-size: 13px; }
.warn-text { color: var(--warning-text); }
.row-muted td { opacity: 0.6; }
code.vid { font-weight: bold; letter-spacing: 0.5px; }
.dev-table td.bar-cell { width: 34%; }
.dev-bar { height: 10px; background: var(--primary); border-radius: 3px; min-width: 2px; display: inline-block; vertical-align: middle; }
.dev-bar.alt { background: var(--accent); }

/* Publik kontrollsida /verify/<id> – alltid ljus och läsbar, oavsett tema/video */
.verify-card { position: relative; z-index: 1; width: 100%; max-width: 680px; background: #ffffff; color: #333; border-radius: 10px; padding: 30px 34px 22px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35); border: 1px solid #d9dee5; font-size: 14px; line-height: 1.5; }
.verify-brand { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid #004080; padding-bottom: 12px; margin-bottom: 18px; }
.verify-logo { width: 46px; height: 46px; }
.verify-title { font-size: 18px; font-weight: 900; letter-spacing: 1px; color: #004080; text-transform: uppercase; }
.verify-sub { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: #666; }
.verify-result { border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; border: 1px solid; }
.verify-result p { margin: 6px 0 0; }
.verify-ok { background: #e8f5e9; border-color: #a5d6a7; color: #1b5e20; }
.verify-bad { background: #fdecea; border-color: #f5c6cb; color: #8a1c1c; }
.verify-stamp { font-size: 22px; font-weight: 900; letter-spacing: 2px; }
.verify-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.verify-table th { text-align: left; width: 34%; color: #666; font-weight: normal; padding: 6px 8px 6px 0; vertical-align: top; border-bottom: 1px solid #eee; font-size: 13px; }
.verify-table td { padding: 6px 0; border-bottom: 1px solid #eee; vertical-align: top; }
.verify-table code, .verify-card code { background: #f1f4f8; color: #004080; padding: 1px 5px; border-radius: 3px; font-size: 13px; }
.verify-hash { word-break: break-all; font-size: 11px !important; }
.verify-card .hint { color: #666; font-size: 12px; }
.verify-form { margin-top: 14px; border-top: 1px solid #eee; padding-top: 14px; }
.verify-form label { color: #444; }
.verify-row { display: flex; gap: 10px; }
.verify-row input { flex: 1; font-family: var(--font-mono); font-size: 16px; letter-spacing: 1.5px; text-transform: uppercase; padding: 10px 12px; border: 1px solid #ccc; border-radius: 4px; background: #fff; color: #222; }
.verify-row .btn { white-space: nowrap; }
.verify-foot { margin-top: 18px; font-size: 11px; color: #888; text-align: center; }
.verify-foot a { color: #004080; text-decoration: none; }
@media (max-width: 560px) { .verify-card { padding: 20px 16px; } .verify-table th { width: 40%; } .verify-row { flex-direction: column; } }
.confirm-input { display: none; width: 100%; margin-top: 12px; padding: 9px 10px; border: 1px solid var(--input-border); border-radius: 4px; background: var(--input-bg); color: var(--text); font-size: 14px; box-sizing: border-box; }
.metric-table.nowrap td.num, .metric-table.nowrap th.num, .ndc-table.dense td.num { white-space: nowrap; }
.metric-table.nowrap td:first-child { font-weight: normal; }
.metric-table.nowrap code { white-space: nowrap; }

/* ---------- 6e – View as company ---------- */
.view-as-bar { position: sticky; top: 0; z-index: 9500; display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; padding: 8px 16px; background: #6f42c1; color: #fff; font-size: 13px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
.view-as-bar .view-as-exit { background: #fff; color: #4b2a8a; border: none; font-weight: bold; }
.view-as-bar .view-as-exit:hover { background: #f0e9ff; }
body.is-view-as .ndc-shell { border-top: 4px solid #6f42c1; }
.sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 18px; }
.sys-meter { height: 8px; background: var(--surface-muted); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.sys-meter > span { display: block; height: 100%; background: var(--success); }
.sys-meter.warn > span { background: var(--accent); }
.sys-meter.bad > span { background: var(--danger); }
.cron-log { max-height: 320px; overflow: auto; background: #1b1b1d; color: #d6e0e9; font-family: var(--font-mono); font-size: 12px; padding: 10px 12px; border-radius: 6px; white-space: pre-wrap; word-break: break-all; }
.job-overdue td { background: var(--warning-bg); }
.job-failed td { background: var(--danger-bg); }
.backup-table td.nowrap, .backup-table .table-actions { white-space: nowrap; }
.backup-table .table-actions form { display: inline; }
.backup-table .table-actions .btn { margin: 1px 0; }
.status-muted { background: var(--surface-muted); color: var(--text-muted); border: 1px solid var(--border); }
.import-table td.nowrap { white-space: nowrap; }

/* step 7 – terminated account (closing access) */
.termination-bar { margin: 0 0 12px; padding: 10px 14px; border-radius: 6px; background: var(--danger-bg, #f2dede); border: 1px solid var(--danger-border, #ebccd1); color: var(--danger-text, #a94442); font-size: 0.92rem; }
.termination-bar a { color: inherit; font-weight: 600; text-decoration: underline; }

/* step 8 */
.platform-test-bar { margin: 0 0 12px; padding: 7px 14px; border-radius: 6px; background: #fff4cc; border: 1px solid #e6c766; color: #6b4e00; font-size: 0.86rem; text-align: center; }
.platform-test-bar a { color: inherit; font-weight: 600; text-decoration: underline; margin-left: 6px; }
.scroll-pane { max-height: var(--scroll-pane-h, 60vh); overflow: auto; border: 1px solid var(--border, #d7dde6); border-radius: 6px; }
.scroll-pane table { margin: 0; }
.scroll-pane thead th { position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 0 var(--border, #d7dde6); }
.scroll-pane.compact { --scroll-pane-h: 46vh; }
.news-pane { max-height: 70vh; overflow: auto; padding: 4px 18px 4px 4px; }
.news-entry { padding: 12px 0 14px; border-bottom: 1px solid var(--border, #d7dde6); }
.news-entry:last-child { border-bottom: 0; }
.news-entry h3 { margin: 0 0 4px; }
.news-entry .news-date { font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted, #5d6b80); margin-bottom: 2px; }
.news-entry p { margin: 0 0 6px; white-space: pre-wrap; }
.news-editor textarea { width: 100%; min-height: 360px; font-family: "DejaVu Sans Mono", Menlo, monospace; font-size: 0.85rem; }
.evidence-flag { display: inline-block; min-width: 1.5em; text-align: center; font-weight: 700; border-radius: 4px; padding: 0 5px; }
.evidence-flag.ok { background: #e3f3e8; color: #1f6b3d; }
.evidence-flag.missing { background: #fff1d6; color: #8a5a00; }
.evidence-flag.overdue { background: #fde3df; color: #9b2c1f; }
.upgrade-box { border: 1px solid var(--border, #d7dde6); border-radius: 6px; padding: 12px 14px; margin-top: 10px; }
.danger-zone { border: 2px solid #c0392b; border-radius: 8px; padding: 14px 16px; background: #fdf3f1; color: #3b2522; }
.danger-zone h3 { color: #9b2c1f; margin-top: 0; }
.danger-zone p, .danger-zone label, .danger-zone .hint, .danger-zone .checkbox-row, .danger-zone strong, .danger-zone em { color: #3b2522; }
.danger-zone .hint { color: #6b4a45; }
.danger-zone code { background: #f4dcd7; color: #7a1f14; }
.danger-zone input[type="text"], .danger-zone input[type="password"] { background: #ffffff; color: #1e1e1e; border: 1px solid #e0b4ad; }
.danger-zone input[type="text"]:focus, .danger-zone input[type="password"]:focus { border-color: #c0392b; outline: none; box-shadow: 0 0 0 2px rgba(192, 57, 43, .18); }
.danger-zone .btn-secondary { background: #f1e3e0; color: #3b2522; border: 1px solid #e0b4ad; }
.danger-zone .btn-secondary:hover { background: #e9d2cd; }
.btn-danger[disabled], .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.table-scroll { max-height: var(--scroll-pane-h, 62vh); overflow: auto; }
.table-scroll > table thead th { position: sticky; top: 0; z-index: 2; }
.invoice-doc .table-scroll, .print .table-scroll { max-height: none; }

/* ---------- Steg 9: staplade boxar (hela bredden), massval i listor ---------- */
.info-grid.stacked { flex-direction: column; }
.info-grid.stacked > .info-box { flex: 1 1 100%; width: 100%; min-width: 0; }
.info-box-wide { min-width: 0; }
.info-box-wide .cron-log { max-height: 360px; }
.ndc-table th.check, .ndc-table td.check { width: 34px; text-align: center; padding-left: 8px; padding-right: 4px; }
.ndc-table td.wrap { white-space: normal; word-break: break-word; }
.bulk-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border, #d7dde6); flex-wrap: wrap; }
.bulk-bar .btn[disabled] { opacity: .45; cursor: not-allowed; }


/* ---------- Steg 9: Learn MSA (videobibliotek) ---------- */
.learn-intro { color: var(--text-muted); max-width: 900px; margin: -6px 0 16px; }
.learn-grid { display: grid; grid-template-columns: repeat(var(--learn-cols, 4), minmax(0, 1fr)); gap: 18px; margin-bottom: 30px; }
@media (max-width: 1100px) { .learn-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px)  { .learn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px)  { .learn-grid { grid-template-columns: 1fr; } }
.learn-tile { display: flex; flex-direction: column; align-items: stretch; text-align: left; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; font: inherit; overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; }
.learn-tile:hover, .learn-tile:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow); outline: none; border-color: var(--primary); }
.learn-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #0f172a; overflow: hidden; }
.learn-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.learn-thumb.no-poster { background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 60%, #1f2937 100%); }
.learn-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: .9; transition: opacity .15s, transform .15s; }
.learn-tile:hover .learn-play { opacity: 1; transform: scale(1.06); }
.learn-num { position: absolute; left: 8px; top: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 4px; }
.learn-title { display: block; padding: 10px 12px 4px; font-weight: 600; font-size: 14px; line-height: 1.3; }
.learn-desc { display: block; padding: 0 12px 10px; color: var(--text-muted); font-size: 12.5px; line-height: 1.35; }
.learn-tile .learn-title:last-child { padding-bottom: 12px; }

.learn-player { position: fixed; inset: 0; z-index: 2000; background: #000; display: flex; flex-direction: column; }
.learn-player[hidden] { display: none; }
.learn-player-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; background: #111; color: #eee; font-size: 14px; flex: 0 0 auto; }
.learn-player-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.learn-player-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.learn-player video { flex: 1 1 auto; min-height: 0; width: 100%; background: #000; outline: none; }
.learn-player-list { flex: 0 0 auto; display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; background: #111; scrollbar-width: thin; }
.learn-list-item { flex: 0 0 auto; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: #222; color: #ddd; border: 1px solid #333; border-radius: 6px; padding: 5px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
.learn-list-item:hover { background: #2d2d2d; color: #fff; }
.learn-list-item.is-current { background: var(--primary); color: #fff; border-color: var(--primary); }
.learn-list-item.is-next { border-color: #e6c766; }
.learn-list-num { opacity: .7; margin-right: 4px; }
body.learn-open { overflow: hidden; }

.learn-form { display: flex; flex-direction: column; gap: 8px; }
.learn-form label { font-size: 12.5px; color: var(--text-muted); display: block; margin-bottom: 3px; }
.learn-form input[type="text"], .learn-form textarea { width: 100%; box-sizing: border-box; }
.learn-form .form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.learn-admin-table td { vertical-align: top; }
.learn-admin-table .learn-edit-form { min-width: 280px; }
.learn-admin-thumb { width: 160px; aspect-ratio: 16 / 9; background: #0f172a; border-radius: 6px; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #9aa; font-size: 12px; margin-bottom: 6px; }
.learn-admin-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.learn-poster-form { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.learn-poster-form input[type="file"] { max-width: 160px; font-size: 11px; }
.learn-move { display: flex; gap: 2px; margin-top: 4px; }
.learn-move .btn { padding: 1px 6px; }
tr.is-muted td { opacity: .55; }
.portal-card.portal-learn { border-top-color: #e6a23c; }

/* ---------- Steg 9: kortbetalning ---------- */
.pay-panel { border: 2px solid var(--success, #2e8b57); border-radius: 10px; padding: 16px 18px; margin: 0 0 18px; background: var(--surface); box-shadow: var(--shadow-sm); }
.pay-panel.is-off { border-color: var(--border); }
.pay-panel-main { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.pay-panel-amount { display: flex; flex-direction: column; gap: 2px; min-width: 200px; }
.pay-label { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); }
.pay-sum { font-size: 28px; font-weight: 700; color: var(--primary); line-height: 1.1; }
.pay-due { font-size: 12.5px; color: var(--text-muted); }
.pay-panel-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pay-form { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pay-btn { font-size: 15px; padding: 10px 18px; display: inline-flex; align-items: center; gap: 8px; }
.pay-card-icon { display: inline-block; width: 22px; height: 15px; border-radius: 3px; background: linear-gradient(135deg, #1e3a8a, #3b82f6); position: relative; vertical-align: middle; margin-right: 6px; }
.pay-card-icon::after { content: ""; position: absolute; left: 0; right: 0; top: 4px; height: 3px; background: rgba(255,255,255,.85); }
.pay-brands { flex-basis: 100%; display: flex; gap: 8px; align-items: center; margin-top: 4px; font-size: 11px; color: var(--text-muted); }
.pay-brands > span { border: 1px solid var(--border); border-radius: 4px; padding: 1px 7px; font-weight: 700; letter-spacing: .3px; }
.pay-brands .pay-secure { border: 0; font-weight: 400; margin-left: auto; }
.pay-attempts { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 12px; }
.pay-save { font-size: 12.5px; color: var(--text-muted); }
.card-table td { vertical-align: middle; }
.status-info { background: #e0ecff; color: #1e3a8a; }
#lv-file-info[hidden] { display: none; }
.php-limits td, .php-limits th { font-size: 12.5px; }
.ini-sources { margin-top: 3px; display: flex; flex-direction: column; gap: 1px; font-size: 11.5px; }
.ini-sources span { opacity: .75; }
.ini-sources span.is-effective { opacity: 1; font-weight: 600; }

/* ---------- Patch 9.7: breda adminsidor + rensa-knappar ------------- */
/* System och Audit log: skalet sträcks ut till skärmens kanter (de breda tabellerna slipper horisontell rullist). */
body.shell-wide .ndc-shell { max-width: none; }
body.shell-wide { padding-left: 16px; padding-right: 16px; }
.section-title .title-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.section-title .title-actions .api-status { white-space: normal; text-align: right; }
.section-title .title-actions form { display: flex; align-items: center; gap: 6px; margin: 0 0 2px; }
.section-title .title-actions select { padding: 4px 6px; font-size: 12px; }
.section-title .title-actions .btn-sm { padding: 5px 10px; font-size: 12px; letter-spacing: 0; text-transform: none; white-space: nowrap; }
.section-title .title-actions .title-label { white-space: nowrap; font-size: 12px; font-family: var(--font); color: var(--text-muted); font-weight: normal; letter-spacing: 0; text-transform: none; }
.section-title .title-actions select { width: auto; max-width: 130px; }
.cron-table td:first-child { max-width: 380px; }
.info-box h3 .box-actions { margin-left: auto; display: inline-flex; gap: 6px; }
.info-box h3 .box-actions .btn-sm { padding: 4px 9px; font-size: 12px; letter-spacing: 0; text-transform: none; font-weight: 600; }
/* Cron-översikten: kortare Summary-kolumn och radbrytning i stället för rullist */
.cron-table td.summary { max-width: 300px; white-space: normal; word-break: break-word; }
.cron-table .table-actions { white-space: normal; }
.cron-table .table-actions .btn { white-space: nowrap; margin: 1px 0; }
.cron-table th.num, .cron-table td.num { white-space: nowrap; }

/* ---------- Patch 9.8: material identification, PIR example, cron pause --- */
.material-guide .mg-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.material-guide .mg-head select { min-width: 320px; max-width: 100%; }
.material-guide .mg-body { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-start; }
.material-guide .mg-figure { flex: 0 1 640px; max-width: 100%; margin: 0; background: #ffffff; border: 1px solid var(--border); border-radius: 8px; padding: 6px; }
.material-guide .mg-figure img { display: block; width: 100%; height: auto; }
.material-guide .mg-figure figcaption { font-size: 12px; color: var(--text-muted); padding: 6px 4px 2px; }
.material-guide .mg-text { flex: 1 1 320px; min-width: 0; }
.material-guide .mg-text h4 { margin: 12px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--primary); }
.material-guide .mg-text ul { margin: 0; padding-left: 18px; }
.material-guide .mg-terms { display: flex; gap: 8px; flex-wrap: wrap; }
.material-guide .mg-badge { display: inline-block; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 14px; padding: 4px 11px; font-size: 12px; color: var(--text-muted); }
.material-guide .mg-badge strong { color: var(--text-strong); margin-left: 4px; }
.material-guide .mg-badge-green { background: #e9f6ec; border-color: #bfe3c7; color: #1f6b35; }
.material-guide .mg-badge-green strong { color: #155228; }
.pir-example { display: flex; gap: 22px; flex-wrap: wrap; }
.pir-example .pir-inputs { flex: 1 1 300px; min-width: 0; }
.pir-example .pir-inputs .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.pir-example .pir-inputs label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.pir-example .pir-inputs input, .pir-example .pir-inputs select { width: 100%; }
.pir-example .pir-steps { flex: 1 1 380px; min-width: 0; }
.pir-example table.pir-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pir-example table.pir-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-light); vertical-align: top; }
.pir-example table.pir-table td.num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.pir-example table.pir-table tr.total td { font-weight: 900; border-top: 2px solid var(--primary); background: var(--primary-soft); }
.pir-example .formula { font-family: var(--font-mono); font-size: 13px; background: var(--surface-muted); padding: 8px 10px; border-radius: 6px; margin: 8px 0; }

/* ---------- Steg 10: modulklassificering, bevisbilagor ------------- */
.module-class { margin: 10px 0; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 6px; background: var(--surface-muted); }
.module-class-head { font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 6px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.module-class-head .hint { font-weight: normal; }
.module-class-allowed { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 13px; align-items: center; }
.module-class-allowed label.chk { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.module-class .hint { font-size: 12px; }
.evidence-rows { display: flex; flex-direction: column; gap: 6px; }
.evidence-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.evidence-row select { width: auto; min-width: 220px; }
.evidence-row input[type="file"] { flex: 1 1 260px; }
.tier-badge.tier-replaces { background: #e9f6ec; color: #1f6b35; border: 1px solid #bfe3c7; text-transform: none; letter-spacing: 0; }
