:root {
  --bg: #0f1114;
  --surface: #1a1d23;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --accent: #e42313;
  --ok: #2e7d32;
  --danger: #c62828;
  --border: #2d333b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
}

a {
  color: #8ab4f8;
}

header.bar {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

header.bar h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

main {
  padding: 1rem 1.25rem 2rem;
  max-width: 960px;
  margin: 0 auto;
}

/* Dashboard skjermliste */
.screen-toolbar {
  margin-bottom: 0.85rem;
}

.screen-filter {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #12151a;
  color: var(--text);
  font: inherit;
}

.screen-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.screen-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}

.screen-card__row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
}

.screen-card__namecell {
  min-width: 0;
}

.screen-card__status {
  flex-shrink: 0;
}

.screen-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

@media (min-width: 768px) {
  .screen-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.75rem 1rem;
    align-items: center;
  }

  .screen-card__row {
    display: contents;
  }

  .screen-card__actions {
    justify-content: flex-end;
  }
}

@media (max-width: 767px) {
  .screen-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .screen-card__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .screen-card__actions .btn-coord {
    grid-column: 1 / -1;
  }

  .screen-card__actions .btn {
    justify-content: center;
  }
}

.screen-name {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.25;
  cursor: help;
  border-bottom: 1px dotted var(--muted);
  text-decoration: none;
  color: var(--text);
}

.screen-name:focus-visible {
  outline: 2px solid #8ab4f8;
  outline-offset: 2px;
}

.screen-card__hint {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

@media (min-width: 768px) {
  .screen-card__hint {
    display: none;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  background: #2a3038;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border-color: #b81c0f;
}

.btn-ok {
  background: var(--ok);
  border-color: #1b5e20;
}

.btn-danger {
  background: var(--danger);
  border-color: #8e0000;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

label {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

input,
textarea,
select {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #12151a;
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

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

.table th,
.table td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
}

.badge.active {
  background: rgba(46, 125, 50, 0.2);
  border-color: #2e7d32;
}

.badge.standby {
  background: rgba(154, 160, 166, 0.15);
}

.msg {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #12151a;
}

.msg.error {
  border-color: #8e0000;
  background: rgba(198, 40, 40, 0.15);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
}

.modal h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
