/* =========================================================
   PRUJSA – WORK INSTRUCTIONS
   Gemensam bakgrund för hela arbetsinstruktionsdelen
   ========================================================= */

.wi-page,
.wi-shell,
.work-instruction-page{
    position: relative;
}

/*
 * Bakgrunden läggs på body när sidan har klassen
 * work-instructions-active.
 */
body.work-instructions-active{
    background:
        linear-gradient(
            rgba(248,250,252,.72),
            rgba(248,250,252,.72)
        ),
        url("/static/img/work_instructions/wi.png")
        center top / cover fixed no-repeat !important;
}

/* Låt respektive instruktionsyta vara transparent
   så blueprint-bakgrunden kan synas igenom. */
body.work-instructions-active .wi-page,
body.work-instructions-active .wi-shell,
body.work-instructions-active .work-instruction-page{
    background: transparent !important;
}

/* =========================================================
   Arbetsinstruktioner
   Dölj Prujsas globala P-vattenstämpel i denna modul
   ========================================================= */

body.work-instructions-active::before,
body.work-instructions-active::after{
    content:none !important;
    display:none !important;
    background:none !important;
}

/* Dölj lokala WI-vattenstämplar i Work Instructions */
body.work-instructions-active .wi-page::before,
body.work-instructions-active .wi-page::after{
    content:none !important;
    display:none !important;
}

/* =========================================================
   Work Instructions
   Den riktiga wi.png-bakgrunden används nu.
   Dölj gamla CSS-genererade vattenstämplar/ritningsdetaljer.
   ========================================================= */

body.work-instructions-active .wi-page::before,
body.work-instructions-active .wi-page::after,
body.work-instructions-active .wi-blueprint,
body.work-instructions-active .blueprint-circle-one,
body.work-instructions-active .blueprint-circle-two,
body.work-instructions-active .blueprint-line-one{
    content:none !important;
    display:none !important;
    background:none !important;
    border:none !important;
    box-shadow:none !important;
}

.wi-document-dashboard{
    display:grid;
    grid-template-columns:repeat(5, minmax(120px,1fr));
    gap:12px;
    margin:0 0 24px;
}

.wi-stat{
    padding:16px 18px;
    border:1px solid rgba(203,213,225,.8);
    border-radius:14px;
    background:rgba(255,255,255,.82);
    backdrop-filter:blur(10px);
    box-shadow:0 8px 24px rgba(15,23,42,.035);
}

.wi-stat-value{
    font-size:25px;
    font-weight:850;
    color:#172033;
    margin-bottom:7px;
}

.wi-stat-label{
    font-size:12px;
    font-weight:700;
    color:#64748b;
    text-transform:uppercase;
    letter-spacing:.055em;
}

.wi-stat-active{
    border-top:3px solid #16a34a;
}

.wi-stat-draft{
    border-top:3px solid #d97706;
}

.wi-stat-confidential{
    border-top:3px solid #dc2626;
}

@media(max-width:850px){
    .wi-document-dashboard{
        grid-template-columns:repeat(2,1fr);
    }
}

@media(max-width:480px){
    .wi-document-dashboard{
        grid-template-columns:1fr;
    }
}

/* =========================================================
   Arbetsinstruktioner – Tabeller & matriser
   ========================================================= */

.wi-section-heading{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:20px;
    margin-bottom:18px;
}

.wi-section-heading h2{
    margin-bottom:5px;
}

.wi-section-help{
    margin:0;
    color:#64748b;
    font-size:13px;
    line-height:1.5;
}

.wi-table-create-form{
    display:grid;
    grid-template-columns:minmax(240px,1fr) 210px auto;
    gap:10px;
    margin-bottom:22px;
}

.wi-table-create-form input,
.wi-table-create-form select{
    min-height:42px;
    border:1px solid #d5dce7;
    border-radius:10px;
    background:#fff;
    padding:0 12px;
    font:inherit;
    color:#172033;
}

.wi-tables{
    display:flex;
    flex-direction:column;
    gap:20px;
}

.wi-table-card{
    overflow:hidden;
    border:1px solid #d8dee8;
    border-radius:14px;
    background:rgba(255,255,255,.88);
}

.wi-table-header{
    padding:16px 18px;
    border-bottom:1px solid #e2e8f0;
}

.wi-table-header h3{
    margin:3px 0 0;
    font-size:17px;
    color:#172033;
}

.wi-table-type{
    font-size:10px;
    font-weight:800;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:#64748b;
}

.wi-table-scroll{
    width:100%;
    overflow-x:auto;
}

.wi-matrix{
    width:100%;
    min-width:900px;
    border-collapse:collapse;
    table-layout:fixed;
}

