/* ============================================================
   SIDE-SPESIFIKK CSS for "Ansatte" (ansatte.html).
   Kun regler som utelukkende brukes på denne siden.
   ============================================================ */

/* Ingen side-spesifikke regler funnet ennå – legg til her etter behov. */


/* Utvidet ansatteregister */
.ansatte-registrering-grid{
  grid-template-columns:repeat(3,minmax(220px,1fr));
}

.ansatte-tabell-wrap{
  overflow-x:auto;
}



#an_tabell th,
#an_tabell td{
  white-space:nowrap;
  vertical-align:middle;
}

#an_tabell td:nth-child(6),
#an_tabell td:nth-child(7){
  white-space:normal;
  min-width:180px;
}

@media(max-width:900px){
  .ansatte-registrering-grid{
    grid-template-columns:1fr 1fr;
  }
}

@media(max-width:600px){
  .ansatte-registrering-grid{
    grid-template-columns:1fr;
  }
}


#an_tabell .row-actions{
  display:flex;
  gap:6px;
  align-items:center;
  justify-content:flex-end;
}


/* Eksportknapper for ansattliste */
.ansatte-liste-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

.ansatte-export-actions{
  display:flex;
  gap:8px;
  margin-left:auto;
}

@media(max-width:700px){
  .ansatte-export-actions{
    width:100%;
    margin-left:0;
  }
  .ansatte-export-actions button{
    flex:1;
  }
}



.an-yrkeskode-felt input[list]{
  width:100%;
}


/* Valg av ansatte for henting av skattekort */
.an-skattekort-head{
  text-align:center;
  min-width:110px;
}

.an-skattekort-check{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:32px;
  height:32px;
  cursor:pointer;
  margin-left:6px;
}

.an-skattekort-check input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}

.an-skattekort-check span{
  width:20px;
  height:20px;
  border:2px solid #94a3b8;
  border-radius:4px;
  background:#fff;
  display:block;
  position:relative;
}

.an-skattekort-check input:checked + span{
  border-color:#059669;
  background:#059669;
}

.an-skattekort-check input:checked + span::after{
  content:"✓";
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#fff;
  font-size:14px;
  font-weight:800;
}

#an_tabell .row-actions{
  min-width:190px;
  white-space:nowrap;
}


.an-skattekort-cell{
  text-align:center;
  width:110px;
  min-width:110px;
}
#an_tabell th:first-child{
  text-align:center;
  width:110px;
  min-width:110px;
}


.an-skattekort-head > div{
  margin-bottom:7px;
}
.an-skattekort-alle{
  margin:0 auto;
  width:26px;
  height:26px;
}

.an-skattekort-status{
  text-align:center;
  font-weight:600;
  white-space:nowrap;
}


/* ============================================================
   Optimalisert kolonnebredde – Alle ansatte
   ============================================================ */

.ansatte-tabell-wrap{
  overflow-x:auto;
  width:100%;
}

#an_tabell{
  width:100%;
  min-width:1380px;
  table-layout:fixed;
}

#an_tabell th,
#an_tabell td{
  padding:10px 8px;
  vertical-align:middle;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* 1: Hent skattekort */
#an_tabell th:nth-child(1),
#an_tabell td:nth-child(1){
  width:88px;
  min-width:88px;
  max-width:88px;
  text-align:center;
}

/* 2: Navn */
#an_tabell th:nth-child(2),
#an_tabell td:nth-child(2){
  width:120px;
  min-width:120px;
}

/* 3: Stilling */
#an_tabell th:nth-child(3),
#an_tabell td:nth-child(3){
  width:120px;
  min-width:120px;
}

/* 4: Ansattnr. */
#an_tabell th:nth-child(4),
#an_tabell td:nth-child(4){
  width:82px;
  min-width:82px;
  text-align:center;
}

/* 5: Fødselsnr. */
#an_tabell th:nth-child(5),
#an_tabell td:nth-child(5){
  width:108px;
  min-width:108px;
}

/* 6: Stilling % */
#an_tabell th:nth-child(6),
#an_tabell td:nth-child(6){
  width:82px;
  min-width:82px;
  text-align:center;
}

/* 7: Skattekort */
#an_tabell th:nth-child(7),
#an_tabell td:nth-child(7){
  width:88px;
  min-width:88px;
  text-align:center;
}

/* 8: Yrkeskode */
#an_tabell th:nth-child(8),
#an_tabell td:nth-child(8){
  width:94px;
  min-width:94px;
}

/* 9: Adresse */
#an_tabell th:nth-child(9),
#an_tabell td:nth-child(9){
  width:180px;
  min-width:180px;
  white-space:normal;
  line-height:1.25;
}

