  /* Memory view — platform-wide interaction history (Log + Insights tabs).
     Reuses .gallery-tabs/.gallery-panel/.gallery-hud/.hud-stat from
     gallery.css for the tab strip and HUD tiles, so it reads as one system
     with the Gallery page rather than a bespoke second design. */
  #memory-view { flex: 1; overflow-y: auto; padding: 20px 28px; }
  #memory-view h2 { font-size: 15px; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
  #memory-view h2 .icon-svg { width: 18px; height: 18px; }
  #memory-view .sub { font-size: 12.5px; color: var(--text-dim); margin-bottom: 18px; }

  /* --- Log tab --- */
  .memory-log-controls { display: flex; gap: 8px; margin-bottom: 14px; }
  .memory-log-controls #memory-search-input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 7px;
    padding: 9px 12px;
    font-size: 12.5px;
    outline: none;
  }
  .memory-log-controls #memory-search-input:focus { border-color: var(--accent); }
  .memory-danger-btn {
    background: transparent;
    border: 1px solid rgba(255,107,107,0.4);
    color: var(--red);
    border-radius: 7px;
    padding: 9px 14px;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
  }
  .memory-danger-btn:hover { background: rgba(255,107,107,0.1); }

  #memory-log-list { display: flex; flex-direction: column; gap: 8px; }
  #memory-log-empty { color: var(--text-dim); font-size: 13px; padding: 10px 0; }
  #memory-log-more { margin-top: 12px; text-align: center; }
  .secondary-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 7px;
    padding: 8px 16px;
    font-size: 12px;
    cursor: pointer;
  }
  .secondary-btn:hover { color: var(--text); border-color: var(--accent); }

  .memory-log-row {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 14px;
  }
  .memory-row-top { display: flex; align-items: center; gap: 8px; }
  .memory-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .memory-title { font-size: 13px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .memory-score { font-size: 10.5px; color: var(--accent-2); font-family: var(--mono); flex-shrink: 0; }
  .memory-row-top .del { color: var(--text-dim); font-size: 14px; cursor: pointer; flex-shrink: 0; padding: 2px 6px; border-radius: 5px; }
  .memory-row-top .del:hover { color: var(--red); }
  .memory-summary { font-size: 12px; color: var(--text-dim); margin-top: 5px; white-space: pre-wrap; word-break: break-word; max-height: 3.6em; overflow: hidden; }
  .memory-row-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11px; color: var(--text-dim); margin-top: 7px; }
  .memory-project-badge {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
  }
  .memory-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
  .memory-tag {
    font-size: 10.5px;
    color: var(--text-dim);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 2px 8px;
  }
  .memory-tag-lg { font-size: 12px; padding: 4px 10px; display: inline-flex; align-items: center; gap: 6px; margin: 0 6px 6px 0; }
  .memory-tag-lg .n { color: var(--accent-2); font-family: var(--mono); }

  /* --- Insights tab --- */
  .memory-chart-card { padding: 16px 18px; }
  .memory-chart-card h3 { font-size: 12.5px; margin: 0 0 12px; color: var(--text-dim); font-weight: 600; }
  .memory-chart-svg { display: block; width: 100%; height: 160px; overflow: visible; }
  .memory-bar { fill: var(--accent); transition: fill 0.1s; }
  .memory-bar:hover { fill: #ff2d5e; }
  .memory-axis-label { fill: var(--text-dim); font-size: 9.5px; font-family: var(--mono); }
  #memory-chart-holder { position: relative; }
  #memory-chart-empty { color: var(--text-dim); font-size: 12.5px; padding: 40px 0; text-align: center; }
  .memory-tooltip {
    display: none;
    position: fixed;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 11.5px;
    pointer-events: none;
    z-index: 50;
  }
  .memory-tooltip .dim { color: var(--text-dim); margin-top: 2px; }

  .memory-insights-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
  .memory-insights-row .dashboard-section { padding: 16px 18px; }
  .memory-insights-row h3 { font-size: 12.5px; margin: 0 0 12px; color: var(--text-dim); font-weight: 600; }
  .memory-empty-sm { color: var(--text-dim); font-size: 12px; }

  .memory-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 12px; }
  .memory-bar-row-label { width: 110px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); }
  .memory-bar-row-track { flex: 1; height: 7px; background: var(--bg); border-radius: 4px; overflow: hidden; }
  .memory-bar-row-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 4px; }
  .memory-bar-row-value { width: 28px; text-align: right; flex-shrink: 0; color: var(--text-dim); font-family: var(--mono); }

  @media (max-width: 720px) {
    .memory-insights-row { grid-template-columns: 1fr; }
    .memory-log-controls { flex-wrap: wrap; }
  }