.wi-matrix td{
    padding:12px;
    border-right:1px solid #d8dee8;
    border-bottom:1px solid #d8dee8;
    vertical-align:top;
    font-size:13px;
    line-height:1.5;
    white-space:pre-wrap;
}

.wi-matrix td:last-child{
    border-right:0;
}

.wi-matrix-heading td{
    background:#edf2f7;
    font-weight:750;
    color:#172033;
}

.wi-row-form{
    padding:16px;
    background:#f8fafc;
}

.wi-row-grid{
    display:grid;
    grid-template-columns:repeat(5,1fr);
    gap:8px;
}

.wi-row-grid textarea{
    width:100%;
    box-sizing:border-box;
    resize:vertical;
    min-height:85px;
    padding:9px;
    border:1px solid #d5dce7;
    border-radius:8px;
    background:white;
    font:inherit;
    font-size:12px;
}

.wi-add-row{
    margin-top:10px;
    background:white;
    cursor:pointer;
}

.wi-table-empty{
    padding:18px;
    border:1px dashed #cbd5e1;
    border-radius:12px;
    color:#64748b;
    text-align:center;
    background:rgba(255,255,255,.55);
}

@media(max-width:800px){
    .wi-table-create-form{
        grid-template-columns:1fr;
    }

    .wi-row-grid{
        grid-template-columns:1fr;
    }
}

/* =========================================================
   Work Instructions – sök & filter
   ========================================================= */

.wi-filterbar{
    display:grid;
    grid-template-columns:minmax(280px,1fr) 180px 220px 190px;
    gap:10px;
    margin:0 0 22px;
    padding:12px;
    border:1px solid rgba(203,213,225,.8);
    border-radius:14px;
    background:rgba(255,255,255,.86);
    backdrop-filter:blur(10px);
    box-shadow:0 8px 24px rgba(15,23,42,.035);
}

.wi-filterbar input,
.wi-filterbar select{
    width:100%;
    box-sizing:border-box;
    min-height:42px;
    border:1px solid #d7deea;
    border-radius:10px;
    background:#fff;
    padding:0 12px;
    font:inherit;
    color:#172033;
}

.wi-filterbar input:focus,
.wi-filterbar select:focus{
    outline:none;
    border-color:#93b4ef;
    box-shadow:0 0 0 3px rgba(37,99,235,.08);
}

@media(max-width:950px){
    .wi-filterbar{
        grid-template-columns:1fr 1fr;
    }
}

@media(max-width:560px){
    .wi-filterbar{
        grid-template-columns:1fr;
    }
}


/* =========================================================
   Arbetsinstruktioner – detaljerad dokumentlista
   ========================================================= */

.wi-filterbar{
    grid-template-columns:
        minmax(240px,1fr)
        165px
        200px
        170px
        auto;
}

.wi-view-switch{
    display:flex;
    gap:5px;
    padding:3px;
    border:1px solid #d7deea;
    border-radius:10px;
    background:#f8fafc;
}

.wi-view-btn{
    min-height:34px;
    padding:0 11px;
    border:0;
    border-radius:7px;
    background:transparent;
    color:#64748b;
    font:inherit;
    font-size:12px;
    font-weight:700;
    cursor:pointer;
    white-space:nowrap;
}

.wi-view-btn.active{
    background:#fff;
    color:#172033;
    box-shadow:0 1px 4px rgba(15,23,42,.12);
}


/* Lista är standard */

.instruction-grid{
    display:none;
}

.wi-document-list{
    overflow:hidden;
    border:1px solid #d8dee8;
    border-radius:14px;
    background:rgba(255,255,255,.90);
    box-shadow:0 8px 24px rgba(15,23,42,.04);
}

.wi-list-header,
.wi-list-row{
    display:grid;
    grid-template-columns:
        105px
        minmax(260px,2fr)
        110px
        125px
        75px
        115px
        155px;
    gap:14px;
    align-items:center;
}

.wi-list-header{
    padding:11px 16px;
    background:#f1f5f9;
    border-bottom:1px solid #d8dee8;
    color:#64748b;
    font-size:10px;
    font-weight:800;
    letter-spacing:.055em;
    text-transform:uppercase;
}

.wi-list-row{
    padding:15px 16px;
    border-bottom:1px solid #e8edf3;
    color:#334155;
    text-decoration:none;
    font-size:12px;
    transition:
        background .15s ease,
        transform .15s ease;
}

.wi-list-row:last-child{
    border-bottom:0;
}

.wi-list-row:hover{
    background:#f8fafc;
}

.wi-list-id{
    font-family:monospace;
    font-size:12px;
    font-weight:700;
    color:#64748b;
}

.wi-list-main strong{
    display:block;
    color:#172033;
    font-size:13px;
    line-height:1.4;
}