/* 10: E-post */
#an_tabell th:nth-child(10),
#an_tabell td:nth-child(10){
  width:170px;
  min-width:170px;
  white-space:normal;
  word-break:break-word;
}

/* 11: Telefon */
#an_tabell th:nth-child(11),
#an_tabell td:nth-child(11){
  width:110px;
  min-width:110px;
}

/* 12: Startdato */
#an_tabell th:nth-child(12),
#an_tabell td:nth-child(12),
#an_tabell th:nth-child(13),
#an_tabell td:nth-child(13){
  width:100px;
  min-width:100px;
}

/* 14: Banknr. */
#an_tabell th:nth-child(14),
#an_tabell td:nth-child(14){
  width:90px;
  min-width:90px;
}

/* 15–16: lønn */
#an_tabell th:nth-child(15),
#an_tabell td:nth-child(15),
#an_tabell th:nth-child(16),
#an_tabell td:nth-child(16){
  width:108px;
  min-width:108px;
  text-align:right;
}

/* 17: handlinger */
#an_tabell th:nth-child(17),
#an_tabell td:nth-child(17){
  width:150px;
  min-width:150px;
}

/* Litt mindre tekst i tabellen for bedre plassutnyttelse */
#an_tabell{
  font-size:13px;
}

#an_tabell thead th{
  font-size:11px;
  letter-spacing:.02em;
  white-space:normal;
  line-height:1.2;
}

/* Knappene på høyre side skal ikke presse tabellen */
#an_tabell .row-actions{
  display:flex;
  gap:5px;
  align-items:center;
  justify-content:flex-end;
  min-width:0;
}

#an_tabell .row-actions button{
  padding:6px 9px;
  font-size:12px;
  white-space:nowrap;
}

/* På litt mindre skjermer reduseres padding og enkelte bredder */
@media(max-width:1450px){
  #an_tabell th,
  #an_tabell td{
    padding:8px 6px;
  }

  #an_tabell{
    font-size:12.5px;
    min-width:1280px;
  }

  #an_tabell th:nth-child(2),
  #an_tabell td:nth-child(2),
  #an_tabell th:nth-child(3),
  #an_tabell td:nth-child(3){
    width:108px;
    min-width:108px;
  }

  #an_tabell th:nth-child(9),
  #an_tabell td:nth-child(9){
    width:155px;
    min-width:155px;
  }

  #an_tabell th:nth-child(10),
  #an_tabell td:nth-child(10){
    width:150px;
    min-width:150px;
  }
}

@media(max-width:1100px){
  #an_tabell{
    min-width:1220px;
  }
}


/* Skattekort-kolonnen skal bruke minst mulig plass */
#an_tabell th:nth-child(7),
#an_tabell td:nth-child(7){
  width:64px !important;
  min-width:64px !important;
  max-width:64px !important;
  padding-left:4px !important;
  padding-right:4px !important;
  text-align:center;
}

/* Kompakt overskrift */
#an_tabell th:nth-child(7){
  font-size:10px;
  line-height:1.05;
  overflow-wrap:anywhere;
}


/* Hent skattekort – tekst og velg-alle-boks i venstre kolonne */
#an_tabell th.an-skattekort-head{
  text-align:center;
  vertical-align:middle;
}
#an_tabell th.an-skattekort-head > div{
  margin:0 0 6px 0;
  line-height:1.1;
}


/* Hent skattekort: mindre og fet overskrift */
#an_tabell th.an-skattekort-head > div{
  font-size:9px !important;
  font-weight:800 !important;
  line-height:1.05 !important;
  letter-spacing:0 !important;
  margin:0 0 5px 0 !important;
  text-align:center !important;
}


/* Hent skattekort – grønn boks som "Legg til ansatt" */
#an_tabell th.an-skattekort-head > div{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  min-height:32px !important;
  padding:7px 10px !important;
  margin:0 0 6px 0 !important;
  border-radius:7px !important;
  background:#0aa174 !important;
  color:#fff !important;
  font-size:9px !important;
  font-weight:800 !important;
  line-height:1.05 !important;
  text-align:center !important;
  white-space:normal !important;
}


/* Ekte Hent skattekort-knapp */
#an_tabell th.an-skattekort-head > .an-hent-skattekort-btn{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  min-height:32px !important;
  padding:7px 10px !important;
  margin:0 0 6px 0 !important;
  border:0 !important;
  border-radius:7px !important;
  background:#0aa174 !important;
  color:#fff !important;
  font-size:9px !important;
  font-weight:800 !important;
  line-height:1.05 !important;
  text-align:center !important;
  white-space:normal !important;
  cursor:pointer !important;
  box-shadow:none !important;
}

