/* ==========================================================================
   openpolicy.no — design system (open-base)
   Ultra-minimal: light neutral background, white borderless surfaces, pills,
   near-monochrome. Geist for content, Geist Mono for numbers and micro labels.
   The accent color is reserved for alarm/critical states only.
   ========================================================================== */

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-var-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+1E00-1EFF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Geist Mono";
  src: url("fonts/GeistMono-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist Mono";
  src: url("fonts/GeistMono-var-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+1E00-1EFF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #f4f4f2;
  --surface-3: #e9e9e6;
  --text: #171717;
  --text-2: #666666;
  --text-3: #6f6f6f;
  --border: rgba(0, 0, 0, 0.05);
  --border-strong: rgba(0, 0, 0, 0.1);

  --accent: #d92d20;
  --accent-soft: rgba(217, 45, 32, 0.08);

  --ok: #157f3d;

  --inverse-bg: #171717;
  --inverse-text: #fafafa;

  --ring: rgba(0, 0, 0, 0.1);
  --shadow-overlay: 0 4px 12px rgba(0, 0, 0, 0.04), 0 24px 60px rgba(0, 0, 0, 0.1);

  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --chevron: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f6f6f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e0e0e;
  --surface: #191919;
  --surface-2: #0e0e0e;
  --surface-3: #262626;
  --text: #ededed;
  --text-2: #a3a3a3;
  --text-3: #9a9a9a;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);

  --accent: #f4645a;
  --accent-soft: rgba(244, 100, 90, 0.12);

  --ok: #6ccb8b;

  --inverse-bg: #fafafa;
  --inverse-text: #171717;

  --ring: rgba(255, 255, 255, 0.16);
  --shadow-overlay: 0 4px 12px rgba(0, 0, 0, 0.4), 0 24px 60px rgba(0, 0, 0, 0.55);

  --chevron: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9a9a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");

  color-scheme: dark;
}

/* System dark mode applies unless the user explicitly chose light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e0e;
    --surface: #191919;
    --surface-2: #0e0e0e;
    --surface-3: #262626;
    --text: #ededed;
    --text-2: #a3a3a3;
    --text-3: #9a9a9a;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.14);

    --accent: #f4645a;
    --accent-soft: rgba(244, 100, 90, 0.12);

    --ok: #6ccb8b;

    --inverse-bg: #fafafa;
    --inverse-text: #171717;

    --ring: rgba(255, 255, 255, 0.16);
    --shadow-overlay: 0 4px 12px rgba(0, 0, 0, 0.4), 0 24px 60px rgba(0, 0, 0, 0.55);

    --chevron: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9a9a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");

    color-scheme: dark;
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Numbers and data: mono with tabular digits so nothing jumps */
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }

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

::selection { background: var(--surface-3); }

/* UI chrome must not be text-selectable (iOS long-press etc.).
   Real content/data the user may want to copy stays selectable. */