.wi-list-sub{
    margin-top:4px;
    color:#7c8799;
    font-size:11px;
    line-height:1.4;
}

.wi-list-status,
.wi-list-classification{
    display:inline-flex;
    align-items:center;
    padding:4px 8px;
    border-radius:999px;
    font-size:10px;
    font-weight:750;
    white-space:nowrap;
}

.wi-status-active{
    background:#ecfdf5;
    color:#047857;
}

.wi-status-draft{
    background:#fff7ed;
    color:#c2410c;
}

.wi-status-archived{
    background:#f1f5f9;
    color:#64748b;
}

.wi-list-classification{
    background:#eef2ff;
    color:#475569;
}

.wi-list-version{
    font-weight:750;
}

.wi-list-updated{
    color:#64748b;
}


/* Kortläge */

body.wi-card-mode .wi-document-list{
    display:none;
}

body.wi-card-mode .instruction-grid{
    display:grid;
}


/* Listläge */

body.wi-list-mode .wi-document-list{
    display:block;
}

body.wi-list-mode .instruction-grid{
    display:none;
}


@media(max-width:1100px){

    .wi-document-list{
        overflow-x:auto;
    }

    .wi-list-header,
    .wi-list-row{
        min-width:1050px;
    }

    .wi-filterbar{
        grid-template-columns:1fr 1fr;
    }
}

@media(max-width:600px){

    .wi-filterbar{
        grid-template-columns:1fr;
    }

    .wi-view-switch{
        width:max-content;
    }
}

/* =========================================================
   Arbetsinstruktioner – Symbolcenter
   ========================================================= */

.wi-selected-symbols{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    margin-bottom:16px;
}

.wi-selected-symbol{
    position:relative;
    display:flex;
    align-items:center;
    gap:10px;
    min-width:180px;
    padding:9px 38px 9px 9px;
    border:1px solid #d8dee8;
    border-radius:12px;
    background:rgba(255,255,255,.9);
}

.wi-selected-symbol img{
    width:44px;
    height:44px;
    object-fit:contain;
}

.wi-selected-symbol-info{
    display:flex;
    flex-direction:column;
    min-width:0;
}

.wi-selected-symbol-info strong{
    font-size:12px;
    color:#172033;
}

.wi-selected-symbol-info span{
    margin-top:2px;
    font-size:10px;
    color:#64748b;
}

.wi-symbol-remove{
    position:absolute;
    right:7px;
    top:7px;
    width:25px;
    height:25px;
    border:0;
    border-radius:7px;
    background:#f1f5f9;
    color:#64748b;
    font-size:18px;
    line-height:1;
    cursor:pointer;
}

.wi-symbol-empty{
    padding:14px;
    margin-bottom:15px;
    border:1px dashed #cbd5e1;
    border-radius:10px;
    background:rgba(255,255,255,.5);
    color:#64748b;
    font-size:12px;
}

.wi-symbol-picker{
    border:1px solid #d8dee8;
    border-radius:12px;
    overflow:hidden;
    background:rgba(255,255,255,.78);
}

.wi-symbol-picker summary{
    padding:12px 15px;
    font-size:13px;
    font-weight:750;
    color:#172033;
    cursor:pointer;
    user-select:none;
}

.wi-symbol-picker-body{
    padding:14px;
    border-top:1px solid #e2e8f0;
}

.wi-symbol-toolbar{
    display:grid;
    grid-template-columns:minmax(240px,1fr) 220px;
    gap:10px;
    margin-bottom:14px;
}

.wi-symbol-toolbar input,
.wi-symbol-toolbar select{
    width:100%;
    box-sizing:border-box;
    min-height:40px;
    padding:0 11px;
    border:1px solid #d5dce7;
    border-radius:9px;
    background:#fff;
    color:#172033;
    font:inherit;
}

.wi-symbol-grid{
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(145px,1fr));
    gap:10px;
    max-height:520px;
    overflow:auto;
}

.wi-symbol-option{
    margin:0;
}

.wi-symbol-option button{
    width:100%;
    min-height:135px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:6px;
    padding:11px;
    border:1px solid #d8dee8;
    border-radius:11px;
    background:#fff;
    color:#172033;
    cursor:pointer;
    transition:.15s ease;
}

.wi-symbol-option button:hover{
    transform:translateY(-2px);
    border-color:#9db8e8;
    box-shadow:0 6px 16px rgba(15,23,42,.07);
}

.wi-symbol-option img{
    width:62px;
    height:62px;
    object-fit:contain;
}

.wi-symbol-name{
    font-size:11px;
    font-weight:750;
    text-align:center;
}

.wi-symbol-category{
    font-size:9px;
    color:#64748b;
    text-align:center;
}

