body {
  font-family: Arial, sans-serif;
  max-width: 750px;
  margin: 0 auto;
  padding: 10px;
  background-color: #f8f9fa;
  color: #333;
  box-sizing: border-box;
}

.language-selector {
  text-align: right;
  padding: 0;
  line-height: 1;
}

.lang-btn {
  background: transparent;
  border: none;
  padding: 0;
  margin-left: 2px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  width: auto;
  height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  vertical-align: top;
}

.lang-btn:hover {
  background: transparent;
  transform: scale(1.05);
}

.lang-btn.active {
  background: transparent;
  box-shadow: none;
}

/* Flag Icons styling */
.lang-btn .fi {
  width: 18px;
  height: 12px;
  display: inline-block;
  margin: 0;
  padding: 0;
  line-height: 1;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.4em;
  color: #333;
  text-align: center;
  font-weight: bold;
}

h2 {
  margin: 12px 0 6px;
  font-size: 1.1em;
  color: #333;
  font-weight: bold;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 10px;
  table-layout: fixed;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  background-color: #ffffff;
  min-width: 280px; /* Minimum bredde for lesbarhet */
  border: 1px solid #ddd;
}

.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 8px;
  border-radius: 6px;
}

th, td {
  padding: 8px 4px;
  text-align: center;
  border-bottom: 1px solid #ddd;
  font-size: 1.0em;
  color: #333;
  word-wrap: break-word;
}

th {
  background-color: #4a90e2;
  color: white;
  font-weight: bold;
  border-bottom: 2px solid #357abd;
  user-select: none;
}

tbody tr:hover {
  background-color: #f0f8ff;
  cursor: pointer;
}

tr.aktiv {
  background-color: #e8f5e8 !important;
}

input[type="number"] {
  width: 85px;
  padding: 6px 4px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 16px;
  text-align: center;
  transition: border-color 0.2s;
  background-color: white;
  color: #333;
  min-height: 32px;
}

input[type="number"]:focus {
  border-color: #4a90e2;
  outline: none;
  background-color: #f9f9f9;
}

.antall {
  opacity: 0.4;
  transition: opacity 0.2s;
  text-align: center;
}

.antall.active {
  opacity: 1;
}

.grand-total {
  font-size: 1.0em;
  text-align: right;
  margin-top: 10px;
  font-weight: bold;
  color: #333;
  background-color: #f8f9fa;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.knapper {
  margin-top: 12px;
  text-align: right;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

button {
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
  background-color: #4a90e2;
  color: white;
  border: 1px solid #357abd;
  transition: background-color 0.2s;
  min-height: 36px;
  touch-action: manipulation; /* Bedre touch respons */
  font-weight: normal;
}

button:hover {
  background-color: #357abd;
}

.fjern-knapp {
  background: none;
  border: none;
  color: #dc3545;
  font-size: 1.2em;
  cursor: pointer;
  float: right;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  font-weight: bold;
}

.fjern-knapp:hover {
  color: #dc3545;
  background: #f0f8ff ;
}

#egendefinertseksjon {
  display: none;
}

.footer-link {
  text-align: center;
  margin-top: 20px;
  padding: 15px 0;
  border-top: 1px solid #ddd;
}

.footer-link a {
  color: #4a90e2;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.footer-link a:hover {
  color: #357abd;
  text-decoration: underline;
}

@media print {
  body {
    background: white !important;
  }
  tr.aktiv {
    background-color: #e8f5e8  !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .fjern-knapp, button, .knapper, .footer-link {
    display: none;
  }
  input[type="number"] {
    text-align: center !important;
    border: 1px solid #ccc !important;
  }
  th {
    background-color: #4a90e2 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    color: white;
    font-weight: bold;
    border-bottom: 2px solid #357abd;
    user-select: none;
  }
  .grand-total {
    background: white !important;
    border: 1px solid #ccc !important;
  }
}

/* Tablet visning */
@media (max-width: 768px) {
  body {
    padding: 8px;
  }
  
  h1 {
    font-size: 1.3em;
    text-align: center;
    margin: 10px 0;
  }
  
  h2 {
    font-size: 1.0em;
    margin: 8px 0 4px;
  }
  
  table {
    font-size: 0.85em;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  }
  
  th, td {
    padding: 6px 3px;
  }
  
  .knapper {
    justify-content: center;
    gap: 8px;
  }
  
  .grand-total {
    text-align: center;
    font-size: 1.1em;
    padding: 15px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    margin: 20px 0;
  }
}

/* Mobilvisning */
@media (max-width: 480px) {
  body {
    padding: 5px;
    margin: 0;
  }
  
  h1 {
    font-size: 1.2em;
    margin: 8px 0 10px;
    text-align: center;
    line-height: 1.3;
  }
  
  h2 {
    font-size: 1.0em;
    margin: 8px 0 4px;
    text-align: center;
  }
  
  table {
    font-size: 0.8em;
    margin-bottom: 10px;
    border-radius: 4px;
  }
  
  th, td {
    padding: 6px 2px;
    font-size: 0.8em;
  }
  
  th {
    font-size: 0.75em;
    padding: 8px 2px;
  }
  
  /* Gjør tabellen scrollbar horisontalt på små skjermer */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  input[type="number"] {
    width: 75px;
    padding: 5px 3px;
    font-size: 14px;
    min-height: 30px;
  }
  

  
  .knapper {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin: 10px 0;
  }
  
  .knapper button {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 500;
  }
  
  .grand-total {
    font-size: 1.1em;
    text-align: center;
    padding: 12px 10px;
    background-color: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    margin: 10px 0;
    border: 2px solid #4a90e2;
  }
  
  .fjern-knapp {
    font-size: 1.4em;
    padding: 8px;
    margin: -4px;
  }
  
  /* Bedre touch targets */
  tbody tr {
    min-height: 50px;
  }
  
  /* Forbedret hover-effekt for touch */
  tbody tr:active {
    background-color: #f0f7ff;
  }
}

/* Ekstra små skjermer */
@media (max-width: 360px) {
  body {
    padding: 5px;
  }
  
  h1 {
    font-size: 1.2em;
  }
  
  table {
    font-size: 0.8em;
  }
  
  th, td {
    padding: 6px 3px;
  }
  
  input[type="number"] {
    width: 90%;
    padding: 6px 4px;
    min-height: 38px;
  }
  
  .grand-total {
    font-size: 1.1em;
    padding: 15px 10px;
  }
}