button, .site-header, .site-footer, .menu, .toast {
  -webkit-user-select: none;
  user-select: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header { background: transparent; }

.header-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-tld { color: var(--text-3); font-weight: 500; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: var(--surface);
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

@media (hover: hover) { .icon-btn:hover { background: var(--surface-3); } }
.icon-btn:active { transform: scale(0.94); }

.icon-btn.open { background: var(--inverse-bg); color: var(--inverse-text); }

/* Toggle buttons (on/off states) invert when active */
.toggle-btn.on { background: var(--inverse-bg); color: var(--inverse-text); }
@media (hover: hover) { .toggle-btn.on:hover { opacity: 0.85; background: var(--inverse-bg); } }

.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease,
              transform 0.15s ease, opacity 0.15s ease;
}

.pill-btn:active { transform: scale(0.97); }

.pill-btn.primary { background: var(--inverse-bg); color: var(--inverse-text); }
@media (hover: hover) { .pill-btn.primary:hover { opacity: 0.85; } }

.pill-btn.ghost {
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: var(--surface);
}

@media (hover: hover) { .pill-btn.ghost:hover { background: var(--surface-2); } }
.pill-btn[disabled] { opacity: 0.4; pointer-events: none; }

/* --------------------------------------------------------------------------
   Settings menu
   -------------------------------------------------------------------------- */

.settings-wrap { position: relative; }

.menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 296px;
  max-height: min(560px, calc(100dvh - 90px));
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-overlay);
  padding: 20px;
  z-index: 60;
  transform-origin: top right;
  animation: menu-in 0.16s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes menu-in {
  from { opacity: 0; transform: scale(0.96) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.menu-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 10px;
}

/* Options share the row evenly when they fit; locales with long words
   («Pantalla completa», «Бегущая строка») wrap to their own row rather
   than wrapping inside the button. gap applies both ways, so the spacing
   between wrapped rows equals the spacing within a row */
.menu-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.menu-grid .opt-btn { flex: 1 1 auto; white-space: nowrap; }

.menu-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background-color: var(--surface-2);
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 15px;
  border: none;
  border-radius: 12px;
  padding: 11px 44px 11px 14px;
  cursor: pointer;
}

.opt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 8px;
  border: none;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13.5px;
  font-weight: 500;
  text-align: center;
  color: var(--text-2);
  transition: background-color 0.13s ease, color 0.13s ease, transform 0.13s ease;
}

.opt-btn .icon { width: 14px; height: 14px; }

@media (hover: hover) { .opt-btn:hover { background: var(--surface-3); color: var(--text); } }
.opt-btn:active { transform: scale(0.97); }

.opt-btn.active {
  background: var(--inverse-bg);
  color: var(--inverse-text);
  font-weight: 600;
}

.opt-btn.wide { width: 100%; }
.opt-btn.copied { background: var(--ok); color: #fff; }

.menu-divider {
  height: 1px;
  background: var(--border);
  margin: 18px -20px;
}

.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 14px;
  line-height: 1.35;
  cursor: pointer;
  user-select: none;
}

.switch {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 40px;
  height: 23px;
  border-radius: 999px;
  background: var(--surface-3);
  position: relative;
  cursor: pointer;
  transition: background-color 0.18s ease;
  margin: 0;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: transform 0.18s ease;
}

.switch:checked { background: var(--inverse-bg); }
.switch:checked::after { transform: translateX(17px); background: var(--inverse-text); }

.menu-info {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--text-3);
}

.menu-info a { color: var(--text-2); text-decoration: none; }
@media (hover: hover) { .menu-info a:hover { text-decoration: underline; } }

.menu-year { margin-top: 6px; }

/* --------------------------------------------------------------------------
   THE TOOL — three phases on one surface, only the active one shown
   (family rule: never an idle empty container): start (choose a
   document) → edit (steps + live preview) → done (link, copy, embed).
   -------------------------------------------------------------------------- */

/* Wider than the family's 900px: the editor sits next to a live preview */
.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
  flex: 1;
}

.phase { animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }

/* starts at 0.01, never 0 (LCP), opacity only (no stacking contexts) */
@keyframes rise {
  from { opacity: 0.01; }
  to { opacity: 1; }
}

.intro { max-width: 720px; margin: clamp(8px, 3vh, 36px) 0 28px; }

.hero-title {
  margin: 0 0 12px;
  font-size: clamp(30px, 4.6vw, 48px);
  font-weight: 650;
  line-height: 1.06;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lead {
  margin: 0;
  max-width: 620px;
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--text-2);
  text-wrap: pretty;
}

.section-title {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.card {
  background: var(--surface);
  border-radius: 24px;
  padding: 24px;
  transition: background-color 0.25s ease;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 620;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.card-title .icon { width: 18px; height: 18px; }
/* a step's heading takes focus on step change (screen readers), no ring */
.card-title:focus { outline: none; }

.card-lead {
  margin: 0 0 22px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-2);
  text-wrap: pretty;
}

/* ------------------------------------------------------------------ start */

.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 860px;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px;
  border-radius: 24px;
  background: var(--surface);
  text-align: left;
  transition: box-shadow 0.18s ease, transform 0.18s ease, background-color 0.25s ease;
}