@media(max-width:650px){
    .wi-symbol-toolbar{
        grid-template-columns:1fr;
    }
}

/* Symboler i dokumentlistan */

.wi-list-symbols{
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:5px;
    margin-top:7px;
}

.wi-list-symbols img{
    width:26px;
    height:26px;
    object-fit:contain;
    padding:2px;
    border:1px solid rgba(203,213,225,.75);
    border-radius:6px;
    background:rgba(255,255,255,.9);
}

.wi-list-symbol-more{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:26px;
    height:26px;
    padding:0 5px;
    border-radius:6px;
    background:#f1f5f9;
    color:#64748b;
    font-size:10px;
    font-weight:750;
}

.wi-list-category{
    display:inline-flex;
    width:max-content;
    margin-top:6px;
    padding:3px 7px;
    border-radius:999px;
    background:#f1f5f9;
    color:#475569;
    font-size:9px;
    font-weight:750;
    letter-spacing:.02em;
}


/* =========================================================
   Ny arbetsinstruktion – Symbolcenter
   ========================================================= */

.wi-symbol-form-help{
    margin:-7px 0 16px;
    color:#64748b;
    font-size:13px;
    line-height:1.5;
}

.wi-new-symbol-grid{
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(145px,1fr));
    gap:10px;
    max-height:480px;
    overflow:auto;
    padding:3px;
}

.wi-new-symbol-option{
    display:block;
    margin:0;
    cursor:pointer;
}

.wi-new-symbol-option > input{
    position:absolute;
    opacity:0;
    pointer-events:none;
}

.wi-new-symbol-card{
    position:relative;
    display:flex;
    flex-direction:column;
    align-items:center;
    min-height:150px;
    padding:13px 10px 11px;
    box-sizing:border-box;

    border:1px solid #d8dee8;
    border-radius:12px;
    background:#fff;

    transition:
        border-color .15s ease,
        box-shadow .15s ease,
        transform .15s ease,
        background .15s ease;
}

.wi-new-symbol-option:hover .wi-new-symbol-card{
    transform:translateY(-1px);
    border-color:#94a3b8;
    box-shadow:0 5px 14px rgba(15,23,42,.08);
}

.wi-new-symbol-image{
    height:78px;
    display:flex;
    align-items:center;
    justify-content:center;
}

.wi-new-symbol-image img{
    display:block;
    max-width:72px;
    max-height:72px;
    object-fit:contain;
}

.wi-new-symbol-info{
    display:block;
    width:100%;
    margin-top:8px;
    text-align:center;
}

.wi-new-symbol-info strong{
    display:block;
    color:#172033;
    font-size:12px;
    line-height:1.3;
}

.wi-new-symbol-info small{
    display:block;
    margin-top:3px;
    color:#64748b;
    font-size:10px;
}

.wi-new-symbol-check{
    position:absolute;
    top:7px;
    right:7px;

    width:22px;
    height:22px;

    display:flex;
    align-items:center;
    justify-content:center;

    border-radius:50%;
    background:#e2e8f0;
    color:#94a3b8;

    font-size:12px;
    font-weight:900;
}

.wi-new-symbol-option > input:checked + .wi-new-symbol-card{
    border-color:#2563eb;
    background:#eff6ff;
    box-shadow:0 0 0 2px rgba(37,99,235,.10);
}

.wi-new-symbol-option > input:checked +
.wi-new-symbol-card .wi-new-symbol-check{
    background:#2563eb;
    color:#fff;
}

@media(max-width:600px){
    .wi-new-symbol-grid{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }
}


/* =========================================================
   FIX – Symbolcenter synlighet i Ny arbetsinstruktion
   ========================================================= */

body.work-instructions-active
.wi-new-symbol-section
.wi-new-symbol-grid{
    display:grid !important;
    visibility:visible !important;
    opacity:1 !important;
    height:auto !important;
    min-height:160px !important;
    max-height:520px !important;
    overflow-y:auto !important;
    overflow-x:hidden !important;

    grid-template-columns:
        repeat(auto-fill,minmax(145px,1fr)) !important;

    gap:10px !important;
    margin-top:14px !important;
    padding:4px !important;
}

body.work-instructions-active
.wi-new-symbol-section
.wi-new-symbol-option{
    display:block !important;
    visibility:visible !important;
    opacity:1 !important;
    position:relative !important;
    width:auto !important;
    height:auto !important;
    min-height:150px !important;
}

body.work-instructions-active
.wi-new-symbol-section
.wi-new-symbol-card{
    display:flex !important;
    visibility:visible !important;
    opacity:1 !important;

    width:100% !important;
    min-height:150px !important;

    flex-direction:column !important;
    align-items:center !important;
    justify-content:center !important;

    box-sizing:border-box !important;
}

