/* Self-hosted Inter variable font */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

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

:root {
  --bg: #f8f8f6;
  --bg-subtle: #f0efe9;
  --surface: #fff;
  --text: #1a1a1a;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border: #e5e5e0;
  --accent: #d97706;
  --accent-hover: #b45309;
  --accent-light: rgba(217, 119, 6, 0.08);
  --accent-muted: rgba(217, 119, 6, 0.15);
  --danger: #dc2626;
  --danger-light: rgba(220, 38, 38, 0.1);
  --success: #16a34a;
  --success-light: rgba(22, 163, 74, 0.1);
  --warning: #d97706;
  --skeleton-highlight: #e9ecef;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* Selection */
::selection {
  background: var(--accent-muted);
  color: var(--text);
}

/* Focus */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Screen-reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Header */
header {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2520 100%);
  color: #fff;
  padding: 1.25rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(217, 119, 6, 0.15);
}

header > div {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 24px;
}

header > div::before {
  content: "K";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.header-home {
  display: contents;
  text-decoration: none;
  color: inherit;
}

header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.last-updated {
  margin-left: auto;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.3rem 0.7rem;
  border-radius: 99px;
  font-weight: 500;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
}

/* Intro */
.intro {
  margin-bottom: 1.5rem;
  max-width: 720px;
}

.intro p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Stats cards */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
}

.card-label {
  display: block;
  font-size: 0.68rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  order: -1;
}

.card-value {
  display: block;
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  min-height: 2.2rem;
  min-width: 3rem;
  letter-spacing: -0.03em;
}

.card-trend {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 500;
}

.card-trend.trend-up { color: var(--danger); }
.card-trend.trend-down { color: var(--success); }
.card-trend.trend-neutral { color: var(--text-secondary); }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--skeleton-highlight) 50%, var(--border) 75%);
  background-size: 300% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius-sm);
  color: transparent !important;
  user-select: none;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Chart */
.chart-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.chart-section h2 {
  font-size: 1.05rem;
  margin-bottom: 0.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.chart-period-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}

.period-btn {
  padding: 0.3rem 0.7rem;
  border: none;
  background: var(--surface);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.period-btn:not(:last-child) {
  border-right: 1px solid var(--border);
}

.period-btn:hover {
  background: var(--accent-light);
}

.period-btn.active {
  background: var(--accent);
  color: #fff;
}

.chart-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: 1.25rem;
}

.chart-wrapper {
  display: flex;
  gap: 0.5rem;
}

.chart-y-axis {
  display: flex;
  flex-direction: column-reverse;
  justify-content: space-between;
  width: 2.5rem;
  padding-bottom: 1.5rem;
  font-size: 0.65rem;
  color: var(--text-tertiary);
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.chart-inner {
  flex: 1;
  min-width: 0;
}

.chart-container {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 220px;
  background-image: repeating-linear-gradient(
    to top,
    transparent,
    transparent calc(25% - 1px),
    var(--border) calc(25% - 1px),
    var(--border) 25%
  );
}

.chart-x-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
  font-size: 0.6rem;
  color: var(--text-tertiary);
  padding: 0 1px;
  font-variant-numeric: tabular-nums;
}

@keyframes bar-grow {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

.chart-bar {
  flex: 1;
  background: linear-gradient(to top, #b45309, #f59e0b);
  border-radius: 3px 3px 0 0;
  min-width: 4px;
  position: relative;
  cursor: default;
  transition: opacity 0.15s;
  transform-origin: bottom;
  animation: bar-grow 0.5s ease-out both;
}

.chart-bar:hover {
  opacity: 0.85;
}

.chart-bar .tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  box-shadow: var(--shadow-md);
  animation: tooltip-fade 0.15s ease-out;
}

.chart-bar .tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--text);
}

