/* ─────────────────────────────────────────────────────────────────────────
   BioInnsikt – felles «shell» for rådgiverportalen (/radgiver/) og
   Innholdsstudio (/admin/innhold/). Samme visuelle språk som appen
   (frostet header, logo, ikon-tabs) og forsiden (dyp grønn gradient).
   Bygger på design-tokens i styles.css. Mobil først (≥ 320 px).
   Prefiks: .sh-*
   ───────────────────────────────────────────────────────────────────────── */
:root {
    --sh-header-h: 64px;
    --sh-nav-h: 46px;          /* mobil: egen rad med tabs under merkevaren (studio) */
    --sh-bottom-h: 62px;       /* mobil: bunn-nav (portal) */
    --sh-gutter: clamp(14px, 3vw, 32px);
    --sh-hero-a: #004d40;
    --sh-hero-b: #0b3b34;
    --sh-hero-c: #0c1421;
    --sh-ring: 0 0 0 3px rgba(38, 166, 154, .22);
}
.sh-body { background: var(--color-bg); min-height: 100vh; min-height: 100dvh; -webkit-tap-highlight-color: transparent; }
.sh-body * { box-sizing: border-box; }
.sh-body :focus-visible { outline: none; box-shadow: var(--sh-ring); border-radius: 8px; }

/* ── Header: full bredde, frostet, som appen ─────────────────────────── */
.sh-header { position: sticky; top: 0; z-index: 90; background: rgba(255, 255, 255, .88); backdrop-filter: blur(18px) saturate(170%); -webkit-backdrop-filter: blur(18px) saturate(170%); border-bottom: 1px solid rgba(0, 77, 64, .09); padding-top: env(safe-area-inset-top, 0px); }
.sh-header-inner { width: 100%; padding: 0 var(--sh-gutter); min-height: var(--sh-header-h); display: flex; align-items: center; gap: clamp(10px, 2vw, 22px); }
.sh-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--color-text); flex: none; }
.sh-logo { display: block; height: 30px; width: auto; }
.sh-product { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--color-primary-bg); color: var(--color-primary-dark); font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
@media (max-width: 480px) { .sh-logo { height: 26px; } }
@media (max-width: 350px) { .sh-product { display: none; } }

/* Ikon-tabs (desktop). Aktiv = tekstfarge + understrek som appens nav-tab. */
.sh-nav { display: flex; align-items: stretch; gap: 2px; height: var(--sh-header-h); margin-left: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.sh-nav::-webkit-scrollbar { display: none; }
.sh-nav a { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 0 13px; color: var(--color-text-secondary); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; border-radius: 10px; transition: color var(--transition-fast), background var(--transition-fast); }
.sh-nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.sh-nav a:hover { color: var(--color-text); }
.sh-nav a::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: transparent; transition: background var(--transition-fast); }
.sh-nav a.active { color: var(--color-primary-dark); font-weight: 600; }
.sh-nav a.active svg { opacity: 1; color: var(--color-primary); }
.sh-nav a.active::after { background: var(--color-primary); }
.sh-nav[hidden] { display: none; }
/* Portal: topp-tabs kun på desktop – mobil bruker bunn-nav */
@media (max-width: 720px) { .sh-nav.sh-nav-desktop { display: none; } }

.sh-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.sh-cross-link { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-surface); color: var(--color-text-secondary); text-decoration: none; font-size: 13.5px; font-weight: 600; white-space: nowrap; transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast); }
.sh-cross-link svg { width: 16px; height: 16px; flex: none; }
.sh-cross-link:hover { color: var(--color-primary-dark); border-color: var(--color-primary); background: var(--color-primary-bg); }
@media (max-width: 480px) { .sh-cross-link span { display: none; } .sh-cross-link { padding: 8px; } }

