/**
 * App styles — the `@layer app` slot.
 *
 * The app's own structural and domain CSS. Sits below `theme`, so a theme can
 * restate a colour or radius without fighting these rules, and above
 * `components`, so a `ui-*` / `civ-*` element can still be placed in a layout.
 *
 * Tokens belong in `theme.css`; setting one here will not win.
 */

@layer app {
body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
    /* Page ground sits one shade behind --background so elevated elements
       (event rows, command dock) read as cards on top. */
    background-color: var(--surface-recessed);
  }

  body[data-show-dock] {
    padding-bottom: var(--dock-height);
  }

  h1, h2, h3, h4, h5, h6 {
    font-weight: var(--fw-normal);
    margin: var(--s4) 0 var(--s3);
    line-height: var(--lh-tight);
  }

  h1, h2 { font-size: var(--f1); }
  h3 { font-size: var(--f2); }
  h4 { font-size: var(--f3); }
  h5 { font-size: var(--f4); font-weight: var(--fw-semibold); }
  h6 { font-size: var(--f5); font-weight: var(--fw-semibold); }

  p {
    line-height: var(--lh-base);
    margin: var(--s3) 0;
    max-width: 80ch;
  }

  small { font-size: var(--f8); }

  strong, b { font-weight: var(--fw-bold); }

  a, a:link, a:visited, a:active, a:focus {
    color: currentColor;
    font-weight: var(--fw-medium);
  }

  code, pre {
    font-family: var(--font-family-mono);
    font-size: 0.95em;
  }

  code {
    background: var(--secondary-dull);
    padding: 0 var(--s1);
    border-radius: var(--br-sm);
  }

  pre {
    background: var(--secondary-dull);
    padding: var(--s3);
    border-radius: var(--br-base);
    overflow-x: auto;
  }

  button {
    font: inherit;
  }

  input:not([type='file']), textarea, select {
    background-color: transparent;
    border: 1px solid var(--secondary);
    border-radius: var(--br-base);
    color: inherit;
    font: inherit;
    padding: var(--s2) var(--s3);
    margin: 0;
  }

  input:focus, textarea:focus, select:focus {
    outline: 2px solid var(--primary-dull);
    outline-offset: 1px;
    border-color: var(--primary);
  }

  .muted { color: var(--muted); }

  /* ── Header ───────────────────────────────────────────────────────── */

  body > header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background-color: var(--header-tint, var(--background));
    color: var(--header-fg, var(--body));
    border-bottom: 1px solid var(--border);
    transition: background-color var(--transition-base), color var(--transition-base);
  }

  /* Icon glyphs rendered via CSS mask so they pick up text color. */
  /* Sizing only — the mask itself comes from the framework `.icon` pattern,
     which accepts both `--icon` and this app's older `--icon-url`. Keeping a
     local copy meant framework-rendered icons (which set `--icon`) had no
     mask at all and painted as solid squares. */
  .icon {
    width: 20px;
    height: 20px;
  }

  ui-header-content {
    display: flex;
    align-items: center;
    gap: var(--s2);
    height: var(--header-height);
    padding: 0 var(--s3);
  }

  ui-header-content h1 {
    flex: 1;
    margin: 0;
    font-size: var(--f5);
    font-weight: var(--fw-bold);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-family-base);
  }  .header-action {
    color: inherit;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
    display: inline-flex;
    align-items: center;
    padding: var(--s1);
  }

  .header-action:hover, .header-action:focus-visible {
    opacity: 1;
  }

  /* ── Main ─────────────────────────────────────────────────────────── */

  main {
    flex: 1;
    padding: var(--s3);
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
  }

  /* ── Command palette dock ─────────────────────────────────────────── */

  command-input {
    display: none;
  }

  body[data-show-dock] command-input {
    position: fixed;
    left: 50%;
    bottom: calc(var(--s3) + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: calc(100% - var(--s4));
    max-width: 500px;
    z-index: var(--z-dock);
    display: block;
  }

  command-input .command-form {
    display: flex;
    align-items: flex-end;
    gap: var(--s1);
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--br-lg);
    padding: var(--s1);
    box-shadow: var(--shadow-md);
    transition:
      border-color var(--transition-fast),
      box-shadow var(--transition-fast);
  }

  command-input .command-form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-dull);
  }

  command-input .command-textarea {
    flex: 1;
    resize: none;
    min-height: 2.5rem;
    max-height: 8rem;
    background-color: transparent;
    color: var(--body);
    border: none;
    padding: var(--s2) var(--s3);
    font: inherit;
  }

  command-input .command-textarea:focus {
    outline: none;
  }

  command-input .command-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background-color: var(--primary);
    color: var(--background);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--br-full);
    font-size: var(--f4);
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity var(--transition-fast);
  }

  command-input .command-submit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
  }

  command-input .command-suggestions {
    list-style: none;
    margin: 0 0 var(--s2) 0;
    padding: var(--s1);
    background-color: var(--background);
    border-radius: var(--br-base);
    border: 1px solid var(--border);
    max-height: 30vh;
    overflow-y: auto;
    animation: command-suggestions-rise 120ms ease-out;
  }

  command-input .command-suggestion {
    padding: var(--s2) var(--s3);
    border-radius: var(--br-sm);
    cursor: pointer;
  }

  command-input .command-suggestion.is-active,
  command-input .command-suggestion:hover {
    background-color: var(--secondary-dull);
  }

  command-input .command-suggestion-header {
    display: flex;
    gap: var(--s2);
    align-items: baseline;
  }

  command-input .command-suggestion strong {
    font-weight: var(--fw-semibold);
    color: var(--primary);
  }

  command-input .command-suggestion-example {
    font-size: var(--f8);
    margin: var(--s1) 0 0 var(--s5);
    color: var(--body);
  }

  command-input .command-suggestion-example code {
    opacity: 0.7;
    font-size: var(--f8);
  }

  command-input .command-label {
    display: block;
    font-size: var(--f8);
    font-weight: var(--fw-semibold);
    margin: var(--s3) 0 0 var(--s3);
    color: var(--body);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  command-input .command-options {
    list-style: none;
    margin: var(--s1) 0 0 var(--s5);
    padding: 0;
  }

  command-input .command-option {
    opacity: 0.7;
    display: flex;
    gap: var(--s2);
    padding: var(--s2);
    align-items: baseline;
    font-size: var(--f8);
    color: var(--body);
    border-radius: var(--br-base);
  }

  command-input .command-option:hover {
    background-color: hsla(var(--primaryH), var(--primaryS), var(--primaryL), 0.5);
  }@keyframes command-suggestions-rise {
from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}@media (prefers-reduced-motion: reduce) {
command-input .command-suggestions { animation: none; }
}

  /* ── Event list (home + collection detail) ────────────────────────── */

  .event-list, .collection-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--s1);
  }

  /* Breathing room below the last row so the latest event isn't flush with the
     dock; also gives a bit of overscroll feel on long lists. */
  .event-list { padding-bottom: 100px; }

  .event-list-item a, .collection-list-item a {
    display: flex;
    align-items: center;
    gap: var(--s3);
    padding: var(--s2) var(--s3);
    border-radius: var(--br-base);
    border: 1px solid var(--border);
    background-color: var(--background);
    color: inherit;
    text-decoration: none;
    transition: background-color var(--transition-fast);
  }

  .event-list-item a:hover, .collection-list-item a:hover {
    background-color: var(--secondary-dull);
  }

  /* Title (bold) and snippet (regular) share clamp behavior; only weight differs. */
  .event-row-title,
  .event-row-snippet {
    flex: 1;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .event-row-title { font-weight: var(--fw-bold); }
  .event-row-snippet { font-weight: var(--fw-normal); }

  .event-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--br-sm);
    flex-shrink: 0;
  }

  .event-row-indicators {
    display: flex;
    align-items: center;
    gap: var(--s1);
    margin-left: auto;
    flex-shrink: 0;
  }

  .event-row-indicator {
    width: 16px;
    height: 16px;
    color: var(--body-dull);
  }

  /* ── Sub-header (tabs blended with header) ────────────────────────── */

  ui-sub-header {
    position: sticky;
    top: var(--header-height);
    z-index: calc(var(--z-header) - 1);
    background-color: var(--header-tint, var(--background));
    color: var(--header-fg, var(--body));
    border-bottom: 1px solid var(--border);
    transition: background-color var(--transition-base), color var(--transition-base);
    display: block;
  }

  ui-sub-header[hidden] {
    display: none;
  }

  /* Eliminate the visual seam between header and sub-header when tinted */
  body:has(> ui-sub-header:not([hidden])) > header {
    border-bottom: none;
  }

  /* ── Home tabs ────────────────────────────────────────────────────── */

  home-tabs {
    display: block;
  }

  .home-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: var(--s1);
    padding: var(--s2) var(--s3);
    scrollbar-width: none;
  }

  .home-tabs::-webkit-scrollbar { display: none; }

  .home-tab {
    --tab-color: currentColor;
    flex-shrink: 0;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: inherit;
    padding: var(--s2) var(--s2) var(--s1);
    border-radius: 0;
    cursor: pointer;
    font-size: var(--f7);
    font-weight: var(--fw-medium);
    opacity: 0.6;
    transition: opacity var(--transition-fast), border-color var(--transition-fast);
    margin: 0 var(--s1);
  }

  .home-tab:hover { opacity: 0.85; }

  .home-tab.is-active {
    opacity: 1;
    border-bottom-color: var(--tab-color);
  }

  /* ── Event header (title; lock/edit live in the page header) ──────── */

  .event-header {
    display: flex;
    gap: var(--s2);
    align-items: center;
    margin-bottom: var(--s3);
  }

  .event-title {
    flex: 1;
    border: none;
    background: transparent;
    font-size: var(--f2);
    font-weight: var(--fw-semibold);
    padding: var(--s1) 0;
    border-bottom: 1px solid var(--border);
    color: inherit;
    border-radius: 0;
  }

  .event-title:disabled {
    -webkit-text-fill-color: var(--body);
    opacity: 1;
  }

  /* Edit/Lock injected into header-actions */
  .header-action-button {
    background: transparent;
    border: none;
    cursor: pointer;
  }

  /* ── Tags ─────────────────────────────────────────────────────────── */

  .event-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s1);
    align-items: center;
    margin: 0 0 var(--s3);
  }

  .event-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--s1);
    padding: 0 var(--s2);
    height: 1.6rem;
    background: var(--secondary-dull);
    color: var(--body);
    border-radius: var(--br-full);
    font-size: var(--f8);
    font-weight: var(--fw-medium);
  }

  .event-tag-remove {
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 0 var(--s1);
    font-size: var(--f6);
    line-height: 1;
  }

  .event-tag-remove:hover { color: var(--body); }

  .event-tag-input {
    flex: 1;
    min-width: 6rem;
    border: none;
    background: transparent;
    padding: var(--s1) var(--s2);
    font-size: var(--f8);
    color: inherit;
  }

  .event-tag-input:focus {
    outline: none;
    border-bottom: 1px solid var(--primary);
  }

  /* Compact chips on home rows */
  .event-row-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
  }


  .event-row-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s1);
  }

  .event-tag-chip-mini {
    height: auto;
    padding: 0 var(--s1);
    font-size: var(--f8);
    font-weight: var(--fw-medium);
  }

  /* ── Map popup ────────────────────────────────────────────────────── */

  .geo-popup-link {
    display: block;
    color: var(--body);
    text-decoration: none;
    font-weight: var(--fw-medium);
    padding: var(--s1) var(--s2);
    max-width: 14rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .geo-popup-link:hover {
    color: var(--primary);
  }

  .maplibregl-popup-content {
    border-radius: var(--br-base);
    padding: var(--s2);
  }

  /* ── Event menu (dropdown) ────────────────────────────────────────── */

  .event-menu {
    position: fixed;
    top: calc(var(--header-height) + var(--s1));
    right: var(--s2);
    z-index: var(--z-header);
    list-style: none;
    margin: 0;
    padding: var(--s1);
    background: var(--background);
    color: var(--body);
    border: 1px solid var(--border);
    border-radius: var(--br-base);
    box-shadow: var(--shadow-md);
    min-width: 10rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: event-menu-rise 120ms ease-out;
  }@keyframes event-menu-rise {
from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}@media (prefers-reduced-motion: reduce) {
.event-menu { animation: none; }
}

  .event-menu button {
    display: flex;
    align-items: center;
    gap: var(--s2);
    width: 100%;
    background: transparent;
    border: none;
    color: inherit;
    text-align: left;
    padding: var(--s2) var(--s3);
    border-radius: var(--br-sm);
    cursor: pointer;
    font-size: var(--f6);
  }

  .event-menu button:hover {
    background: var(--secondary-dull);
  }

  .event-menu-danger,
  .event-menu-danger .icon {
    color: var(--error);
  }

  /* ── Rich-text view ───────────────────────────────────────────────── */

  /* Stretch the note to fill the viewport: main's uniform --s3 padding then
     leaves the same gap below the editor as above the title input. */
  main:has(text-view) {
    display: flex;
    flex-direction: column;
  }

  main:has(text-view) event-page,
  main:has(text-view) [data-plugin-mount],
  text-view {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .text-article {
    display: flex;
    flex-direction: column;
    gap: var(--s2);
    flex: 1;
  }

  .text-header {
    display: flex;
    gap: var(--s2);
    align-items: center;
  }

  .text-title {
    flex: 1;
    border: none;
    background: transparent;
    font-size: var(--f2);
    font-weight: var(--fw-semibold);
    padding: var(--s1) 0;
    border-bottom: 1px solid var(--border);
    color: inherit;
    border-radius: 0;
  }

  .text-title:disabled {
    border-bottom-color: transparent;
  }

  .text-lock {
    padding: var(--s1) var(--s3);
    border-radius: var(--br-full);
    border: 1px solid var(--border);
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: var(--f7);
  }

  /* Applies to both the live editor (wg-content) and the static, selectable
     locked view (raw HTML rendered directly into .text-body). */
  .text-body {
    flex: 1;
    min-height: 40dvh;
    line-height: var(--lh-base);
  }

  /* Unlocked only: pass the stretch through to Wordgard so wg-scroller /
     wg-content (both 100%-height) make the whole area clickable. Scoped via
     :has so the locked view's raw HTML keeps normal block flow. */
  .text-body:has(> wordgard-editor) {
    display: flex;
    flex-direction: column;
  }

  .text-body > wordgard-editor {
    flex: 1;
  }

  .text-body wg-content {
    display: block;
    outline: none;
  }

  .text-body p {
    margin: var(--s2) 0;
  }

  /* ── Search ───────────────────────────────────────────────────────── */

  .search-section {
    display: flex;
    flex-direction: column;
    gap: var(--s3);
  }

  .search-input {
    width: 100%;
    box-sizing: border-box;
  }

  .search-result-text {
    display: flex;
    flex-direction: column;
    gap: var(--s1);
    min-width: 0;
    flex: 1;
  }

  .search-result-text strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .search-result-text small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--f8);
  }

  /* ── Image view ───────────────────────────────────────────────────── */

  .image-figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--s2);
  }

  .image-figure img {
    max-width: 100%;
    border-radius: var(--br-base);
    border: 1px solid var(--border);
  }

  .image-figure figcaption {
    font-size: var(--f8);
    color: var(--muted);
    font-family: var(--font-family-mono);
  }

  .image-picker label {
    display: flex;
    flex-direction: column;
    gap: var(--s2);
    padding: var(--s4);
    border: 2px dashed var(--border);
    border-radius: var(--br-base);
    cursor: pointer;
    text-align: center;
  }

  /* ── Audio view ───────────────────────────────────────────────────── */

  .audio-figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--s2);
  }

  .audio-figure audio {
    width: 100%;
  }

  .audio-figure figcaption {
    font-size: var(--f8);
    color: var(--muted);
    font-family: var(--font-family-mono);
  }

  .audio-picker label {
    display: flex;
    flex-direction: column;
    gap: var(--s2);
    padding: var(--s4);
    border: 2px dashed var(--border);
    border-radius: var(--br-base);
    cursor: pointer;
    text-align: center;
  }

  .event-row-audio {
    width: 100%;
    height: 32px;
    margin-top: var(--s1);
  }

  /* ── Geolocation view ─────────────────────────────────────────────── */

  .geolocation-article {
    display: flex;
    flex-direction: column;
    gap: var(--s2);
  }

  .geolocation-open {
    margin-left: var(--s2);
    padding: var(--s1) var(--s3);
    border: 1px solid var(--border);
    border-radius: var(--br-full);
    background: transparent;
    color: inherit;
    cursor: pointer;
  }

  .geolocation-body {
    font-size: var(--f8);
    line-height: var(--lh-tight);
  }

  /* ── Collections ──────────────────────────────────────────────────── */

  .collections-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s2);
  }

  .collections-new {
    padding: var(--s2) var(--s3);
    border-radius: var(--br-full);
    border: 1px solid var(--primary);
    background: var(--primary);
    color: var(--background);
    cursor: pointer;
    font-weight: var(--fw-medium);
    transition: opacity var(--transition-fast);
  }

  .collections-new:hover {
    opacity: 0.85;
  }

  .collection-list-item {
    display: flex;
    align-items: stretch;
    gap: var(--s2);
  }

  .collection-list-item a {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--s2);
    grid-template-columns: none;
  }

  .collection-reorder {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .collection-reorder button {
    width: 32px;
    flex: 1;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--body);
    border-radius: var(--br-sm);
    cursor: pointer;
    padding: var(--s1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .collection-reorder button:disabled {
    opacity: 0.3;
    cursor: default;
  }

  .collection-swatch {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: var(--br-full);
    flex-shrink: 0;
  }

  .collection-detail-header {
    display: flex;
    align-items: center;
    gap: var(--s2);
    margin: 0 0 var(--s3);
  }

  .collection-detail-header h2 {
    margin: 0;
  }

  .collection-color-row {
    display: flex;
    flex-direction: column;
    gap: var(--s2);
    margin: 0 0 var(--s3);
  }

  .collection-color-label {
    font-size: var(--f7);
    color: var(--muted);
  }

  .collection-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s2);
  }

  .collection-swatch-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--br-full);
    border: 2px solid transparent;
    background: var(--secondary);
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--f7);
  }

  .collection-swatch-btn.is-active {
    border-color: var(--body);
  }

  .collection-swatch-custom {
    overflow: hidden;
    position: relative;
    border: 2px dashed var(--border);
  }

  .collection-swatch-custom input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    padding: 0;
    background: transparent;
    cursor: pointer;
    opacity: 0;
  }

  .collection-filters {
    margin: 0 0 var(--s4);
  }

  .collection-filters-title {
    font-size: var(--f5);
    margin-bottom: var(--s2);
  }

  .collection-plugin-filters {
    border: 1px solid var(--border);
    border-radius: var(--br-base);
    padding: var(--s3);
    margin: 0 0 var(--s3);
    display: flex;
    flex-direction: column;
    gap: var(--s2);
  }

  .collection-plugin-filters legend {
    font-size: var(--f7);
    color: var(--muted);
    padding: 0 var(--s1);
  }

  .collection-filter-row {
    display: flex;
    align-items: center;
    gap: var(--s2);
    cursor: pointer;
  }

  .collection-filter-row input {
    margin: 0;
    width: auto;
    height: auto;
  }

  .collection-filter-hint {
    font-size: var(--f8);
    margin: var(--s1) 0 0;
  }

  .collection-view-type {
    display: flex;
    align-items: center;
    gap: var(--s3);
    margin: 0 0 var(--s3);
  }

  .collection-view-type-label {
    font-size: var(--f7);
    color: var(--muted);
  }

  .collection-view-type-option {
    display: inline-flex;
    align-items: center;
    gap: var(--s1);
    cursor: pointer;
  }

  .collection-view-type-option input {
    margin: 0;
    width: auto;
    height: auto;
  }

  /* ── Geolocation collection map ───────────────────────────────────── */

  .geo-collection-wrap {
    display: flex;
    flex-direction: column;
    gap: var(--s2);
  }

  .geo-collection-map {
    width: 100%;
    height: 60vh;
  }

  /* Native maplibre markers are SVG; we cursor-pointer them so clicks navigate. */
  .maplibregl-marker { cursor: pointer; }

  .collection-actions {
    display: flex;
    gap: var(--s2);
    margin: 0 0 var(--s4);
  }

  .collection-actions button {
    padding: var(--s2) var(--s3);
    border-radius: var(--br-full);
    border: 1px solid var(--border);
    background: transparent;
    color: inherit;
    cursor: pointer;
  }

  /* ── Settings ─────────────────────────────────────────────────────── */

  settings-page, settings-sync-page, settings-about-page {
    display: block;
    padding: var(--s3);
    max-width: 600px;
    margin: 0 auto;
  }

  settings-page section,
  settings-sync-page section,
  settings-about-page section {
    margin-bottom: var(--s5);
  }

  settings-page section > p,
  settings-sync-page section > p,
  settings-about-page section > p {
    color: var(--muted);
    margin-bottom: var(--s3);
  }

  /* ── civ-sync-input / civ-store-import ──────────────────────────────── */

  civ-sync-input form {
    display: flex;
    flex-direction: column;
    gap: var(--s2);
  }

  civ-sync-input label {
    display: flex;
    flex-direction: column;
    gap: var(--s1);
  }

  civ-sync-input label span {
    font-size: var(--f7);
    color: var(--muted);
  }  civ-store-import div {
    display: flex;
    gap: var(--s2);
    flex-wrap: wrap;
  }

  /* Pill buttons are an app choice; colour is not — leaving `color` alone
     lets the framework's `[data-variant='danger']` through. */
  civ-store-import button {
    padding: var(--s2) var(--s3);
    border-radius: var(--br-full);
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
  }

  /* ── device-pin ────────────────────────────────────────────────────── */

  device-pin {
    display: flex;
    flex-direction: column;
    gap: var(--s3);
  }

  device-pin .device-pin__status {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s2);
    align-items: center;
  }

  device-pin button.link {
    padding: var(--s2) var(--s3);
    border-radius: var(--br-full);
    cursor: pointer;
    font: inherit;
    border: none;
    background: transparent;
    color: var(--primary);
    text-decoration: underline;
  }

  device-pin button.action {
    padding: var(--s2) var(--s3);
    border-radius: var(--br-full);
    cursor: pointer;
    font: inherit;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: var(--background);
  }

  device-pin .device-pin__form {
    display: flex;
    flex-direction: column;
    gap: var(--s2);
    padding: var(--s3);
    border: 1px solid var(--border);
    border-radius: var(--br-base);
    background: var(--secondary-dull);
  }

  device-pin .device-pin__form label {
    display: flex;
    flex-direction: column;
    gap: var(--s1);
  }

  device-pin .device-pin__form label span {
    font-size: var(--f7);
    color: var(--muted);
  }

  device-pin .device-pin__hint {
    font-size: var(--f7);
    margin: 0;
  }

  device-pin .device-pin__actions {
    display: flex;
    gap: var(--s2);
    flex-wrap: wrap;
  }

  device-pin .device-pin__error {
    font-size: var(--f7);
    color: var(--error);
    margin: 0;
  }
}