@keyframes tooltip-fade {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.chart-bar:hover .tooltip {
  display: block;
}

/* Top lists */
.top-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.top-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.top-list h2 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.top-list ol {
  list-style: none;
  counter-reset: rank;
  padding-left: 0;
}

.top-list li {
  counter-increment: rank;
  font-size: 0.85rem;
  padding: 0.5rem 0;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.top-list li:last-child {
  border-bottom: none;
}

.top-list li::before {
  content: counter(rank);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.top-list li:nth-child(1)::before {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
}

.top-list li:nth-child(2)::before {
  background: linear-gradient(135deg, #9ca3af, #6b7280);
  color: #fff;
}

.top-list li:nth-child(3)::before {
  background: linear-gradient(135deg, #d97706, #92400e);
  color: #fff;
}

.top-list li .top-list-btn {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.count-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  pointer-events: none;
  user-select: none;
}

.top-list-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  text-align: left;
}

.top-list-btn:hover {
  text-decoration: underline;
  color: var(--accent);
}

.top-list-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: 2px;
}

.top-list-toggle {
  display: block;
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.5rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.top-list-toggle:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

/* Table section */
.table-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.table-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
}

.table-header-row h2 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.result-count {
  font-weight: 400;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.export-btn {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.export-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Mobile sort (hidden on desktop) */
.mobile-sort {
  display: none;
}

/* Active filter chips */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  background: var(--accent-light);
  border: 1px solid var(--accent-muted);
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent-hover);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.filter-chip:hover {
  background: var(--accent-muted);
  border-color: var(--accent);
}

.chip-remove {
  font-size: 1rem;
  line-height: 1;
  font-weight: 400;
  opacity: 0.6;
}

.filter-chip:hover .chip-remove {
  opacity: 1;
}

.chip-clear-all {
  background: var(--bg-subtle);
  border-color: var(--border);
  color: var(--text-secondary);
}

.chip-clear-all:hover {
  background: var(--border);
  color: var(--text);
}

.table-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: center;
}

.table-controls input[type="search"],
.table-controls input[type="date"],
.table-controls select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  color: var(--text);
}

.table-controls input[type="search"]:focus,
.table-controls input[type="date"]:focus,
.table-controls select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
  outline: 2px solid transparent;
}

.table-controls input[type="search"] {
  flex: 1;
  min-width: 200px;
}

.date-range {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.date-range-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.toggle-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
}

.toggle-label input[type="checkbox"] {
  accent-color: var(--accent);
}

.table-wrapper {
  overflow-x: auto;
  position: relative;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead th {
  background: var(--bg-subtle);
  padding: 0.7rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

thead th[data-sort] {
  cursor: pointer;
  transition: color 0.15s;
}

thead th[data-sort]:hover {
  color: var(--accent);
}

thead th:not([data-sort]) {
  cursor: default;
}

thead th.sorted-asc::after {
  content: " \25B2";
  font-size: 0.7em;
  color: var(--accent);
}

thead th.sorted-desc::after {
  content: " \25BC";
  font-size: 0.7em;
  color: var(--accent);
}

tbody td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

tbody tr:nth-child(even) {
  background: var(--bg-subtle);
}

tbody tr:hover {
  background: var(--accent-light);
}

.brreg-link {
  color: var(--accent);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.brreg-link:hover {
  text-decoration: underline;
}

/* Expandable detail row */
tbody tr[data-orgnr] {
  cursor: pointer;
}

tbody tr.expanded {
  background: var(--accent-light);
}

.detail-row td {
  padding: 0 !important;
  border-bottom: 1px solid var(--border);
}

.detail-content {
  padding: 1.25rem;
  background: var(--bg-subtle);
  border-top: 2px solid var(--accent);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem 1.5rem;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.detail-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.detail-value {
  font-size: 0.85rem;
  color: var(--text);
  word-break: break-word;
}

.detail-value a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.detail-value a:hover {
  text-decoration: underline;
}

.detail-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.detail-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.detail-link:hover {
  text-decoration: underline;
}

/* Search highlight */
mark {
  background: var(--accent-muted);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
}

.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge.status-active {
  color: var(--success);
  background: var(--success-light);
}

.status-badge.status-active::before {
  background: var(--success);
}

.status-badge.status-inactive {
  color: var(--danger);
  background: var(--danger-light);
}

.status-badge.status-inactive::before {
  background: var(--danger);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.pagination button {
  padding: 0.4rem 0.75rem;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.pagination button:hover:not(:disabled) {
  background: var(--accent-light);
  border-color: var(--accent);
}

.pagination button:disabled {
  opacity: 0.35;
  cursor: default;
}

.pagination .page-info {
  color: var(--text-tertiary);
  font-size: 0.8rem;
}

/* Empty/loading states */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}

.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.empty-icon {
  width: 48px;
  height: 48px;
  color: var(--text-tertiary);
  margin-bottom: 0.25rem;
}

.empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.empty-hint {
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

.empty-state button {
  margin-top: 0.5rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
}

.empty-state button:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* FAQ section */
.faq-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-top: 2rem;
  box-shadow: var(--shadow-sm);
}

.faq-section h2 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.faq-section details {
  border-bottom: 1px solid var(--border);
}

.faq-section details:last-of-type {
  border-bottom: none;
}

.faq-section summary {
  padding: 0.85rem 0;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--text);
  transition: color 0.15s;
}

.faq-section summary:hover {
  color: var(--accent);
}

.faq-section summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.faq-section details[open] summary::after {
  content: "\2212";
}

.faq-section summary::-webkit-details-marker {
  display: none;
}

.faq-section details p {
  padding: 0 0 1rem;
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.faq-section details a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.faq-section details a:hover {
  text-decoration: underline;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-tertiary);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  max-width: 1200px;
  margin: 0 auto;
}

footer p + p {
  margin-top: 0.25rem;
}

footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

footer a:hover {
  text-decoration: underline;
}

/* Chart focus (keyboard accessibility) */
.chart-bar:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.chart-bar:focus-visible .tooltip {
  display: block;
}

/* Page size selector */
.page-size-select {
  padding: 0.35rem 0.5rem;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
}

/* Column visibility */
table.hide-stiftelsesdato .col-stiftelsesdato,
table.hide-kommune .col-kommune,
table.hide-naering .col-naering,
table.hide-debitor .col-debitor,
table.hide-bostyrer .col-bostyrer,
table.hide-status .col-status {
  display: none;
}

/* Column toggle dropdown */
.table-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.col-toggle-wrap {
  position: relative;
}

@keyframes dropdown-enter {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.col-toggle-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  z-index: 20;
  min-width: 190px;
  box-shadow: var(--shadow-lg);
  animation: dropdown-enter 0.15s ease-out;
}

.col-toggle-dropdown label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.4rem;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: background 0.1s;
}

.col-toggle-dropdown label:hover {
  background: var(--accent-light);
}

.col-toggle-dropdown input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Skip-to-content link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
  top: 0;
}

/* Top list loading skeleton */
.top-list-loading {
  min-height: 200px;
  background: linear-gradient(90deg, var(--border) 25%, var(--skeleton-highlight) 50%, var(--border) 75%);
  background-size: 300% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius);
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: var(--text);
  color: var(--bg);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 100;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}

.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0f14;
    --bg-subtle: #141820;
    --surface: #1a1f2e;
    --text: #e8eaf0;
    --text-secondary: #8b92a5;
    --text-tertiary: #5c6478;
    --border: #262d3d;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --accent-light: rgba(245, 158, 11, 0.1);
    --accent-muted: rgba(245, 158, 11, 0.2);
    --danger: #f87171;
    --danger-light: rgba(248, 113, 113, 0.12);
    --success: #4ade80;
    --success-light: rgba(74, 222, 128, 0.12);
    --warning: #fbbf24;
    --skeleton-highlight: #262d3d;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  }

  header {
    background: linear-gradient(135deg, #0c0f14 0%, #1a1510 100%);
    border-bottom-color: rgba(245, 158, 11, 0.12);
  }

  .last-updated {
    background: rgba(255, 255, 255, 0.06);
  }

  .table-controls input[type="search"],
  .table-controls input[type="date"],
  .table-controls select,
  .page-size-select {
    color: var(--text);
  }

  .col-toggle-dropdown {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .chart-bar {
    animation: none;
  }
  .col-toggle-dropdown {
    animation: none;
  }
  .skeleton {
    animation: none;
    background: var(--border);
  }
  .card {
    transition: none;
  }
  .toast {
    transition: none;
  }
  .top-list-loading {
    animation: none;
    background: var(--border);
  }
}

/* Entity page */
.entity-main {
  max-width: 860px;
}

.entity-breadcrumb {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.entity-breadcrumb a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.entity-breadcrumb a:hover {
  text-decoration: underline;
}

.entity-breadcrumb span[aria-hidden] {
  margin: 0 0.4rem;
  color: var(--text-tertiary);
}

.entity-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.entity-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--border);
}

.entity-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.entity-details {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem 2rem;
  margin-bottom: 1.75rem;
}

.entity-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.entity-field dt {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.entity-field dd {
  font-size: 0.88rem;
  color: var(--text);
  word-break: break-word;
}

.entity-field a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.entity-field a:hover {
  text-decoration: underline;
}

.entity-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.entity-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  color: #fff;
  background: var(--accent);
  transition: background 0.15s, box-shadow 0.15s;
}

.entity-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.entity-btn-secondary {
  background: var(--surface);
  color: var(--accent);
}

.entity-btn-secondary:hover {
  background: var(--accent-light);
}

@media (max-width: 640px) {
  .entity-card {
    padding: 1.25rem;
  }

  .entity-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .entity-details {
    grid-template-columns: 1fr;
  }
}

/* API docs page */
.docs-main {
  max-width: 860px;
}

.docs-main h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.docs-main h2:first-of-type {
  margin-top: 0;
}

.docs-main h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.docs-main p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.docs-main a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.docs-main a:hover {
  text-decoration: underline;
}

.docs-main ul,
.docs-main ol {
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
}

.docs-main li {
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.endpoint-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.endpoint-section h3 {
  margin-top: 0;
}

.param-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin: 0.75rem 0;
}

.param-table th {
  background: var(--bg-subtle);
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
}

.param-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.docs-main code {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 0.82em;
  background: var(--bg-subtle);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--accent);
  border: 1px solid var(--border);
}

.docs-main pre {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 0.75rem 0;
  font-size: 0.8rem;
  line-height: 1.6;
}

.docs-main pre code {
  background: none;
  padding: 0;
  border: none;
  color: var(--text);
}

.http-method {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--success-light);
  color: var(--success);
  margin-right: 0.4rem;
  vertical-align: middle;
  letter-spacing: 0.03em;
}