body.work-instructions-active
.wi-new-symbol-section
.wi-new-symbol-image{
    display:flex !important;
    visibility:visible !important;
    opacity:1 !important;
}

body.work-instructions-active
.wi-new-symbol-section
.wi-new-symbol-image img{
    display:block !important;
    visibility:visible !important;
    opacity:1 !important;
}

body.work-instructions-active
.wi-new-symbol-section
.wi-new-symbol-info{
    display:block !important;
    visibility:visible !important;
    opacity:1 !important;
}

body.work-instructions-active
.wi-new-symbol-section
.wi-new-symbol-option > input[type="checkbox"]{
    position:absolute !important;
    opacity:0 !important;
    width:1px !important;
    height:1px !important;
}

@media(max-width:600px){
    body.work-instructions-active
    .wi-new-symbol-section
    .wi-new-symbol-grid{
        grid-template-columns:
            repeat(2,minmax(0,1fr)) !important;
    }
}


/* =========================================================
   Arbetsinstruktion – automatiska symbolförslag
   ========================================================= */

.wi-symbol-toolbar{
    grid-template-columns:
        minmax(240px,1fr)
        220px
        auto;
}

.wi-symbol-suggest-btn{
    min-height:40px;
    padding:0 14px;
    border:1px solid #c7d2fe;
    border-radius:9px;
    background:#eef2ff;
    color:#3730a3;
    font-weight:750;
    cursor:pointer;
    white-space:nowrap;
}

.wi-symbol-suggest-btn:hover{
    background:#e0e7ff;
}

.wi-symbol-suggestions{
    margin:0 0 15px;
    padding:12px;
    border:1px solid #c7d2fe;
    border-radius:12px;
    background:rgba(238,242,255,.72);
}

.wi-suggestion-heading{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
    margin-bottom:10px;
    color:#3730a3;
    font-size:12px;
}

.wi-suggestion-heading span{
    color:#6366f1;
    font-size:10px;
}

.wi-symbol-suggestion{
    width:100%;
    display:grid;
    grid-template-columns:42px 1fr 26px;
    align-items:center;
    gap:10px;

    margin-top:7px;
    padding:8px 10px;

    border:1px solid #d8dee8;
    border-radius:10px;

    background:#fff;
    color:#172033;

    text-align:left;
    cursor:pointer;
}

.wi-symbol-suggestion img{
    width:38px;
    height:38px;
    object-fit:contain;
}

.wi-symbol-suggestion strong{
    display:block;
    font-size:12px;
}

.wi-symbol-suggestion small{
    display:block;
    margin-top:2px;
    color:#64748b;
    font-size:10px;
    line-height:1.35;
}

.wi-symbol-suggestion b{
    display:flex;
    align-items:center;
    justify-content:center;

    width:24px;
    height:24px;

    border-radius:50%;
    background:#e2e8f0;
}

.wi-symbol-suggestion.selected{
    border-color:#2563eb;
    background:#eff6ff;
}

.wi-symbol-suggestion.selected b{
    background:#2563eb;
    color:#fff;
}

.wi-new-symbol-option.wi-symbol-suggested
.wi-new-symbol-card{
    border-color:#818cf8 !important;
    box-shadow:
        0 0 0 2px rgba(99,102,241,.12);
}

.wi-suggestion-empty{
    color:#64748b;
    font-size:12px;
}

@media(max-width:800px){

    .wi-symbol-toolbar{
        grid-template-columns:1fr;
    }
}

/* =========================================================
   FIX – valda symboler på arbetsinstruktionens detaljsida
   ========================================================= */

body.work-instructions-active
.wi-symbol-section
.wi-selected-symbols{
    display:flex !important;
    visibility:visible !important;
    opacity:1 !important;
    flex-wrap:wrap !important;
    gap:12px !important;
    margin:14px 0 18px !important;
}

body.work-instructions-active
.wi-symbol-section
.wi-selected-symbol{
    display:flex !important;
    visibility:visible !important;
    opacity:1 !important;

    align-items:center !important;
    gap:10px !important;

    min-width:190px !important;
    padding:10px 40px 10px 10px !important;

    border:1px solid #d8dee8 !important;
    border-radius:12px !important;
    background:#fff !important;
}

body.work-instructions-active
.wi-symbol-section
.wi-selected-symbol img{
    display:block !important;
    visibility:visible !important;
    opacity:1 !important;

    width:52px !important;
    height:52px !important;
    object-fit:contain !important;
}

body.work-instructions-active
.wi-symbol-section
.wi-selected-symbol-info{
    display:flex !important;
    visibility:visible !important;
    opacity:1 !important;
}

