:root {
  color-scheme: light dark;
  --fg: #1a1a1a;
  --bg: #ffffff;
  --muted: #6b6b6b;
  --muted-light: #b5b5b5;
  --border: #e0e0e0;
  --accent: #1d4ed8;
  --error-bg: #fdecea;
  --error-fg: #7a1a10;
  --positive: #1a7f37;
  --negative: #b3261e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #f0f0f0;
    --bg: #14161a;
    --muted: #9a9a9a;
    --muted-light: #5c5f66;
    --border: #2c2f36;
    --accent: #6ea8fe;
    --error-bg: #3a1e1c;
    --error-fg: #f5b6ae;
    --positive: #4ade80;
    --negative: #f5b6ae;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

#search-form,
main > .hint {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

#logo {
  display: block;
  height: 4rem;
  width: auto;
  margin: 0 auto 1rem;
}

.lead {
  color: var(--muted);
  margin: 0 auto 2rem;
  max-width: 480px;
  text-align: center;
}

#search-form {
  display: flex;
  gap: 0.5rem;
}

#cvr-input {
  flex: 1;
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
}

#status-filter {
  padding: 0.65rem 0.6rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
}

button {
  padding: 0.65rem 1.25rem;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

.hint {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

#status-antal {
  text-align: center;
}

#status {
  margin-top: 1rem;
}

#result-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.result-pick {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  text-align: left;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
}

.result-pick:hover,
.result-pick.highlighted {
  border-color: var(--accent);
}

.result-pick strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-pick span {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

#status.error {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--error-bg);
  color: var(--error-fg);
}

#virksomhed-navn {
  margin: 2.5rem 0 0.5rem;
  font-size: 1.5rem;
}

#result {
  margin-top: 2rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
}

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

.result-header h2 {
  margin-top: 0;
}

.result-header a {
  color: var(--accent);
  font-size: 0.9rem;
  white-space: nowrap;
}

.ejer-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 1rem;
  margin: 0;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
}

#virksomhed-tabs {
  margin-top: 0;
}

.tab-bar {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  background: none;
  color: var(--muted);
  padding: 0.6rem 1rem;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 0.95rem;
}

.tab-btn:hover {
  color: var(--fg);
}

.tab-btn.active {
  color: var(--fg);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

.tab-panel {
  padding-top: 1.25rem;
}

#kapital-table-wrap {
  overflow-x: auto;
}

.kapital-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

.kapital-filter label {
  color: var(--muted);
}

.kapital-filter select {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-size: 0.9rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 600;
  vertical-align: bottom;
}

th.num,
td.num {
  text-align: right;
}

th.center,
td.center {
  text-align: center;
}

td.positive {
  color: var(--positive);
}

td.negative {
  color: var(--negative);
}

tfoot tr.total td {
  border-top: 2px solid var(--border);
  border-bottom: none;
  font-weight: 600;
}

tbody tr.har-tooltip {
  cursor: help;
}

tbody tr.har-tooltip:hover {
  background: rgba(128, 128, 128, 0.1);
}

.kapital-tooltip {
  position: absolute;
  z-index: 50;
  width: 480px;
  max-width: min(90vw, 480px);
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  font-size: 0.85rem;
  line-height: 1.4;
  white-space: normal;
  pointer-events: none;
}

tr.ophoert {
  color: var(--muted-light);
}
