/* Existing application layouts. Visual primitives are defined by design-system/app.css. */
* { box-sizing: border-box; }

    body {
      background: var(--bg);
      color: var(--text);
      font-family: var(--font-body);
      font-size: 15px;
      line-height: 1.5;
      letter-spacing: -0.1px;
      max-width: 1800px;
      margin: 0;
      padding: 0 40px 64px;
      text-align: left;
    }

    a { color: inherit; }

    h1, h2, h3 { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.5px; margin: 0; }
    h1 { font-size: 30px; letter-spacing: -1px; margin-bottom: 14px; }
    h2 { font-size: 16px; margin: 28px 0 12px; }

    .back-link { display: inline-block; font-size: 13px; color: var(--text-muted); text-decoration: none; margin-bottom: 20px; }
    .back-link:hover { color: var(--text); }

    .source-url { color: var(--text-muted); font-size: 14px; text-decoration: none; word-break: break-all; }
    .source-url:hover { color: var(--accent); }

    .sources-list { list-style: none; margin: 0; padding: 0; }
    .sources-list li { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); padding: 8px 0; border-bottom: 1px solid var(--border); }
    .sources-list li:last-child { border-bottom: none; }

    /* --- Unified button system --- */
    .btn {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-family: var(--font-body);
      font-size: 12px;
      font-weight: 500;
      padding: 7px 15px;
      border-radius: var(--radius-pill);
      border: 1px solid var(--border);
      background: transparent;
      color: var(--text-muted);
      cursor: pointer;
      text-decoration: none;
      transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
    }
    .btn:hover { border-color: var(--border-strong); color: var(--text); }
    .btn-primary {
      background: var(--accent);
      color: var(--ink);
      border-color: var(--accent);
      font-weight: 600;
    }
    .btn-primary:hover { background: var(--accent-active); border-color: var(--accent-active); color: var(--ink); }
    .btn:disabled { background: var(--bg-elevated); color: var(--text-faint); cursor: not-allowed; }

    .markdown-block { font-size: 14px; color: var(--text-muted); white-space: pre-wrap; font-family: var(--font-body); line-height: 1.6; }

    /* --- Header --- */
    .site-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: 67px;
      border-bottom: 1px solid var(--border);
      margin-bottom: 32px;
    }
    .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
    .brand-mark { width: 34px; height: 34px; flex-shrink: 0; object-fit: contain; }
    .brand-name { font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: -0.4px; }

    /* --- Nav: pill-segmented control --- */
    .site-nav {
      display: flex;
      gap: 2px;
      align-items: center;
      background: var(--bg-elevated);
      border: 1px solid var(--border);
      border-radius: var(--radius-pill);
      padding: 4px;
    }
    .site-nav a {
      font-size: 13px;
      font-weight: 500;
      text-decoration: none;
      color: var(--text-muted);
      padding: 8px 18px;
      border-radius: var(--radius-pill);
      transition: background 120ms ease, color 120ms ease;
    }
    .site-nav a:hover { color: var(--text); }
    .site-nav a.active { background: var(--text); color: var(--ink); }
    .site-nav a.active:hover { color: var(--ink); }

    .site-auth { display: flex; align-items: center; gap: 8px; margin-left: 16px; }
    .site-auth a { font-size: 13px; color: var(--text-muted); text-decoration: none; }
    .site-auth a:hover, .site-auth a.active { color: var(--text); }
    .site-auth-link { display: flex; align-items: center; gap: 6px; }
    .site-avatar {
      width: 22px;
      height: 22px;
      border-radius: var(--radius-pill);
      object-fit: cover;
      flex-shrink: 0;
    }
    .site-avatar-fallback {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: var(--bg-elevated);
      border: 1px solid var(--border);
      color: var(--text);
      font-family: var(--font-display);
      font-size: 11px;
    }

    .eyebrow {
      font-family: var(--font-mono);
      font-size: 11px;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--text-faint);
      margin-bottom: 8px;
    }

    /* --- Header search (Ask, in the nav) --- */
    .header-search { position: relative; flex: 1; max-width: 440px; margin: 0 24px; }
    .header-search input[type="text"] {
      width: 100%;
      background: var(--bg-elevated);
      border: 1px solid var(--border);
      color: var(--text);
      padding: 10px 40px 10px 16px;
      border-radius: var(--radius-pill);
      font: inherit;
      font-size: 13px;
    }
    .header-search input[type="text"]:focus { outline: none; border-color: var(--border-strong); }
    .header-search input[type="text"]::placeholder { color: var(--text-faint); }
    .header-search-submit {
      position: absolute;
      top: 50%;
      right: 6px;
      transform: translateY(-50%);
      width: 26px;
      height: 26px;
      border-radius: 50%;
      border: none;
      background: var(--accent);
      color: var(--ink);
      font-size: 14px;
      line-height: 1;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .header-search-submit:hover { background: var(--accent-active); }
    .header-search .htmx-indicator { position: absolute; top: calc(100% + 4px); left: 16px; }
    .header-search-results {
      position: absolute;
      top: calc(100% + 8px);
      left: 0;
      right: 0;
      z-index: 30;
      max-height: 340px;
      overflow-y: auto;
    }
    .header-search-results:empty { display: none; }
    .qa-answer { background: var(--bg-elevated-hover); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 16px 20px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); }
    .qa-answer p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.6; white-space: pre-wrap; }

    /* --- Standalone content block (digest entries, research report) --- */
    .card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 12px; }
    .card-title { font-family: var(--font-display); font-weight: 500; font-size: 17px; letter-spacing: -0.2px; }
    .card-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); margin: 6px 0 10px; letter-spacing: 0.02em; }
    .card-actions { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

    /* --- Panel (table-style list container) --- */
    .panel { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-elevated); margin-bottom: 32px; }
    .panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px 20px; border-bottom: 1px solid var(--border); }
    .panel-title { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
    .panel-note { padding: 14px 20px; font-size: 13px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
    .panel-empty { padding: 32px 20px; text-align: center; color: var(--text-faint); font-size: 14px; }

    /* --- Filters --- */
    .filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
    .filters select {
      -webkit-appearance: none;
      -moz-appearance: none;
      appearance: none;
      background: transparent
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23a39c8f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>")
        no-repeat right 14px center;
      border: 1px solid var(--border);
      color: var(--text);
      padding: 8px 32px 8px 14px;
      border-radius: var(--radius-pill);
      font: inherit;
      font-size: 13px;
      line-height: 1.2;
      cursor: pointer;
    }
    .filters select:focus { outline: none; border-color: var(--border-strong); }

    /* --- Colored tag dropdown --- */
    .tag-select { position: relative; }
    .tag-select summary {
      list-style: none;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      border: 1px solid var(--border);
      color: var(--text);
      padding: 8px 14px;
      border-radius: var(--radius-pill);
      font-size: 13px;
      line-height: 1;
    }
    .plus-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 12px;
      height: 12px;
      font-size: 14px;
      line-height: 1;
      font-weight: 600;
    }
    .tag-select summary::-webkit-details-marker { display: none; }
    .tag-select summary:hover { border-color: var(--border-strong); }
    .tag-select .swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--tag-color, var(--text-faint)); flex-shrink: 0; }
    .tag-select-menu {
      position: absolute;
      top: calc(100% + 6px);
      left: 0;
      z-index: 10;
      min-width: 200px;
      max-height: 280px;
      overflow-y: auto;
      background: var(--bg-elevated-hover);
      border: 1px solid var(--border-strong);
      border-radius: var(--radius-md);
      padding: 6px;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .tag-option {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 7px 10px;
      border-radius: var(--radius-sm);
      font-size: 13px;
      text-decoration: none;
      color: var(--text);
      cursor: pointer;
    }
    .tag-option:hover { background: var(--ghost); }
    .tag-option .swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--tag-color, var(--text-faint)); flex-shrink: 0; }
    /* Открывается влево от триггера — для поповеров у правого края страницы
       (иначе меню уезжает за пределы viewport на широких full-width страницах). */
    .tag-select-menu-left { left: auto; right: 0; }

    /* --- Generic text input (popovers: add link, etc.) --- */
    .input-field {
      background: transparent;
      border: 1px solid var(--border);
      color: var(--text);
      padding: 8px 12px;
      border-radius: var(--radius-md);
      font: inherit;
      font-size: 14px;
      width: 100%;
    }
    .input-field:focus { outline: none; border-color: var(--border-strong); }
    .input-field::placeholder { color: var(--text-faint); }

    /* --- Row list (table-style) --- */
    .row-list { display: flex; flex-direction: column; }
    .row-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
    .row-item:last-child { border-bottom: none; }
    .row-item:hover { background: var(--ghost); }
    .row-main { min-width: 0; flex: 1 1 320px; }
    .row-title { font-family: var(--font-display); font-weight: 500; font-size: 16px; letter-spacing: -0.2px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
    .row-title a { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
    .row-title a:hover { color: var(--accent); text-decoration-color: var(--accent); }
    .row-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); margin: 6px 0 0; letter-spacing: 0.02em; }
    .row-desc { font-size: 13px; color: var(--text-muted); margin: 8px 0 0; }
    .row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }

    /* --- Data table (Links index) --- */
    .table-scroll { overflow-x: auto; }
    .data-table { width: 100%; border-collapse: collapse; }
    .data-table th {
      text-align: left;
      font-family: var(--font-mono);
      font-size: 10px;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      color: var(--text-faint);
      font-weight: 500;
      padding: 12px 16px;
      border-bottom: 1px solid var(--border);
      white-space: nowrap;
    }
    .data-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 13px; }
    .data-table tr:last-child td { border-bottom: none; }
    .data-table tr:hover td { background: var(--ghost); }
    .data-table .col-title { width: 18%; min-width: 180px; }
    .data-table .col-title a {
      font-family: var(--font-display);
      font-weight: 500;
      font-size: 15px;
      text-decoration: underline;
      text-decoration-color: var(--border-strong);
      text-underline-offset: 3px;
    }
    .data-table .col-title a:hover { color: var(--accent); text-decoration-color: var(--accent); }
    .data-table .col-desc { color: var(--text-muted); width: 100%; }
    .data-table .col-tags, .data-table .col-area, .data-table .col-priority,
    .data-table .col-date, .data-table .col-post,
    .data-table .col-usefulness { white-space: nowrap; }
    /* Links table: колонки заданы через <colgroup> (Description ровно в 4
       раза шире Title), поэтому fixed layout и явный сброс width/min-width
       у отдельных td, иначе колгруппа конфликтует с процентами выше. Title
       обрезается многоточием в одну строку — иначе разные по длине заголовки
       переносятся на разное число строк и строки таблицы выглядят неровно. */
    .data-table-links { table-layout: fixed; }
    .data-table-links th { white-space: normal; }
    .data-table-links .col-title { width: auto; min-width: 0; overflow: hidden; }
    .data-table-links .col-desc { width: auto; }
    .data-table-links .col-title a {
      display: block;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .data-table-links .col-title .row-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .data-table-links .col-desc, .data-table-links .col-tags { white-space: normal; overflow-wrap: break-word; }
    .data-table-links .col-actions { text-align: right; }
    .data-table-links .col-actions-stack { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
    .data-table .col-actions { white-space: nowrap; text-align: right; }
    .data-table .tags { margin: 0; }
    /* --- Inline-editable Priority cells --- */
    .priority-select {
      -webkit-appearance: none;
      -moz-appearance: none;
      appearance: none;
      background: transparent
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23a39c8f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>")
        no-repeat right 8px center;
      border: 1px solid var(--tag-color, var(--border));
      color: var(--text);
      padding: 4px 22px 4px 10px;
      border-radius: var(--radius-pill);
      font: inherit;
      font-size: 12px;
      cursor: pointer;
    }
    .priority-select:focus { outline: none; border-color: var(--border-strong); }
    .post-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; margin-bottom: 8px; display: block; }

    /* --- Channel Parser wizard (TZ_CHANNELS.md) --- */
    .wizard-progress-bar { width: 100%; height: 10px; border-radius: var(--radius-pill); background: var(--ghost); overflow: hidden; }
    .wizard-progress-fill { height: 100%; background: var(--accent); border-radius: var(--radius-pill); transition: width 300ms ease; }

    /* --- Voice DNA report (TZ_CHANNELS.md §3.5) --- */
    .disclaimer { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); line-height: 1.5; margin: 0 0 20px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); }
    .report-tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
    .report-tab { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 8px 16px; cursor: pointer; }
    .report-tab.active { color: var(--ink); background: var(--text); border-color: var(--text); }
    .report-tab-panel { display: none; }
    .report-tab-panel.active { display: block; }
    .kpi-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; margin-bottom: 20px; }
    .kpi-tile { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; }
    .kpi-tile .kpi-value { font-family: var(--font-display); font-size: 40px; font-weight: 500; letter-spacing: -0.5px; line-height: 1.1; }
    .kpi-tile .kpi-label { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); margin-top: 6px; letter-spacing: 0.02em; }
    .chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 20px; }
    .chart-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; min-height: 280px; }
    .chart-card canvas { max-height: 240px; }
    .report-prose { line-height: 1.6; margin: 0 0 14px; }
    .report-prose h4 { font-family: var(--font-display); font-size: 14px; margin: 0 0 6px; color: var(--text-muted); }
    .insight-list { margin: 0 0 20px; padding-left: 20px; line-height: 1.6; }
    .insight-list li { margin-bottom: 6px; }
    .under-the-hood-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 20px; }
    .cheat-code { font-family: var(--font-mono); font-size: 13px; color: var(--yellow); border: 1px dashed var(--yellow); border-radius: var(--radius-md); padding: 10px 14px; }

    /* --- Usefulness score badge + hover tooltip --- */
    .score-badge {
      position: relative;
      display: inline-block;
      font-family: var(--font-mono);
      font-size: 12px;
      font-weight: 500;
      color: var(--text);
      border: 1px solid var(--border-strong);
      border-radius: var(--radius-pill);
      padding: 3px 10px;
      cursor: default;
    }
    .score-tooltip {
      display: none;
      position: absolute;
      bottom: calc(100% + 8px);
      right: 0;
      width: 220px;
      background: var(--bg-elevated-hover);
      border: 1px solid var(--border-strong);
      border-radius: var(--radius-md);
      padding: 10px 12px;
      font-family: var(--font-body);
      font-size: 12px;
      font-weight: 400;
      color: var(--text-muted);
      line-height: 1.5;
      white-space: normal;
      z-index: 20;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    }
    .score-badge:hover .score-tooltip { display: block; }

    /* --- Post preview popup (Posts table) --- */
    .preview-dialog {
      width: min(640px, 92vw);
      max-height: 85vh;
      background: var(--bg-elevated);
      color: var(--text);
      border: 1px solid var(--border-strong);
      border-radius: var(--radius-lg);
      padding: 0;
      overflow: hidden;
    }
    .preview-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
    .preview-dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
    .preview-iframe { width: 100%; height: 480px; border: none; display: block; }

    .badge {
      display: inline-block;
      background: transparent;
      color: var(--green);
      border: 1px solid var(--green);
      font-family: var(--font-mono);
      font-size: 10px;
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      padding: 2px 9px;
      border-radius: var(--radius-pill);
    }

    .tags { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
    .tag {
      display: inline-block;
      background: var(--tag-color, var(--lilac));
      color: var(--ink);
      border-radius: var(--radius-pill);
      padding: 3px 11px;
      font-size: 12px;
      font-weight: 500;
    }
    .click-count { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }

    .edit-form { display: flex; flex-direction: column; gap: 8px; padding: 16px 20px; }
    .edit-form label { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
    .edit-form input, .edit-form textarea, .edit-form select {
      background: transparent;
      border: 1px solid var(--border);
      color: var(--text);
      padding: 8px 12px;
      border-radius: var(--radius-md);
      font: inherit;
      font-size: 14px;
      width: 100%;
      resize: vertical;
    }
    .edit-form input:focus, .edit-form textarea:focus, .edit-form select:focus { outline: none; border-color: var(--border-strong); }
    .edit-form-actions { display: flex; gap: 8px; margin-top: 4px; }

    .pagination { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }
    .pagination a, .pagination-disabled { text-decoration: none; color: var(--text-muted); font-family: var(--font-mono); font-size: 13px; padding: 6px 10px; border-radius: var(--radius-sm); }
    .pagination a:hover { color: var(--text); background: var(--ghost); }
    .pagination-disabled { color: var(--text-faint); }
    .pagination-current { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }

    .htmx-indicator { opacity: 0; transition: opacity 150ms ease-in; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); align-self: center; }
    .htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

    pre { font-family: var(--font-body); }

    /* --- Version table (changelog page) --- */
    .version-table { width: 100%; border-collapse: collapse; }
    .version-table th { text-align: left; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); font-weight: 500; padding: 10px 20px; border-bottom: 1px solid var(--border); }
    .version-table td { padding: 14px 20px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 13px; }
    .version-table tr:last-child td { border-bottom: none; }
    .version-table .v-num { font-family: var(--font-mono); font-weight: 500; color: var(--text); white-space: nowrap; }
    .version-table .v-date { font-family: var(--font-mono); color: var(--text-faint); white-space: nowrap; }
    .version-table ul { margin: 0; padding-left: 16px; color: var(--text-muted); }
    .version-table li { margin-bottom: 4px; }

    footer { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); letter-spacing: 0.04em; text-transform: uppercase; display: flex; gap: 16px; flex-wrap: wrap; }
    footer a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
    footer a:hover { color: var(--accent-active); }

    @media (max-width: 520px) {
      body { padding: 0 16px 48px; }
      .site-header { flex-wrap: wrap; height: auto; padding: 14px 0; gap: 10px; }
      .brand-name { font-size: 17px; }
      .header-search { order: 3; max-width: none; margin: 0; flex-basis: 100%; }
      .row-item { padding: 14px; }
      .row-actions { width: 100%; }
    }
  
  
    .scope-switch { display:flex; gap:8px; align-items:center; font-size:12px; color:var(--text-muted); }
    a.tag { text-decoration:none; }
    a.tag:hover { filter:brightness(1.15); }
    .taxonomy-filters { flex-wrap:wrap; }
    .header-search form[action="/search"] input { flex:1; min-width:0; width:auto; }
    .header-search { min-width:0; }
    .panel-header > div { min-width:0; max-width:100%; }
    .report-prose, .row-desc, .row-main { overflow-wrap:anywhere; min-width:0; }
    @media(max-width:520px) {
      .site-nav { width:100%; }
      .site-auth { flex-wrap:wrap; }
      .filters { width:100%; min-width:0; }
      .filters .input-field { max-width:100% !important; width:100%; box-sizing:border-box; }
      .tag-select-menu { min-width:0 !important; max-width:calc(100vw - 48px); box-sizing:border-box; }
      .preview-dialog { max-width:calc(100vw - 24px); width:calc(100vw - 24px); }
      .edit-form input, .edit-form textarea, .edit-form select { box-sizing:border-box; max-width:100%; }
      .report-tabs { overflow-x:auto; max-width:100%; }
      .kpi-value { overflow-wrap:anywhere; }
      .kpi-hero { grid-template-columns:1fr; }
    }
    .scope-switch select { border:1px solid var(--border); border-radius:20px; background:var(--bg-elevated); color:var(--text); padding:6px 10px; font:inherit; }
    #ui-error { padding:12px; border:1px solid var(--accent); border-radius:8px; margin:12px 0; white-space:pre-wrap; }
    .markdown-block,.qa-answer { white-space:pre-wrap; overflow-wrap:anywhere; }
    @media(max-width:700px) { .site-header { flex-wrap:wrap; } .header-search { order:4; flex-basis:100%; } .site-nav { overflow-x:auto; max-width:100%; } }