#an_tabell th.an-skattekort-head > .an-hent-skattekort-btn:hover{
  filter:brightness(.96);
}

#an_tabell th.an-skattekort-head > .an-hent-skattekort-btn:disabled{
  opacity:.55;
  cursor:not-allowed !important;
}

.an-skattekort-status{
  text-align:center;
  font-weight:700;
  white-space:nowrap;
}

.an-skattekort-status.ok{color:#047857}
.an-skattekort-status.pending{color:#b45309}
.an-skattekort-status.error{color:#b91c1c}

.an-skattekort-modal-list{
  max-height:280px;
  overflow:auto;
  border:1px solid var(--line);
  border-radius:8px;
  margin-top:10px;
}

.an-skattekort-modal-list table{
  width:100%;
}

.an-skattekort-api-box{
  margin-top:14px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#f8fafc;
}

.an-skattekort-api-box input{
  width:100%;
}


/* Årsak til slutt – litt mer plass i ansattetabellen */
#an_tabell th:nth-child(15),
#an_tabell td:nth-child(15){
  width:170px !important;
  min-width:170px !important;
  white-space:normal !important;
  line-height:1.25;
}



/* Hent skattekort – litt større grønn knapp */
#an_tabell th.an-skattekort-head > .an-hent-skattekort-btn{
  min-width:82px !important;
  min-height:38px !important;
  padding:8px 12px !important;
  font-size:10px !important;
  font-weight:800 !important;
  border-radius:8px !important;
  line-height:1.1 !important;
}


/* Hent skattekort – enda litt større */
#an_tabell th.an-skattekort-head > .an-hent-skattekort-btn{
  min-width:96px !important;
  min-height:44px !important;
  padding:10px 14px !important;
  font-size:11px !important;
  font-weight:800 !important;
  border-radius:8px !important;
  line-height:1.1 !important;
}


/* Hent skattekort – større versjon */
#an_tabell th.an-skattekort-head > .an-hent-skattekort-btn{
  min-width:112px !important;
  min-height:50px !important;
  padding:11px 16px !important;
  font-size:12px !important;
  font-weight:800 !important;
  border-radius:9px !important;
  line-height:1.12 !important;
}


/* Hent skattekort – mindre grønn boks, samme tekststørrelse */
#an_tabell th.an-skattekort-head > .an-hent-skattekort-btn{
  min-width:92px !important;
  min-height:38px !important;
  padding:7px 10px !important;
  font-size:12px !important;
  font-weight:800 !important;
  border-radius:8px !important;
  line-height:1.12 !important;
}


/* ==========================================================
   Ansatte – kompakt oppsett etter referansebildet
   ========================================================== */

/* Ny ansatt: tettere og ryddigere kort */
.an-page .card,
body[data-page="ansatte"] .card{
  border-radius:10px;
}

#an_form,
.an-form{
  gap:12px 14px !important;
}

/* Feltene skal bruke tilgjengelig bredde jevnt */
#an_form input,
#an_form select,
.an-form input,
.an-form select{
  width:100%;
  box-sizing:border-box;
}

/* Hent skattekort: kompakt grønn knapp.
   FONT SIZE endres IKKE her. */
#an_tabell th.an-skattekort-head > .an-hent-skattekort-btn{
  width:auto !important;
  min-width:0 !important;
  max-width:none !important;
  min-height:30px !important;
  height:30px !important;
  padding:5px 10px !important;
  margin:0 0 5px 0 !important;
  border-radius:5px !important;
  line-height:1 !important;
  white-space:nowrap !important;
}

/* Venstre skattekort-kolonne skal bare bruke nødvendig plass */
#an_tabell th:first-child,
#an_tabell td:first-child{
  width:72px !important;
  min-width:72px !important;
  max-width:72px !important;
  padding-left:5px !important;
  padding-right:5px !important;
  text-align:center;
}

/* Ansattlisten: mer kompakt slik som referansen */
.ansatte-tabell-wrap{
  width:100%;
  overflow-x:auto;
}

#an_tabell{
  width:100% !important;
  min-width:1180px !important;
  table-layout:auto !important;
}

#an_tabell th,
#an_tabell td{
  padding:8px 7px !important;
  vertical-align:middle !important;
}

#an_tabell thead th{
  white-space:nowrap !important;
}

/* Navn og stilling får naturlig plass */
#an_tabell th:nth-child(2),
#an_tabell td:nth-child(2){
  min-width:105px !important;
}