/* Avatar + meny */
.sh-user { position: relative; }
.sh-avatar-btn { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border: 1px solid transparent; background: transparent; border-radius: 999px; cursor: pointer; color: var(--color-text); font: inherit; transition: background var(--transition-fast), border-color var(--transition-fast); }
.sh-avatar-btn:hover, .sh-avatar-btn[aria-expanded="true"] { background: var(--color-surface); border-color: var(--color-border); }
.sh-avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12.5px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%); letter-spacing: .02em; flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); overflow: hidden; }
.sh-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sh-user-name { font-size: 14px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-user-role { display: block; font-size: 11px; font-weight: 500; color: var(--color-text-tertiary); line-height: 1; margin-top: 2px; }
.sh-avatar-btn .sh-chev { width: 14px; height: 14px; color: var(--color-text-tertiary); transition: transform var(--transition-fast); }
.sh-avatar-btn[aria-expanded="true"] .sh-chev { transform: rotate(180deg); }
@media (max-width: 720px) { .sh-user-name, .sh-user-role, .sh-avatar-btn .sh-chev { display: none; } .sh-avatar-btn { padding: 2px; } }
.sh-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 14px; box-shadow: var(--shadow-xl); padding: 6px; z-index: 120; animation: shpop .14s ease-out; }
.sh-menu[hidden] { display: none; }
@keyframes shpop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.sh-menu-head { padding: 10px 12px 10px; border-bottom: 1px solid var(--color-border-light); margin-bottom: 6px; }
.sh-menu-head b { display: block; font-size: 14px; }
.sh-menu-head span { display: block; font-size: 12.5px; color: var(--color-text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-menu a, .sh-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: 9px; color: var(--color-text); font: inherit; font-size: 14px; text-align: left; text-decoration: none; cursor: pointer; }
.sh-menu a svg, .sh-menu button svg { width: 17px; height: 17px; color: var(--color-text-tertiary); flex: none; }
.sh-menu a:hover, .sh-menu button:hover { background: var(--color-surface-hover); }
.sh-menu .sh-menu-danger { color: #b91c1c; }
.sh-menu .sh-menu-danger svg { color: #b91c1c; }
.sh-menu hr { border: 0; border-top: 1px solid var(--color-border-light); margin: 6px 0; }

/* Studio: på mobil ligger tabs på egen rad under merkevaren, som appens .main-nav */
.sh-header.sh-has-tabs .sh-nav { flex: 1 1 auto; min-width: 0; }
@media (max-width: 1340px) { .sh-header.sh-has-tabs .sh-nav a { padding: 0 10px; font-size: 13.5px; gap: 6px; } .sh-header.sh-has-tabs .sh-nav a::after { left: 9px; right: 9px; } }
@media (max-width: 1300px) and (min-width: 901px) { .sh-header.sh-has-tabs .sh-user-name, .sh-header.sh-has-tabs .sh-user-role, .sh-header.sh-has-tabs .sh-chev { display: none; } .sh-header.sh-has-tabs .sh-avatar-btn { padding: 2px; } .sh-header.sh-has-tabs .sh-product { display: none; } }
@media (max-width: 900px) {
    .sh-header.sh-has-tabs .sh-header-inner { flex-wrap: wrap; row-gap: 0; }
    .sh-header.sh-has-tabs .sh-nav { order: 3; flex: 1 0 100%; height: var(--sh-nav-h); margin: 0 calc(-1 * var(--sh-gutter)); padding: 0 var(--sh-gutter); border-top: 1px solid var(--color-border-light); }
    .sh-header.sh-has-tabs .sh-nav a { padding: 0 11px; font-size: 13.5px; }
    .sh-header.sh-has-tabs .sh-header-inner { min-height: auto; }
    .sh-header.sh-has-tabs .sh-brand { min-height: 56px; }
    .sh-header.sh-has-tabs { --sh-header-h: calc(56px + var(--sh-nav-h)); }
}

/* Portal: bunn-nav på mobil – frostet, med aktiv «pille» */
.sh-bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(255, 255, 255, .9); backdrop-filter: blur(18px) saturate(170%); -webkit-backdrop-filter: blur(18px) saturate(170%); border-top: 1px solid rgba(0, 77, 64, .09); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
.sh-bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 50px; padding: 4px 2px; border-radius: 12px; color: var(--color-text-secondary); text-decoration: none; font-size: 11px; font-weight: 600; letter-spacing: .01em; transition: color var(--transition-fast); }
.sh-bottomnav a svg { width: 22px; height: 22px; }
.sh-bottomnav a .sh-pill { display: inline-grid; place-items: center; width: 44px; height: 26px; border-radius: 999px; transition: background var(--transition-fast); }
.sh-bottomnav a.active { color: var(--color-primary-dark); }
.sh-bottomnav a.active .sh-pill { background: var(--color-primary-bg); }
.sh-bottomnav a.active svg { color: var(--color-primary-dark); }
.sh-bottomnav[hidden], .sh-hide { display: none !important; }
@media (min-width: 721px) { .sh-bottomnav { display: none; } }

/* ── Sideinnhold ────────────────────────────────────────────────────── */
.sh-main { width: 100%; margin: 0 auto; padding: clamp(16px, 2.5vw, 28px) var(--sh-gutter) 56px; }
.sh-loading { display: grid; place-items: center; padding: 70px 0; }
.sh-skeleton { position: relative; overflow: hidden; background: var(--color-border-light); border-radius: 10px; min-height: 14px; }
.sh-skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent); animation: shshimmer 1.3s infinite; }
@keyframes shshimmer { to { transform: translateX(100%); } }