@media (hover: hover) {
  .choice:hover { box-shadow: 0 0 0 1.5px var(--text); }
  .choice:hover .choice-go { background: var(--inverse-bg); color: var(--inverse-text); }
}

.choice:active { transform: scale(0.99); }

.choice-icon {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
}

.choice-icon .icon { width: 24px; height: 24px; stroke-width: 1.6; }

.choice-body { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; padding-top: 2px; }
.choice-title { font-size: 18px; font-weight: 620; letter-spacing: -0.015em; }
.choice-text { font-size: 14px; line-height: 1.5; color: var(--text-2); }

.choice-go {
  flex: none;
  align-self: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  transition: background-color 0.18s ease, color 0.18s ease;
}

.choice-go .icon { width: 17px; height: 17px; }

.resume {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  max-width: 860px;
  margin: 0 0 14px;
  padding: 18px 20px 18px 24px;
}

.resume .menu-label { margin-bottom: 2px; }
.resume-title { margin: 0; font-size: 15px; font-weight: 600; }
.resume-actions { display: flex; align-items: center; gap: 14px; }

.mine { max-width: 860px; margin: 0 0 28px; }
.mine-list { display: flex; flex-direction: column; gap: 8px; }

.mine-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--surface);
}

.mine-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mine-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-meta { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.02em; color: var(--text-3); }

.usps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13.5px;
  color: var(--text-2);
}

.usps li { display: inline-flex; align-items: center; gap: 7px; }
.usps .icon { width: 15px; height: 15px; color: var(--ok); stroke-width: 2.4; }

.signin-hint { margin: 18px 0 0; font-size: 13.5px; color: var(--text-3); }

/* ------------------------------------------------------------------- edit */

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 20px;
  align-items: start;
  margin: 8px 0 32px;
}

.editor { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.stepper ol {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 4px;
  list-style: none;
  border-radius: 999px;
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: none;
}

.stepper ol::-webkit-scrollbar { display: none; }

.stepper button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px 7px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  transition: background-color 0.13s ease, color 0.13s ease;
}

.stepper .num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
}

.stepper .num .icon { width: 12px; height: 12px; stroke-width: 2.6; }
@media (hover: hover) { .stepper button:hover { color: var(--text); } }
.stepper button[aria-current="step"] { background: var(--inverse-bg); color: var(--inverse-text); font-weight: 600; }
.stepper button[aria-current="step"] .num { background: var(--inverse-text); color: var(--inverse-bg); }
.stepper button.done .num { background: var(--ok); color: #fff; }

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 12px;
}

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field.wide, .wide { grid-column: 1 / -1; }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; }

.field-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
}

.field-label.spaced { display: block; margin-top: 16px; }
.optional { text-transform: none; letter-spacing: 0; opacity: 0.8; }

.text-input {
  width: 100%;
  height: 44px;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--text);
  background: var(--surface-2);
  border: none;
  border-radius: 12px;
  padding: 0 14px;
  transition: background-color 0.25s ease, box-shadow 0.13s ease;
}

.text-input.mono { font-family: var(--font-mono); font-size: 13.5px; }
.text-input::placeholder, .code-input::placeholder { color: var(--text-3); opacity: 0.75; }
.text-input:focus, .code-input:focus { outline: none; box-shadow: 0 0 0 2px var(--ring); }
.text-input.bad { box-shadow: 0 0 0 2px var(--accent-soft), inset 0 0 0 1px var(--accent); }

.text-input:-webkit-autofill,
.text-input:-webkit-autofill:hover {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-out 0s;
}

.text-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 2px var(--ring), 0 0 0 1000px var(--surface-2) inset;
}

.text-input:autofill { background: var(--surface-2); }
.text-input:-moz-ui-invalid { box-shadow: none; }
.text-input:user-invalid { box-shadow: none; }

