/* =========================================================
   Styreportal — Palla Pharma Norway AS
   Design etter mockup «Palla Pharma Board Portal».
   ========================================================= */
:root {
    --brand:       #2d567f;
    --brand-dark:  #27374d;
    --brand-soft:  #41597a;
    --brand-light: #eef1f5;
    --navy:        #1b2436;
    --navy-deep:   #161d2c;
    --ink:         #1c2230;
    --muted:       #6b7382;
    --muted-warm:  #8a8073;
    --line:        #ece7de;
    --line-soft:   #e3ddd2;
    --bg:          #faf9f5;
    --card:        #ffffff;
    --card-warm:   #fcfbf9;
    --danger:      #b23b3b;
    --danger-bg:   #f6e7e6;
    --ok:          #256046;
    --ok-bg:       #e3f0e8;
    --gold:        #9a6b1f;
    --gold-bg:     #f6edda;
    --radius:      12px;
    --shadow:      0 1px 3px rgba(28,34,48,.06), 0 1px 2px rgba(28,34,48,.04);
    --sidew:       248px;
    --serif:       'Source Serif 4', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--ink); background: var(--bg); line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d7d1c6; border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 1.6rem 2rem 4rem; max-width: 1100px; width: 100%; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidew); flex: none; background: var(--navy); color: #c2cadb;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.1rem 1.3rem; color: #fff; }
.side-brand:hover { text-decoration: none; }
.side-logo { width: 42px; height: 42px; flex: none; border-radius: 10px; background: rgba(255,255,255,.06);
    display: flex; align-items: center; justify-content: center; padding: 6px; }