/* Sidehode: eyebrow + tittel + handlinger */
.sh-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; margin: 4px 0 22px; }
.sh-eyebrow { display: block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--color-primary-dark); margin-bottom: 4px; }
.sh-title { font-size: clamp(24px, 2.4vw, 30px); font-weight: 800; letter-spacing: -.015em; line-height: 1.15; margin: 0; }
.sh-subtitle { color: var(--color-text-secondary); font-size: 15px; margin: 6px 0 0; max-width: 62ch; line-height: 1.5; }
.sh-page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Hero (forsidens gradient) – brukes på portalens hjem og studioets oversikt */
.sh-hero { position: relative; overflow: hidden; color: #fff; border-radius: 20px; padding: clamp(20px, 3vw, 30px) clamp(18px, 3vw, 30px); background: linear-gradient(135deg, var(--sh-hero-a) 0%, var(--sh-hero-b) 55%, var(--sh-hero-c) 100%); box-shadow: 0 18px 40px -22px rgba(0, 77, 64, .55); isolation: isolate; }
.sh-hero::before { content: ''; position: absolute; width: 380px; height: 380px; right: -120px; top: -160px; border-radius: 50%; background: radial-gradient(closest-side, rgba(77, 182, 172, .35), transparent 70%); pointer-events: none; }
.sh-hero::after { content: ''; position: absolute; width: 260px; height: 260px; left: -90px; bottom: -150px; border-radius: 50%; background: radial-gradient(closest-side, rgba(38, 166, 154, .22), transparent 70%); pointer-events: none; }
.sh-hero > * { position: relative; z-index: 1; }
.sh-hero .sh-eyebrow { color: rgba(255, 255, 255, .72); }
.sh-hero .sh-title { color: #fff; }
.sh-hero .sh-subtitle { color: rgba(255, 255, 255, .8); }
.sh-hero a:not(.sh-btn) { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.sh-hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 22px; }
.sh-hero-stat { display: block; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .13); text-decoration: none !important; color: #fff; transition: background var(--transition-fast), transform var(--transition-fast); }
a.sh-hero-stat:hover { background: rgba(255, 255, 255, .15); transform: translateY(-1px); }
.sh-hero-stat b { display: block; font-size: 24px; font-weight: 800; line-height: 1.1; letter-spacing: -.01em; }
.sh-hero-stat span { display: block; font-size: 12.5px; color: rgba(255, 255, 255, .78); margin-top: 3px; }
.sh-hero-stat.is-hot { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .28); }

/* Seksjonstittel med teller */
.sh-section { display: flex; align-items: center; gap: 8px; margin: 30px 0 12px; }
.sh-hero + .sh-section, .sh-page-head + .sh-section { margin-top: 22px; }
.sh-section + .sh-empty { margin-top: 0; }
.sh-section h2 { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: -.005em; }
.sh-section .sh-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--color-border-light); color: var(--color-text-secondary); font-size: 12px; font-weight: 700; }
.sh-section .sh-count.is-primary { background: var(--color-primary-bg); color: var(--color-primary-dark); }
.sh-section .sh-section-aside { margin-left: auto; font-size: 13px; color: var(--color-text-secondary); text-align: right; }
@media (max-width: 600px) { .sh-section { flex-wrap: wrap; } .sh-section .sh-section-aside { flex: 1 0 100%; margin-left: 0; text-align: left; font-size: 12.5px; } }

/* Tom tilstand med ikon */
.sh-empty { display: grid; place-items: center; text-align: center; padding: 34px 20px; color: var(--color-text-secondary); }
.sh-empty-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--color-primary-bg); color: var(--color-primary-dark); margin-bottom: 12px; }
.sh-empty-icon svg { width: 26px; height: 26px; }
.sh-empty strong { display: block; color: var(--color-text); font-size: 16px; margin-bottom: 4px; }
.sh-empty p { margin: 0; max-width: 42ch; font-size: 14.5px; line-height: 1.5; }

/* Statusprikk i badges */
.sh-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }

/* Hjelpeklasser */
.sh-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