select.text-input, .mini-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px;
  padding-right: 38px;
  cursor: pointer;
}

.text-input.narrow { width: auto; min-width: 150px; }

.mini-select {
  width: auto;
  max-width: 170px;
  height: 32px;
  padding: 0 28px 0 12px;
  border: none;
  border-radius: 999px;
  background-color: var(--surface-2);
  background-position: right 10px center;
  background-size: 12px;
  font: inherit;
  font-size: 12.5px;
  color: var(--text);
}

.code-input {
  display: block;
  width: 100%;
  min-height: 90px;
  resize: vertical;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--surface-2);
  border: 1.5px dashed var(--border-strong);
  border-radius: 14px;
}

.code-input:focus { border-style: solid; border-color: transparent; }

.hint {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--text-3);
}

.hint.block { display: block; margin-top: 6px; }

.block { margin-top: 22px; }
.block:first-of-type { margin-top: 0; }
.block > .field-label:first-child { display: block; margin-bottom: 10px; }
.block .menu-toggle + .menu-toggle { margin-top: 12px; }

.pill-btn.small { height: 36px; padding: 0 15px; font-size: 13px; }
.pill-btn .icon { width: 16px; height: 16px; }
.pill-btn.danger, .pill-btn.primary.danger { background: var(--accent); color: #fff; }
.pill-btn[aria-disabled="true"] { opacity: 0.55; cursor: progress; }

.icon-btn.small { width: 32px; height: 32px; }
.icon-btn.small .icon { width: 16px; height: 16px; }

.icon-btn.square {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: transparent;
  color: var(--text-3);
  flex-shrink: 0;
}

@media (hover: hover) { .icon-btn.square:hover { background: var(--surface-3); color: var(--text); } }
.icon-btn.square .icon { width: 16px; height: 16px; }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  color: var(--text-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
  transition: color 0.13s ease;
}

@media (hover: hover) { .link-btn:hover { color: var(--text); } }
.link-btn.danger { color: var(--accent); }
.link-btn .icon { width: 15px; height: 15px; }

/* Choice rows: platform, consent tool */
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg .opt-btn { flex: 0 1 auto; padding: 9px 14px; white-space: nowrap; }
.opt-btn[aria-pressed="true"], .opt-btn[aria-checked="true"] { background: var(--inverse-bg); color: var(--inverse-text); font-weight: 600; }

.seg.mini {
  flex-wrap: nowrap;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 999px;
}

.seg.mini .opt-btn { flex: 0 0 auto; padding: 5px 11px; background: transparent; font-size: 12.5px; }
.seg.mini .opt-btn[aria-pressed="true"] { background: var(--inverse-bg); color: var(--inverse-text); }
.seg.mini:empty { display: none; }

/* Feature tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tile {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 14px 12px;
  border-radius: 16px;
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
  transition: box-shadow 0.13s ease, background-color 0.13s ease;
}

.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile .icon { width: 20px; height: 20px; margin-top: 1px; color: var(--text-2); }
.tile-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile-title { font-size: 14px; font-weight: 600; line-height: 1.3; }
.tile-text { font-size: 12.5px; line-height: 1.4; color: var(--text-3); }
@media (hover: hover) { .tile:hover { box-shadow: inset 0 0 0 1px var(--border-strong); } }
.tile:has(input:checked) { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--text); }
.tile:has(input:checked) .icon { color: var(--text); }
.tile:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 2px; }
.tile .tick {
  margin-left: auto;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1.5px var(--border-strong);
}
.tile .tick .icon { width: 12px; height: 12px; margin: 0; stroke-width: 3; color: var(--inverse-text); opacity: 0; }
.tile:has(input:checked) .tick { background: var(--inverse-bg); box-shadow: none; }
/* must outrank `.tile:has(input:checked) .icon` above, or the tick takes
   the circle's own colour and vanishes */
.tile:has(input:checked) .tick .icon { opacity: 1; color: var(--inverse-text); }

/* Services */
.search { position: relative; }
.search .icon { position: absolute; left: 14px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .text-input { padding-left: 40px; }
.search .text-input::-webkit-search-cancel-button { cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.selected-wrap { margin-top: 16px; }
.selected-wrap .field-label { display: block; margin-bottom: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.13s ease, color 0.13s ease, transform 0.13s ease;
}

.chip .icon { width: 12px; height: 12px; stroke-width: 2.4; }
@media (hover: hover) { .chip:hover { background: var(--surface-3); color: var(--text); } }
.chip:active { transform: scale(0.97); }
.chip[aria-pressed="true"] { background: var(--inverse-bg); color: var(--inverse-text); }
.chip.on { background: var(--inverse-bg); color: var(--inverse-text); }
.chip.fixed { cursor: default; }
.chip small { font-family: var(--font-mono); font-size: 10px; opacity: 0.75; }

.svc-groups { display: flex; flex-direction: column; margin-top: 14px; border-top: 1px solid var(--border); }

.svc-group { border-bottom: 1px solid var(--border); }

.svc-group summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 2px;
  list-style: none;
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 550;
}

.svc-group summary::-webkit-details-marker { display: none; }
.svc-group summary .icon { width: 15px; height: 15px; color: var(--text-3); transition: transform 0.18s ease; }
.svc-group[open] summary .icon { transform: rotate(180deg); }
.svc-group .count { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }
.svc-group .count.some { color: var(--text); font-weight: 600; }
.svc-group .chips { padding: 0 0 14px; }
.svc-results { margin-top: 12px; }
.svc-results .empty { font-size: 13.5px; color: var(--text-3); }

.disclosure { margin-top: 16px; }

.disclosure > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 550;
  color: var(--text-2);
}

.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary .icon { width: 16px; height: 16px; transition: transform 0.18s ease; }
.disclosure[open] > summary .icon { transform: rotate(45deg); }
.disclosure > summary:has(use[href="#i-code"]) .icon { transform: none; }
@media (hover: hover) { .disclosure > summary:hover { color: var(--text); } }
.disclosure[open] > summary { color: var(--text); margin-bottom: 12px; }
.disclosure .code-input { margin: 10px 0; }
.disclosure .fields { margin-top: 4px; }

.custom-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
  margin-top: 12px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
}