#an_tabell th:nth-child(3),
#an_tabell td:nth-child(3){
  min-width:110px !important;
}

/* Kompakte tekniske felt */
#an_tabell th:nth-child(4),
#an_tabell td:nth-child(4){
  min-width:72px !important;
}

#an_tabell th:nth-child(5),
#an_tabell td:nth-child(5){
  min-width:105px !important;
}

#an_tabell th:nth-child(6),
#an_tabell td:nth-child(6){
  min-width:75px !important;
}

#an_tabell th:nth-child(7),
#an_tabell td:nth-child(7){
  min-width:68px !important;
  width:68px !important;
}

/* Adresse og e-post får mest plass */
#an_tabell th:nth-child(9),
#an_tabell td:nth-child(9){
  min-width:150px !important;
}

#an_tabell th:nth-child(10),
#an_tabell td:nth-child(10){
  min-width:145px !important;
}

/* Knapper i handlingskolonnen holdes samlet */
#an_tabell td:last-child{
  white-space:nowrap !important;
}

/* Litt mindre luft rundt Alle ansatte-kortet */
.an-alle-ansatte,
#an_alleAnsatte{
  margin-top:12px !important;
}

@media (max-width:1300px){
  #an_tabell{
    min-width:1120px !important;
  }
}


/* ==========================================================
   Ansatte – Hent skattekort øverst til høyre som referanse
   ========================================================== */
.ansatte-pagehead{
  display:flex !important;
  align-items:flex-start !important;
  justify-content:space-between !important;
  gap:18px !important;
}

.ansatte-top-actions{
  display:flex !important;
  align-items:center !important;
  justify-content:flex-end !important;
  gap:10px !important;
  margin-left:auto !important;
  flex-wrap:wrap;
}

/* Beholder tekststørrelsen, justerer bare selve boksen */
.ansatte-top-actions .an-hent-skattekort-btn{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  width:auto !important;
  min-width:118px !important;
  height:36px !important;
  min-height:36px !important;
  padding:0 14px !important;
  margin:0 !important;
  border:0 !important;
  border-radius:7px !important;
  background:#0aa174 !important;
  color:#fff !important;
  font-size:12px !important;
  font-weight:800 !important;
  line-height:1 !important;
  white-space:nowrap !important;
  cursor:pointer !important;
}

.ansatte-top-actions .an-hent-skattekort-btn:hover{
  filter:brightness(.96);
}

.ansatte-top-actions .secondary{
  min-height:36px !important;
}

/* Første tabellkolonne er nå bare avkrysningsboksen */
#an_tabell th.an-skattekort-head{
  width:44px !important;
  min-width:44px !important;
  max-width:44px !important;
  padding-left:4px !important;
  padding-right:4px !important;
  text-align:center !important;
}

#an_tabell th.an-skattekort-head .an-skattekort-check{
  margin-left:0 !important;
}

.ansatte-registrering-grid{
  gap:12px 14px !important;
}

#ansatte > .card{
  border-radius:10px !important;
}

@media(max-width:900px){
  .ansatte-pagehead{
    flex-direction:column;
  }
  .ansatte-top-actions{
    width:100%;
    justify-content:flex-start !important;
    margin-left:0 !important;
  }
}


/* Merk alle ansatte rett under Hent skattekort */
.an-skattekort-top-group{
  display:flex !important;
  flex-direction:column !important;
  align-items:flex-start !important;
  gap:7px !important;
}
.an-merk-alle-top{
  display:inline-flex !important;
  align-items:center !important;
  gap:8px !important;
  margin:0 !important;
  font-size:12px !important;
  font-weight:600 !important;
  color:var(--text,#172033) !important;
  white-space:nowrap !important;
  cursor:pointer !important;
}
.an-merk-alle-top input{
  width:17px !important;
  height:17px !important;
  margin:0 !important;
  cursor:pointer !important;
}
.ansatte-top-actions{align-items:flex-start !important;}

/* Merk alle ansatte: avkrysningsboksen skal alltid stå FORAN teksten */
.an-merk-alle-top{
  display:flex !important;
  flex-direction:row !important;
  align-items:center !important;
  justify-content:flex-start !important;
  text-align:left !important;
}
.an-merk-alle-top input#an_hentSkattekortAlle{
  order:0 !important;
  position:static !important;
  float:none !important;
  flex:0 0 17px !important;
  width:17px !important;
  height:17px !important;
  margin:0 8px 0 0 !important;
}
.an-merk-alle-top span{
  order:1 !important;
  display:inline-block !important;
  margin:0 !important;
}
