/* FLOGVIT.image — én site.css for familiechromen (portal/STYLE.md): papir,
   blekk og teal aksent. Verktøyene får sine stiler etter hvert som de
   konverteres (#12–#17). Fontdeklarasjonene bor i fonts.css (absolutte
   /fonts/-URL-er, kopieres rått til /assets). */

:root {
  --paper: #faf9f6;
  --surface: #ffffff;
  --ink: #1b1b18;
  --ink-2: #67665f;
  --line: #dcdacf;
  --accent: #0f6e77;
  --bad: #c03b2e;
}

/* FLOGVIT familie-tema (portal/PREFS.md). Head-snippeten setter data-fv-theme
   fra fv-prefs-cookien: 'dark'/'light' tvinger, 'system' (uten attributt) gir
   default. image er light-first — kun eksplisitt valg flipper. */
[data-fv-theme="dark"] {
  --paper: #161614;
  --surface: #1e1e1b;
  --ink: #edece6;
  --ink-2: #99978d;
  --line: #2e2d29;
  --accent: #3aa7b0;
  --bad: #e0604f;
}

* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

html {
  overflow-x: clip; /* clip, ikke hidden — bryter ellers sticky */
}

body {
  max-width: 100vw;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-grotesk), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

.mono {
  font-family: var(--font-plex-mono), "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

.app-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-wrapper main {
  flex: 1;
}

@media (min-width: 1024px) {
  .app-wrapper {
    margin-left: 240px;
  }
}

/* ---------- FLOGVIT-wordmark + produktvelger ---------- */

.wordmark {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
  color: var(--ink);
}

.fv-menu {
  position: relative;
  display: inline-block;
}

.fv-summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);

  &::-webkit-details-marker {
    display: none;
  }

  &:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
  }
}

.fv-caret {
  color: var(--ink-2);
  transition: transform 0.15s ease-out;
}

.fv-menu[open] .fv-caret {
  transform: rotate(180deg);
}

.fv-panel {
  position: absolute;
  left: -10px;
  top: calc(100% + 10px);
  z-index: 120;
  display: flex;
  flex-direction: column;
  min-width: 230px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
}

.fv-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 400;
  letter-spacing: 0;
  text-decoration: none;
  color: var(--ink);
}

a.fv-item {
  transition: background 0.12s ease;

  &:hover {
    background: color-mix(in oklab, var(--ink) 6%, var(--surface));
  }
}

.fv-item[aria-current] {
  background: color-mix(in oklab, var(--ink) 6%, var(--surface));
}

.fv-wm {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
}

.fv-brand-b {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.fv-dot {
  font-weight: 800;
  color: var(--ink);
}

.fv-prod {
  font-family: var(--font-plex-mono), "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 500;
  font-size: 0.95em;
}

.fv-soon {
  cursor: default;

  .fv-wm {
    opacity: 0.5;
  }
}

.fv-chip {
  font-family: var(--font-plex-mono), "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--ink-2);
}

/* Produktaksenter (lys modus) */
.fv-dot-puzzles { color: #2b5bb7; }
.fv-dot-lab { color: #6743b8; }
.fv-dot-image { color: #0f6e77; }
.fv-dot-books { color: #2f7d43; }
.fv-dot-foto { color: #b0355f; }
.fv-dot-photosuite { color: #8a5d0b; }
.fv-dot-bibel { color: #7a4a21; }

/* «.image» — lenke til forsiden; prikken i produktaksenten */
.wm-product {
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-plex-mono), "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 500;
  font-size: 0.95em;

  &:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
  }
}

.wm-product-dot {
  font-family: var(--font-grotesk), sans-serif;
  font-weight: 800;
  font-size: 1.0526em; /* tilbake til wordmark-størrelsen (prikken er Grotesk 800) */
  color: var(--accent);
}

/* ---------- Delte piller: konto, tema, enheter ---------- */

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  padding: 0.35rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;

  &:hover {
    color: var(--ink);
    border-color: var(--ink-2);
  }
}

.account-name {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 10rem;
}

.plus-badge {
  padding: 0.1rem 0.4rem;
  background: var(--accent);
  color: var(--paper);
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

.theme-toggle,
.unit-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;

  button {
    padding: 0.35rem 0.7rem;
    background: transparent;
    border: none;
    color: var(--ink-2);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;

    &:hover {
      color: var(--ink);
    }

    &.active {
      background: var(--ink);
      color: var(--paper);
    }
  }
}

/* Fullbredde-variant for sidebar-footeren */
.theme-toggle.block,
.unit-toggle.block {
  width: 100%;

  button {
    flex: 1;
    padding: 0.4rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
  }
}

/* ---------- Innstillinger: tannhjul + /settings-siden ---------- */

.settings-gear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 1rem;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;

  span {
    display: inline-block;
    transition: transform 0.25s ease;
  }

  &:hover {
    color: var(--ink);
    border-color: var(--ink-2);

    span {
      transform: rotate(45deg);
    }
  }

  &.active {
    color: var(--ink);
    border-color: var(--ink);
  }
}

.sb-footer-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;

  .account-chip {
    flex: 1;
    min-width: 0;
  }
}

.settings {
  max-width: 640px;
  margin: 0 auto;
  padding: 0.5rem 0 2rem;
}

.settings-title {
  font-family: var(--font-grotesk), sans-serif;
  font-size: 1.6rem;
  margin: 0 0 1.25rem;
  color: var(--ink);
}

.settings-group {
  padding: 1.1rem 0;
  border-top: 1px solid var(--line);

  &:first-of-type {
    border-top: none;
    padding-top: 0;
  }

  h2 {
    font-size: 1rem;
    margin: 0 0 0.25rem;
    color: var(--ink);
  }
}

.settings-hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--ink-2);
}

.settings-link {
  display: inline-block;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;

  &:hover {
    text-decoration: underline;
  }
}

.plus-hint {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--ink-2);
  text-align: center;

  a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;

    &:hover {
      text-decoration: underline;
    }
  }
}

/* ---------- Sidebar (desktop) ---------- */

.sidebar {
  display: none;
  width: 240px;
  min-width: 240px;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: var(--paper);
  color: var(--ink);
  flex-direction: column;
  border-right: 1px solid var(--line);
  z-index: 100;
}

@media (min-width: 1024px) {
  .sidebar {
    display: flex;
  }
}

.sb-brand {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 1.15rem;
}

.sb-search {
  padding: 0.75rem 1rem;
  position: relative;
}

.sb-search-input {
  width: 100%;
  padding: 0.5rem 2rem 0.5rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;

  &::placeholder {
    color: var(--ink-2);
  }

  &:focus {
    border-color: var(--accent);
  }
}

.sb-clear {
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--ink-2);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s ease;

  &:hover {
    color: var(--ink);
  }
}

.sb-controls {
  display: flex;
  justify-content: flex-end;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--line);

  button {
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink-2);
    width: 24px;
    height: 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, border-color 0.15s ease;

    &:hover {
      border-color: var(--ink-2);
      color: var(--ink);
    }
  }
}

.sb-nav {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex: 1;
  padding: 0.5rem 0;

  &::-webkit-scrollbar {
    width: 6px;
  }

  &::-webkit-scrollbar-track {
    background: transparent;
  }

  &::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 3px;

    &:hover {
      background: var(--ink-2);
    }
  }
}

.sb-featured {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  margin: 0 0.5rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, background 0.15s ease;

  .sb-icon {
    font-size: 1.1rem;
  }

  &:hover {
    border-color: var(--accent);
  }

  &.active {
    border-color: var(--accent);
    background: color-mix(in oklab, var(--accent) 8%, var(--surface));
  }
}

.sb-cat {
  margin-bottom: 0.25rem;
}

.sb-cat-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-plex-mono), "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  font-weight: 500;
  text-transform: lowercase;
  transition: color 0.15s ease, background 0.15s ease;

  &:hover {
    color: var(--ink);
    background: color-mix(in oklab, var(--ink) 4%, transparent);
  }

  &.has-active {
    color: var(--accent);
  }
}

.sb-cat-icon {
  font-size: 0.9rem;
}

.sb-cat-name {
  flex: 1;
}

.sb-chevron {
  font-size: 1rem;
  transition: transform 0.2s ease;
  transform: rotate(0deg);
}

.sb-cat.open .sb-chevron {
  transform: rotate(90deg);
}

/* Kategoriverktøyene vises når kategorien er åpen — eller alltid i compact. */
.sb-cat-tools {
  display: none;
  flex-direction: column;
}

