/* Universell box-sizing */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Grunnstruktur */
body {
  font-family: system-ui, sans-serif;
  font-size: 0.95rem;
  line-height: 1.5;
  background: #f9fafb;
  color: #111;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

h2 {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
}

/* Filterform */
.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: flex-end;
  margin-bottom: 2rem;
}

.filter-form label {
  font-weight: 500;
  font-size: 0.9rem;
}

input[type="date"],
button {
  font-size: 0.9rem;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
  transition: border 0.2s, background 0.2s;
}

input[type="date"]:focus,
button:focus {
  border-color: #007BFF;
  outline: none;
}

button {
  cursor: pointer;
  background-color: #007BFF;
  color: white;
  font-weight: 500;
  border: none;
}

button:hover {
  background-color: #005FCC;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Refresh-knapp og status */
.refresh-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.refresh-button {
  background-color: #007BFF;
  color: #fff;
  padding: 8px 16px;
  border-radius: 4px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.refresh-button:hover {
  background-color: #005FCC;
}

.refresh-status {
  font-size: 0.9rem;
}

/* Tabell */
.table-wrapper {
  overflow-x: auto;
  width: 100%;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: white;
  table-layout: auto;
}

thead {
  background-color: #f1f3f5;
}

th, td {
  padding: 10px 12px;
  border: 1px solid #ddd;
  text-align: right;
  white-space: normal;
}

th:first-child,
td:first-child {
  text-align: left;
}

td:nth-child(2) {
  max-width: 180px;
  word-break: break-word;
}

tfoot {
  font-weight: bold;
  background: #f6f6f6;
}

.negativ {
  color: red;
  font-weight: bold;
}

/* Modal popup */
#details-modal {
  display: none;
  position: fixed;
  top: 5%;
  left: 5%;
  width: 90%;
  max-height: 85%;
  overflow-y: auto;
  background: white;
  border: 1px solid #ccc;
  box-shadow: 0 0 20px rgba(0,0,0,0.3);
  padding: 20px;
  z-index: 9999;
  border-radius: 8px;
}

#details-modal table {
  width: 100%;
  margin-top: 1rem;
  font-size: 0.9rem;
  border-collapse: collapse;
}

#details-modal th,
#details-modal td {
  border: 1px solid #ccc;
  padding: 6px 8px;
  text-align: right;
}

#details-modal th:first-child,
#details-modal td:first-child {
  text-align: left;
}

#details-modal button {
  margin-top: 1rem;
  padding: 8px 16px;
  background: #007BFF;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

/* Mobiltilpasning */
@media screen and (max-width: 768px) {
  .filter-form {
    flex-direction: column;
    gap: 0.75rem;
  }

  .table-wrapper {
    box-shadow: none;
  }

  table {
    font-size: 0.85rem;
  }

  #details-modal {
    width: 95%;
    left: 2.5%;
    padding: 12px;
  }
}
.date-range {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}
#cpaChart {
  max-width: 1000px;
  margin: 2rem auto;
  display: block;
}
.panel-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0 2rem 0;
  padding: 0 0.5rem;
}

.panel {
  flex: 1 1 100px;
  min-width: 140px;
  background: #f8f9fa;
  padding: 1rem;
  border-left: 4px solid #007BFF;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.panel-title {
  font-size: 0.9rem;
  color: #555;
}

.panel strong {
  font-size: 1.5rem;
  color: #111;
}
.panel-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.panel {
  flex: 1 1 150px;
}

.panel-title {
  font-size: 1.1rem;
  line-height: 1.6em;
}

.panel-value {
  display: block;
  font-size: 1.3rem;
  font-weight: bold;
  line-height: 1.6em;
}