/* Kontroll före start – detaljsida */

.wi-check-detail-list{
    display:flex;
    flex-direction:column;
    gap:8px;
}

.wi-check-detail-item{
    display:flex;
    align-items:flex-start;
    gap:9px;
    padding:9px 11px;
    border:1px solid #e2e8f0;
    border-radius:9px;
    background:rgba(255,255,255,.78);
    color:#334155;
    font-size:13px;
    line-height:1.45;
}

.wi-check-box{
    flex:0 0 auto;
    font-size:18px;
    line-height:1;
    color:#475569;
}


/* =========================================================
   Arbetsinstruktion – Redigera
   ========================================================= */

.wi-form{
    display:flex;
    flex-direction:column;
    gap:20px;
}

.wi-section{
    padding:22px 22px 20px;
    border:1px solid #d8dee8;
    border-radius:16px;
    background:rgba(255,255,255,.92);
    box-shadow:0 8px 24px rgba(15,23,42,.04);
}

.wi-section h2{
    margin:0 0 18px;
    color:#172033;
    font-size:20px;
}

.wi-section label{
    display:flex;
    flex-direction:column;
    gap:7px;
    margin-bottom:16px;
    color:#172033;
    font-size:13px;
    font-weight:650;
}

.wi-section input,
.wi-section textarea,
.wi-section select{
    width:100%;
    box-sizing:border-box;
    padding:10px 12px;
    border:1px solid #d5dce7;
    border-radius:10px;
    background:#fff;
    color:#172033;
    font:inherit;
}

.wi-section textarea{
    resize:vertical;
    line-height:1.5;
}

.two-col{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:14px;
}

.three-col{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:14px;
}

.wi-actions{
    display:flex;
    justify-content:flex-end;
    align-items:center;
    gap:10px;
    margin-top:4px;
    padding-bottom:28px;
}

@media(max-width:800px){
    .two-col,
    .three-col{
        grid-template-columns:1fr;
    }
}


/* =========================================================
   Redigera arbetsinstruktion – begränsad dokumentbredd
   ========================================================= */

.wi-page .wi-shell{
    width:min(1100px, calc(100% - 48px));
    max-width:1100px;
    margin-left:auto;
    margin-right:auto;
    box-sizing:border-box;
}

@media(max-width:700px){
    .wi-page .wi-shell{
        width:calc(100% - 24px);
    }
}


/* =========================================================
   Arbetsinstruktion detalj – action buttons
   ========================================================= */

.detail-actions{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:12px;
    flex-wrap:wrap;
}

.wi-action-btn{
    min-height:48px;
    padding:0 18px;

    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:9px;

    border-radius:12px;
    border:1px solid #d6deea;

    text-decoration:none;
    font-size:14px;
    font-weight:750;
    line-height:1;

    transition:
        transform .15s ease,
        box-shadow .15s ease,
        border-color .15s ease,
        background .15s ease;
}

.wi-action-btn:hover{
    transform:translateY(-1px);
    box-shadow:0 8px 20px rgba(15,23,42,.10);
}

.wi-action-icon{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:20px;
    font-size:20px;
    line-height:1;
}


/* Redigera */

.wi-action-edit{
    background:rgba(255,255,255,.94);
    color:#163b91;
    border-color:#b9cdfd;
}

.wi-action-edit:hover{
    background:#f8fbff;
    border-color:#7aa2f7;
}


/* Primär PDF */

.wi-action-primary{
    background:linear-gradient(
        145deg,
        #16387d,
        #0f2352
    );

    color:#fff;
    border-color:#0f2352;

    box-shadow:
        0 7px 18px rgba(15,35,82,.18);
}

.wi-action-primary:hover{
    box-shadow:
        0 10px 24px rgba(15,35,82,.26);
}


/* Tillbaka */

.wi-action-back,
.wi-action-secondary{
    background:rgba(255,255,255,.90);
    color:#172033;
    border-color:#d6deea;
}

.wi-action-back:hover,
.wi-action-secondary:hover{
    background:#fff;
    border-color:#b8c2d1;
}


@media(max-width:900px){

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

    .detail-actions{
        justify-content:flex-start;
        width:100%;
    }
}


@media(max-width:600px){

    .wi-action-btn{
        flex:1 1 auto;
        min-width:140px;
    }
}


/* =========================================================
   Publika arbetsinstruktioner
   ========================================================= */

.wi-public-search{
    display:grid;
    grid-template-columns:minmax(280px,1fr) 220px 150px auto;
    gap:10px;
    margin-bottom:22px;
}

.wi-public-search input,
.wi-public-search select{
    min-height:44px;
    padding:0 12px;
    border:1px solid #d5dce7;
    border-radius:10px;
    background:#fff;
    color:#172033;
    font:inherit;
}

