/* Extracted without modifications from pinned AIGate base.html style block. */

    html,
    body {
      background: #020617;
      color: #e5e7eb;
    }

    html[data-theme="light"],
    html[data-theme="light"] body {
      background: #f4f7fb;
      color: #111827;
    }

    /* Preload theme to prevent flash */
    html[data-theme="light"] {
      --bg: #f4f7fb;
      --surface: rgba(255, 255, 255, 0.96);
    }

    /* Avoid showing mojibake while i18n is being applied after navigation. */
    html.i18n-pending [data-i18n]:not([data-i18n-shell]),
    html.i18n-pending [data-i18n-title]:not([data-i18n-shell]),
    html.i18n-pending [data-i18n-placeholder]:not([data-i18n-shell]),
    html.i18n-pending [data-policy-name]:not([data-i18n-shell]) {
      visibility: hidden;
    }

    .aigate-toast-stack {
      position: fixed;
      right: 18px;
      bottom: 18px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      z-index: 4000;
      max-width: min(92vw, 420px);
      pointer-events: none;
    }

    .aigate-toast {
      pointer-events: auto;
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: start;
      gap: 10px;
      padding: 10px 12px;
      border-radius: 10px;
      border: 1px solid var(--border-light);
      background: var(--surface);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      box-shadow: var(--shadow-md);
      opacity: 0;
      transform: translateY(6px);
      transition: opacity 0.2s ease, transform 0.2s ease;
      color: var(--text);
    }

    .aigate-toast.is-visible {
      opacity: 1;
      transform: translateY(0);
    }

    .aigate-toast-success {
      border-color: rgba(16, 185, 129, 0.45);
      box-shadow: 0 0 12px rgba(16, 185, 129, 0.14);
    }

    .aigate-toast-error {
      border-color: rgba(239, 68, 68, 0.45);
      box-shadow: 0 0 12px rgba(239, 68, 68, 0.14);
    }

    .aigate-toast-warning {
      border-color: rgba(245, 158, 11, 0.45);
      box-shadow: 0 0 12px rgba(245, 158, 11, 0.14);
    }

    .aigate-toast-message {
      font-size: 0.83rem;
      line-height: 1.35;
      white-space: pre-wrap;
      word-break: break-word;
    }

    .aigate-toast-details {
      margin-top: 6px;
      font-size: 0.75rem;
      line-height: 1.25;
      color: var(--text-muted);
      white-space: pre-wrap;
      word-break: break-word;
      max-height: 180px;
      overflow: auto;
    }

    .aigate-toast-close {
      appearance: none;
      border: none;
      background: transparent;
      color: var(--text-muted);
      font-size: 1rem;
      line-height: 1;
      padding: 2px 4px;
      border-radius: 4px;
      cursor: pointer;
    }

    .aigate-toast-close:hover {
      color: var(--text);
      background: rgba(255, 255, 255, 0.06);
    }

    .product-version-footer {
      position: fixed;
      right: 0.75rem;
      bottom: 0.35rem;
      z-index: 15;
      pointer-events: none;
      color: var(--text-muted);
      font-family: var(--font-mono);
      font-size: 0.58rem;
      line-height: 1;
      opacity: 1;
      user-select: none;
    }

    @media (max-width: 768px) {
      .aigate-toast-stack {
        left: 12px;
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom));
      }

      .product-version-footer {
        right: 0.5rem;
        bottom: calc(0.25rem + env(safe-area-inset-bottom));
      }
    }

    /* Gate Context Switcher */
    .gate-context-switcher {
      display: flex;
      gap: 0.35rem;
      padding: 0 1.1rem 0.5rem;
      margin-bottom: 0.25rem;
    }

    .aigate-collapse-toggle {
      display: inline-flex;
      align-items: center;
      gap: 0.32rem;
      min-height: 0;
      padding: 0.08rem 0.18rem;
      border-radius: 999px;
      border: none;
      background: transparent;
      color: var(--text-muted);
      font-size: 0.64rem;
      font-weight: 700;
      letter-spacing: 0.04em;
      line-height: 1;
      cursor: pointer;
      transition: background-color 0.18s ease, color 0.18s ease;
    }

    .aigate-collapse-toggle:hover {
      background: rgba(255, 255, 255, 0.06);
      color: var(--text);
    }

    html[data-theme="light"] .aigate-collapse-toggle:hover {
      background: rgba(17, 24, 39, 0.06);
    }

    .aigate-collapse-toggle-icon {
      width: 0.46rem;
      height: 0.46rem;
      border-right: 1.5px solid currentColor;
      border-bottom: 1.5px solid currentColor;
      transform: rotate(45deg);
      transition: transform 0.18s ease;
      flex-shrink: 0;
    }

    [data-collapsed="true"] .aigate-collapse-toggle-icon {
      transform: rotate(-135deg);
    }

    .aigate-collapse-body[hidden] {
      display: none !important;
    }

    .gate-ctx-btn {
      flex: 1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
      padding: 5px 8px;
      border-radius: 10px;
      border: 1px solid transparent;
      background: transparent;
      color: var(--text-muted);
      font-size: 0.74rem;
      font-weight: 600;
      letter-spacing: 0.01em;
      cursor: pointer;
      transition: all 0.18s ease;
      text-transform: none;
    }

    .gate-ctx-btn:hover {
      background: rgba(255, 255, 255, 0.025);
      color: var(--text);
    }

    html[data-theme="light"] .gate-ctx-btn:hover {
      background: rgba(0, 0, 0, 0.04);
    }

    .gate-ctx-btn.active[data-gate-context="llm"] {
      background: rgba(45, 212, 191, 0.08);
      color: var(--text);
      border-color: rgba(45, 212, 191, 0.22);
    }

    .gate-ctx-btn.active[data-gate-context="agent"] {
      background: rgba(16, 185, 129, 0.08);
      color: var(--text);
      border-color: rgba(16, 185, 129, 0.22);
    }

    .nav-section-collapsible {
      margin-top: 0.5rem;
      padding-top: 0;
    }

    .nav-section-summary {
      list-style: none;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 4px 1.1rem 0.25rem;
      border-radius: 0;
      border: none;
      background: transparent;
      cursor: pointer;
      transition: color 0.18s ease;
    }

    .nav-section-summary::-webkit-details-marker {
      display: none;
    }

    .nav-section-summary:hover {
      background: transparent;
    }

    html[data-theme="light"] .nav-section-summary:hover {
      background: transparent;
    }

    .nav-section-summary .nav-section-title {
      margin: 0;
    }

    .nav-section-summary-main {
      min-width: 0;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .nav-section-caret {
      width: 8px;
      height: 8px;
      border-right: 1.5px solid var(--text-muted);
      border-bottom: 1.5px solid var(--text-muted);
      transform: rotate(45deg);
      transition: transform 0.18s ease, border-color 0.18s ease;
      flex-shrink: 0;
      margin-right: 0;
      opacity: 0.72;
    }

    .nav-section-collapsible[open] .nav-section-caret {
      transform: rotate(225deg);
      border-color: var(--text);
    }

    .nav-section-body {
      display: grid;
      gap: 2px;
      margin-top: 8px;
    }

    /* Apply persisted disclosure state before DOMContentLoaded to avoid layout jumps on navigation. */
    html[data-sidebar-settings-open="true"] .nav-section-collapsible[data-nav-section="settings"]>.nav-section-body,
    html[data-sidebar-platform-open="true"] .nav-section-collapsible[data-nav-section="platform"]>.nav-section-body {
      display: grid;
    }

    html[data-sidebar-settings-open="false"] .nav-section-collapsible[data-nav-section="settings"]>.nav-section-body,
    html[data-sidebar-platform-open="false"] .nav-section-collapsible[data-nav-section="platform"]>.nav-section-body {
      display: none;
    }

    html[data-sidebar-settings-open="true"] .nav-section-collapsible[data-nav-section="settings"]>.nav-section-summary .nav-section-caret,
    html[data-sidebar-platform-open="true"] .nav-section-collapsible[data-nav-section="platform"]>.nav-section-summary .nav-section-caret {
      transform: rotate(225deg);
      border-color: var(--text);
    }

    html[data-sidebar-settings-open="false"] .nav-section-collapsible[data-nav-section="settings"]>.nav-section-summary .nav-section-caret,
    html[data-sidebar-platform-open="false"] .nav-section-collapsible[data-nav-section="platform"]>.nav-section-summary .nav-section-caret {
      transform: rotate(45deg);
      border-color: var(--text-muted);
    }

    /* Context-aware nav: hide items not matching context */
    body[data-gate-context="llm"] .gate-ctx-agent,
    body[data-gate-context="agent"] .gate-ctx-llm {
      display: none;
    }

    /* License banners */
    .license-banner {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 18px;
      border-radius: 8px;
      font-size: 13px;
      margin-bottom: 12px;
      font-weight: 500;
    }

    .license-banner a {
      color: inherit;
      text-decoration: underline;
      font-weight: 600;
    }

    .license-banner-warning {
      background: rgba(234, 179, 8, 0.12);
      border: 1px solid rgba(234, 179, 8, 0.35);
      color: #eab308;
    }

    .license-banner-danger {
      background: rgba(239, 68, 68, 0.10);
      border: 1px solid rgba(239, 68, 68, 0.35);
      color: var(--danger, #ef4444);
    }

    html[data-theme="light"] .license-banner-danger {
      color: #991b1b;
    }

    html[data-shell-context-collapsed="true"] [data-shell-context-panel][data-collapse-root-attr="data-shell-context-collapsed"]>[data-collapse-body] {
      display: none !important;
    }

    html[data-shell-context-collapsed="true"] [data-shell-context-panel][data-collapse-root-attr="data-shell-context-collapsed"] .aigate-collapse-toggle-icon {
      transform: rotate(-135deg);
    }

    .gate-ctx-btn {
      border-radius: var(--radius-md);
    }

    .gate-ctx-btn.active[data-gate-context="llm"],
    .gate-ctx-btn.active[data-gate-context="agent"] {
      background: var(--surface-section);
      border-color: rgba(16, 185, 129, 0.28);
      box-shadow: inset 0 -1px 0 rgba(16, 185, 129, 0.08);
    }

    .license-banner {
      box-shadow: none;
    }

    .aigate-toast-success,
    .aigate-toast-error,
    .aigate-toast-warning {
      box-shadow: var(--shadow-sm);
    }
  