/* ================================================================
   Nora Signal — Rammeverk: topbar, navigasjon, innhold, statistikk-fliser, dashbord, varslinger
   Utledet fra samples/sample2.html · Profilhåndbok v1.0
   ================================================================ */

/* ============ Logo og toppnavigasjon (standalone) ============ */
.logo { display: flex; align-items: center; gap: 10px; margin-right: 20px; }
.logomark {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 19px; letter-spacing: -.5px;
}
/* Ordmerket følger noracrm.no: «Nora» i halvfet blekk, produktnavnet i
   lettere snitt og aksentgrønt (<span> rundt ordet i markupen). */
.logotype { font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.logotype span { color: var(--accent); font-weight: 500; }
.topnav { display: flex; gap: 4px; }
/* Vises bare når toppnavigasjonen er slide-out-meny (se mobilblokka nederst) */
.topnav-merke { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 6px;
  font-size: 13.5px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; white-space: nowrap; transition: all .15s;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--accent-light); color: var(--accent); }
.nav-count {
  font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px;
  background: var(--bg); color: var(--text-tertiary);
}
.nav-item.active .nav-count { background: var(--surface); color: var(--accent); }

/* ============ Topbar ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: 56px; min-height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  transition: background .3s;
}
.topbar-spacer { flex: 1; }
.btn-icon {
  width: 36px; height: 36px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; position: relative;
}
.btn-icon:hover { background: var(--bg); color: var(--accent); }
.btn-icon svg { width: 20px; height: 20px; }
.notif-dot {
  position: absolute; top: 7px; right: 8px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); border: 1.5px solid var(--surface);
}
.theme-wrap { position: relative; }
.theme-dropdown {
  position: absolute; right: 0; top: 44px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 6px; width: 168px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: all .15s ease;
}
.theme-dropdown.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.theme-option {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
  font-size: 13px; color: var(--text); transition: all .15s;
}
.theme-option:hover { background: var(--bg); }
.theme-swatch { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border); }
.theme-option .check { margin-left: auto; color: var(--accent); opacity: 0; font-size: 12px; }
.theme-option.active .check { opacity: 1; }
.theme-divider { height: 1px; background: var(--border-light); margin: 6px 4px; }
.theme-drop-label {
  padding: 4px 10px 2px;
  font-size: 10px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase;
  color: var(--text-tertiary);
}
.font-swatch {
  width: 16px; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; color: var(--text-secondary); line-height: 1;
}
.tb-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; cursor: pointer;
}

/* ============ Content ============ */
.content { max-width: 1440px; margin: 0 auto; padding: 28px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page-head h2 { font-size: 20px; font-weight: 600; letter-spacing: -.3px; }
.page-sub { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; }

/* Statistikk-fliser */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04); transition: background .3s;
}
.stat-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-secondary); margin-bottom: 6px;
}
.stat-value {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 26px; font-weight: 600; letter-spacing: -.3px; line-height: 1.15;
}
.stat-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }
.stat-sub .up { color: var(--accent); font-weight: 500; }

/* Panelvisning */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============ Avatar-meny ============ */
.user-drop-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border-light); margin-bottom: 4px; }
.drop-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
  font-size: 13px; color: var(--text); transition: all .15s;
}
.drop-item:hover { background: var(--bg); }

/* «Merk alle»-menyen (velg alle-checkboxen i trefflistene) */
.merk-meny {
  position: fixed; z-index: 200;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 6px; width: 264px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.merk-meny .drop-item { flex-direction: column; align-items: flex-start; gap: 1px; }
.merk-meny-sub { font-size: 11px; color: var(--text-tertiary); }
.merk-meny-av { opacity: .5; cursor: default; }
.merk-meny-av:hover { background: none; }

/* ============ Dashbord ============ */
/* dense: småwidgets rykker opp og fyller hull etter span-2-kort,
   så ingen rad blir stående med tom kolonne */
.dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; grid-auto-flow: dense; }
.dash-grid .span-2 { grid-column: span 2; }
.dash-grid .span-3 { grid-column: span 3; }
/* Nytt seksjonshode inni samme kort (Dine lister + Overvåkning) */
.card-header--stacked { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-light); }

/* Flyttbare widgets: håndtak, fjern-knapp og dra-tilstand */
.wg-grip {
  display: flex; align-items: center; flex-shrink: 0;
  color: var(--text-tertiary); cursor: grab; user-select: none; margin-right: 2px;
}
.wg-grip:active { cursor: grabbing; }
.wg-grip svg { width: 14px; height: 14px; }
.wg-remove {
  flex-shrink: 0; margin-left: 4px; padding: 0 6px; border: none; border-radius: 4px;
  background: none; color: var(--text-tertiary);
  font-size: 17px; line-height: 22px; cursor: pointer; transition: all .15s;
}
.wg-remove:hover { color: var(--red); background: var(--bg); }
.dash-widget.dragging { opacity: .45; outline: 2px dashed var(--accent); outline-offset: -2px; }

/* «Legg til widget»-menyen */
#widgetDropdown { width: 240px; }
.theme-option.er-lagt-til { opacity: .5; }
.theme-option .wg-hake { margin-left: auto; color: var(--accent); font-size: 12px; }
.wg-ikon { display: flex; flex-shrink: 0; color: var(--text-secondary); }
.wg-ikon svg { width: 16px; height: 16px; }

