/* Fiskepiren intranett – same palette as fiskepirenlegesenter.no */
:root {
  --green-900: #1B2E24;
  --green-800: #2E4A3C;
  --green-600: #4A6B57;
  --sage: #8BA696;
  --sage-200: #DCE6DF;
  --sage-100: #F1F5F2;
  --line: #E2E9E4;
  --text: #1F2A24;
  --muted: #5A685F;
  --bg: #F6F8F6;
  --card: #FFFFFF;
  --alert: #B5523A;
  --alert-bg: #F4E4DF;
  --alert-text: #8A3A26;
  --warn-bg: #FBF1D9;
  --warn-text: #7A5A12;
  --in-bg: #DDEFE3;
  --in-text: #1F5C37;
  --closed: repeating-linear-gradient(135deg, #EEF1EF 0 6px, #E6EAE7 6px 12px);
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--green-800); }
h1, h2, h3 { color: var(--green-900); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 24px; }
h1 small { font-size: 15px; font-weight: 400; }
h3 { font-size: 16px; margin-bottom: 12px; display: flex; align-items: baseline; gap: 8px; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }

/* header */
.top { background: var(--green-800); color: #fff; }
.top-in { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 17px; }
.brand img { width: 32px; height: 32px; border-radius: 6px; background: #fff; padding: 3px; }
.brand b { font-weight: 700; color: var(--sage-200); }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav a { color: #E8F0EA; text-decoration: none; padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, 0.08); }
.nav a.on { background: rgba(255, 255, 255, 0.16); color: #fff; }
.me { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.me a, .me .link { color: #E8F0EA; }
.me form { margin: 0; }

main.wrap { padding-top: 24px; padding-bottom: 32px; }
.foot { color: var(--muted); font-size: 13px; padding-bottom: 24px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* layout */
.head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.cols aside { display: grid; gap: 20px; }
.main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }
@media (max-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card.narrow { max-width: 640px; }
.card.login { max-width: 420px; margin: 40px auto; }
.card.login h1 { margin-bottom: 16px; }
.scroll { overflow-x: auto; }
.count { font-size: 13px; font-weight: 500; color: var(--muted); }

/* status */
.status { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px; font-size: 15px; }
.status .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.status.open { background: var(--in-bg); color: var(--in-text); }
.status.open .dot { background: #2E8B57; }
.status.closed { background: var(--alert-bg); color: var(--alert-text); }
.status.closed .dot { background: var(--alert); }

/* people */
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.people li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); }
.people li:last-child { border-bottom: 0; }
.people .av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--in-bg); color: var(--in-text); flex: none; }
.people .out .av { background: #ECEFED; color: var(--muted); }
.people .out .nm { color: var(--muted); }
.people .nm { font-weight: 600; }
.people .off { font-size: 13px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--sage-100); color: var(--green-800); font-weight: 500; }
.tag.warn { background: var(--warn-bg); color: var(--warn-text); }

/* absence type colours, shared by tags and calendar cells */
.t-ferie { background: #DCEBF7; color: #1F4F7A; }
.t-syk, .t-sykmelding, .t-egenmelding, .t-barn { background: var(--alert-bg); color: var(--alert-text); }
.t-kurs { background: #EAE3F5; color: #4F3A7A; }
.t-avspasering { background: var(--warn-bg); color: var(--warn-text); }
.t-permisjon { background: #F5E3EE; color: #7A2F5C; }
.t-annet { background: #ECEFED; color: #3E4A43; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sync { font-size: 13px; margin: 0; padding: 10px 14px; border-radius: 8px; background: var(--sage-100); color: var(--muted); }
.sync.warn { background: var(--warn-bg); color: var(--warn-text); }
.flash { padding: 12px 16px; border-radius: 8px; margin: 0 0 20px; background: var(--in-bg); color: var(--in-text); }
.flash.error { background: var(--alert-bg); color: var(--alert-text); }
.flash.warn { background: var(--warn-bg); color: var(--warn-text); }
.empty { color: var(--muted); }

/* forms */
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-form .wide, .grid-form .actions, .grid-form fieldset { grid-column: 1 / -1; }
aside .grid-form { grid-template-columns: 1fr 1fr; }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: 8px; display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 8px 12px; }
fieldset label.check { grid-column: auto; }
legend { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 4px; }
input, select { font: inherit; font-weight: 400; color: var(--text); padding: 8px 10px; border: 1px solid #C9D4CD; border-radius: 8px; background: #fff; min-width: 0; width: 100%; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--green-800); }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--sage); outline-offset: 1px; }
.actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
button, .btn { font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 9px 16px; background: var(--green-800); color: #fff; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: var(--green-900); color: #fff; }
.btn.ghost, button.ghost { background: #fff; color: var(--green-800); border: 1px solid #C9D4CD; }
.btn.ghost:hover, button.ghost:hover { background: var(--sage-100); color: var(--green-900); }
.btn.on { background: var(--green-800); }
button.link { background: none; padding: 0; color: inherit; text-decoration: underline; font-weight: 500; }
button.danger { background: var(--alert); }
button.link.danger { background: none; color: var(--alert); }
.danger-zone { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.toolbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.toolbar select { width: auto; }
.toolbar .sep { width: 12px; }

/* tables */
table { border-collapse: collapse; width: 100%; }
.data th, .data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data thead th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.data tr.inactive td { color: var(--muted); }
.hours input { min-width: 90px; }
.sumtable td, .sumtable th { text-align: center; }
.sumtable th.who { text-align: left; }
td.sum, th.sum { font-weight: 700; }

/* calendar */
.cal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); border-collapse: separate; border-spacing: 0; overflow: hidden; }
.cal th, .cal td { border-bottom: 1px solid var(--line); padding: 6px; text-align: center; font-size: 13px; }
.cal thead th { background: var(--sage-100); font-weight: 600; color: var(--green-900); white-space: nowrap; }
.cal thead th small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.cal thead th small.hol { color: var(--alert-text); font-weight: 600; }
.cal thead th.today { background: var(--sage-200); }
.cal th.who { text-align: left; font-weight: 600; white-space: nowrap; position: sticky; left: 0; background: var(--card); z-index: 1; }
.cal th.who small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.cal tr.grp th { text-align: left; background: #FAFBFA; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--green-600); padding-top: 12px; }
.cal td.closed, .cal th.closed { background: var(--closed); }
.cal thead th.closed { background: var(--closed); }
.cal.week td { min-width: 104px; }
.cal.week td a, .cal.week td span { display: block; padding: 6px 4px; border-radius: 6px; text-decoration: none; font-weight: 500; }
.c-in { background: var(--in-bg); color: var(--in-text); }
.c-off { color: #B8C2BC; }
.cal.week td a.c-off:hover { background: var(--sage-100); color: var(--green-800); }
.cal.week td a:hover { filter: brightness(0.96); }
.cal tr.total th, .cal tr.total td { font-weight: 700; background: #FAFBFA; border-bottom: 0; }
.cal.month th, .cal.month td { padding: 4px 2px; min-width: 26px; font-size: 12px; }
.cal.month td.m-in { background: var(--in-bg); color: var(--in-text); }
.cal.month td.m-out { font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; margin: 12px 0 4px; }
.legend span { padding: 3px 8px; border-radius: 6px; }
.legend .closed-sample { background: var(--closed); color: var(--muted); }

@media (max-width: 640px) {
  .top-in { gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .nav { order: 3; width: 100%; }
  .me { margin-left: auto; }
  .grid-form, aside .grid-form { grid-template-columns: 1fr; }
  .status { border-radius: 12px; }
}
.grid-form.spaced { margin-top: 20px; }
form.inline { display: inline; margin-left: 8px; }
.t-merknad { background: var(--warn-bg); color: var(--warn-text); }
.totp ol { padding-left: 20px; }
.totp li { margin-bottom: 6px; }
.qr { display: flex; justify-content: center; margin: 16px 0; }
.qr svg { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; }
code.key { font-size: 15px; letter-spacing: 0.05em; background: var(--sage-100); padding: 2px 6px; border-radius: 4px; }
.viewas label { display: flex; align-items: center; gap: 6px; color: #E8F0EA; font-weight: 500; font-size: 13px; }
.viewas select { width: auto; padding: 4px 8px; font-size: 13px; }
.viewas-bar { background: var(--warn-bg); color: var(--warn-text); font-size: 14px; padding: 8px 0; }

/* admin menu */
.admin-menu { position: relative; }
.admin-menu summary { list-style: none; cursor: pointer; color: #E8F0EA; padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.admin-menu summary::-webkit-details-marker { display: none; }
.admin-menu summary::after { content: " ▾"; font-size: 11px; }
.admin-menu.on summary, .admin-menu summary:hover { background: rgba(255, 255, 255, 0.12); }
.admin-menu > div { position: absolute; z-index: 10; top: 100%; left: 0; background: var(--green-800); border-radius: 10px; padding: 6px; display: grid; min-width: 160px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 5px; border-radius: 999px; background: var(--alert); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.small { font-size: 12px; }

/* meetings */
.meets { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.meet { display: grid; gap: 4px; align-content: start; padding: 12px 14px; border: 1px solid var(--line); border-top: 4px solid var(--sage); border-radius: 10px; color: var(--text); text-decoration: none; position: relative; }
.meet.t-lege { border-top-color: #7A6BB0; }
.meet.today { border-color: var(--alert); }
.meet:hover { background: var(--sage-100); }
.meet .when { font-size: 11px; font-weight: 700; color: var(--green-600); text-transform: uppercase; letter-spacing: 0.04em; }
.meet ul { margin: 4px 0 0; padding-left: 16px; font-size: 13px; color: var(--muted); }
.meet .tag { justify-self: start; }
.tag.t-lege { background: #EAE6F5; color: #4F3A7A; }
.prose { white-space: pre-wrap; line-height: 1.6; }
textarea { font: inherit; font-weight: 400; color: var(--text); padding: 8px 10px; border: 1px solid #C9D4CD; border-radius: 8px; width: 100%; resize: vertical; }

/* two weeks */
.twoweeks { border-collapse: separate; border-spacing: 6px; min-width: 640px; }
.twoweeks td { vertical-align: top; width: 19%; padding: 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.twoweeks td > * { display: block; }
.twoweeks td.today { background: var(--warn-bg); border-color: #E8D49A; }
.twoweeks td.past { opacity: 0.55; }
.twoweeks td.closed { background: var(--closed); }
.twoweeks .d { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--green-600); margin-bottom: 4px; }
.twoweeks .who { display: inline-block; margin: 0 4px 3px 0; padding: 1px 6px; border-radius: 6px; font-weight: 600; }
.twoweeks .m, .legend .m { color: var(--muted); text-decoration: none; font-size: 12px; }
.twoweeks th.wk { font-size: 11px; color: var(--muted); font-weight: 500; text-align: center; }
.twoweeks th.wk b { font-size: 18px; color: var(--green-900); }

/* documents */
.searchbar { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.searchbar input { flex: 1 1 260px; padding: 12px 16px; border-radius: 999px; font-size: 16px; }
.searchbar select { width: auto; }
.docs { list-style: none; margin: 0; padding: 0; }
.docs li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.docs li:last-child { border-bottom: 0; }
.snippet { font-size: 13px; color: var(--muted); margin-top: 4px; }
mark { background: #FBE7A1; color: inherit; border-radius: 2px; }
details summary { cursor: pointer; color: var(--green-800); font-weight: 600; margin: 8px 0; }

/* chat */
.msgs { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; max-height: 60vh; overflow-y: auto; }
.msgs li { background: var(--sage-100); border-radius: 12px; padding: 8px 12px; max-width: 80%; }
.msgs li.mine { background: var(--in-bg); justify-self: end; }
.msgs .meta { font-size: 12px; display: flex; gap: 6px; align-items: baseline; }
.msgs .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea { flex: 1; }
.toast { position: fixed; right: 16px; bottom: 16px; z-index: 50; max-width: 340px; background: var(--green-900); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); text-decoration: none; display: block; }
.toast b { color: var(--sage-200); }
.badge[hidden] { display: none; }
.nav { align-items: center; }

/* Kalender: rødt for borte, grønt/gult for deler av dagen */
.c-away { background: #F2C9C4; color: #8A1F17; }
.cal.week td a.c-part, .cal.week td span.c-part { position: relative; overflow: hidden; z-index: 0; }
.c-part svg.bar, .m-part svg.bar { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.c-part em { font-style: normal; }
svg.bar rect.yes { fill: #DDEFE3; }
svg.bar rect.no { fill: #F7E39A; }
.cal.month td.m-part { position: relative; padding: 0; z-index: 0; }
.cal.month td.m-out { background: #F2C9C4; color: #8A1F17; }
.legend .l-part { background: #F7E39A; color: var(--text); }
.legend.small span { padding: 0 4px; color: var(--muted); }
.tag.hours { background: var(--in-bg); color: var(--in-text); }
.hours-row { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.hours-row span { flex: 0 0 44px; }
.hours-row input { flex: 1 1 0; min-width: 0; max-width: 140px; }
form.hours-row { flex-wrap: wrap; }
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--green-900); color: #fff; font-size: 13px; padding: 5px 9px; border-radius: 6px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); white-space: nowrap; }
.tip[hidden] { display: none; }