.sb-cat.open .sb-cat-tools,
.sidebar.compact .sb-cat-tools {
  display: flex;
}

.sb-cat-tools a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.5rem 1rem 0.5rem 2.25rem;
  transition: color 0.15s ease, background 0.15s ease;
  border-left: 2px solid transparent;

  &:hover {
    color: var(--ink);
    background: color-mix(in oklab, var(--ink) 4%, transparent);
  }

  &.active {
    color: var(--accent);
    background: color-mix(in oklab, var(--accent) 8%, transparent);
    border-left-color: var(--accent);
  }

  .sb-icon {
    font-size: 0.95rem;
    width: 1.25rem;
    text-align: center;
  }
}

.sb-no-results {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--ink-2);
  font-size: 0.85rem;
  font-style: italic;
}

.sb-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;

  span {
    font-family: var(--font-plex-mono), "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 11px;
    color: var(--ink-2);
  }
}

.sb-sync {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  transition: color 0.15s ease, background 0.15s ease;

  &:hover {
    color: var(--ink);
    background: color-mix(in oklab, var(--ink) 6%, transparent);
  }

  &.active {
    color: var(--accent);
    background: color-mix(in oklab, var(--accent) 8%, transparent);
  }
}

/* Compact-modus */
.sidebar.compact {
  width: 60px;
  min-width: 60px;

  .sb-brand {
    padding: 1.25rem 0.25rem;
    font-size: 0.72rem;
    display: flex;
    justify-content: center;
  }

  .sb-controls {
    justify-content: center;
  }

  .sb-cat-header {
    justify-content: center;
    padding: 0.6rem 0.5rem;
  }

  .sb-featured {
    justify-content: center;
    padding: 0.5rem;
    margin: 0 0.25rem 0.5rem;
  }

  .sb-cat-tools a {
    justify-content: center;
    padding: 0.5rem;

    .sb-icon {
      width: auto;
    }
  }

  .sb-footer {
    padding: 0.75rem 0.5rem;
  }

  /* Alt som bare gir mening i full bredde skjules i compact. */
  .sb-search,
  .sb-expand,
  .sb-collapse,
  .sb-cat-name,
  .sb-chevron,
  .sb-featured-name,
  .sb-tool-name,
  .sb-sync,
  .sb-footer .account-chip,
  .sb-footer .theme-toggle,
  .sb-count-full {
    display: none;
  }
}

.sidebar:not(.compact) .sb-count-compact {
  display: none;
}

/* ---------- Header (mobil/tablet) ---------- */

.site-header {
  background: var(--surface);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

@media (min-width: 1024px) {
  .site-header {
    display: none;
  }
}

.hdr-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
}

.hdr-brand {
  font-size: 1.3rem;
}

.hdr-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.menu-btn {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 28px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 10;

  span {
    width: 100%;
    height: 3px;
    background: var(--ink);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: left;
  }

  &.open {
    span:nth-child(1) {
      transform: rotate(45deg);
    }
    span:nth-child(2) {
      opacity: 0;
    }
    span:nth-child(3) {
      transform: rotate(-45deg);
    }
  }
}

.hdr-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0 2rem 1rem;

  a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--ink-2);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    transition: color 0.15s ease, background 0.15s ease;
    white-space: nowrap;

    &:hover {
      color: var(--ink);
      background: color-mix(in oklab, var(--ink) 6%, transparent);
    }

    &.active {
      color: var(--accent);
      background: color-mix(in oklab, var(--accent) 8%, transparent);
    }
  }

  .hdr-icon {
    font-size: 1rem;
  }
}

@media (max-width: 768px) {
  .hdr-topbar {
    padding: 1rem;
  }

  .menu-btn {
    display: flex;
  }

  .hdr-nav {
    display: none;
    flex-direction: column;
    padding: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);

    &.open {
      display: flex;
    }

    a {
      padding: 1rem 1.5rem;
      border-radius: 0;
      font-size: 1rem;
      border-bottom: 1px solid var(--line);
      border-left: 3px solid transparent;

      &:hover {
        background: color-mix(in oklab, var(--ink) 4%, transparent);
      }

      &.active {
        color: var(--accent);
        background: color-mix(in oklab, var(--accent) 8%, transparent);
        border-left-color: var(--accent);
      }
    }
  }
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: auto;
  padding: 1.5rem 2rem;
  background: var(--paper);
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.875rem;
  text-align: center;

  a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;

    &:hover {
      text-decoration: underline;
    }
  }
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.footer-wip {
  font-family: var(--font-plex-mono), "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  font-weight: 500;
  text-transform: lowercase;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.footer-sep {
  color: var(--line);
}

/* ---------- Forsiden ---------- */

.home {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.home-hero {
  text-align: center;
  padding: 2.5rem 1rem 2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 2rem;
  color: var(--ink);

  h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
  }

  p {
    font-size: 1rem;
    color: var(--ink-2);
    max-width: 400px;
    margin: 0 auto;
  }
}

.hero-dot {
  color: var(--accent);
}

.home-cat {
  margin-bottom: 2rem;
}

.home-cat-title {
  font-family: var(--font-plex-mono), "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  font-weight: 500;
  text-transform: lowercase;
  color: var(--ink-2);
  margin-bottom: 0.75rem;
  padding-left: 0.25rem;
}

.home-tools {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tool-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;

  &:hover {
    border-color: var(--accent);
    transform: translateX(4px);

    .tool-card-arrow {
      opacity: 1;
      transform: translateX(0);
    }
  }

  &:active {
    transform: scale(0.99);
  }
}

.tool-card-icon {
  font-size: 1.75rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  border-radius: 10px;
  flex-shrink: 0;
}

.tool-card-body {
  flex: 1;
  min-width: 0;

  h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 0.25rem 0;
  }

  p {
    font-size: 0.875rem;
    color: var(--ink-2);
    margin: 0;
    line-height: 1.4;
  }
}

.tool-card-arrow {
  font-size: 1.25rem;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .home {
    padding: 2rem;
  }

  .home-hero {
    padding: 3rem 2rem;

    h1 {
      font-size: 2.75rem;
    }

    p {
      font-size: 1.1rem;
    }
  }

  .home-tools {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .tool-card:hover {
    transform: translateY(-2px);
  }
}

@media (min-width: 900px) {
  .home-hero {
    padding: 4rem 2rem;
    margin-bottom: 2.5rem;
  }

  .home-cat-title {
    margin-bottom: 1rem;
  }

  .tool-card {
    padding: 1.25rem 1.5rem;
    gap: 1.25rem;
  }

  .tool-card-icon {
    width: 52px;
    height: 52px;
    font-size: 1.85rem;
  }

  .tool-card-body h3 {
    font-size: 1.05rem;
  }

  .tool-card-arrow {
    opacity: 0.3;
  }
}

@media (max-width: 639px) {
  .home {
    padding: 1rem;
  }

  .home-hero {
    border-radius: 10px;
    padding: 2rem 1rem;
    margin-bottom: 1.5rem;

    h1 {
      font-size: 1.75rem;
    }

    p {
      font-size: 0.9rem;
    }
  }

  .tool-card {
    padding: 0.875rem 1rem;
  }

  .tool-card-icon {
    width: 42px;
    height: 42px;
    font-size: 1.5rem;
    border-radius: 8px;
  }

  .tool-card-body {
    h3 {
      font-size: 0.95rem;
    }

    p {
      font-size: 0.8rem;
    }
  }

  .tool-card-arrow {
    display: none;
  }
}

/* ---------- Verktøyskall (placeholder til konverteringene #12–#17) ---------- */

.tool-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.tool-page-header {
  margin-bottom: 1.5rem;

  h1 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.6rem;
  }

  p {
    margin-top: 0.4rem;
    color: var(--ink-2);
    max-width: 60ch;
    line-height: 1.5;
  }
}

.tool-pending {
  padding: 2rem;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--ink-2);
  text-align: center;
}

/* ---------- Kalkulatorer (#12-malen) — portert fra Calculator.module.css ----------
   Verktøypanelene beholder de hardkodede lyse fargene fra originalen;
   mørk-pass over verktøyflatene er en egen oppfølging (som før). */

.calc {
  max-width: 800px;
  margin: 0 auto;

  h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #555;
  }

  h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: #666;
  }
}

.calc-mode {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;

  button {
    padding: 0.75rem 1.25rem;
    border: 1px solid #dee2e6;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;

    &:hover {
      border-color: #1a1a2e;
    }

    &.active {
      background: #1a1a2e;
      color: #fff;
      border-color: #1a1a2e;
    }
  }
}