.wi-public-grid{
    display:grid;
    grid-template-columns:
        repeat(auto-fill,minmax(320px,1fr));
    gap:16px;
}

.wi-public-card{
    display:flex;
    flex-direction:column;
    gap:13px;

    padding:18px;

    border:1px solid #d8dee8;
    border-radius:16px;

    background:rgba(255,255,255,.92);

    box-shadow:
        0 8px 24px rgba(15,23,42,.045);
}

.wi-public-card-top{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:14px;
}

.wi-public-card h2{
    margin:4px 0 0;
    color:#172033;
    font-size:18px;
    line-height:1.35;
}

.wi-public-category{
    color:#64748b;
    font-size:10px;
    font-weight:800;
    letter-spacing:.07em;
    text-transform:uppercase;
}

.wi-public-price{
    flex:0 0 auto;

    padding:5px 9px;
    border-radius:999px;

    background:#eef2ff;
    color:#3730a3;

    font-size:11px;
    font-weight:800;
}

.wi-public-price.free{
    background:#ecfdf5;
    color:#047857;
}

.wi-public-description{
    margin:0;
    color:#475569;
    font-size:13px;
    line-height:1.55;
}

.wi-public-meta{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
}

.wi-public-meta span{
    padding:4px 7px;
    border-radius:7px;
    background:#f1f5f9;
    color:#475569;
    font-size:10px;
}

.wi-public-stats{
    display:flex;
    gap:14px;
    color:#94a3b8;
    font-size:10px;
}

.wi-public-actions{
    margin-top:auto;
    padding-top:10px;
    border-top:1px solid #eef2f7;
}

.wi-public-coming{
    color:#94a3b8;
    font-size:11px;
}

@media(max-width:850px){

    .wi-public-search{
        grid-template-columns:1fr 1fr;
    }
}

@media(max-width:550px){

    .wi-public-search{
        grid-template-columns:1fr;
    }
}

/* Publiceringskontroll */

.wi-publish-checks{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
}

.wi-publish-check{
    display:flex;
    align-items:center;
    gap:8px;
    padding:9px 11px;
    border-radius:9px;
    font-size:13px;
}

.wi-publish-check span{
    display:flex;
    align-items:center;
    justify-content:center;
    width:22px;
    height:22px;
    border-radius:50%;
    font-weight:900;
}

.wi-publish-check.ok{
    background:#ecfdf5;
    color:#047857;
}

.wi-publish-check.ok span{
    background:#d1fae5;
}

.wi-publish-check.missing{
    background:#fef2f2;
    color:#b91c1c;
}

.wi-publish-check.missing span{
    background:#fee2e2;
}

.wi-publish-warnings{
    margin-top:14px;
    display:flex;
    flex-direction:column;
    gap:7px;
}

.wi-publish-warnings > div{
    display:flex;
    align-items:center;
    gap:8px;
    padding:8px 10px;
    border-radius:8px;
    background:#fffbeb;
    color:#92400e;
    font-size:12px;
}

.wi-publish-warnings span{
    font-weight:900;
}

.wi-publish-blocked{
    margin-top:14px;
    padding:10px 12px;
    border-radius:9px;
    background:#fef2f2;
    color:#991b1b;
    font-size:12px;
    font-weight:700;
}

.btn-primary:disabled{
    opacity:.45;
    cursor:not-allowed;
}

@media(max-width:650px){
    .wi-publish-checks{
        grid-template-columns:1fr;
    }
}


/* =========================================================
   Kontroll före start – färdiga tekniska val
   ========================================================= */

.wi-check-presets{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:12px;
    margin-bottom:18px;
}

.wi-check-preset-group{
    padding:12px;
    border:1px solid #e2e8f0;
    border-radius:12px;
    background:#f8fafc;
}

.wi-check-preset-group > strong{
    display:block;
    margin-bottom:9px;
    color:#475569;
    font-size:11px;
    text-transform:uppercase;
    letter-spacing:.06em;
}

.wi-check-preset-buttons{
    display:flex;
    flex-wrap:wrap;
    gap:7px;
}

.wi-check-preset{
    padding:7px 10px;

    border:1px solid #cbd5e1;
    border-radius:8px;

    background:#fff;
    color:#475569;

    font-size:11px;
    font-weight:700;

    cursor:pointer;

    transition:
        background .15s ease,
        border-color .15s ease,
        color .15s ease,
        transform .15s ease;
}

.wi-check-preset:hover{
    border-color:#93a4bb;
    transform:translateY(-1px);
}

.wi-check-preset.selected{
    border-color:#2563eb;
    background:#eff6ff;
    color:#1d4ed8;
}

