/* =========================================================================
   SORA 2.5-KALKULATORER – vindu som legger seg over kartet (js/kalkulator.js)
   ========================================================================= */
.kalk-overlay {
    --k-brand: #03477F;
    --k-brand-soft: #e7f0f8;
    --k-text: #1f2933;
    --k-muted: #5f6b7a;
    --k-line: #e1e6ed;
    --k-bg: #f2f4f7;
    --k-fg: #28a745;
    --k-cv: #e0a800;
    --k-grb: #dc3545;
    --k-adj: #007bff;

    position: fixed; top: 60px; left: 0; right: 0; bottom: 0; z-index: 1500;
    display: flex; justify-content: center; align-items: stretch;
    padding: 14px 20px calc(18px + env(safe-area-inset-bottom, 0px)); box-sizing: border-box;
    background: rgba(15, 23, 42, 0.35);
    opacity: 0; transition: opacity 0.18s ease;
    color: var(--k-text);
}
.kalk-overlay[hidden] { display: none; }
.kalk-overlay.is-open { opacity: 1; }

.kalk-sheet {
    width: 100%; max-width: 1480px;
    display: flex; flex-direction: column; min-height: 0;
    background: var(--k-bg); border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: translateY(18px); transition: transform 0.2s ease;
    overflow: hidden;
}
.kalk-overlay.is-open .kalk-sheet { transform: none; }