.form-actions { display: flex; gap: 8px; }

.custom-list { display: flex; flex-direction: column; gap: 6px; }

.extra-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.extra-list:empty { display: none; }

.extra-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
}

.extra-item .area { grid-column: 1 / -1; }
.text-input.area { height: auto; min-height: 96px; padding: 11px 14px; line-height: 1.5; resize: vertical; }
.custom-list:empty { display: none; }

.custom-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px 8px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 13.5px;
}

.custom-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.custom-row small { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }

/* Cookies */
.cookie-summary { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.cookie-summary .empty { margin: 0; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); font-size: 13.5px; color: var(--text-2); }

.cat-row {
  border-radius: 14px;
  background: var(--surface-2);
}

.cat-row summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  list-style: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 550;
}

.cat-row summary::-webkit-details-marker { display: none; }
.cat-row summary .icon { width: 15px; height: 15px; color: var(--text-3); transition: transform 0.18s ease; }
.cat-row[open] summary .icon { transform: rotate(180deg); }
.cat-row .count { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }
.cat-row .tag { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }

.cookie-list { margin: 0; padding: 0 14px 12px; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.cookie-list li { display: flex; gap: 10px; font-size: 12.5px; line-height: 1.4; }
.cookie-list code { font-family: var(--font-mono); font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cookie-list span { color: var(--text-3); margin-left: auto; white-space: nowrap; }

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--accent-soft);
  font-size: 13.5px;
  line-height: 1.5;
}

.notice .icon { width: 17px; height: 17px; margin-top: 1px; color: var(--accent); }
.notice a { font-weight: 600; }

.lang-chips { margin-top: 10px; }

