/* Felles komponenter. Importer etter tokens.css. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--background);
  color: var(--on-surface);
  line-height: 1.5;
}
h1, h2, h3, h4 { font-family: var(--font-headline); font-weight: 400; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 6vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.serif { font-family: var(--font-headline); }
.muted { color: var(--on-surface-variant); }
.small { font-size: .8125rem; }
.right { text-align: right; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.eyebrow {
  font-size: .6875rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: var(--secondary); margin-bottom: .75rem;
}

/* Topplinje */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(251, 249, 244, .85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--outline-variant);
}
.topbar-inner {
  max-width: 80rem; margin: 0 auto; padding: 14px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { font-family: var(--font-headline); font-size: 1.5rem; letter-spacing: -0.04em; color: var(--emerald); text-decoration: none; }
.brand-logo { display: block; width: auto; height: 40px; }
.nav { display: flex; gap: 20px; flex-wrap: wrap; font-family: var(--font-headline); font-size: 1.05rem; }
.nav a { text-decoration: none; color: #57534e; padding-bottom: 4px; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--emerald); }
.nav a[aria-current="page"] { color: var(--emerald); border-color: var(--emerald); }

/* Knapper */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-pill); border: 1px solid var(--outline-variant);
  background: transparent; cursor: pointer; font-size: .75rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; text-decoration: none; min-height: 40px;
}
.btn:hover { background: var(--surface-high); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-container); }
.btn-danger { color: var(--error); border-color: var(--error-container); }
.btn-danger:hover { background: var(--error-container); }
.btn-sm { padding: 6px 12px; min-height: 32px; font-size: .6875rem; }

/* Kort og layout */
.page { max-width: 80rem; margin: 0 auto; padding: 24px var(--gutter) 64px; }
.card { background: var(--surface-low); border-radius: var(--radius-lg); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-warm { background: var(--tertiary-fixed); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { justify-content: space-between; }

/* Skjema */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: .6875rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--secondary); }
.field input, .field select, .field textarea {
  background: var(--surface-high); border: 0; border-bottom: 2px solid transparent;
  border-radius: var(--radius); padding: 12px; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-bottom-color: var(--primary); }

/* Statusmerker */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: .6875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  background: var(--surface-highest); color: var(--on-surface-variant); white-space: nowrap;
}
.badge-ok { background: var(--standard-bg); color: var(--standard); }
.badge-warn { background: var(--flexible-bg); color: #7a5d00; }
.badge-bad { background: var(--booked-bg); color: var(--booked-fg); }
.badge-info { background: var(--primary-fixed); color: var(--primary); }
.badge-test { background: #e0e7ff; color: #3730a3; }

/* Tabeller */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th { text-align: left; font-size: .6875rem; letter-spacing: .1em; text-transform: uppercase; color: var(--secondary); padding: 10px 12px; border-bottom: 1px solid var(--outline-variant); }
td { padding: 12px; border-bottom: 1px solid var(--surface-highest); vertical-align: middle; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface); }

/* Statuslinje */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { position: relative; padding: 0 0 18px 32px; color: var(--outline); }
.timeline li::before {
  content: ""; position: absolute; left: 5px; top: 4px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface-highest); border: 2px solid var(--outline-variant);
}
.timeline li::after { content: ""; position: absolute; left: 10px; top: 18px; bottom: 0; width: 2px; background: var(--surface-highest); }
.timeline li:last-child::after { display: none; }
.timeline li.done { color: var(--on-surface); }
.timeline li.done::before { background: var(--standard); border-color: var(--standard); }
.timeline li.current { color: var(--on-surface); font-weight: 700; }
.timeline li.current::before { background: var(--background); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-fixed); }

/* Utkast-bånd */
.draft-banner {
  background: var(--secondary-fixed); color: #5e411e; text-align: center; font-size: .75rem;
  font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 6px var(--gutter);
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--primary); color: var(--on-primary); padding: 12px 20px; border-radius: var(--radius-pill);
  box-shadow: var(--shadow); z-index: 100; font-size: .875rem; max-width: calc(100vw - 32px);
}

@media (max-width: 640px) {
  .page { padding-top: 16px; }
  .card { padding: 16px; }
}

/* Google-knapp (se google-button.js) */
.gsi-button {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; max-width: 300px; height: 40px; margin: 0 auto; padding: 0 12px;
  background: #fff; color: #1f1f1f; border: 1px solid #747775; border-radius: 4px;
  font-family: "Roboto", Arial, sans-serif; font-size: 14px; font-weight: 500; letter-spacing: .25px; cursor: pointer;
  transition: background-color .2s, box-shadow .2s;
}
.gsi-button:hover { background: #f8f9fa; box-shadow: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15); }
.gsi-button:focus-visible { outline: 3px solid #d3e3fd; outline-offset: 1px; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--outline); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--outline-variant); }