.calc-inputs {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.calc-group {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.calc-compare-group {
  border-left: 3px solid #ef4444;
}

.calc-row {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  align-items: center;

  label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: #495057;

    input {
      width: 120px;
      padding: 0.5rem;
      border: 1px solid #ced4da;
      border-radius: 4px;
      font-size: 1rem;
      text-align: right;

      &:focus {
        outline: none;
        border-color: #80bdff;
        box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
      }
    }

    span {
      color: #6c757d;
      font-size: 0.9rem;
    }
  }

  select {
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
    background: #fff;
    min-width: 150px;

    &:focus {
      outline: none;
      border-color: #80bdff;
      box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
    }
  }
}

.calc-presets {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;

  button {
    padding: 0.4rem 0.75rem;
    border: 1px solid #ced4da;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;

    &:hover {
      background: #e9ecef;
    }

    &.active {
      background: #1a1a2e;
      color: #fff;
      border-color: #1a1a2e;
    }
  }
}

.calc-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;

  input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
  }
}

.calc-slider {
  margin: 1rem 0;

  input[type="range"] {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    background: linear-gradient(to right, #dee2e6 0%, #1a1a2e 100%);
    border-radius: 4px;
    outline: none;

    &::-webkit-slider-thumb {
      -webkit-appearance: none;
      width: 20px;
      height: 20px;
      background: #1a1a2e;
      border-radius: 50%;
      cursor: pointer;
      border: 2px solid #fff;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    &::-moz-range-thumb {
      width: 20px;
      height: 20px;
      background: #1a1a2e;
      border-radius: 50%;
      cursor: pointer;
      border: 2px solid #fff;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
  }
}

.calc-slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #888;
}

.calc-slider-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;

  input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: #dee2e6;
    border-radius: 3px;
    outline: none;

    &::-webkit-slider-thumb {
      -webkit-appearance: none;
      width: 18px;
      height: 18px;
      background: #1a1a2e;
      border-radius: 50%;
      cursor: pointer;
    }
  }

  span {
    min-width: 60px;
    text-align: right;
    font-weight: 500;
  }
}

.calc-canvas {
  margin: 1rem 0;
  overflow-x: auto;

  canvas {
    display: block;
    max-width: 100%;
    border-radius: 8px;
    background: #1a1a2e;
  }
}

.calc-hint {
  font-size: 0.85rem;
  color: #888;
  font-style: italic;
  margin-top: 0.5rem;
  text-align: center;
}

.calc-results {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 1.5rem;

  > h2 {
    border-bottom: 2px solid #1a1a2e;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
  }
}

.calc-compare-title {
  color: #ef4444;
}

.calc-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.calc-result-card {
  background: #e7f3ff;
  padding: 1rem;
  border-radius: 6px;
  text-align: center;

  h3 {
    margin-bottom: 0.5rem;
    color: #0056b3;
  }

  p {
    font-size: 1.1rem;
    margin: 0;

    strong {
      color: #0056b3;
      font-size: 1.3rem;
    }
  }

  &.warning {
    background: #fff3cd;

    h3, p strong {
      color: #856404;
    }
  }

  &.success {
    background: #d4edda;

    h3, p strong {
      color: #155724;
    }
  }
}

.calc-info {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 6px;
  margin-top: 1.5rem;

  h3 {
    margin-bottom: 0.75rem;
  }

  ul {
    margin: 0;
    padding-left: 1.5rem;

    li {
      margin-bottom: 0.25rem;
      color: #495057;
    }
  }

  p {
    margin: 0.5rem 0;
    color: #495057;
  }
}

.calc-table {
  overflow-x: auto;
  margin: 1rem 0;

  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;

    th, td {
      padding: 0.5rem 0.75rem;
      text-align: left;
      border-bottom: 1px solid #e9ecef;
    }

    th {
      background: #f8f9fa;
      font-weight: 600;
      color: #495057;
    }

    tr:hover {
      background: #f8f9fa;
    }
  }
}

@media (max-width: 639px) {
  .calc h2 {
    font-size: 1.1rem;
  }

  .calc-mode {
    margin-bottom: 1.5rem;

    button {
      padding: 0.6rem 1rem;
      font-size: 0.85rem;
      flex: 1;
      min-width: 0;
    }
  }

  .calc-inputs {
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .calc-group {
    padding: 1rem;

    h2 {
      margin-bottom: 0.75rem;
    }
  }

  .calc-row {
    gap: 1rem;

    label {
      flex-direction: column;
      align-items: flex-start;
      gap: 0.25rem;
      width: 100%;

      input {
        width: 100%;
        padding: 0.75rem;
        font-size: 16px; /* hindrer zoom på iOS */
      }
    }

    select {
      width: 100%;
      padding: 0.75rem;
      font-size: 16px;
    }
  }

  .calc-presets {
    flex-wrap: wrap;
    width: 100%;
    margin-top: 0.5rem;

    button {
      flex: 1;
      min-width: 0;
    }
  }

  .calc-results {
    padding: 1rem;

    > h2 {
      margin-bottom: 1rem;
    }
  }

  .calc-result-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .calc-result-card {
    padding: 0.875rem;

    h3 {
      font-size: 0.85rem;
      margin-bottom: 0.25rem;
    }

    p {
      font-size: 1rem;

      strong {
        font-size: 1.15rem;
      }
    }
  }

  .calc-info {
    padding: 0.875rem;
    margin-top: 1rem;

    h3 {
      font-size: 0.95rem;
    }

    ul {
      padding-left: 1.25rem;
      font-size: 0.9rem;
    }
  }

  .calc-slider-row {
    flex-wrap: wrap;

    span:first-child {
      width: 100%;
      margin-bottom: 0.25rem;
    }
  }
}

@media (min-width: 640px) and (max-width: 899px) {
  .calc-row {
    gap: 1.5rem;
  }

  .calc-result-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Kort- og listeklasser rapportert fra #12-konverteringene (portert fra
   colorCard/frameList i Calculator.module.css). To navnesett i bruk
   (frame-*/list-*) — grupperte selektorer til de samles ved en senere
   opprydding. Inline styles per fase/rad overstyrer basefargene. */

.calc-color-card,
.calc-card {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;

  h3 {
    color: #1a1a2e;
    margin-bottom: 1rem;
    font-size: 1.1rem;
  }

  p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 0.75rem;
  }
}

.calc-frame-list,
.calc-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.calc-frame-item,
.calc-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #e9ecef;

  &.recommended {
    background: #d4edda;
    border-color: #28a745;
  }

  .calc-frame-name,
  .calc-list-name {
    font-weight: 600;
    color: #333;
  }

  .calc-frame-size,
  .calc-list-detail {
    color: #666;
  }

  .calc-frame-match,
  .calc-list-match {
    font-size: 0.85rem;
    color: #28a745;
  }
}

@media (max-width: 639px) {
  .calc-color-card,
  .calc-card {
    padding: 1rem;
    margin-bottom: 1rem;

    h3 {
      font-size: 1rem;
    }
  }

  .calc-frame-item,
  .calc-list-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.75rem;

    .calc-frame-size,
    .calc-list-detail {
      font-size: 0.85rem;
    }
  }
}

/* ---------- Delt bilde-picker (ip-*) — portert fra ImagePicker.module.css ---------- */

.image-picker {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ip-dropzone {
  border: 2px dashed #ccc;
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fafafa;

  &:hover {
    border-color: #007bff;
    background: #f0f7ff;
  }

  &.dragging {
    border-color: #007bff;
    background: #e7f1ff;
    border-style: solid;
  }
}

.ip-dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: #666;

  p {
    margin: 0;
    font-size: 0.9rem;
  }
}

.ip-drop-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #666;
  font-weight: 300;
}

.ip-library {
  background: #f8f9fa;
  border-radius: 10px;
  overflow: hidden;
}

.ip-library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: #e9ecef;
}

.ip-library-toggle {
  background: none;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem;

  &:hover {
    color: #007bff;
  }
}

.ip-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 1rem;

  &.down {
    transform: rotate(90deg);
  }
}

.ip-clear {
  background: none;
  border: none;
  color: #666;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;

  &:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.08);
  }
}

.ip-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 0.5rem;
  padding: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
}

.ip-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s ease;

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  &:hover {
    border-color: #007bff;

    .ip-remove {
      opacity: 1;
    }
  }
}

.ip-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(220, 53, 69, 0.9);
  color: white;
  border: none;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;

  &:hover {
    background: #dc3545;
  }
}

.ip-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #888;
  font-size: 0.85rem;
  padding: 1rem;
}