.http-method.post {
  background: var(--accent-light);
  color: var(--accent);
}

/* Responsive */
@media (max-width: 640px) {
  .last-updated {
    display: none;
  }

  .stats-cards {
    grid-template-columns: 1fr 1fr;
  }

  .top-lists {
    grid-template-columns: 1fr;
  }

  .mobile-sort {
    display: block;
    margin-bottom: 0.75rem;
  }

  .mobile-sort select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: var(--surface);
    color: var(--text);
  }

  .table-controls {
    flex-direction: column;
  }

  .table-controls input[type="search"],
  .table-controls input[type="date"],
  .table-controls select {
    min-width: auto;
    width: 100%;
  }

  .date-range {
    width: 100%;
  }

  .date-range input[type="date"] {
    flex: 1;
    min-width: 0;
  }

  .table-header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .col-toggle-dropdown {
    right: auto;
    left: 0;
  }

  /* Card layout for table rows */
  table,
  tbody,
  tr,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  /* Data rows as cards */
  tbody tr:not(.state-row):not(.detail-row) {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.85rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-xs);
  }

  tbody tr:not(.state-row):not(.detail-row):hover {
    box-shadow: var(--shadow-sm);
  }

  tbody tr:not(.state-row):not(.detail-row) td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.25rem 0;
    border: none;
    gap: 0.5rem;
  }

  tbody tr:not(.state-row):not(.detail-row) td::before {
    content: attr(data-label);
    font-weight: 600;
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  /* Name as card title */
  tbody tr:not(.state-row):not(.detail-row) td:nth-child(2) {
    font-weight: 700;
    font-size: 1rem;
    padding-bottom: 0.35rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
  }

  tbody tr:not(.state-row):not(.detail-row) td:nth-child(2)::before {
    display: none;
  }

  /* Detail rows in mobile keep block layout */
  tbody tr.detail-row {
    margin-bottom: 0.75rem;
    margin-top: -0.5rem;
  }

  tbody tr.detail-row td {
    display: block;
  }

  tbody tr.detail-row td::before {
    display: none;
  }

  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* State rows keep centered layout */
  tbody tr.state-row td {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .table-wrapper::after {
    display: none;
  }

  .pagination {
    flex-wrap: wrap;
  }

  .pagination .page-info {
    width: 100%;
    text-align: center;
    order: -1;
  }

  .pagination button {
    padding: 0.6rem 1rem;
    min-height: 44px;
  }

  .chart-x-axis span {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 0.6rem;
  }

  .chart-hint {
    display: none;
  }
}

/* Print */
@media print {
  header,
  .chart-section,
  .top-lists,
  .table-controls,
  .active-filters,
  .mobile-sort,
  .table-header-actions,
  .pagination,
  .faq-section,
  .skip-link,
  .toast {
    display: none !important;
  }

  body {
    font-size: 11pt;
    background: #fff;
    color: #000;
  }

  main {
    padding: 0;
    max-width: 100%;
  }

  .table-section {
    border: none;
    box-shadow: none;
    padding: 0;
  }

  table {
    font-size: 9pt;
  }

  thead th {
    background: none;
    border-bottom: 2px solid #000;
    color: #000;
  }

  tbody td {
    border-bottom: 1px solid #ccc;
  }

  a {
    color: #000;
    text-decoration: none;
  }
}