.side-logo img { width: 100%; height: 100%; object-fit: contain; }
.side-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.side-brand-text strong { font-size: .95rem; font-weight: 600; letter-spacing: .2px; }
.side-brand-text small { font-size: .68rem; color: #7c89a3; letter-spacing: .6px; text-transform: uppercase; }

.side-nav { flex: 1; overflow-y: auto; padding: .4rem .6rem; }
.side-link {
    display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; margin-bottom: 2px;
    border-radius: 9px; color: #9aa6bd; font-size: .92rem; font-weight: 500;
}
.side-link:hover { color: #fff; background: rgba(255,255,255,.05); text-decoration: none; }
.side-link.is-active { color: #fff; background: rgba(255,255,255,.10); }
.side-ico { width: 20px; height: 20px; flex: none; display: inline-flex; }
.side-ico svg { width: 20px; height: 20px; }
.side-group { font-size: .66rem; text-transform: uppercase; letter-spacing: .7px; color: #6b7892;
    padding: 1rem .8rem .3rem; }

.side-user { display: flex; align-items: center; gap: .6rem; padding: .9rem 1rem; border-top: 1px solid rgba(255,255,255,.07); }
.side-user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.side-user-text strong { font-size: .85rem; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text small { font-size: .72rem; color: #7c89a3; }
.side-logout { color: #7c89a3; display: inline-flex; }
.side-logout:hover { color: #fff; }
.side-logout svg { width: 18px; height: 18px; }

.avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
    border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; font-size: .8rem; font-weight: 700; flex: none; }
.avatar-sm { width: 28px; height: 28px; font-size: .68rem; background: var(--brand-light); color: var(--brand-soft); }

/* ---------- Topbar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1.1rem 2rem; border-bottom: 1px solid var(--line); background: var(--bg); flex-wrap: wrap; }
.topbar-title h1 { font-size: 1.4rem; font-weight: 600; letter-spacing: -.2px; }
.topbar-title p { margin: .15rem 0 0; color: var(--muted); font-size: .9rem; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.topsearch { display: flex; align-items: center; gap: .5rem; background: var(--card); border: 1px solid var(--line);
    border-radius: 9px; padding: .4rem .7rem; }
.topsearch svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.topsearch input { border: none; outline: none; background: none; font: inherit; width: 180px; }
.topdate { color: var(--muted); font-size: .85rem; white-space: nowrap; }

/* ---------- Generelt ---------- */
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.serif { font-family: var(--serif); }
.lead { color: var(--muted); margin: .2rem 0 1.4rem; }
.section { margin-top: 2rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.section-head h2 { font-size: 1.05rem; font-weight: 600; }
.breadcrumb { margin: 0 0 1rem; font-size: .9rem; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }

/* ---------- Kort ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: var(--shadow); }
.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.1rem; align-items: start; }

/* ---------- Knapper ---------- */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .95rem; border-radius: 9px;
    border: 1px solid var(--line-soft); background: var(--card); color: var(--ink); font: inherit; font-size: .9rem;
    font-weight: 500; cursor: pointer; line-height: 1.2; }
.btn:hover { border-color: var(--brand); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { color: var(--danger); border-color: #e7c6c4; }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-sm { padding: .32rem .65rem; font-size: .82rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-link { background: none; border: none; color: var(--brand); cursor: pointer; padding: 0; font: inherit; font-size: .88rem; }
.btn-link:hover { text-decoration: underline; }
.btn-link-danger { color: var(--danger); }
.inline { display: inline; }

/* ---------- Flash ---------- */
.flash { padding: .7rem 1rem; border-radius: 9px; margin-bottom: 1rem; font-size: .92rem; }
.flash-success { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--danger-bg); color: var(--danger); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: .18rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.badge-soft { background: var(--brand-light); color: var(--brand-soft); }

/* ---------- Tabeller ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .8rem 1rem; border-bottom: 1px solid var(--line); font-size: .9rem; vertical-align: middle; }
.table thead th { background: var(--card-warm); color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--card-warm); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-ref { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; color: var(--muted); }
.cell-title { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: .82rem; }
.row-inactive { opacity: .55; }
.badge-soft { background: var(--brand-light); color: var(--brand-soft); }

/* ---------- Dashboard ---------- */
.greeting { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; margin: 0 0 .3rem; }
.approve-banner { display: flex; align-items: center; gap: 1rem; background: linear-gradient(180deg,#fbf3e6,#f6edda);
    border: 1px solid #ecd9b6; border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1.2rem; }
.approve-banner.done { background: var(--ok-bg); border-color: #c5dccd; }
.approve-banner .ab-text { flex: 1; }
.approve-banner .ab-text strong { display: block; }
.next-meeting { display: flex; gap: 1.1rem; align-items: flex-start; }
.cal-chip { flex: none; width: 64px; text-align: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.cal-chip .m { background: var(--brand); color: #fff; font-size: .7rem; text-transform: uppercase; letter-spacing: .5px; padding: .2rem 0; }
.cal-chip .d { font-size: 1.5rem; font-weight: 700; padding: .25rem 0 .05rem; }
.cal-chip .w { font-size: .68rem; color: var(--muted); padding: 0 0 .3rem; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: center; gap: .6rem; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.mini-list li:last-child { border-bottom: none; }
.mini-list .ml-main { flex: 1; min-width: 0; }
.mini-list .ml-title { font-weight: 500; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { display: flex; gap: .65rem; padding: .6rem 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.activity-list li:last-child { border-bottom: none; }
.activity-list .al-text { flex: 1; font-size: .9rem; }
.activity-list .al-when { color: var(--muted); font-size: .78rem; }

/* ---------- Møter ---------- */
.meeting-row { display: flex; align-items: center; gap: 1rem; }

/* ---------- Avstemning ---------- */
.vote-grid { display: grid; gap: .6rem; }
.vote-row { display: flex; align-items: center; gap: .7rem; border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; }
.vote-row .vr-main { flex: 1; }
.vote-row .vr-name { font-weight: 600; font-size: .92rem; }
.vote-row .vr-role { color: var(--muted); font-size: .8rem; }
.vote-pill { border: none; cursor: pointer; padding: .3rem .85rem; border-radius: 999px; font: inherit; font-size: .82rem; font-weight: 600; }
.tally-bars { display: flex; gap: .5rem; margin: .8rem 0; }
.tally-bars .tb { flex: 1; text-align: center; border-radius: 9px; padding: .6rem; }
.tally-bars .tb b { display: block; font-size: 1.3rem; }
.tally-bars .tb span { font-size: .76rem; }
.outcome-box { border: 1px solid; border-radius: 10px; padding: .8rem 1rem; font-weight: 600; margin-bottom: 1rem; }

/* ---------- Detalj/innhold ---------- */
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.detail-actions { display: flex; gap: .5rem; align-items: center; }
.kv { color: var(--muted); font-size: .9rem; margin: .3rem 0 1.2rem; }
.prose { line-height: 1.65; }
.prose h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 1.4rem 0 .4rem; }
.bullet { margin: .4rem 0 0; padding-left: 1.1rem; }
.bullet li { margin-bottom: .35rem; }
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-list li { display: flex; align-items: center; gap: .6rem; padding: .6rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.doc-list li:last-child { border-bottom: none; }
.doc-ico { color: var(--brand-soft); }

/* ---------- Diskusjon/meldinger ---------- */
.comment-list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .9rem; }
.comment { background: var(--card-warm); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; }
.comment-reply { margin-left: 1.5rem; border-style: dashed; }
.comment-replies { list-style: none; margin: .7rem 0 0; padding: 0; display: grid; gap: .6rem; }
.comment-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.comment-author { font-weight: 600; font-size: .9rem; }
.comment-body { white-space: normal; }
.comment-tools { display: flex; gap: 1rem; margin-top: .5rem; }
.reply-form, .comment-form { margin-top: .6rem; }
textarea, input, select { font: inherit; }
.thread-list { list-style: none; margin: 0; padding: 0; }
.thread-list li a { display: flex; align-items: center; gap: .8rem; padding: .9rem 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.thread-list li a:hover { text-decoration: none; }
.thread-main { flex: 1; min-width: 0; }
.thread-subj { font-weight: 600; }
.thread-last { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-meta { text-align: right; color: var(--muted); font-size: .78rem; white-space: nowrap; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; }

/* ---------- Skjema ---------- */
.form label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .9rem; }
.form input, .form select, .form textarea { display: block; width: 100%; margin-top: .3rem; padding: .55rem .65rem;
    border: 1px solid var(--line-soft); border-radius: 9px; background: #fff; font-weight: 400; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--brand-light); border-color: var(--brand); }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 180px; }
.form-actions { margin-top: .5rem; display: flex; gap: .6rem; }
.add-form { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.add-form input, .add-form select { flex: 1; min-width: 140px; padding: .5rem .6rem; border: 1px solid var(--line-soft); border-radius: 9px; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.2rem; }
.filters input, .filters select { padding: .5rem .65rem; border: 1px solid var(--line-soft); border-radius: 9px; background: #fff; }

/* ---------- Login (egen, uten sidebar) ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1.5rem; background: var(--bg); }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 2.2rem; width: 100%; max-width: 390px; }
.login-brand { text-align: center; margin-bottom: 1.6rem; }
.login-brand img { max-height: 58px; margin-bottom: .5rem; }
.login-brand h1 { color: var(--brand); font-family: var(--serif); }
.login-brand p { color: var(--muted); margin: .15rem 0 0; font-size: .85rem; }
.login-help { text-align: center; color: var(--muted); font-size: .8rem; margin: 1.2rem 0 0; }
.login-sep { border: none; border-top: 1px solid var(--line); margin: 1.4rem 0 .6rem; }
.login-card .form label { text-align: left; }
.btn-ms { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; }
.ms-logo { display: inline-block; width: 16px; height: 16px; flex: none;
    background: linear-gradient(#f25022,#f25022) 0 0/7px 7px no-repeat, linear-gradient(#7fba00,#7fba00) 9px 0/7px 7px no-repeat,
    linear-gradient(#00a4ef,#00a4ef) 0 9px/7px 7px no-repeat, linear-gradient(#ffb900,#ffb900) 9px 9px/7px 7px no-repeat; }

/* ---------- Responsiv ---------- */
@media (max-width: 860px) {
    .dash-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .sidebar { width: 72px; }
    .side-brand-text, .side-label, .side-group, .side-user-text { display: none; }
    .side-link { justify-content: center; }
    .content, .topbar { padding-left: 1rem; padding-right: 1rem; }
    .topsearch input { width: 120px; }
    .topdate { display: none; }
}