.ip-hint {
  font-size: 0.8rem;
  color: #888;
  text-align: center;
}

/* ---------- Analyseverktøyene (#16): faner, kanalknapper, statistikk ---------- */

.calc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.5rem;
  background: #f0f0f0;
  border-radius: 8px;

  button {
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #666;
    transition: all 0.15s ease;

    &:hover { background: #e0e0e0; color: #333; }
    &.active { background: #1a1a2e; color: #fff; }
  }
}

.calc-channel-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;

  button {
    padding: 0.5rem 1rem;
    border: 1px solid #dee2e6;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s ease;

    &:hover { border-color: #1a1a2e; }
    &.active { background: #1a1a2e; color: #fff; border-color: #1a1a2e; }
    &.red.active { background: #dc3545; border-color: #dc3545; }
    &.green.active { background: #28a745; border-color: #28a745; }
    &.blue.active { background: #007bff; border-color: #007bff; }
  }
}

.calc-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.calc-stat-section-label {
  grid-column: 1 / -1;
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: #666;
}

.calc-stat-card {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 6px;

  h3 { margin-bottom: 0.5rem; font-size: 0.9rem; }
  p {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    span { font-family: monospace; }
  }
  .red { color: #dc3545; }
  .green { color: #28a745; }
  .blue { color: #007bff; }
  .luminance { color: #666; margin-top: 0.25rem; font-family: monospace; }
}

.calc-no-data {
  color: #888;
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem 0;
  small { display: block; margin-top: 0.5rem; font-size: 0.8rem; color: #aaa; }
}

.calc-subheader {
  font-size: 0.9rem;
  color: #555;
  margin: 1rem 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #e9ecef;
}

.calc-c2pa-found {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background: #28a745;
  color: #fff;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
}

.calc-c2pa-link {
  display: inline-block;
  margin-left: 1rem;
  padding: 0.4rem 0.8rem;
  background: #0066cc;
  color: #fff;
  border-radius: 4px;
  font-size: 0.85rem;
  text-decoration: none;
}

.calc-export-btn {
  padding: 0.5rem 1rem;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;

  &:hover { opacity: 0.9; }
  &.secondary { background: #6c757d; }
}

/* ---------- #13 print/frame-kalkulatorene — delte klasser ----------
   Portert fra Calculator.module.css + PassepartoutCalculator.module.css. */

/* Klientene toggler hidden-attributtet; klasser som setter display ville
   ellers overstyrt UA-regelen for [hidden]. */
.calc [hidden] { display: none !important; }

.calc-note {
  font-size: 0.85rem;
  color: #6c757d;
  margin: 0.75rem 0 0 0;
}

.calc-type-toggle {
  display: flex;
  gap: 0.5rem;

  button {
    padding: 0.6rem 1rem;
    border: 1px solid #dee2e6;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s ease;

    &:hover { border-color: #1a1a2e; }
    &.active { background: #1a1a2e; color: #fff; border-color: #1a1a2e; }
  }
}

.calc-dropzone {
  border: 2px dashed #ced4da;
  border-radius: 6px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 1rem;
  color: #666;

  span { color: #6c757d; font-size: 0.9rem; }
  &:hover { border-color: #80bdff; background: rgba(0, 123, 255, 0.05); }
  &.dragging { border-color: #007bff; background: rgba(0, 123, 255, 0.1); border-style: solid; }
  &.calc-dropzone-with-image { padding: 0.5rem; }
}

.calc-preview-image {
  max-width: 100%;
  max-height: 150px;
  object-fit: contain;
  border-radius: 4px;
}

.calc-dropzone-inline {
  padding: 1rem;
  border: 2px dashed #ccc;
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 0.75rem;
  background: #f8f9fa;
  transition: all 0.2s ease;

  &:hover { border-color: #1a1a2e; }
  &.dragging { background: #e3f2fd; border-color: #007bff; }
}
.calc-dropzone-filename { font-weight: 600; }
.calc-dropzone-fileinfo { font-size: 0.85rem; color: #666; }
.calc-dropzone-placeholder { color: #666; }

.calc-preset-label { font-size: 0.85rem; color: #666; margin-bottom: 0.5rem; }
.calc-preset-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.75rem; }
.calc-preset-chip {
  padding: 0.375rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #333;
  cursor: pointer;
  transition: all 0.15s ease;

  &:hover { border-color: #1a1a2e; }
  &.active { background: #007bff; color: #fff; border-color: #007bff; }
}

.calc-vd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.calc-vd-card { padding: 0.75rem; border-radius: 6px; border: 1px solid; }
.calc-vd-suitable { background: #d4edda; border-color: #c3e6cb; }
.calc-vd-bad { background: #f8d7da; border-color: #f5c6cb; }
.calc-vd-name { font-size: 0.8rem; font-weight: 600; }
.calc-vd-mindpi { font-size: 0.75rem; color: #666; }

.calc-quality-excellent { color: #28a745; font-size: 0.85rem; font-weight: 600; }
.calc-quality-good { color: #5cb85c; font-size: 0.85rem; font-weight: 600; }
.calc-quality-acceptable { color: #f0ad4e; font-size: 0.85rem; font-weight: 600; }
.calc-quality-low { color: #dc3545; font-size: 0.85rem; font-weight: 600; }

.calc-recommendation {
  margin-top: 1rem;
  padding: 1rem;
  background: #e3f2fd;
  border-radius: 6px;
  border: 1px solid #90caf9;
}
.calc-recommendation-title { font-size: 0.85rem; color: #1565c0; }
.calc-recommendation-sub { font-size: 0.75rem; color: #666; margin-top: 0.25rem; }

.calc-cost-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;

  .calc-cost-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;

    &:last-child { border-bottom: none; font-weight: 600; font-size: 1.1rem; }
  }
}

/* Passepartout-spesifikt */
.calc-pp-margins-section { margin-bottom: 1.5rem; }
.calc-pp-margins-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 6px;
}
.calc-pp-margin-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1rem;
  background: #ffeeba;
  border-radius: 4px;

  span { font-size: 0.75rem; color: #856404; }
  strong { color: #856404; }
}
.calc-pp-margin-middle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  justify-content: center;
}
.calc-pp-print-preview {
  width: 100px;
  height: 60px;
  background: #d4edda;
  border: 2px solid #28a745;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: #155724;
}
.calc-pp-visual { margin-bottom: 1.5rem; }
.calc-pp-frame {
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
  background: #fff;
  border: 8px solid #495057;
  border-radius: 4px;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.calc-pp-print {
  background: linear-gradient(135deg, #6c757d 0%, #adb5bd 100%);
  border-radius: 2px;
  position: absolute;
}
.calc-pp-slack-info { display: block; font-size: 0.8rem; color: #0056b3; margin-top: 0.25rem; }
.calc-pp-ideal {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 6px;

  .calc-pp-ideal-line { font-style: italic; color: #6c757d; margin-bottom: 0.75rem; }
  ul {
    margin: 0;
    padding-left: 1.5rem;
    li { margin-bottom: 0.25rem; color: #495057; }
  }
}

/* ---------- color-palette (#16): palett-strip, fargekort, harmonier ---------- */

.calc-cp-strip { display: flex; height: 60px; border-radius: 6px; overflow: hidden; margin-bottom: 1.5rem; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.calc-cp-block { min-width: 30px; transition: flex 0.3s ease, transform 0.15s ease; cursor: pointer; }
.calc-cp-block:hover { transform: scaleY(1.1); z-index: 1; }
.calc-cp-block.selected { box-shadow: 0 0 0 3px #fff, 0 0 0 5px #1a1a2e; z-index: 2; }
.calc-cp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.calc-cp-card { border-radius: 8px; overflow: hidden; border: 1px solid #e9ecef; box-shadow: 0 2px 4px rgba(0,0,0,0.05); cursor: grab; transition: box-shadow 0.15s ease; }
.calc-cp-card:active { cursor: grabbing; }
.calc-cp-card.selected { box-shadow: 0 0 0 2px #1a1a2e, 0 4px 12px rgba(0,0,0,0.15); }
.calc-cp-swatch { height: 80px; display: flex; align-items: center; justify-content: center; font-family: monospace; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.calc-cp-info { padding: 0.75rem; background: #f8f9fa; display: flex; flex-direction: column; gap: 0.25rem; }
.calc-cp-info button { background: none; border: none; text-align: left; font-size: 0.75rem; color: #666; cursor: pointer; padding: 0.25rem; border-radius: 3px; font-family: monospace; }
.calc-cp-info button:hover { background: #e9ecef; }
.calc-cp-percentage { font-size: 0.7rem; color: #999; margin-top: 0.25rem; }
.calc-cp-section { border-top: 1px solid #e9ecef; padding-top: 1rem; margin-top: 1rem; }
.calc-cp-harmony-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.calc-cp-harmony-card { background: #f8f9fa; border-radius: 6px; padding: 0.75rem; }
.calc-cp-harmony-name { font-size: 0.8rem; color: #666; margin-bottom: 0.5rem; display: block; }
.calc-cp-harmony-colors { display: flex; gap: 4px; border-radius: 4px; overflow: hidden; }
.calc-cp-harmony-color { flex: 1; height: 40px; cursor: pointer; }

/* ---------- Før/etter-slider på lib/compare-slider (lens-distortion #16) ----------
   Klippe/håndtak-hooks er [data-cmp-clip]/[data-cmp-handle]; compare (#17)
   inliner sine egne stiler, lens-distortion bruker disse klassene. */

.calc-cmp-slider { position: relative; display: inline-block; cursor: ew-resize; user-select: none; max-width: 100%; }
.calc-cmp-base { max-width: 100%; height: auto; display: block; }
.calc-cmp-clip { position: absolute; top: 0; left: 0; width: 50%; height: 100%; overflow: hidden; }
.calc-cmp-clip-canvas { max-width: none; height: 100%; display: block; }
.calc-cmp-handle { position: absolute; top: 0; left: 50%; width: 4px; height: 100%; background: #fff; box-shadow: 0 0 4px rgba(0,0,0,0.5); cursor: ew-resize; transform: translateX(-50%); }
.calc-cmp-knob { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: 50%; background: #fff; box-shadow: 0 0 4px rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; font-size: 12px; }
.calc-cmp-label { position: absolute; top: 10px; background: rgba(0,0,0,0.6); color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 12px; }
.calc-cmp-label-left { left: 10px; }
.calc-cmp-label-right { right: 10px; }

/* ---------- /sync — manuell sky-synk (#19), portert fra SyncPanel.module.css ---------- */

.sync-panel {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem;

  h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--ink);
  }
}

.sync-intro {
  color: var(--ink-2);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.sync-muted {
  color: var(--ink-2);
  font-size: 0.8rem;
  font-family: var(--font-plex-mono), "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  margin-bottom: 1rem;
}

.sync-notice {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;

  p {
    color: var(--ink);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
  }
}

.sync-plus-name {
  color: var(--accent);
  font-weight: 700;
}

.sync-primary {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--paper);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;

  &:hover { opacity: 0.9; }
}

.sync-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.sync-btn {
  padding: 0.6rem 1.25rem;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s ease;

  &:hover:not(:disabled) { opacity: 0.85; }
  &:disabled { opacity: 0.5; cursor: wait; }
}

.sync-message {
  color: var(--ink);
  font-size: 0.9rem;
  margin: 1rem 0;
}

.sync-results {
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1rem;

  li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    background: var(--surface);

    &:not(:last-child) { border-bottom: 1px solid var(--line); }
  }
}

.sync-result-label { color: var(--ink); }

.sync-result-status {
  color: var(--ink-2);
  font-family: var(--font-plex-mono), "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
}

.sync-results li.ok .sync-result-status { color: var(--accent); }
.sync-results li.error .sync-result-status { color: var(--bad); }

.sync-footnote {
  color: var(--ink-2);
  font-size: 0.8rem;
}


/* ---------- Image-editor (#18) ---------- */

:root {
  --ie-bg-dark: #1e1e1e;
  --ie-bg-panel: #2d2d2d;
  --ie-bg-input: #3a3a3a;
  --ie-bg-hover: #3e3e3e;
  --ie-bg-active: #0078d4;
  --ie-text: #e0e0e0;
  --ie-text-dim: #999;
  --ie-border: #444;
  --ie-accent: #0078d4;
}

.ed-editor {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px);
  background: var(--ie-bg-dark);
  color: var(--ie-text);
  font-size: 13px;
  user-select: none;
  overflow: hidden;
}

/* --- Menu Bar --- */
.ed-menubar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--ie-bg-panel);
  border-bottom: 1px solid var(--ie-border);
  flex-shrink: 0;
  flex-wrap: wrap;

  button {
    background: transparent;
    color: var(--ie-text);
    border: 1px solid transparent;
    padding: 4px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;

    &:hover {
      background: var(--ie-bg-hover);
      border-color: var(--ie-border);
    }

    &:disabled {
      opacity: 0.4;
      cursor: default;

      &:hover {
        background: transparent;
        border-color: transparent;
      }
    }
  }
}

.ed-menuGroup {
  display: flex;
  align-items: center;
  gap: 2px;

  &:not(:last-child)::after {
    content: "";
    display: block;
    width: 1px;
    height: 20px;
    background: var(--ie-border);
    margin: 0 6px;
  }
}

.ed-menuDropdown {
  position: relative;

  &:hover .ed-menuDropdownContent {
    display: flex;
  }
}

.ed-menuDropdownContent {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--ie-bg-panel);
  border: 1px solid var(--ie-border);
  border-radius: 4px;
  flex-direction: column;
  z-index: 100;
  min-width: 120px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);

  button {
    text-align: left;
    padding: 6px 12px;
    border-radius: 0;

    &:hover {
      background: var(--ie-accent);
    }
  }
}

.ed-docInfo {
  color: var(--ie-text-dim);
  font-size: 11px;
  padding: 0 8px;
  white-space: nowrap;
}

/* --- Workspace --- */
.ed-workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* --- Toolbar --- */
.ed-toolbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  background: var(--ie-bg-panel);
  border-right: 1px solid var(--ie-border);
  gap: 2px;
  width: 44px;
  flex-shrink: 0;
  overflow-y: auto;
}

.ed-toolButton {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--ie-text);
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  flex-shrink: 0;

  &:hover {
    background: var(--ie-bg-hover);
    border-color: var(--ie-border);
  }
}

.ed-toolActive {
  background: var(--ie-accent) !important;
  border-color: var(--ie-accent) !important;
  color: white;
}

.ed-toolIcon {
  line-height: 1;
}

.ed-toolDivider {
  width: 28px;
  height: 1px;
  background: var(--ie-border);
  margin: 4px 0;
}

.ed-colorSwatches {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 4px;
  gap: 4px;
}

.ed-colorStack {
  position: relative;
  width: 32px;
  height: 32px;
}

.ed-colorSwatch {
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  border: 2px solid var(--ie-text);
  border-radius: 2px;
  cursor: pointer;
  z-index: 2;
}

.ed-bgSwatch {
  top: 10px;
  left: 10px;
  z-index: 1;
}

.ed-colorInput {
  opacity: 0;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  cursor: pointer;
}

.ed-swapButton {
  background: transparent;
  border: none;
  color: var(--ie-text-dim);
  cursor: pointer;
  font-size: 12px;
  padding: 0;

  &:hover {
    color: var(--ie-text);
  }
}

/* --- Canvas area with rulers --- */
.ed-canvasAreaWrapper {
  flex: 1;
  display: grid;
  grid-template-columns: 20px 1fr;
  grid-template-rows: 20px 1fr;
  overflow: hidden;
}

.ed-rulerCorner {
  background: #2a2a2a;
  border-right: 1px solid #444;
  border-bottom: 1px solid #444;
}

.ed-rulerH {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  height: 20px;
  cursor: s-resize;
  border-bottom: 1px solid #444;
}

.ed-rulerV {
  grid-column: 1;
  grid-row: 2;
  width: 20px;
  height: 100%;
  cursor: e-resize;
  border-right: 1px solid #444;
}

.ed-canvasContainer {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  overflow: hidden;
  background: #1a1a1a;
}

.ed-display-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.ed-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--ie-text-dim);
  z-index: 10;
  pointer-events: auto;

  p {
    margin: 8px 0;
  }
}

.ed-empty-icon {
  font-size: 64px;
  color: var(--ie-border);
  line-height: 1;
}

.ed-emptyHint {
  font-size: 11px;
  color: darken(var(--ie-text-dim), 15%);
}

.ed-openButton {
  margin-top: 12px;
  padding: 8px 24px;
  background: var(--ie-accent);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;

  &:hover {
    background: lighten(var(--ie-accent), 8%);
  }
}

/* --- Right Panels --- */
.ed-panels {
  display: flex;
  flex-direction: column;
  width: 260px;
  flex-shrink: 0;
  background: var(--ie-bg-panel);
  border-left: 1px solid var(--ie-border);
  overflow-y: auto;
}

/* --- Properties Panel --- */
.ed-propertiesPanel {
  border-bottom: 1px solid var(--ie-border);
}

.ed-panelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: darken(var(--ie-bg-panel), 3%);
  border-bottom: 1px solid var(--ie-border);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ed-propertiesSection {
  padding: 8px 10px;
  border-bottom: 1px solid darken(var(--ie-border), 5%);

  h4 {
    margin: 0 0 6px;
    font-size: 11px;
    color: var(--ie-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
  }
}

.ed-propRow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;

  label {
    font-size: 11px;
    color: var(--ie-text-dim);
    min-width: 55px;
    flex-shrink: 0;
  }

  input[type="range"] {
    flex: 1;
    height: 4px;
    accent-color: var(--ie-accent);
    min-width: 60px;
  }

  input[type="color"] {
    width: 28px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--ie-border);
    border-radius: 3px;
    background: transparent;
    cursor: pointer;
  }

  span {
    font-size: 11px;
    color: var(--ie-text-dim);
    min-width: 32px;
    text-align: right;
    flex-shrink: 0;
  }
}

.ed-propBtn {
  padding: 3px 8px;
  background: var(--ie-bg-input);
  border: 1px solid var(--ie-border);
  border-radius: 3px;
  color: var(--ie-text);
  font-size: 11px;
  cursor: pointer;

  &:hover {
    background: lighten(var(--ie-bg-input), 8%);
  }
}

.ed-dragLabel {
  font-size: 11px;
  color: var(--ie-text-dim);
  min-width: 55px;
  flex-shrink: 0;
  cursor: ew-resize;
  user-select: none;
  touch-action: none;

  &:hover {
    color: var(--ie-text);
  }

  &:active {
    color: var(--ie-accent);
  }
}

.ed-propNumber {
  width: 60px;
  padding: 3px 6px;
  background: var(--ie-bg-input);
  border: 1px solid var(--ie-border);
  border-radius: 3px;
  color: var(--ie-text);
  font-size: 12px;

  &:focus {
    outline: none;
    border-color: var(--ie-accent);
  }
}

.ed-propSmallBtn {
  padding: 2px 6px;
  background: transparent;
  border: 1px solid var(--ie-border);
  border-radius: 3px;
  color: var(--ie-text-dim);
  cursor: pointer;
  font-size: 12px;

  &:hover {
    background: var(--ie-bg-hover);
    color: var(--ie-text);
  }
}

.ed-propSelect {
  flex: 1;
  padding: 3px 6px;
  background: var(--ie-bg-input);
  border: 1px solid var(--ie-border);
  border-radius: 3px;
  color: var(--ie-text);
  font-size: 12px;

  &:focus {
    outline: none;
    border-color: var(--ie-accent);
  }
}

.ed-textInput {
  width: 100%;
  padding: 4px 6px;
  background: var(--ie-bg-input);
  border: 1px solid var(--ie-border);
  border-radius: 3px;
  color: var(--ie-text);
  font-size: 12px;
  resize: vertical;
  font-family: inherit;

  &:focus {
    outline: none;
    border-color: var(--ie-accent);
  }
}

.ed-alignButtons {
  display: flex;
  gap: 2px;

  button {
    width: 28px;
    height: 24px;
    background: var(--ie-bg-input);
    border: 1px solid var(--ie-border);
    border-radius: 3px;
    color: var(--ie-text);
    cursor: pointer;
    font-size: 14px;
    padding: 0;

    &:hover {
      background: var(--ie-bg-hover);
    }
  }
}

.ed-alignActive {
  background: var(--ie-accent) !important;
  border-color: var(--ie-accent) !important;
}

.ed-smallButton {
  padding: 3px 10px;
  background: var(--ie-bg-input);
  border: 1px solid var(--ie-border);
  border-radius: 3px;
  color: var(--ie-text);
  cursor: pointer;
  font-size: 11px;

  &:hover {
    background: var(--ie-bg-hover);
  }
}

.ed-inlineDialog {
  margin-top: 6px;
  padding: 6px;
  background: darken(var(--ie-bg-panel), 3%);
  border-radius: 4px;
  border: 1px solid var(--ie-border);
}

/* --- Layer Panel --- */
.ed-layerPanel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.ed-layerControls {
  padding: 6px 10px;
  border-bottom: 1px solid darken(var(--ie-border), 5%);
}

.ed-blendDropdownContainer {
  position: relative;
  margin-bottom: 4px;
}

.ed-blendSelect {
  width: 100%;
  padding: 4px 6px;
  background: var(--ie-bg-input);
  border: 1px solid var(--ie-border);
  border-radius: 3px;
  color: var(--ie-text);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;

  &:hover {
    border-color: lighten(var(--ie-border), 10%);
  }

  &:focus {
    outline: none;
    border-color: var(--ie-accent);
  }
}

.ed-blendDropdownArrow {
  font-size: 10px;
  color: var(--ie-text-dim);
  margin-left: 4px;
}

.ed-blendDropdownList {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: darken(var(--ie-bg-panel), 3%);
  border: 1px solid var(--ie-border);
  border-radius: 3px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  padding: 2px 0;
}

.ed-blendDropdownSep {
  height: 1px;
  background: var(--ie-border);
  margin: 2px 4px;
}

.ed-blendDropdownItem {
  display: block;
  width: 100%;
  padding: 3px 8px;
  background: transparent;
  border: none;
  color: var(--ie-text);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;

  &:hover {
    background: var(--ie-accent);
    color: #fff;
  }
}

.ed-blendDropdownItemActive {
  background: rgba(var(--ie-accent), 0.3);
  font-weight: 600;
}

.ed-opacityControl {
  display: flex;
  align-items: center;
  gap: 6px;

  label {
    font-size: 11px;
    color: var(--ie-text-dim);
    min-width: 45px;
  }

  input[type="range"] {
    flex: 1;
    height: 4px;
    accent-color: var(--ie-accent);
  }

  span {
    font-size: 11px;
    color: var(--ie-text-dim);
    min-width: 32px;
    text-align: right;
  }
}

.ed-layerSearch {
  padding: 4px 8px;
  border-bottom: 1px solid darken(var(--ie-border), 5%);
}

.ed-layerSearchInput {
  width: 100%;
  padding: 4px 6px;
  background: var(--ie-bg-input);
  border: 1px solid var(--ie-border);
  border-radius: 3px;
  color: var(--ie-text);
  font-size: 11px;

  &:focus {
    outline: none;
    border-color: var(--ie-accent);
  }

  &::placeholder {
    color: var(--ie-text-dim);
  }
}

.ed-layerList {
  flex: 1;
  overflow-y: auto;
  padding: 2px 0;
}

.ed-layerItem {
  display: flex;
  align-items: center;
  padding: 4px 6px;
  gap: 4px;
  cursor: pointer;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  min-height: 42px;

  &:hover {
    background: var(--ie-bg-hover);
  }
}

.ed-layerItemActive {
  background: rgba(var(--ie-accent), 0.15);
  border-left-color: var(--ie-accent);
}

.ed-layerItemDragOver {
  border-top: 2px solid var(--ie-accent);
}

.ed-visibilityBtn {
  width: 22px;
  height: 22px;
  background: transparent;
  border: none;
  color: var(--ie-text);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  &:hover {
    color: var(--ie-accent);
  }
}

.ed-hidden {
  opacity: 0.3;
}

.ed-isolated {
  color: #ff8800 !important;
}

.ed-layerThumb {
  width: 36px;
  height: 36px;
  border: 1px solid var(--ie-border);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(#555 0% 25%, #444 0% 50%) 50% / 8px 8px;

  img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }
}

.ed-layerTypeIcon {
  font-size: 18px;
  color: var(--ie-text-dim);
}

.ed-layerName {
  flex: 1;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.ed-layerNameInput {
  flex: 1;
  padding: 2px 4px;
  background: var(--ie-bg-input);
  border: 1px solid var(--ie-accent);
  border-radius: 2px;
  color: var(--ie-text);
  font-size: 12px;
  min-width: 0;

  &:focus {
    outline: none;
  }
}

.ed-lockBtn {
  width: 22px;
  height: 22px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.3;

  &:hover {
    opacity: 1;
  }
}

.ed-locked {
  opacity: 0.8;
  color: #f0a030;
}

.ed-clipBtn {
  width: 18px;
  height: 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 11px;
  padding: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.3;
  color: var(--ie-text);

  &:hover {
    opacity: 1;
  }
}

.ed-clipActive {
  opacity: 0.9;
  color: #ff6600;
}

.ed-layerItemClipped {
  padding-left: 18px !important;
  border-left: 2px solid #ff6600;
}

.ed-linkIndicator {
  font-size: 10px;
  margin-right: 2px;
}

.ed-linkActive {
  color: #ff8800 !important;
}

/* --- Layer Actions --- */
.ed-layerActions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  border-top: 1px solid var(--ie-border);
  background: darken(var(--ie-bg-panel), 3%);

  button {
    width: 32px;
    height: 28px;
    background: var(--ie-bg-input);
    border: 1px solid var(--ie-border);
    border-radius: 3px;
    color: var(--ie-text);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;

    &:hover {
      background: var(--ie-bg-hover);
      border-color: lighten(var(--ie-border), 10%);
    }

    &:disabled {
      opacity: 0.3;
      cursor: default;

      &:hover {
        background: var(--ie-bg-input);
        border-color: var(--ie-border);
      }
    }
  }
}

.ed-addMenuContainer {
  position: relative;
}

.ed-addMenu {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: var(--ie-bg-panel);
  border: 1px solid var(--ie-border);
  border-radius: 4px;
  min-width: 160px;
  z-index: 100;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.4);
  margin-bottom: 4px;

  button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 12px;
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--ie-text);
    cursor: pointer;
    font-size: 12px;
    height: auto;

    &:hover {
      background: var(--ie-accent);
    }
  }
}

.ed-addMenuSub {
  position: relative;
}

.ed-addSubMenu {
  position: absolute;
  left: 100%;
  bottom: 0;
  background: var(--ie-bg-panel);
  border: 1px solid var(--ie-border);
  border-radius: 4px;
  min-width: 160px;
  z-index: 101;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);

  button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 12px;
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--ie-text);
    cursor: pointer;
    font-size: 12px;
    height: auto;

    &:hover {
      background: var(--ie-accent);
    }
  }
}

/* --- Dialogs --- */
.ed-dialogOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.ed-dialog {
  background: var(--ie-bg-panel);
  border: 1px solid var(--ie-border);
  border-radius: 8px;
  padding: 20px;
  min-width: 320px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);

  h3 {
    margin: 0 0 16px;
    font-size: 16px;
    font-weight: 600;
  }
}

.ed-dialogField {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;

  label {
    min-width: 70px;
    font-size: 13px;
    color: var(--ie-text-dim);
  }

  input {
    flex: 1;
    padding: 6px 10px;
    background: var(--ie-bg-input);
    border: 1px solid var(--ie-border);
    border-radius: 4px;
    color: var(--ie-text);
    font-size: 13px;

    &:focus {
      outline: none;
      border-color: var(--ie-accent);
    }
  }
}

.ed-dialogPresets {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;

  button {
    padding: 4px 10px;
    background: var(--ie-bg-input);
    border: 1px solid var(--ie-border);
    border-radius: 4px;
    color: var(--ie-text);
    cursor: pointer;
    font-size: 11px;

    &:hover {
      background: var(--ie-bg-hover);
      border-color: lighten(var(--ie-border), 10%);
    }
  }
}

.ed-dialogActions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;

  button {
    padding: 6px 16px;
    background: var(--ie-bg-input);
    border: 1px solid var(--ie-border);
    border-radius: 4px;
    color: var(--ie-text);
    cursor: pointer;
    font-size: 13px;

    &:hover {
      background: var(--ie-bg-hover);
    }
  }
}

.ed-primaryButton {
  background: var(--ie-accent) !important;
  border-color: var(--ie-accent) !important;
  color: white !important;

  &:hover {
    background: lighten(var(--ie-accent), 8%) !important;
  }
}

/* --- Filter Dialog --- */
.ed-filterDialog {
  background: var(--ie-bg-panel);
  border: 1px solid var(--ie-border);
  border-radius: 8px;
  padding: 20px;
  width: 600px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);

  h3 {
    margin: 0 0 16px;
    font-size: 16px;
    font-weight: 600;
  }
}

.ed-filterLayout {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.ed-filterList {
  width: 160px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 400px;
  overflow-y: auto;
}

.ed-filterItem {
  text-align: left;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--ie-text);
  cursor: pointer;
  font-size: 12px;

  &:hover {
    background: var(--ie-bg-hover);
    border-color: var(--ie-border);
  }
}

.ed-filterItemActive {
  background: var(--ie-accent) !important;
  border-color: var(--ie-accent) !important;
  color: white;
}

.ed-filterPreview {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;

  canvas {
    border: 1px solid var(--ie-border);
    border-radius: 4px;
    background: repeating-conic-gradient(#555 0% 25%, #444 0% 50%) 50% / 8px 8px;
    max-width: 100%;
  }
}

.ed-filterParams {
  width: 100%;
}

.ed-noParams {
  color: var(--ie-text-dim);
  font-size: 12px;
  text-align: center;
  padding: 12px;
}

/* --- History Panel --- */
.ed-historyPanel {
  border-top: 1px solid var(--ie-border);
  display: flex;
  flex-direction: column;
  max-height: 260px;
}

.ed-historyCount {
  font-size: 10px;
  color: var(--ie-text-dim);
  font-weight: 400;
}

.ed-historyHeaderActions {
  display: flex;
  gap: 2px;
}

.ed-historyTabBtn {
  background: transparent;
  border: none;
  color: var(--ie-text-dim);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;

  &:hover {
    color: var(--ie-text);
    background: var(--ie-bg-hover);
  }
}

.ed-historyTabActive {
  color: var(--ie-text);
  background: rgba(var(--ie-accent), 0.2);
  font-weight: 600;
}

.ed-snapshotActions {
  padding: 4px 8px;
  border-top: 1px solid darken(var(--ie-border), 5%);
}

.ed-snapshotSaveBtn {
  width: 100%;
  padding: 4px 8px;
  background: rgba(var(--ie-accent), 0.15);
  border: 1px solid var(--ie-border);
  border-radius: 3px;
  color: var(--ie-text);
  font-size: 11px;
  cursor: pointer;

  &:hover:not(:disabled) {
    background: rgba(var(--ie-accent), 0.3);
  }

  &:disabled {
    opacity: 0.4;
    cursor: default;
  }
}

.ed-snapshotNameInput {
  display: flex;
  gap: 4px;

  input {
    flex: 1;
    padding: 3px 6px;
    background: var(--ie-bg-input);
    border: 1px solid var(--ie-border);
    border-radius: 3px;
    color: var(--ie-text);
    font-size: 11px;

    &:focus {
      outline: none;
      border-color: var(--ie-accent);
    }
  }

  button {
    padding: 2px 6px;
    background: transparent;
    border: 1px solid var(--ie-border);
    border-radius: 3px;
    color: var(--ie-text);
    cursor: pointer;
    font-size: 12px;

    &:hover {
      background: var(--ie-bg-hover);
    }
  }
}

.ed-snapshotItem {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px 0 0;

  &:hover {
    background: var(--ie-bg-hover);
  }
}

.ed-snapshotRestore {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 4px 10px;
  background: transparent;
  border: none;
  color: var(--ie-text);
  cursor: pointer;
  text-align: left;
}

.ed-snapshotName {
  font-size: 12px;
}

.ed-snapshotTime {
  font-size: 10px;
  color: var(--ie-text-dim);
}

.ed-groupExpandBtn {
  background: transparent;
  border: none;
  color: var(--ie-text-dim);
  cursor: pointer;
  font-size: 11px;
  padding: 0 2px;
  flex-shrink: 0;

  &:hover {
    color: var(--ie-text);
  }
}

.ed-snapshotDelete {
  padding: 2px 4px;
  background: transparent;
  border: none;
  color: var(--ie-text-dim);
  cursor: pointer;
  font-size: 11px;
  border-radius: 3px;

  &:hover {
    color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
  }
}

.ed-historyList {
  overflow-y: auto;
  flex: 1;
  padding: 2px 0;
}

.ed-historyEmpty {
  padding: 12px;
  text-align: center;
  color: var(--ie-text-dim);
  font-size: 11px;
}

.ed-historyItem {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 3px 10px;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  color: var(--ie-text);
  cursor: pointer;
  font-size: 12px;
  text-align: left;

  &:hover {
    background: var(--ie-bg-hover);
  }
}

.ed-historyItemActive {
  background: rgba(var(--ie-accent), 0.15);
  border-left-color: var(--ie-accent);
  font-weight: 600;
}

.ed-historyItemFuture {
  opacity: 0.4;
}

.ed-historyIndex {
  font-size: 10px;
  color: var(--ie-text-dim);
  min-width: 16px;
}

.ed-historyLabel {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Before/After Badge --- */
.ed-beforeAfterBadge {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 4px 16px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  z-index: 20;
  pointer-events: none;
  letter-spacing: 1px;
}

.ed-persistenceNotice {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #ffb84d;
  padding: 4px 12px;
  border: 1px solid rgba(255, 184, 77, 0.4);
  border-radius: 4px;
  font-size: 12px;
  z-index: 30;
  pointer-events: none;
  white-space: nowrap;
}

/* --- Curves Editor --- */
.ed-curvesEditor {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ed-curvesChannels {
  display: flex;
  gap: 2px;
  align-items: center;
}

.ed-curvesChannelBtn {
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  background: transparent;
  border: 1px solid #444;
  border-radius: 3px;
  cursor: pointer;
  opacity: 0.6;

  &:hover {
    opacity: 0.9;
  }
}

.ed-curvesChannelActive {
  opacity: 1;
  border-color: currentColor;
  background: rgba(255, 255, 255, 0.1);
}

.ed-curvesResetBtn {
  margin-left: auto;
  padding: 2px 6px;
  font-size: 12px;
  background: transparent;
  border: 1px solid #444;
  border-radius: 3px;
  color: #aaa;
  cursor: pointer;

  &:hover {
    color: #fff;
    border-color: #666;
  }
}

.ed-curvesCanvas {
  width: 100%;
  aspect-ratio: 1;
  cursor: crosshair;
  border: 1px solid #333;
  border-radius: 3px;
}

.ed-curvesHint {
  font-size: 9px;
  color: #666;
  text-align: center;
}

/* --- Layer Mask Controls --- */
.ed-maskControls {
  display: flex;
  gap: 4px;
  padding: 4px 8px;
  border-top: 1px solid #333;
}

.ed-maskBtn {
  padding: 2px 6px;
  font-size: 10px;
  background: #333;
  border: 1px solid #444;
  border-radius: 3px;
  color: #ccc;
  cursor: pointer;

  &:hover {
    background: #444;
    color: #fff;
  }
}

.ed-maskBtnActive {
  background: #555;
  border-color: #888;
  color: #fff;
}

.ed-maskThumb {
  width: 24px;
  height: 24px;
  border: 1px solid #666;
  border-radius: 2px;
  margin-left: 4px;

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

/* --- Command Palette --- */
.ed-commandPalette {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  justify-content: center;
  padding-top: 15vh;
}

.ed-commandPaletteInner {
  width: 480px;
  max-height: 400px;
  background: #2a2a2a;
  border: 1px solid #555;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.ed-commandSearch {
  padding: 12px 16px;
  border-bottom: 1px solid #444;

  input {
    width: 100%;
    padding: 8px 12px;
    background: #1a1a1a;
    border: 1px solid #555;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    outline: none;

    &:focus {
      border-color: #6688ff;
    }
  }
}

.ed-commandResults {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.ed-commandItem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  color: #ccc;
  font-size: 13px;

  &:hover,
  &.ed-commandItemActive {
    background: #3a3a5a;
    color: #fff;
  }
}

.ed-commandItemActive {
  background: #3a3a5a;
  color: #fff;
}

.ed-commandIcon {
  width: 24px;
  text-align: center;
  font-size: 14px;
  opacity: 0.7;
}

.ed-commandLabel {
  flex: 1;
}

.ed-commandShortcut {
  font-size: 11px;
  color: #888;
  padding: 1px 6px;
  background: #333;
  border-radius: 3px;
}

.ed-commandCategory {
  font-size: 10px;
  color: #666;
  text-transform: uppercase;
}

/* --- Crop overlay UI --- */
.ed-cropToolbar {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: rgba(30, 30, 30, 0.9);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--ie-border);

  select {
    background: var(--ie-bg-input);
    color: var(--ie-text);
    border: 1px solid var(--ie-border);
    border-radius: 3px;
    padding: 3px 6px;
    font-size: 12px;
    cursor: pointer;
  }
}

.ed-cropActions {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 20;

  button {
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    border: 1px solid var(--ie-border);

    &:first-child {
      background: var(--ie-accent);
      color: white;
      border-color: var(--ie-accent);

      &:hover {
        background: lighten(var(--ie-accent), 8%);
      }
    }

    &:last-child {
      background: var(--ie-bg-input);
      color: var(--ie-text);

      &:hover {
        background: var(--ie-bg-hover);
      }
    }
  }
}

/* Color Picker Panel */
.ed-colorPickerPanel {
  background: var(--ie-bg-panel);
  border-top: 1px solid var(--ie-border);
}

.ed-colorPickerBody {
  padding: 8px;
}

.ed-colorSpectrumRow {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.ed-colorSpectrum {
  cursor: crosshair;
  border: 1px solid var(--ie-border);
  border-radius: 2px;
  width: 160px;
  height: 120px;
}

.ed-hueBar {
  cursor: pointer;
  border: 1px solid var(--ie-border);
  border-radius: 2px;
  width: 20px;
  height: 120px;
}

.ed-colorInputs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}

.ed-colorInputRow {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;

  label {
    color: var(--ie-text-dim);
    min-width: 14px;
    text-align: right;
  }

  input[type="number"] {
    width: 40px;
    background: var(--ie-bg-input);
    border: 1px solid var(--ie-border);
    color: var(--ie-text);
    border-radius: 2px;
    padding: 2px 4px;
    font-size: 11px;
  }
}

.ed-hexInput {
  width: 72px !important;
  background: var(--ie-bg-input);
  border: 1px solid var(--ie-border);
  color: var(--ie-text);
  border-radius: 2px;
  padding: 2px 4px;
  font-size: 11px;
  font-family: monospace;
}

.ed-colorPreviewSwatch {
  width: 100%;
  height: 20px;
  border: 1px solid var(--ie-border);
  border-radius: 2px;
  margin-bottom: 6px;
}

.ed-swatchGrid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.ed-swatchItem {
  width: 16px;
  height: 16px;
  border: 1px solid var(--ie-border);
  border-radius: 2px;
  cursor: pointer;

  &:hover {
    border-color: var(--ie-text);
    transform: scale(1.2);
  }
}

.ed-swatchAddBtn {
  width: 16px;
  height: 16px;
  border: 1px dashed var(--ie-border);
  border-radius: 2px;
  background: transparent;
  color: var(--ie-text-dim);
  cursor: pointer;
  font-size: 10px;
  line-height: 14px;
  padding: 0;

  &:hover {
    border-color: var(--ie-text);
    color: var(--ie-text);
  }
}

.ed-colorHarmonySection {
  margin-top: 8px;
  border-top: 1px solid var(--ie-border);
  padding-top: 6px;
}

.ed-colorHarmonyLabel {
  font-size: 10px;
  color: var(--ie-text-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.ed-harmonySchemes {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ed-harmonyRow {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ed-harmonyName {
  font-size: 10px;
  color: var(--ie-text-dim);
  min-width: 62px;
  flex-shrink: 0;
}

.ed-harmonyColors {
  display: flex;
  gap: 2px;
}

.ed-harmonySwatch {
  width: 18px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  cursor: pointer;

  &:hover {
    border-color: var(--ie-text);
    transform: scale(1.2);
  }
}

/* Skeleton containers used by the server view (no direct module source) */
.ed-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #1a1a1a;
}

.ed-panel {
  border-bottom: 1px solid var(--ie-border);
}

.ed-dialogs {
  display: contents;
}

/* ---------- Plus-gate (#plus) — «husking = plus» ---------- */

.plus-locked {
  opacity: 0.65;
}
.plus-locked::after {
  content: " 🔒";
  font-size: 0.85em;
}

.plus-prompt-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.plus-prompt-overlay[hidden] { display: none; }

.plus-prompt {
  position: relative;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.5rem 1.75rem;
  max-width: 22rem;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}
.plus-prompt-text {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  line-height: 1.5;
}
.plus-prompt-cta {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  background: var(--accent);
  color: var(--paper);
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
}
.plus-prompt-close {
  position: absolute;
  top: 0.4rem;
  right: 0.6rem;
  background: none;
  border: none;
  color: var(--ink-2);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}

.plus-lib-hint {
  font-size: 0.8rem;
  color: var(--ink-2);
  text-align: center;
  padding: 0.75rem;
}

/* Uniform konto-oppforing i familiemenyen */
.fv-kontoitem {
  font-size: 13px;
  border-top: 1px solid var(--border, #ddd);
  margin-top: 4px;
  padding-top: 10px;
}