/* --- Topp: tittel og faner --- */
.kalk-head { background: #fff; border-bottom: 1px solid var(--k-line); padding: 12px 20px 0; flex-shrink: 0; }
.kalk-head-row { display: flex; align-items: center; gap: 10px; }
.kalk-head-row > .material-symbols-outlined { color: var(--k-brand); font-size: 24px; }
.kalk-head h2 { margin: 0; font-size: 17px; font-weight: 700; flex: 1; color: var(--k-text); }
.kalk-close {
    width: 36px; height: 36px; border-radius: 50%; border: none; background: transparent;
    display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--k-muted);
}
.kalk-close:hover { background: #eef1f5; color: var(--k-text); }
.kalk-reset {
    display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 8px;
    border: 1px solid var(--k-line); background: #fff; cursor: pointer; color: var(--k-muted);
    font: 600 12.5px 'Open Sans', Arial, sans-serif;
}
.kalk-reset:hover { color: var(--k-text); border-color: #c5ccd6; background: #f7f9fb; }
.kalk-reset .material-symbols-outlined { font-size: 18px; }

.kalk-tabs { display: flex; gap: 2px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; }
.kalk-tabs::-webkit-scrollbar { display: none; }
.kalk-tab {
    display: flex; align-items: center; gap: 6px; flex-shrink: 0;
    padding: 10px 14px 11px; border: none; background: none; cursor: pointer;
    font: 600 13px/1 'Open Sans', Arial, sans-serif; color: var(--k-muted);
    border-bottom: 3px solid transparent; border-radius: 6px 6px 0 0; white-space: nowrap;
}
.kalk-tab .material-symbols-outlined { font-size: 19px; }
.kalk-tab:hover { color: var(--k-text); background: #f5f7fa; }
.kalk-tab.is-on { color: var(--k-brand); border-bottom-color: var(--k-brand); }
.kalk-tab:focus-visible { outline: 2px solid var(--k-brand); outline-offset: -2px; }

/* --- Innhold --- */
.kalk-body { flex: 1; overflow-y: auto; padding: 20px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.kalk-source { font-size: 11px; color: var(--k-muted); text-align: center; margin: 6px 0 4px; }
.kalk-source a { color: var(--k-brand); }

.kgrid { display: grid; grid-template-columns: minmax(330px, 420px) minmax(0, 1fr); gap: 20px; align-items: start; }
.kcol-out { position: sticky; top: 0; }

.kcard { background: #fff; border: 1px solid var(--k-line); border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.kcard-title {
    margin: 0 0 14px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--k-muted);
}
.ksub { display: flex; align-items: center; gap: 6px; margin: 18px 0 6px; font-size: 12px; font-weight: 700; color: var(--k-muted); }
.ksub .material-symbols-outlined { font-size: 18px; }
.kcenter { text-align: center; margin-top: 2px; }
.kviz-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.kviz-pair .kviz { margin-top: 0; }
.kpill {
    display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px 5px; margin: 10px 6px 0 0; padding: 5px 11px; border-radius: 999px;
    background: #f1f4f7; border: 1px solid var(--k-line); font-size: 12.5px; color: var(--k-text);
}
.kpill .material-symbols-outlined { font-size: 17px; color: var(--k-muted); }
.kpill-warn { background: #fff4e5; border-color: #ffd8a8; }
.knote { font-size: 12px; color: var(--k-muted); line-height: 1.45; margin: 10px 0 0; }
.kmeta { font-size: 13px; color: var(--k-text); line-height: 1.6; margin: 0 0 10px; }

/* --- Felt --- */
.kf { margin-bottom: 14px; }
.kf:last-child { margin-bottom: 0; }
.kf[hidden] { display: none; }
.kf-label { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--k-text); }
.kf-label sub, .kstat-label sub { font-size: 0.75em; }
.kf-info {
    border: none; background: none; padding: 0; cursor: pointer; color: #98a2b0;
    display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 50%;
}
.kf-info .material-symbols-outlined { font-size: 17px; }
.kf-info:hover, .kf-info[aria-expanded="true"] { color: var(--k-brand); background: var(--k-brand-soft); }
.kf-help {
    margin-top: 6px; padding: 8px 10px; font-size: 12px; line-height: 1.45; color: #34414f;
    background: var(--k-brand-soft); border-radius: 6px; white-space: pre-line;
}
.kf-hint { font-size: 11px; color: var(--k-muted); margin-top: 4px; }
.kf-ic { display: inline-flex; color: #7a8594; margin-right: 3px; flex-shrink: 0; }
.kf-ic .material-symbols-outlined { font-size: 19px; }
.kf-link { display: inline-flex; color: #98a2b0; margin-left: 2px; }
.kf-link .material-symbols-outlined { font-size: 16px; }
.kf-link:hover { color: var(--k-brand); }
.kf-help-img { display: block; max-width: 230px; width: 100%; margin-top: 8px; border-radius: 6px; background: #fff; padding: 4px; box-sizing: border-box; }
.kico { width: 18px; height: 18px; flex-shrink: 0; }

/* Kompakte tallfelt: etikett til venstre, − verdi + [enhet] til høyre */
.kf-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kf-inline .kf-label { margin: 0; flex: 1; min-width: 0; line-height: 1.3; }
.kf-inline .kf-num { flex: 0 0 auto; height: 34px; }
.kf-inline .kf-num input { width: 62px; flex: 0 0 62px; font-size: 14px; }
.kf-inline .kf-step { width: 30px; }
.kf-inline .kf-unit { min-width: 30px; padding: 0 8px; font-size: 11.5px; }
.kf-inline { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid #f0f2f5; }
.kf-inline:last-child { border-bottom: none; padding-bottom: 0; }
.kf-slider { width: 100%; margin: 10px 0 0 !important; accent-color: var(--k-brand) !important; height: 16px; }

.kf-num { display: flex; align-items: stretch; height: 38px; border: 1px solid #cfd6df; border-radius: 8px; overflow: hidden; background: #fff; }
.kf-num:focus-within { border-color: var(--k-brand); box-shadow: 0 0 0 3px rgba(3, 71, 127, 0.12); }
.kf-num input {
    flex: 1; min-width: 0; border: none; outline: none; text-align: center;
    font: 600 15px 'Open Sans', Arial, sans-serif; color: var(--k-text); -moz-appearance: textfield;
}
.kf-num input::-webkit-outer-spin-button, .kf-num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.kf-step {
    width: 38px; border: none; background: #f4f6f9; cursor: pointer; color: #4a5563;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.kf-step:hover { background: #e7ebf0; color: var(--k-text); }
.kf-step .material-symbols-outlined { font-size: 18px; }
.kf-num .kf-step:first-child { border-right: 1px solid #e3e7ed; }
.kf-unit {
    display: flex; align-items: center; padding: 0 10px; min-width: 34px; justify-content: center;
    font-size: 12px; color: var(--k-muted); background: #f9fafb; border-left: 1px solid #e3e7ed;
}
.kf-num .kf-step:nth-child(3) { border-left: 1px solid #e3e7ed; }
/* Enhetsvalg bak tallfeltet (høyde m/ft, V₀ m/s / km/h / kt) */
.kf-num select.kf-unit-sel {
    -webkit-appearance: none; appearance: none; border: none; border-left: 1px solid #e3e7ed; border-radius: 0; margin: 0;
    padding: 0 18px 0 8px; font: 600 11.5px 'Open Sans', Arial, sans-serif; color: var(--k-brand); cursor: pointer;
    background: #f9fafb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%235f6b7a'/%3E%3C/svg%3E") no-repeat right 6px center;
}
.kf-num select.kf-unit-sel:hover { background-color: #eef3f8; }
.kf-num select.kf-unit-sel:focus { outline: none; background-color: var(--k-brand-soft); }

.kf-select {
    width: 100%; height: 38px; padding: 0 10px; border: 1px solid #cfd6df; border-radius: 8px; background: #fff;
    font: 13px 'Open Sans', Arial, sans-serif; color: var(--k-text);
}
.kf-select:focus { outline: none; border-color: var(--k-brand); box-shadow: 0 0 0 3px rgba(3, 71, 127, 0.12); }
.kf-select:disabled { background: #f4f6f9; color: #9aa3ad; }

.kf-range { display: flex; align-items: center; gap: 12px; }
.kf-range input { flex: 1; accent-color: var(--k-brand); }
.kf-range output { min-width: 58px; text-align: right; font-weight: 700; font-size: 14px; }

.kseg { display: flex; border: 1px solid #cfd6df; border-radius: 8px; overflow: hidden; background: #fff; }
.kseg-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px;
    padding: 6px 8px; border: none; background: none; cursor: pointer;
    font: 600 12.5px 'Open Sans', Arial, sans-serif; color: #4a5563; text-align: center; line-height: 1.2;
}
.kseg-btn + .kseg-btn { border-left: 1px solid #e3e7ed; }
.kseg-btn .material-symbols-outlined { font-size: 18px; }
.kseg-btn:hover:not(:disabled):not(.is-on) { background: #f4f6f9; }
.kseg-btn.is-on { background: var(--k-brand); color: #fff; }
.kseg-btn.is-on:hover { background: #02365f; }
.kseg-btn:disabled { color: #b8c0ca; cursor: not-allowed; background: #fafbfc; }
.kseg-btn[hidden] { display: none; }
.kseg-wrap .kseg-btn { flex: 1 1 0; min-width: 0; padding: 6px 4px; font-size: 12px; flex-direction: column; gap: 2px; }
.kseg-wrap .kseg-btn .material-symbols-outlined { font-size: 18px; }


/* --- Resultater --- */
.kcard-result { padding: 18px; }
.kstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.kstat {
    border-radius: 8px; padding: 10px 14px; background: #f7f9fb;
    border: 1px solid var(--k-line); border-left: 5px solid #9aa3ad;
}
.kstat-wide { grid-column: 1 / -1; }
.kstats-2 { grid-template-columns: 1fr 1fr; }
.kstat-label { font-size: 12px; font-weight: 600; color: var(--k-muted); }
.kstat-val { display: flex; align-items: baseline; gap: 5px; margin-top: 2px; }
.kstat-val span { font-size: 28px; font-weight: 700; line-height: 1.15; color: var(--k-text); font-variant-numeric: tabular-nums; }
.kstat-val small { font-size: 13px; color: var(--k-muted); font-weight: 600; }
.kstat-sub { font-size: 11.5px; color: var(--k-muted); min-height: 0; }
.kstat-sub:empty { display: none; }
.kstat.is-off { opacity: 0.45; }

.kstat-cv { border-left-color: var(--k-cv); background: #fffbeb; }
.kstat-fg { border-left-color: var(--k-fg); background: #f0faf2; }
.kstat-grb { border-left-color: var(--k-grb); background: #fdf2f3; }
.kstat-adj { border-left-color: var(--k-adj); background: #eef5ff; }
.kstat-ac { border-left-color: #8e44ad; background: #f7f1fa; }
.kstat-alos { border-left-color: #8e44ad; }
.kstat-dlos { border-left-color: #0f9bb5; }
.kstat-vlos { border-left-color: var(--k-brand); background: var(--k-brand-soft); }
.kstat-vlos .kstat-val span { font-size: 34px; color: var(--k-brand); }

/* Farge etter risikonivå (GRC 1–10, SAIL I–VI, containment-robusthet) */
.kstat[data-grc="1"], .kstat[data-grc="2"] { border-left-color: #2e9e4f; }
.kstat[data-grc="3"], .kstat[data-grc="4"] { border-left-color: #b8b000; }
.kstat[data-grc="5"], .kstat[data-grc="6"] { border-left-color: #f08c00; }
.kstat[data-grc="7"], .kstat[data-grc="8"], .kstat[data-grc="9"], .kstat[data-grc="10"] { border-left-color: #d63939; }
.kstat-sail { border-left-color: var(--k-brand); }
.kstat-sail[data-sail="I"], .kstat-sail[data-sail="II"] { border-left-color: #2e9e4f; background: #f0faf2; }
.kstat-sail[data-sail="III"], .kstat-sail[data-sail="IV"] { border-left-color: #f08c00; background: #fff6e9; }
.kstat-sail[data-sail="V"], .kstat-sail[data-sail="VI"] { border-left-color: #d63939; background: #fdf2f3; }
.kstat-cont[data-rob="Low"] { border-left-color: #2e9e4f; background: #f0faf2; }
.kstat-cont[data-rob="Medium"] { border-left-color: #f08c00; background: #fff6e9; }
.kstat-cont[data-rob="High"] { border-left-color: #d63939; background: #fdf2f3; }
.kstat-cont[data-rob="OOS"] { border-left-color: #6c757d; background: #f1f3f5; }
.kstat-cont[data-rob="OOS"] .kstat-val span { font-size: 20px; }

.kwarn, .kinfo {
    display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 0; padding: 9px 12px; border-radius: 8px;
    font-size: 12.5px; line-height: 1.45;
}
.kwarn { background: #fff4e5; color: #7a4a00; border: 1px solid #ffd8a8; }
.kinfo { background: var(--k-brand-soft); color: #173d5e; border: 1px solid #c7dbee; }
.kwarn .material-symbols-outlined, .kinfo .material-symbols-outlined { font-size: 18px; flex-shrink: 0; }

.kbtn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
    border-radius: 8px; border: 1px solid #cfd6df; background: #fff; cursor: pointer;
    font: 700 14px 'Open Sans', Arial, sans-serif; color: var(--k-text);
}
.kbtn-primary { background: var(--k-brand); border-color: var(--k-brand); color: #fff; }
.kbtn-primary:hover { background: #02365f; }
.kbtn-block { width: 100%; margin-top: 14px; }
.kbtn-next { margin: 4px 0 14px; background: #fff; border-color: #c7dbee; color: var(--k-brand); justify-content: space-between; }
.kbtn-next:hover { background: var(--k-brand-soft); }
.kbtn .material-symbols-outlined { font-size: 20px; }

.ktable-details { width: 100%; border-collapse: collapse; font-size: 13px; }
.ktable-details td { padding: 7px 2px; border-bottom: 1px solid #eef1f4; }
.ktable-details tr:last-child td { border-bottom: none; }
.ktable-details td:last-child { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* --- Visualiseringer --- */
.kviz { margin-top: 14px; }
.ksvg { width: 100%; height: auto; display: block; overflow: visible; font-family: 'Open Sans', Arial, sans-serif; }
.kv-fg { fill: rgba(40, 167, 69, 0.55); stroke: #1e7e34; stroke-width: 2; }
.kv-cv { fill: rgba(255, 193, 7, 0.25); stroke: var(--k-cv); stroke-width: 2; }
.kv-grb { fill: rgba(220, 53, 69, 0.38); stroke: var(--k-grb); stroke-width: 2; }
.kv-adj { fill: rgba(0, 123, 255, 0.10); stroke: var(--k-adj); stroke-width: 2; stroke-dasharray: 6 4; }
.kv-ca { fill: rgba(142, 68, 173, 0.18); stroke: #8e44ad; stroke-width: 2; }
.kv-glide { stroke: #2d8fd5; stroke-width: 3; stroke-dasharray: 7 5; }
.kv-slide { stroke: #f39c12; stroke-width: 3; }
.kv-impact { fill: #d63939; stroke: #fff; stroke-width: 2; }
.kv-ground { stroke: #3d4652; stroke-width: 2.5; }
.kv-path { fill: none; stroke: #2d8fd5; stroke-width: 2.5; stroke-dasharray: 7 6; }
.kv-ext { stroke: #7a8594; stroke-width: 1; stroke-dasharray: 3 3; }
.kv-head { stroke: #9aa3ad; stroke-width: 1.5; stroke-dasharray: 5 4; }
.kv-person { fill: #2e9e4f; }
.kv-arc { fill: none; stroke: #d63939; stroke-width: 2; }
.kv-star { fill: #e74c3c; stroke: #b03a2e; stroke-width: 1; }
.kv-lbl.kv-lbl-angle { fill: #c0392b; font-size: 16px; paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; }
.kv-lbl.kv-lbl-muted { fill: #7a8594; font-size: 13px; font-weight: 600; }
.kv-lbl.kv-lbl-ca { fill: #6c3483; }
.kv-lbl { font-size: 14px; font-weight: 700; fill: #3d4652; }
.kv-lbl.kv-lbl-glide { fill: #1f6fa8; }
.kv-lbl.kv-lbl-slide { fill: #b86e00; }
.kdim { color: #3d4652; }
.kdim line { stroke: currentColor; stroke-width: 1.5; }
.kdim text { fill: currentColor; font-size: 13px; font-weight: 700; paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; }

.klegend { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; margin-top: 8px; font-size: 12px; color: var(--k-muted); }
.klegend > span { display: inline-flex; align-items: center; }
.ksw { width: 14px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 6px; }
.ksw-fg { background: rgba(40, 167, 69, 0.7); border: 1.5px solid #1e7e34; }
.ksw-cv { background: rgba(255, 193, 7, 0.35); border: 1.5px solid var(--k-cv); }
.ksw-grb { background: rgba(220, 53, 69, 0.45); border: 1.5px solid var(--k-grb); }
.ksw-ca { background: rgba(142, 68, 173, 0.25); border: 1.5px solid #8e44ad; }
.ksw-glide { background: #2d8fd5; height: 3px; }
.ksw-slide { background: #f39c12; height: 3px; }

/* Kritisk areal: CD-kolonner og modellterskler */
.kcols { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.kcol-cell {
    border: 1px solid var(--k-line); border-radius: 8px; padding: 8px 4px; text-align: center; background: #f9fafb;
    display: flex; flex-direction: column; gap: 2px;
}
.kcol-cell b { font-size: 14px; }
.kcol-cell small { font-size: 11px; color: var(--k-muted); }
.kcol-cell.is-hit { background: var(--k-brand); border-color: var(--k-brand); color: #fff; }
.kcol-cell.is-hit small { color: #d6e4f1; }
.kswitch { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.kswitch div { background: #f7f9fb; border: 1px solid var(--k-line); border-radius: 8px; padding: 8px 10px; }
.kswitch small { display: block; font-size: 11px; color: var(--k-muted); }
.kswitch b { font-size: 14px; }

/* --- Tabeller (iGRC og SAIL) --- */
.ktable-wrap { overflow-x: auto; margin-top: 14px; }
.ktable { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 13px; }
.ktable th, .ktable td { padding: 7px 6px; text-align: center; border-radius: 5px; }
.ktable thead th { font-size: 11.5px; font-weight: 700; color: var(--k-muted); background: #f1f4f7; }
.ktable tbody th { font-size: 12px; font-weight: 600; color: #3d4652; background: #f1f4f7; text-align: left; white-space: nowrap; }
.ktable td { background: #f7f9fb; font-weight: 600; color: #3d4652; }
.ktable .is-line { background: #e3edf7; color: var(--k-brand); }
.ktable .is-hit { background: var(--k-brand) !important; color: #fff !important; font-weight: 800; box-shadow: 0 2px 6px rgba(3, 71, 127, 0.35); }
.ktable .is-na { background: #eceef1; color: #8b95a1; font-weight: 500; font-style: italic; }

.ktable-sail td.ks-I, .ktable-sail td.ks-II { background: #e6f5ea; color: #1e6b35; }
.ktable-sail td.ks-III, .ktable-sail td.ks-IV { background: #fff1dc; color: #8a5200; }
.ktable-sail td.ks-V, .ktable-sail td.ks-VI { background: #fde6e6; color: #9c2323; }
.ktable-sail td.is-line { filter: saturate(1.6) brightness(0.97); }

.kbadge {
    display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 6px;
    border-radius: 13px; font-weight: 800; font-size: 13px; color: #fff; background: #9aa3ad;
}
.kbadge.kg-1, .kbadge.kg-2 { background: #2e9e4f; }
.kbadge.kg-3, .kbadge.kg-4 { background: #a8a000; }
.kbadge.kg-5, .kbadge.kg-6 { background: #f08c00; }
.kbadge.kg-7, .kbadge.kg-8, .kbadge.kg-9, .kbadge.kg-10 { background: #d63939; }
.ktag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: #1e6b35; background: #e6f5ea; padding: 2px 7px; border-radius: 999px; }

.ktrade { border: 1px solid var(--k-line); border-radius: 8px; margin-top: 8px; background: #fff; }
.ktrade summary {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; list-style: none; font-size: 13px;
}
.ktrade summary::-webkit-details-marker { display: none; }
.ktrade summary::before { content: 'chevron_right'; font-family: 'Material Symbols Outlined'; font-size: 20px; color: var(--k-muted); transition: transform 0.15s; }
.ktrade[open] summary::before { transform: rotate(90deg); }
.ktrade-name { flex: 1; }
.ktrade .ktable-wrap { margin: 0; padding: 0 10px 10px; }

/* --- Tabeller i samme form og farger som i SORA 2.5 (gjenkjennelige fra regelverket) --- */
.ktable-reg { width: 100%; border-collapse: collapse; font-size: 12.5px; color: #222; background: #fff; }
.ktable-reg th, .ktable-reg td { border: 1px solid #8f98a3; padding: 6px 6px; text-align: center; }
.ktable-reg th { font-weight: 700; }
.ktable-reg td { font-weight: 500; background: #fff; }
.ktable-reg .reg-title, .ktable-reg .reg-grey { background: #d9d9d9; }
.ktable-reg .reg-dim { background: #cce5ff; }
.ktable-reg .reg-vel { background: #d4edda; }
.ktable-reg .reg-pop { background: #f8d7da; text-align: left; white-space: nowrap; }
.ktable-reg .reg-pop-title { white-space: normal; width: 130px; }
.ktable-reg .reg-na { background: #e0e0e0; color: #555; font-style: italic; }
.ktable-reg .reg-cert { background: #fff; }
.ktable-reg td.is-line { background: #fdf0e6; }
.ktable-reg td.is-hit { background: #F06C00; color: #fff; font-weight: 800; }
.ktable-sail td.sail-I { background: #c8e6c9; }
.ktable-sail td.sail-II { background: #f0f4c3; }
.ktable-sail td.sail-III { background: #fff9c4; }
.ktable-sail td.sail-IV { background: #ffe0b2; }
.ktable-sail td.sail-V { background: #ffcdd2; }
.ktable-sail td.sail-VI { background: #ef9a9a; }
.ktable-reg td.is-sel { outline: 3px solid #e53935; outline-offset: -3px; font-weight: 800; }
.ktable-sail td { width: 17%; }

/* --- SAIL: ARC-knapper --- */
.karc { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.karc-btn {
    display: flex; flex-direction: column; gap: 2px; padding: 10px 6px; border-radius: 8px; cursor: pointer;
    border: 1px solid #cfd6df; background: #fff; font-family: 'Open Sans', Arial, sans-serif; color: var(--k-text);
}
.karc-btn b { font-size: 14px; }
.karc-btn small { font-size: 11px; color: var(--k-muted); }
.karc-btn.is-on { color: #fff; border-color: transparent; }
.karc-btn.is-on small { color: rgba(255, 255, 255, 0.85); }
.karc-a.is-on { background: #2e9e4f; }
.karc-b.is-on { background: #a8a000; }
.karc-c.is-on { background: #f08c00; }
.karc-d.is-on { background: #d63939; }

/* --- ARC-fanen --- */
.karc-tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 800; color: #fff; white-space: nowrap; }
.karc-bg-a { background: #2e9e4f; }
.karc-bg-b { background: #a8a000; }
.karc-bg-c { background: #f08c00; }
.karc-bg-d { background: #d63939; }
.kaec { display: flex; flex-direction: column; gap: 5px; }
.kaec + .ksub, #r-arc-height + .ksub { margin-top: 14px; }
.karc-h {
    display: flex; gap: 8px; align-items: flex-start; padding: 8px 12px; border-radius: 8px;
    background: #f1f4f7; border: 1px solid var(--k-line); font-size: 12.5px; line-height: 1.45;
}
.karc-h > .material-symbols-outlined { font-size: 18px; color: var(--k-muted); }
.karc-h .klink { font-size: 12px; margin-top: 2px; }
.karc-card.is-res { background: var(--k-brand-soft); }
.kaec-btn {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; text-align: left; cursor: pointer;
    border: 1px solid #cfd6df; border-radius: 8px; background: #fff;
    font: 600 12.5px/1.35 'Open Sans', Arial, sans-serif; color: var(--k-text);
}
.kaec-btn > span { flex: 1; min-width: 0; }
.kaec-btn small { font-size: 10.5px; font-weight: 600; color: var(--k-muted); white-space: nowrap; }
.kaec-btn:hover:not(.is-on) { background: #f4f6f9; }
.kaec-btn.is-on { border-color: var(--k-brand); background: var(--k-brand-soft); box-shadow: inset 3px 0 0 var(--k-brand); }
.kaec-btn:focus-visible, .karc-card:focus-visible { outline: 2px solid var(--k-brand); outline-offset: 1px; }

.karc-list { display: flex; flex-direction: column; gap: 8px; }
.karc-card {
    display: flex; flex-direction: column; gap: 5px; width: 100%; padding: 10px 12px; text-align: left; cursor: pointer;
    border: 1px solid var(--k-line); border-left: 5px solid #9aa3ad; border-radius: 8px; background: #fff;
    font: 12.5px/1.45 'Open Sans', Arial, sans-serif; color: var(--k-text);
}
.karc-card.karc-a { border-left-color: #2e9e4f; }
.karc-card.karc-b { border-left-color: #a8a000; }
.karc-card.karc-c { border-left-color: #f08c00; }
.karc-card.karc-d { border-left-color: #d63939; }
.karc-card:hover:not(.is-on) { background: #f7f9fb; }
.karc-card.is-on, .karc-card.is-res { background: #f7f9fb; border-top-color: #c5ccd6; border-right-color: #c5ccd6; border-bottom-color: #c5ccd6; }
.karc-card.is-res { box-shadow: 0 2px 8px rgba(3, 71, 127, 0.12); }
.karc-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.karc-lvl { display: inline-block; font-weight: 700; font-size: 13px; }
.karc-lvl::first-letter { text-transform: uppercase; }
.karc-tags { display: inline-flex; gap: 5px; margin-left: auto; }
.ktag.ktag-arc { color: var(--k-brand); background: var(--k-brand-soft); }
.karc-txt { color: #3d4652; }
.karc-txt b { color: var(--k-text); }

.kstat-arc[data-arc="a"] { border-left-color: #2e9e4f; background: #f0faf2; }
.kstat-arc[data-arc="b"] { border-left-color: #a8a000; background: #fafae8; }
.kstat-arc[data-arc="c"] { border-left-color: #f08c00; background: #fff6e9; }
.kstat-arc[data-arc="d"] { border-left-color: #d63939; background: #fdf2f3; }
.kstat-tmpr[data-arc="b"] { border-left-color: #2e9e4f; }
.kstat-tmpr[data-arc="c"] { border-left-color: #f08c00; }
.kstat-tmpr[data-arc="d"] { border-left-color: #d63939; }
.kstat-tmpr .kstat-val span { font-size: 22px; }

/* --- VLOS --- */
.kvlos { padding: 34px 6px 0; }
.kvlos-track { position: relative; height: 44px; border-radius: 8px; background: linear-gradient(#dbeefd, #eef7ff); border-bottom: 6px solid #9ccf84; }
.kvlos-fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(3, 71, 127, 0.14); border-radius: 8px 0 0 8px; }
.kvlos-mark { position: absolute; top: -26px; bottom: 0; width: 2px; transform: translateX(-1px); opacity: 0.45; }
.kvlos-mark span {
    position: absolute; top: 0; left: 50%; transform: translateX(-50%); font-size: 10.5px; font-weight: 800;
    color: #fff; padding: 2px 6px; border-radius: 4px; white-space: nowrap;
}
.kvlos-alos { background: #8e44ad; } .kvlos-alos span { background: #8e44ad; }
.kvlos-dlos { background: #0f9bb5; } .kvlos-dlos span { background: #0f9bb5; }
.kvlos-mark.is-lim { opacity: 1; z-index: 2; }
.kvlos-pilot, .kvlos-craft { position: absolute; bottom: 2px; color: var(--k-brand); }
.kvlos-pilot { left: 2px; }
.kvlos-craft { transform: translateX(-50%); bottom: 12px; }
.kvlos-pilot .material-symbols-outlined, .kvlos-craft .material-symbols-outlined { font-size: 26px; }
.kvlos-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--k-muted); margin-top: 6px; }

/* --- Bekreftelse etter overføring --- */
.kalk-toast {
    position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 2100;
    display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px);
    padding: 11px 16px; border-radius: 10px; background: #1f2933; color: #fff; font-size: 13px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: all 0.2s ease;
}
.kalk-toast.is-on { transform: translate(-50%, 0); opacity: 1; }
.kalk-toast .material-symbols-outlined { color: #6fdc8c; }

/* --- Knappen som åpner kalkulatoren (i SORA-panelet) --- */
.sora-calc-btn {
    display: inline-flex; align-items: center; gap: 6px; border: 1px solid #cfe0f2; background: #f2f7fc;
    color: #03477F; border-radius: 6px; padding: 7px 12px; font: 600 12px 'Open Sans', Arial, sans-serif; cursor: pointer;
}
.sora-calc-btn:hover { background: #e3eef9; }
.sora-calc-btn .material-symbols-outlined { font-size: 18px; }

/* =========================================================================
   Nettbrett og mobil
   ========================================================================= */
@media (max-width: 1250px) {
    .kviz-pair { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .kgrid { grid-template-columns: minmax(0, 1fr); }
    .kcol-out { position: static; }
}
@media (max-width: 768px), (orientation: landscape) and (max-height: 500px) and (max-width: 950px) {
    .kalk-overlay { top: 50px; padding: 0; }
    .kalk-sheet { border-radius: 0; }
    .kalk-reset span:not(.material-symbols-outlined) { display: none; }
    .kalk-reset { padding: 0 8px; }
    .kalk-head { padding: 8px 12px 0; }
    .kalk-head h2 { font-size: 15px; }
    .kalk-tab { padding: 9px 10px 10px; font-size: 12.5px; }
    .kalk-body { padding: 12px 12px calc(16px + env(safe-area-inset-bottom, 0px)); }
    .kcard { padding: 14px; margin-bottom: 10px; }
    .kstat-val span { font-size: 24px; }
    .kstats { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
    .kcols { gap: 4px; }
    .kcol-cell b { font-size: 12.5px; }
    .kcol-cell small { font-size: 10px; }
    .karc { grid-template-columns: repeat(2, 1fr); }
    .ktable { font-size: 12px; border-spacing: 2px; }
    .ktable th, .ktable td { padding: 6px 4px; }
    .ktable tbody th { white-space: normal; min-width: 70px; }
    .ktable-reg { font-size: 11.5px; }
    .ktable-reg th, .ktable-reg td { padding: 5px 3px; }
    .ktable-reg .reg-pop { white-space: normal; }
    .ktable-reg .reg-pop-title { width: 22px; padding: 4px 2px; }
    .ktable-reg .reg-pop-title span { writing-mode: vertical-rl; transform: rotate(180deg); display: inline-block; }
}
@media (max-width: 600px) {
    /* Figurene skaleres ned på smale skjermer - større tekst i SVG-koordinater holder den lesbar */
    .ksvg .kdim text, .ksvg .kv-lbl { font-size: 21px; }
    .ksvg .kv-lbl.kv-lbl-angle { font-size: 22px; }
    .ksvg .kv-lbl.kv-lbl-muted { font-size: 17px; }
    /* Resultatene som kompakte rader: etikett til venstre, verdi til høyre */
    .kstats, .kstats-2 { grid-template-columns: 1fr; gap: 6px; }
    .kstat { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 10px; padding: 8px 12px; border-left-width: 4px; }
    .kstat-label { grid-column: 1; grid-row: 1; font-size: 12.5px; }
    .kstat-sub { grid-column: 1; grid-row: 2; }
    .kstat-val { grid-column: 2; grid-row: 1 / span 2; margin: 0; }
    .kstat-val span { font-size: 22px; }
}
@media (max-width: 420px) {
    .kalk-tab span:not(.material-symbols-outlined) { display: none; }
    .kalk-tab.is-on span:not(.material-symbols-outlined) { display: inline; }
}
#k-m1b-na { margin: -8px 0 12px; }

/* --- Utregningskort: formel, innsatte verdier og resultat --- */
.kfx { width: 100%; border-collapse: collapse; font-size: 13px; }
.kfx td { padding: 8px 2px; border-bottom: 1px solid #eef1f4; vertical-align: top; }
.kfx tr:last-child td { border-bottom: none; }
.kfx td:last-child { text-align: right; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; padding-left: 12px; }
.kfx-l { font-weight: 600; color: var(--k-text); }
.kfx-d { font-size: 11.5px; font-weight: 700; color: var(--k-brand); margin-bottom: 2px; }
.kfx-alt { font-weight: 500; color: var(--k-muted); }
/* Symboler og konstanter under utregningen */
.kfx-legend { display: grid; grid-template-columns: max-content 1fr; gap: 5px 12px; margin: 0; font-size: 12px; line-height: 1.4; }
.kfx-legend dt { font-weight: 700; color: var(--k-text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.kfx-legend dd { margin: 0; color: var(--k-muted); }
.kfx-legend sub, .kfx-d sub { font-size: 0.75em; }
@media (max-width: 600px) {
    .kfx-legend { grid-template-columns: 1fr; gap: 0; }
    .kfx-legend dd { margin-bottom: 6px; }
}
.kfx-f { margin-top: 2px; font-size: 12px; color: var(--k-muted); font-variant-numeric: tabular-nums; }
.kfx tr.is-total td { background: var(--k-brand-soft); }
.kfx tr.is-total td:first-child { border-radius: 6px 0 0 6px; padding-left: 8px; }
.kfx tr.is-total td:last-child { border-radius: 0 6px 6px 0; padding-right: 8px; color: var(--k-brand); }
.klink { border: none; background: none; padding: 0; color: var(--k-brand); font: inherit; text-decoration: underline; cursor: pointer; }
.kcard > .klink { font-size: 12.5px; font-weight: 600; margin-top: 4px; }

/* --- Containment-tabell som i regelverket --- */
.ktable-cont th.reg-grey:first-child { text-align: left; width: 34%; font-size: 11.5px; }
.ktable-cont .reg-pop-h { background: #f1f4f7; font-size: 11.5px; }
.ktable-cont td.rob-Low { background: #c8e6c9; }
.ktable-cont td.rob-Medium { background: #ffe0b2; }
.ktable-cont td.rob-High { background: #ef9a9a; }
.ktable-cont td.rob-OOS { background: #e0e0e0; color: #555; font-style: italic; }

/* --- Sammenleggbare utregningskort --- */
.kfold > summary {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin: -16px; padding: 16px; cursor: pointer; list-style: none; border-radius: 10px;
}
.kfold > summary::-webkit-details-marker { display: none; }
.kfold > summary:hover { background: #f7f9fb; }
.kfold > summary .material-symbols-outlined { font-size: 22px; color: var(--k-muted); transition: transform 0.15s; }
.kfold[open] > summary { margin-bottom: 0; border-radius: 10px 10px 0 0; }
.kfold[open] > summary .material-symbols-outlined { transform: rotate(180deg); }
.kfold[open] > summary + * { margin-top: 14px; }

/* Faste rader i sammenligningen (T0 og analytisk formel) */
.ktrade-static { display: block; width: 100%; text-align: left; font: inherit; color: inherit; }
.ktrade-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; font-size: 13px; }
.ktrade-row > .material-symbols-outlined { font-size: 20px; color: var(--k-muted); }
.ktrade-row .ktrade-name small { display: block; font-size: 11.5px; color: var(--k-muted); margin-top: 1px; }
.ktrade-static:first-child { background: #f7f9fb; }
.ktrade-an { cursor: pointer; background: var(--k-brand-soft); border-color: #c7dbee; }
.ktrade-an:hover { background: #dce9f5; }

/* --- Felles fartøydata øverst (samme plass i alle faner) ---
   Hvert tallfelt: etikett (og km/h-hint til høyre) på første linje, kompakt − verdi + [enhet]
   og glidebryteren side om side på andre linje. */
.kac-bar { margin-bottom: 16px; padding: 12px 16px 14px; }
.kac-bar .kcard-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.kac-bar .kcard-title .kico { width: 18px; height: 18px; color: var(--k-brand); }
.kac-note { margin-left: auto; font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--k-muted); }
.kac-grid { display: grid; grid-template-columns: auto repeat(3, minmax(0, 1fr)); gap: 10px 28px; align-items: start; }
.kac-grid .kf { margin-bottom: 0; }
.kac-lbl { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; margin-bottom: 6px; min-height: 22px; }
.kac-lbl label { min-width: 0; }
.kac-hint { margin: 0 0 0 auto; padding-left: 8px; white-space: nowrap; font-weight: 400; }
.kac-ctl { display: flex; align-items: center; gap: 14px; }
.kac-ctl .kf-num { flex: 0 0 auto; height: 34px; }
.kac-ctl .kf-num input { flex: 0 0 56px; width: 56px; font-size: 14px; }
.kac-ctl .kf-step { width: 30px; }
.kac-ctl .kf-unit { min-width: 28px; padding: 0 8px; font-size: 11.5px; }
.kac-ctl .kf-slider { flex: 1 1 auto; min-width: 50px; margin: 0 !important; }
.kac-grid .kseg-btn { min-height: 34px; }
.kf-first { margin: 0 0 12px; }

@media (max-width: 1100px) {
    .kac-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    .kac-bar { margin-bottom: 10px; }
    .kac-note { display: none; }
    .kac-grid { grid-template-columns: 1fr; gap: 12px; }
}

/* --- Sammenleggbare utregningskort --- */
.kfold > summary {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin: -16px; padding: 16px; cursor: pointer; list-style: none; border-radius: 10px;
}
.kfold > summary::-webkit-details-marker { display: none; }
.kfold > summary:hover { background: #f7f9fb; }
.kfold > summary .material-symbols-outlined { font-size: 22px; color: var(--k-muted); transition: transform 0.15s; }
.kfold[open] > summary { margin-bottom: 0; border-radius: 10px 10px 0 0; }
.kfold[open] > summary .material-symbols-outlined { transform: rotate(180deg); }
.kfold[open] > summary + * { margin-top: 14px; }

/* Faste rader i sammenligningen (T0 og analytisk formel) */
.ktrade-static { display: block; width: 100%; text-align: left; font: inherit; color: inherit; }
.ktrade-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; font-size: 13px; }
.ktrade-row > .material-symbols-outlined { font-size: 20px; color: var(--k-muted); }
.ktrade-row .ktrade-name small { display: block; font-size: 11.5px; color: var(--k-muted); margin-top: 1px; }
.ktrade-static:first-child { background: #f7f9fb; }
.ktrade-an { cursor: pointer; background: var(--k-brand-soft); border-color: #c7dbee; }
.ktrade-an:hover { background: #dce9f5; }

/* --- Felles fartøydata øverst (samme plass i alle faner) --- */
.kac-bar { margin-bottom: 16px; }
.kac-bar .kcard-title { display: flex; align-items: center; gap: 8px; }
.kac-bar .kcard-title .kico { width: 18px; height: 18px; color: var(--k-brand); }
.kac-note { margin-left: auto; font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--k-muted); }
.kac-grid { display: grid; grid-template-columns: minmax(230px, 1.15fr) repeat(3, minmax(0, 1fr)); gap: 10px 26px; align-items: start; }
.kac-grid .kf, .kac-grid .kf-inline { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.kac-grid .kf-row { flex-wrap: wrap; gap: 6px 12px; }
.kac-grid .kf-inline .kf-label { flex: 1 1 100%; }
.kac-grid .kf-inline .kf-num { flex: 1 1 100%; }
.kac-grid .kf-inline .kf-num input { flex: 1 1 auto; width: auto; }
.kf-first { margin: 0 0 12px; }

@media (max-width: 1100px) {
    .kac-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    .kac-bar { margin-bottom: 10px; }
    .kac-note { display: none; }
    .kac-grid { grid-template-columns: 1fr; gap: 0; }
    .kac-grid > .kf { padding: 10px 0; border-bottom: 1px solid #f0f2f5; }
    .kac-grid > .kf:first-child { padding-top: 0; }
    .kac-grid > .kf:last-child { border-bottom: none; padding-bottom: 0; }
    .kac-grid .kf-row { flex-wrap: nowrap; }
    .kac-grid .kf-inline .kf-label { flex: 1; }
    .kac-grid .kf-inline .kf-num { flex: 0 0 auto; }
    .kac-grid .kf-inline .kf-num input { flex: 0 0 62px; width: 62px; }
}

/* Tallfelt med glidebryter i fanene (samme oppsett som fartøystripen) */
.kcard > .kac-f, .kcard > div > .kac-f { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid #f0f2f5; }
.kcard > .kac-f:last-child, .kcard > div > .kac-f:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.kac-grid .kac-f { padding: 0; margin: 0; border: none; }
.kfold-sum { margin-left: 8px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--k-text); font-size: 12px; }

/* Fartøykortet øverst i venstre kolonne - kompakt */
.kac-side { border-color: #cfdfee; box-shadow: inset 3px 0 0 var(--k-brand); padding: 12px 16px; }
.kac-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.kac-head .kcard-title { display: flex; align-items: center; gap: 8px; margin: 0; }
.kac-head .kcard-title .kico { width: 18px; height: 18px; color: var(--k-brand); }
.kseg-sm .kseg-btn { min-height: 30px; padding: 4px 10px; font-size: 12px; gap: 5px; }
.kseg-sm .kseg-btn .kico, .kseg-sm .kseg-btn .material-symbols-outlined { width: 16px; height: 16px; font-size: 16px; }
.kac-side .kf-inline { padding-bottom: 8px; margin-bottom: 8px; }
.kac-side .kf-inline:last-child { padding-bottom: 0; margin-bottom: 0; }
.kac-kmh { text-align: right; margin-top: 2px; }

.ktable-reg .reg-cont-title { padding: 7px 8px; }
.ktable-reg .reg-cont-title b { display: block; font-size: 13px; }
.ktable-reg .reg-cont-title span { display: block; font-weight: 500; font-size: 11.5px; margin-top: 1px; }

/* --- Mitigeringstabellen (EAR tabell 5) med klikkbare celler --- */
.ktable-mit th.reg-pop { font-weight: 600; white-space: normal; font-size: 12px; }
.ktable-mit thead th.reg-pop { font-weight: 700; }
.ktable-mit td { width: 17%; }
.ktable-mit td.kmit-td { padding: 0; }
.kmit { display: block; width: 100%; min-height: 34px; border: none; background: none; cursor: pointer; font: 700 13px 'Open Sans', Arial, sans-serif; color: inherit; }
.kmit-td:not(.is-hit):not(.is-locked):hover { background: #fdf0e6; }
.kmit:focus-visible { outline: 2px solid var(--k-brand); outline-offset: -3px; }
.ktable-mit td.is-locked { background: #eceef1; }
.kmit:disabled { color: #a3aab4; cursor: not-allowed; text-decoration: line-through; }
.ktable-mit .kf-link { vertical-align: middle; }
#r-mit-table { margin-top: 0; }
#r-mit-table + .kf-hint { margin-top: 8px; }

/* --- Robusthetsnivåer (NR / L / M / H) --- */
.klvl { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.klvl-NR { background: #eceef1; color: #5f6b7a; }
.klvl-L { background: #c8e6c9; color: #1e6b35; }
.klvl-M { background: #ffe0b2; color: #8a5200; }
.klvl-H { background: #ef9a9a; color: #7d1c1c; }
.koso-cnt { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.kstat.koso-counts { border-left-color: var(--k-brand); }
.kbtn-ghost { background: #fff; border-color: #c7dbee; color: var(--k-brand); }
.kbtn-ghost:hover { background: var(--k-brand-soft); }
.kbtn[hidden] { display: none; }

/* --- OSO-tabellen (EAR tabell 14) --- */
.ktable-oso { font-size: 12.5px; }
.ktable-oso .koso-title { text-align: left; font-weight: 500; }
.ktable-oso .koso-id { white-space: nowrap; }
.ktable-oso td.klvl-NR { background: #f4f5f7; color: #7a8594; }
.ktable-oso td.klvl-L { background: #e3f3e4; }
.ktable-oso td.klvl-M { background: #fff0db; }
.ktable-oso td.klvl-H { background: #fbdcdc; }
.ktable-oso td.is-dim { opacity: 0.55; font-weight: 400; }
.ktable-oso td.is-sailcol { font-weight: 800; box-shadow: inset 0 0 0 2px rgba(3, 71, 127, 0.55); opacity: 1; }
.ktable-oso th.is-colhead { background: var(--k-brand); color: #fff; }
.ktable-oso .koso-dep { font-size: 11px; color: #3d4652; white-space: nowrap; }
.ktable-oso thead .koso-dep { font-weight: 700; white-space: normal; }
.ktable-oso thead .koso-dep small { font-weight: 500; }
.koso-row { cursor: pointer; }
.koso-row:hover td.koso-title, .koso-row:focus td.koso-title { background: var(--k-brand-soft); color: var(--k-brand); text-decoration: underline; }
.koso-row:focus { outline: 2px solid var(--k-brand); outline-offset: -2px; }

/* Klikkbare robusthetsceller i containment-tabellen */
.kcell-btn { border: none; background: none; width: 100%; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.kcell-btn:hover { text-decoration: underline; }

/* --- Vindu med kravtekst --- */
.kalk-modal {
    position: fixed; inset: 0; z-index: 1700; display: flex; align-items: center; justify-content: center;
    padding: 24px; box-sizing: border-box; background: rgba(15, 23, 42, 0.45); color: #1f2933;
}
.kalk-modal[hidden] { display: none; }
.kalk-modal-box {
    width: 100%; max-width: 1180px; max-height: 100%; display: flex; flex-direction: column;
    background: #fff; border-radius: 14px; box-shadow: 0 16px 50px rgba(0, 0, 0, 0.35); overflow: hidden;
    font-family: 'Open Sans', Arial, sans-serif;
}
.kalk-modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px; border-bottom: 1px solid #e1e6ed; }
.kalk-modal-head > div { flex: 1; min-width: 0; }
.kalk-modal-head h2 { margin: 0; font-size: 17px; line-height: 1.3; color: #03477F; }
.kalk-modal-sub { margin-top: 6px; font-size: 13px; color: #3d4652; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.kalk-modal .kalk-close { width: 36px; height: 36px; border-radius: 50%; border: none; background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #5f6b7a; flex-shrink: 0; }
.kalk-modal .kalk-close:hover { background: #eef1f5; }
.kalk-modal-body { overflow-y: auto; padding: 8px 20px 20px; -webkit-overflow-scrolling: touch; }
.kalk-modal .ksub { display: flex; align-items: center; gap: 6px; margin: 18px 0 6px; font-size: 12px; font-weight: 700; color: #5f6b7a; text-transform: uppercase; letter-spacing: 0.04em; }
.kalk-modal .knote { font-size: 12px; color: #5f6b7a; line-height: 1.45; margin: 12px 0 0; }
.kreq-sec { margin: 22px 0 4px; font-size: 15px; color: #1f2933; }
/* Vinduet om beredskapsmetodene */
.kalk-modal-box.kalk-modal-narrow { max-width: 760px; }
.kalk-modal-narrow .kreq-sec { display: flex; align-items: center; gap: 6px; }
.kalk-modal-narrow .kreq-sec .material-symbols-outlined { font-size: 20px; color: #03477F; }
.kcvm-case { font-size: 13px; line-height: 1.5; margin-top: 10px; padding: 8px 10px; border-radius: 6px; border: 1px solid #e1e6ed; color: #1f2933; }
.kcvm-case.is-on { border-color: #03477F; background: #e7f0f8; }
.kcvm-cmp th[scope="row"] { text-align: left; }
.kcvm-cmp tr.is-on th, .kcvm-cmp tr.is-on td { background: #e7f0f8; }
.kcvm-cmp small { font-weight: 500; }
.kreq-intro, .kreq-foot { font-size: 13px; line-height: 1.5; margin-top: 12px; color: #1f2933; }
.kreq-foot { font-size: 12px; color: #5f6b7a; }
.ktable-req { font-size: 12.5px; line-height: 1.45; }
.ktable-req th, .ktable-req td { text-align: left; vertical-align: top; padding: 8px 10px; }
.ktable-req tbody th { width: 17%; font-weight: 700; }
.ktable-req td { width: 27%; }
.ktable-req td.is-req { background: #fff6e8; box-shadow: inset 3px 0 0 #F06C00; }
.ktable-req th.is-reqhead { background: #F06C00; color: #fff; }
.ktable-req a { color: #03477F; word-break: break-all; }
@media (max-width: 768px) {
    .kalk-modal { padding: 0; }
    .kalk-modal-box { border-radius: 0; height: 100%; }
    .ktable-req { min-width: 640px; }
}
@media (max-width: 768px) {
    .ktable-oso { min-width: 620px; }
    .ktable-oso .koso-title { min-width: 170px; }
}

/* --- Underfaner (GRC: steg 2 og 3, ARC: steg 4, 5 og 6) - fanestil under hovedfanene --- */
.ksubtabs {
    display: flex; gap: 4px; margin: -4px 0 16px; padding: 0 2px; border-bottom: 1px solid #c9d1dc;
    overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.ksubtabs::-webkit-scrollbar { display: none; }
/* Hver underfane som en «mappefane» med omriss; den valgte smelter sammen med innholdet under */
.ksubtab {
    display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; padding: 8px 14px 8px; margin-bottom: -1px;
    border: 1px solid #d5dce5; border-bottom-color: #c9d1dc; border-radius: 8px 8px 0 0;
    background: #e6ebf1; cursor: pointer; white-space: nowrap;
    font-family: 'Open Sans', Arial, sans-serif; color: var(--k-muted);
}
.ksubtab small { font-size: 11px; font-weight: 600; color: #7d8898; }
.ksubtab-name { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; }
.ksubtab-name .material-symbols-outlined { font-size: 18px; }
.ksubtab .karc-tag { font-size: 10.5px; padding: 1px 7px; }
.ksubtab:hover:not(.is-on) { color: var(--k-text); background: #eef2f6; }
.ksubtab.is-on {
    color: var(--k-brand); background: var(--k-bg); border-color: #c9d1dc; border-bottom-color: var(--k-bg);
    box-shadow: inset 0 3px 0 var(--k-brand);
}
.ksubtab.is-on small { color: var(--k-brand); }
.ksubtab:focus-visible { outline: 2px solid var(--k-brand); outline-offset: -2px; }
.ksubpane[hidden] { display: none; }
.karc-bg-none { background: var(--k-brand); }

/* Kategorier av strategiske mitigeringer */
.kcats { display: flex; flex-direction: column; gap: 8px; }
.kcat { padding: 10px 12px; border: 1px solid var(--k-line); border-left: 5px solid var(--k-brand); border-radius: 8px; font-size: 12.5px; line-height: 1.45; color: #3d4652; }
.kcat-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; color: var(--k-text); }
.kcat-head .material-symbols-outlined { font-size: 20px; color: var(--k-brand); }
.kcat-head b { font-size: 13px; }
.kcat-head small { margin-left: auto; font-size: 11px; color: var(--k-muted); white-space: nowrap; }
.kcat p { margin: 4px 0 0; }
.kcat p b { color: var(--k-text); }
#r-red-other .kf-hint { margin: 0; font-size: 12px; }

/* Taktisk mitigering: krav som definisjonsliste */
.ktm { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0 14px; font-size: 13px; line-height: 1.45; }
.ktm dt { font-weight: 700; padding: 7px 0; border-bottom: 1px solid #eef1f4; }
.ktm dd { margin: 0; padding: 7px 0; border-bottom: 1px solid #eef1f4; color: #3d4652; }
.ktm dt:last-of-type, .ktm dd:last-of-type { border-bottom: none; }
.klist { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.5; color: #3d4652; }
.klist li + li { margin-top: 4px; }

@media (max-width: 600px) {
    .ksubtabs { margin: -2px -12px 10px; padding: 0 8px; }
    .ksubtab { padding: 7px 8px 8px; gap: 5px; }
    .ksubtab small { display: none; }
    .ksubtab-name .material-symbols-outlined { display: none; }
    .ksubtab-name { font-size: 12.5px; }
    .ktm { grid-template-columns: minmax(0, 1fr); }
    .ktm dt { border-bottom: none; padding-bottom: 0; }
}

/* Befolkningstetthet: EAR tabell 2 med klikkbare rader */
.kpop-wrap { margin-top: 6px; }
.kpop { font-size: 12px; }
.kpop th, .kpop td { text-align: left; vertical-align: top; }
.kpop tbody th.reg-pop { white-space: nowrap; font-weight: 700; }
.kpop tbody td:nth-child(2) { font-weight: 600; width: 30%; }
.kpop-row { cursor: pointer; }
.kpop-row:hover td, .kpop-row:focus td { background: #fdf0e6; }
.kpop-row:focus { outline: 2px solid var(--k-brand); outline-offset: -2px; }
.kpop-row.is-on th, .kpop-row.is-on td { background: #F06C00; color: #fff; }

/* Lenker til SORA-veilederen */
.kguide { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding: 9px 12px; border-radius: 8px; background: #f7f9fb; border: 1px solid var(--k-line); font-size: 12.5px; line-height: 1.5; }
.kguide > .material-symbols-outlined { font-size: 18px; color: var(--k-brand); }
.kguide a { color: var(--k-brand); font-weight: 600; }
.kguide small { font-size: 11.5px; color: var(--k-muted); }

/* Verdimerke for GRC i underfanene (samme farger som GRC-merkene) */
.kgrc-tag { background: #9aa3ad; }
.kgrc-tag.kg-1, .kgrc-tag.kg-2 { background: #2e9e4f; }
.kgrc-tag.kg-3, .kgrc-tag.kg-4 { background: #a8a000; }
.kgrc-tag.kg-5, .kgrc-tag.kg-6 { background: #f08c00; }
.kgrc-tag.kg-7, .kgrc-tag.kg-8, .kgrc-tag.kg-9, .kgrc-tag.kg-10 { background: #d63939; }

/* Klikkbare navn i mitigeringstabellen (åpner kravene fra Annex B) */
.kreq-btn { border: none; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.kreq-btn:hover { color: var(--k-brand); text-decoration: underline; }
.kreq-btn:focus-visible { outline: 2px solid var(--k-brand); outline-offset: 2px; }

/* --- Oversikt: nøktern oppsummering --- */
.ksum-top .kcard-title { margin-bottom: 6px; }
.ksum-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 14px; }
.ksum-pair { display: flex; align-items: center; gap: 6px; }
.ksum-step { min-width: 96px; padding: 8px 14px; border: 1px solid var(--k-line); border-radius: 8px; background: #f7f9fb; }
.ksum-step small { display: block; font-size: 11px; font-weight: 600; color: var(--k-muted); }
.ksum-step b { font-size: 20px; line-height: 1.25; color: var(--k-text); font-variant-numeric: tabular-nums; }
.ksum-step.is-sail { border-color: var(--k-brand); background: var(--k-brand-soft); }
.ksum-step.is-sail b { color: var(--k-brand); }
.ksum-arrow { display: inline-flex; color: #9aa3ad; }
.ksum-arrow .material-symbols-outlined { font-size: 20px; }
.ksum-arrow-big .material-symbols-outlined { font-size: 26px; color: var(--k-brand); }
.ksum-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.ksum-sec { background: #fff; border: 1px solid var(--k-line); border-radius: 10px; padding: 16px; }
.ksum-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ksum-head h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--k-muted); }
.ksum-head h3 .material-symbols-outlined { font-size: 18px; color: var(--k-brand); }
.ksum-head .klink { font-size: 12px; font-weight: 600; }
.ksum-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.ksum-tbl + .ksum-tbl { margin-top: 12px; }
.ksum-tbl th, .ksum-tbl td { padding: 7px 4px; border-bottom: 1px solid #eef1f4; vertical-align: top; text-align: left; }
.ksum-tbl tbody th, .ksum-tbl > tr > th, .ksum-tbl tr > th[scope="row"] { width: 46%; font-weight: 500; color: #3d4652; }
.ksum-tbl td { font-weight: 600; color: var(--k-text); }
.ksum-tbl td small { display: block; margin-top: 1px; font-size: 11.5px; font-weight: 400; color: var(--k-muted); line-height: 1.4; }
.ksum-tbl sub { font-size: 0.75em; }
.ksum-cols thead th { padding-top: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--k-muted); border-bottom: 1px solid #d5dce5; }
.ksum-cols tbody th { width: 46%; }
.ksum-num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ksum-total th, .ksum-total td { background: #f4f6f9; border-bottom: none; }
.ksum-total th { font-weight: 700 !important; color: var(--k-text) !important; padding-left: 8px; border-radius: 6px 0 0 6px; }
.ksum-total td { font-size: 15px; padding-right: 8px; border-radius: 0 6px 6px 0; }
.ksum-lvl { display: inline-block; margin-right: 10px; font-weight: 500; color: #3d4652; }
.ksum-lvl b { color: var(--k-text); }
@media (max-width: 900px) {
    .ksum-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
    .ksum-step { min-width: 0; padding: 6px 10px; }
    .ksum-step b { font-size: 17px; }
}

/* Oversikt: dempede nivåfarger (1 grønn, 2 gul, 3 oransje, 4 rød) */
.ksum-step.lv-1 { border-left: 4px solid #2e9e4f; background: #f1f8f3; }
.ksum-step.lv-2 { border-left: 4px solid #a8a000; background: #f9f9ec; }
.ksum-step.lv-3 { border-left: 4px solid #e08a1e; background: #fdf5ea; }
.ksum-step.lv-4 { border-left: 4px solid #c94a4a; background: #fbf1f1; }
.ksum-step.is-sail { border-width: 1px 1px 1px 4px; border-style: solid; }
.ksum-step.is-sail.lv-1 { border-color: #b9dcc4 #b9dcc4 #b9dcc4 #2e9e4f; }
.ksum-step.is-sail.lv-3 { border-color: #f0d2a8 #f0d2a8 #f0d2a8 #e08a1e; }
.ksum-step.is-sail.lv-4 { border-color: #e8c0c0 #e8c0c0 #e8c0c0 #c94a4a; }
.ksum-step.is-sail b { color: var(--k-text); }
.ksum-pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-weight: 700; border: 1px solid transparent; }
.ksum-pill.lv-1 { background: #eaf6ee; color: #1e6b35; border-color: #c6e5cf; }
.ksum-pill.lv-2 { background: #f6f6e2; color: #626000; border-color: #e3e2b5; }
.ksum-pill.lv-3 { background: #fdf1e1; color: #8a5200; border-color: #f2d6ae; }
.ksum-pill.lv-4 { background: #fbecec; color: #9c2323; border-color: #efc9c9; }

/* VLOS-fanen står for seg selv helt til høyre - et hjelpeverktøy, ikke et SORA-steg */
.kalk-tab-aside { margin-left: auto; position: relative; }
.kalk-tab-aside::before { content: ''; position: absolute; left: -6px; top: 8px; bottom: 10px; border-left: 1px solid var(--k-line); }

/* Visninger i underfanen Iboende GRC (tredje nivå): iGRC-tabell / kritisk areal (valgfritt) */
.kviews { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }
.kview {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
    border: 1px solid #cfd6df; background: #fff; font: 600 12.5px 'Open Sans', Arial, sans-serif; color: #4a5563;
}
.kview .material-symbols-outlined { font-size: 17px; }
.kview-val { font-size: 11px; font-weight: 700; color: var(--k-muted); padding-left: 6px; border-left: 1px solid #dde2e8; }
.kview-val:empty { display: none; }
.kview-val sub { font-size: 0.75em; }
.kview:hover:not(.is-on) { background: #f4f6f9; color: var(--k-text); }
.kview.is-on { background: var(--k-brand); border-color: var(--k-brand); color: #fff; }
.kview.is-on .kview-val { color: #d6e4f1; border-left-color: rgba(255, 255, 255, 0.35); }
.kview:focus-visible { outline: 2px solid var(--k-brand); outline-offset: 2px; }
[data-igrcview][hidden] { display: none; }

/* Sammenligning av iGRC-metoder: «Bruk» velger metoden, valgt rad er markert */
.kuse {
    flex-shrink: 0; padding: 3px 11px; border-radius: 999px; border: 1px solid #c7dbee; background: #fff; cursor: pointer;
    font: 600 11.5px 'Open Sans', Arial, sans-serif; color: var(--k-brand);
}
.kuse:hover:not(:disabled):not(.is-on) { background: var(--k-brand-soft); }
.kuse.is-on { background: var(--k-brand); border-color: var(--k-brand); color: #fff; cursor: default; }
.kuse:disabled { opacity: 0.4; cursor: not-allowed; }
.kuse:focus-visible { outline: 2px solid var(--k-brand); outline-offset: 2px; }
.ktrade.is-used { border-color: var(--k-brand); box-shadow: inset 3px 0 0 var(--k-brand); }
.ktrade-link { border: none; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.ktrade-link:hover { color: var(--k-brand); }
.ktrade-link:hover > small { text-decoration: none; }
div.ktrade-an { cursor: default; }
div.ktrade-an:hover { background: var(--k-brand-soft); }

/* Hakk under glidebryteren (f.eks. 120 m og hver 1000 ft for flygehøyden). Innrykket på 8 px tilsvarer
   halve bredden av håndtaket, slik at merkene står der håndtaket står for verdien. */
.kf-slider-wrap { position: relative; width: 100%; }
.kac-ctl .kf-slider-wrap { flex: 1 1 auto; min-width: 50px; }
.kf-ticks { position: absolute; left: 8px; right: 8px; bottom: -7px; height: 6px; pointer-events: none; }
.kf-ticks i { position: absolute; left: calc(var(--p) * 100%); width: 2px; height: 6px; margin-left: -1px; background: #7d8a97; border-radius: 1px; }