/* Nyhetskategorier: av/på-chips */
.nyh-kats { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 12px; }
.nyh-kat {
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text-secondary); font-size: 12px; font-family: inherit;
  padding: 3px 11px; cursor: pointer; transition: all .15s;
}
.nyh-kat:hover { color: var(--text); }
.nyh-kat.on { background: var(--accent-light); border-color: transparent; color: var(--accent); font-weight: 600; }

/* Widgetfilter (bransje + fylke) i kortheadere */
.dash-filter { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
.dash-filter select {
  padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-size: 12.5px; font-family: inherit; max-width: 150px; cursor: pointer;
}
.dash-filter select:focus { outline: none; border-color: var(--accent); }

/* Siste nytt: kategoriseksjoner i to spalter på desktop */
#dashNews { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; align-items: start; }
#dashNews .empty-note { grid-column: 1 / -1; }
.dash-grid .card-header { flex-wrap: wrap; gap: 8px; }
.news-sec-head {
  font-size: 11px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase;
  color: var(--text-tertiary); padding: 12px 0 4px; border-bottom: 1px solid var(--border-light);
}
/* Én synlig kategori: seksjonen brer seg over begge spaltene,
   og radene fordeles i to spalter i stedet */
.news-sec--full { grid-column: 1 / -1; }
.news-sec--full .news-sec-rows {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; align-items: start;
}
.news-dato { font-size: 11.5px; font-weight: 400; color: var(--text-tertiary); margin-left: 8px; white-space: nowrap; }
.news-kilde { font-size: 11.5px; color: var(--accent); text-decoration: none; }
.news-kilde:hover { text-decoration: underline; }
.co-link { cursor: pointer; }
.co-link:hover { text-decoration: underline; }
/* Grid-items skal kunne krympe — ellers presser tabeller/lange navn dem
   bredere enn viewporten på mobil (min-width:auto-fella). */
.dash-grid > *, .saved-grid > *, .produkt-grid > * { min-width: 0; }
.prow { min-width: 0; }
.prow-name, .prow-sub { overflow-wrap: anywhere; }
.progress { height: 6px; border-radius: 3px; background: var(--border-light); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width .6s ease; }
.check-item { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); padding: 7px 0; }
.check-item.done { color: var(--text); }
.check-dot {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 11px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text-tertiary);
}
.check-item.done .check-dot { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ============ Varslinger ============ */
.notif-drop { width: 340px; padding: 8px; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px 10px; border-bottom: 1px solid var(--border-light); margin-bottom: 4px; font-size: 13px; font-weight: 600; }
.notif-item { display: flex; gap: 10px; padding: 10px; border-radius: 6px; cursor: pointer; transition: background .15s; }
.notif-item:hover { background: var(--bg); }
.n-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; visibility: hidden; }
.notif-item.unread .n-dot { visibility: visible; }
.n-body { font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); }
.n-body strong { color: var(--text); }
.n-time { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

/* Responsivt */
.menu-btn { display: none; }
.nav-overlay {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(0,0,0,0.4);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
@media (max-width: 1280px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .saved-grid { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-grid .span-2, .dash-grid .span-3 { grid-column: span 1; }
}
@media (max-width: 1000px) {
  .search-layout { flex-direction: column; align-items: stretch; }
  /* .filters-mobilreglene ligger i filters.css — den lastes etter layout.css,
     og basisregelen der (280px + sticky) ville ellers vunnet over denne blokka. */
  .results { width: 100%; max-width: 100%; }
}
@media (max-width: 700px) {
  #dashNews { grid-template-columns: 1fr; }
}

/* Mobil: toppnavigasjonen blir en slide-out-meny bak hamburgerknappen */
@media (max-width: 900px) {
  .menu-btn { display: flex; flex-shrink: 0; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topnav {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 130;
    width: 272px; max-width: 84vw;
    flex-direction: column; gap: 2px; align-items: stretch;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 64px 12px 16px;
    transform: translateX(-105%); transition: transform .22s ease;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  }
  /* Ordmerket i skuffen er et ekte element (ikke ::before) — et pseudoelement
     kan ikke bære to skriftvekter, og «Nora» skal stå halvfeit mot «Signal».
     NB: må stå med .topnav foran — ellers slår «.logotype { display: none }»
     i 640px-blokka lenger nede den ut (den skjuler ordmerket i topbaren). */
  .topnav .topnav-merke {
    display: block; position: absolute; top: 18px; left: 24px; font-size: 17px;
  }
  .topnav.open { transform: none; }
  body.nav-open .nav-overlay { opacity: 1; pointer-events: auto; }
  .nav-item { padding: 12px 14px; font-size: 14.5px; border-radius: 8px; }
  .nav-item .nav-count { margin-left: auto; }
}

/* Små skjermer: tettere innhold, fliser i to kolonner, profil i fullbredde */
@media (max-width: 640px) {
  .content { padding: 14px; }
  .stats-row { gap: 10px; }
  .stat-tile { padding: 12px 14px; }
  .stat-value { font-size: 21px; }
  .page-head { flex-wrap: wrap; }
  .page-actions { flex-wrap: wrap; }
  .logotype { display: none; }
  .detail { width: 100vw; max-width: 100vw; border-radius: 0; }
  .prod-toolbar { flex-wrap: wrap; }
  .prod-toolbar .input { min-width: 0 !important; width: 100%; }
  .byra-filt { flex: 1 1 100%; }
  .prod-toolbar .byra-filt .input { width: 74px; flex: 1; }
}