.wi-check-preset.selected::before{
    content:"✓ ";
    font-weight:900;
}

.wi-check-row{
    display:grid;
    grid-template-columns:minmax(0,1fr) 38px;
    gap:8px;
    margin-bottom:8px;
}

.wi-check-remove,
.wi-edit-check-remove{
    border:1px solid #d8dee8;
    border-radius:8px;
    background:#fff;
    color:#64748b;
    cursor:pointer;
    font-size:18px;
}

.wi-check-remove:hover,
.wi-edit-check-remove:hover{
    background:#fef2f2;
    border-color:#fecaca;
    color:#b91c1c;
}

@media(max-width:750px){

    .wi-check-presets{
        grid-template-columns:1fr;
    }
}

/* Saknade krav vid publicering */

.wi-publish-blocked strong{
    display:block;
    margin-bottom:10px;
}

.wi-publish-missing-list{
    display:flex;
    flex-wrap:wrap;
    gap:7px;
    margin-top:8px;
    margin-bottom:12px;
}

.wi-publish-missing-item{
    display:flex;
    align-items:center;
    gap:6px;
    padding:6px 9px;
    border-radius:7px;
    background:#fff;
    border:1px solid #fecaca;
    color:#991b1b;
    font-size:12px;
    font-weight:600;
}

.wi-publish-missing-item span{
    display:flex;
    align-items:center;
    justify-content:center;
    width:17px;
    height:17px;
    border-radius:50%;
    background:#fee2e2;
    font-weight:900;
}

.wi-publish-edit-link{
    display:inline-flex;
    align-items:center;
    padding:7px 11px;
    border-radius:8px;
    background:#fff;
    border:1px solid #fecaca;
    color:#991b1b;
    font-size:12px;
    font-weight:700;
    text-decoration:none;
}

.wi-publish-edit-link:hover{
    background:#fef2f2;
}


/* =========================================================
   Redigera – publiceringskrav
   ========================================================= */

.wi-required{
    color:#dc2626;
    font-weight:900;
}

.wi-publish-invalid{
    border-color:#dc2626 !important;
    background:#fff7f7 !important;
    box-shadow:0 0 0 2px rgba(220,38,38,.08);
}

.wi-publish-checks-invalid{
    padding:8px;
    margin:-8px;
    border:1px solid #fecaca;
    border-radius:10px;
    background:#fff7f7;
}

.wi-required-message{
    margin:0 0 14px;
    padding:9px 11px;
    border:1px solid #fecaca;
    border-radius:9px;
    background:#fef2f2;
    color:#b91c1c;
    font-size:12px;
    font-weight:700;
}

.wi-edit-publish-status{
    margin-bottom:16px;
    padding:14px 16px;
    border:1px solid #e2e8f0;
    border-radius:12px;
    background:#fff;
}

.wi-edit-publish-status-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
}

.wi-edit-publish-status-head strong{
    font-size:14px;
}

#wiEditPublishBadge{
    padding:5px 9px;
    border-radius:999px;
    font-size:11px;
    font-weight:800;
}

.wi-edit-publish-status.has-errors{
    border-color:#fecaca;
    background:#fffafa;
}

.wi-edit-publish-status.has-errors #wiEditPublishBadge{
    background:#fee2e2;
    color:#b91c1c;
}

.wi-edit-publish-status.is-ready{
    border-color:#bbf7d0;
    background:#f7fff9;
}

.wi-edit-publish-status.is-ready #wiEditPublishBadge{
    background:#dcfce7;
    color:#15803d;
}

.wi-edit-missing-title{
    margin-top:10px;
    color:#991b1b;
    font-size:12px;
}

.wi-edit-missing-items{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    margin-top:7px;
}

.wi-edit-missing-items span{
    padding:5px 8px;
    border-radius:7px;
    background:#fee2e2;
    color:#991b1b;
    font-size:11px;
    font-weight:700;
}

.wi-publish-ready-text{
    margin-top:8px;
    color:#15803d;
    font-size:12px;
    font-weight:600;
}

.wi-edit-check-preset{
    padding:7px 10px;
    border:1px solid #cbd5e1;
    border-radius:8px;
    background:#fff;
    color:#475569;
    font-size:11px;
    font-weight:700;
    cursor:pointer;
    transition:
        background .15s ease,
        border-color .15s ease,
        color .15s ease,
        transform .15s ease;
}

.wi-edit-check-preset:hover{
    border-color:#93a4bb;
    transform:translateY(-1px);
}

.wi-edit-check-preset.selected{
    border-color:#2563eb;
    background:#eff6ff;
    color:#1d4ed8;
}

.wi-edit-check-preset.selected::before{
    content:"✓ ";
    font-weight:900;
}