/* Unlayered on purpose — these out-rank every layer, including
   `theme`. Carried over from the original theme.css, where they
   also sat outside `@layer theme`. */
/**
 * Inro Theme
 *
 * Visuals modeled on the legacy Inro app (sn-pro typography, flat 5px radii,
 * gray secondary surface, blue primary accent). Token system mirrors
 * `climb/www/static/theme.css` so a second theme can be slotted in later by
 * overriding the HSL triples in `:root`.
 */

@font-face {
  font-family: sn-pro;
  src: url(/static/fonts/sn-pro/SNPro-Regular.woff2) format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: sn-pro;
  src: url(/static/fonts/sn-pro/SNPro-RegularItalic.woff2) format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: sn-pro;
  src: url(/static/fonts/sn-pro/SNPro-Light.woff2) format('woff2');
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: sn-pro;
  src: url(/static/fonts/sn-pro/SNPro-Medium.woff2) format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: sn-pro;
  src: url(/static/fonts/sn-pro/SNPro-Semibold.woff2) format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: sn-pro;
  src: url(/static/fonts/sn-pro/SNPro-Bold.woff2) format('woff2');
  font-weight: 700;
  font-display: swap;
}

nav {
  border: none;
  margin: 0;
}

/* Outside @layer theme: Wordgard injects unlayered styles, which would beat
   any layered declaration. Its wg-scroller/wg-content percentage heights
   don't resolve against the flex-stretched editor root, so the clickable
   wg-content would stay at content height — grow both with flex instead so
   clicking the empty space below the text focuses the editor. */
.text-body > wordgard-editor > wg-scroller {
  flex: 1;
  height: auto;
  display: flex;
  flex-direction: column;
}

.text-body > wordgard-editor > wg-scroller > wg-content {
  flex: 1;
}