.step-nav { display: flex; justify-content: space-between; gap: 10px; }
.step-nav .pill-btn.primary { margin-left: auto; }

/* Combobox (Brønnøysund search) */
.combo { position: relative; }

.combo-list {
  position: absolute;
  z-index: 30;
  top: 72px;
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-overlay);
}

.combo-opt {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}

.combo-opt small { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }
.combo-opt[aria-selected="true"] { background: var(--surface-2); }

/* Live preview */
.side { position: sticky; top: 16px; min-width: 0; }
.preview-card { padding: 16px; }

.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px 12px;
}

.preview-bar .menu-label { margin: 0; }
.preview-tools { display: flex; align-items: center; gap: 6px; }

.paper {
  max-height: calc(100dvh - 120px);
  overflow-y: auto;
  padding: 26px 26px 32px;
  border-radius: 16px;
  background: var(--surface-2);
  font-size: 13.5px;
  line-height: 1.6;
  overscroll-behavior: contain;
}

.paper .op-doc h1 { font-size: 26px; }
.paper .op-doc .op-summary { background: var(--surface); }
.paper:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.paper.big { max-height: none; overflow: visible; padding: clamp(24px, 5vw, 52px); background: var(--surface); font-size: 15.5px; border-radius: 24px; }
.paper.big .op-doc h1 { font-size: clamp(28px, 4vw, 38px); }
.paper.big .op-doc .op-summary { background: var(--surface-2); }
.paper .loading { color: var(--text-3); font-size: 13px; }

.preview-fab {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 40;
  width: max-content;
  white-space: nowrap;
  box-shadow: var(--shadow-overlay);
  display: none;
}

.preview-fab:active { transform: translateX(-50%) scale(0.97); }

/* ------------------------------------------------------------------- done */

.done-wrap { max-width: 800px; margin: 0 auto 40px; }
.done-wrap .intro { margin-top: 18px; }
.back-link { margin-top: clamp(4px, 2vh, 20px); text-decoration: none; }

.missing-card, .suggest-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-bottom: 14px;
  padding: 16px 18px;
}

.missing-card .notice { margin: 0; flex: 1 1 320px; }
.suggest-card p { margin: 0; flex: 1 1 320px; font-size: 14px; line-height: 1.5; color: var(--text-2); }

.link-card { margin-bottom: 14px; }
.link-card .card-title { margin-bottom: 14px; }
.link-text { margin: 0 0 16px; font-size: 14.5px; line-height: 1.55; color: var(--text-2); }
.link-row + .link-row { margin-top: 10px; }

.link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 16px;
  border-radius: 14px;
  background: var(--surface-2);
}

.link-row .link-label { flex: none; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.link-row a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: 13px; text-decoration: none; }
@media (hover: hover) { .link-row a:hover { text-decoration: underline; text-underline-offset: 3px; } }
.link-status { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-top: 14px; font-size: 13px; color: var(--text-3); }
.link-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.link-status .dot.pending { background: #c98a12; }
.link-fine { margin: 12px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text-3); }
.link-actions { display: flex; flex-wrap: wrap; gap: 8px 18px; }

.history-list { display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow-y: auto; }

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 14px;
  text-align: left;
}

.history-row small { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
@media (hover: hover) { .history-row:hover { background: var(--surface-3); } }
.history-row[aria-pressed="true"] { background: var(--inverse-bg); color: var(--inverse-text); }
.history-row[aria-pressed="true"] small { color: inherit; opacity: 0.7; }
.history-paper { margin-top: 12px; max-height: calc(100dvh - 380px); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }
.actions .pill-btn { height: 40px; padding: 0 16px; font-size: 13.5px; }
.dl-wrap { position: relative; }
.dl-menu { width: 180px; padding: 8px; display: flex; flex-direction: column; gap: 4px; left: 0; right: auto; transform-origin: top left; }
.dl-menu .opt-btn { justify-content: flex-start; padding: 9px 12px; }

.doc-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.disclaimer { margin: 16px 4px 0; font-size: 12.5px; line-height: 1.55; color: var(--text-3); }

/* Menus: account */
.menu-account { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.passkey-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }

.passkey-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 4px 6px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 13.5px;
}

.passkey-row small { display: block; font-family: var(--font-mono); font-size: 10px; color: var(--text-3); }
.menu-actions { display: flex; flex-direction: column; gap: 8px; }
.menu-actions .link-btn { align-self: flex-start; margin-top: 4px; font-size: 12.5px; }

/* ----------------------------------------------------------------- sheets */

.sheet {
  border: 0;
  border-radius: 24px;
  padding: 24px;
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-overlay);
}

.sheet::backdrop { background: rgba(0, 0, 0, 0.45); }
.sheet[open] { animation: menu-in 0.18s cubic-bezier(0.2, 0.9, 0.3, 1); }
.sheet.wide { width: min(620px, calc(100vw - 32px)); }

.sheet.full {
  width: calc(100vw - 16px);
  height: calc(100dvh - 16px);
  max-height: none;
  max-width: none;
  padding: 16px;
  display: none;
  flex-direction: column;
}

.sheet.full[open] { display: flex; }
.sheet.full .paper { flex: 1; max-height: none; }

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sheet-title { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.sheet-text { margin: 0 0 16px; font-size: 14.5px; line-height: 1.55; color: var(--text-2); }
.sheet .field { margin-bottom: 16px; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.sheet-actions .pill-btn { flex: 1 1 auto; }
.sheet .hint { margin-top: 14px; }
.sheet .code-input { min-height: 118px; margin-bottom: 10px; resize: none; }
.sheet .field-label { display: block; margin: 14px 0 8px; }

.perks { margin: 0 0 18px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.45; }
.perks li { display: flex; gap: 10px; align-items: flex-start; }
.perks .icon { width: 17px; height: 17px; margin-top: 1px; color: var(--ok); stroke-width: 2.2; }

.recovery-code {
  margin: 4px 0 0;
  padding: 16px;
  border-radius: 14px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: center;
  -webkit-user-select: all;
  user-select: all;
}

.error-text { margin: 12px 0 0; font-size: 13.5px; color: var(--accent); }
.error-text:empty { display: none; }

/* -------------------------------------------------------- narrow screens */

@media (max-width: 980px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  body[data-phase="edit"] .preview-fab { display: inline-flex; }
  body[data-phase="edit"] .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
  body[data-phase="edit"] .site-footer { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
}

@media (max-width: 700px) {
  .choices { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .fields, .custom-form { grid-template-columns: 1fr; }
  .card { padding: 20px; border-radius: 22px; }
  .choice { padding: 20px; gap: 14px; }
  .choice-icon { width: 42px; height: 42px; border-radius: 12px; }
  .stepper .label { display: none; }
  .stepper button[aria-current="step"] .label { display: inline; }
  .field.inline { flex-direction: column; align-items: stretch; }
  .text-input.narrow { width: 100%; }
  .actions .pill-btn { flex: 1 1 auto; }
  .link-row { flex-wrap: wrap; padding: 10px 8px 8px 14px; }
  .link-row a { flex-basis: 100%; order: 2; padding: 2px 0 4px; }
  .link-row .link-label { flex: 1; }
  .paper.big { font-size: 15px; }
  .resume { padding: 16px 18px; }
}


/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  inset: auto; /* resets popover UA styling (inset: 0) */
  margin: 0;
  border: 0;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translate(-50%, 16px);
  background: var(--inverse-bg);
  color: var(--inverse-text);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow-overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 100;
  max-width: calc(100vw - 40px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

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

.site-footer {
  text-align: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.9;
  letter-spacing: 0.02em;
  color: var(--text-3);
}

.site-footer p { margin: 0; }
.site-footer a { color: var(--text-2); text-decoration: none; }
@media (hover: hover) { .site-footer a:hover { text-decoration: underline; } }

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */

@media (max-width: 600px) {
  .menu { width: min(296px, calc(100vw - 32px)); }
}
