.tools-panel {
  padding: 24px;
  overflow: auto;
  max-width: 720px;
}

.tools-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.tools-card h2 {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 600;
}

.tools-card p {
  margin: 0 0 16px 0;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1.5;
}

.tools-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
}

.tools-status {
  margin-top: 12px;
  font-size: 15px;
  color: var(--text-dim);
}

.tools-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tools-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: var(--chip-bg);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-secondary);
}

.tools-recent {
  margin-top: 14px;
  font-size: 14px;
}

.tools-recent summary {
  cursor: pointer;
  color: var(--text-dim);
  user-select: none;
  padding: 4px 0;
}

.tools-recent ul {
  list-style: none;
  margin: 8px 0 0 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.tools-recent li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.tools-recent-text {
  flex: 1;
  color: var(--text);
  word-break: break-word;
}

.tools-recent-meta {
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: 12px;
  white-space: nowrap;
}

.shared-mem-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.shared-mem-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.shared-mem-row:last-child {
  border-bottom: none;
}

.shared-mem-name {
  font-weight: 500;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 14px;
}

.shared-mem-stats {
  color: var(--text-dim);
  font-size: 13px;
  white-space: nowrap;
}

.mem-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex;
  align-items: center; justify-content: center; z-index: 1000; }
.mem-modal { background: var(--surface, #fff); color: inherit; width: min(720px, 92vw);
  max-height: 84vh; display: flex; flex-direction: column; border-radius: 10px; padding: 16px; gap: 10px; }
.mem-head { display: flex; justify-content: space-between; align-items: center; }
.mem-close { border: 0; background: none; font-size: 22px; cursor: pointer; color: inherit; }
.mem-search { padding: 8px; border-radius: 6px; border: 1px solid var(--border, #ccc); }
.mem-list { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.mem-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px;
  align-items: baseline; padding: 6px 4px; border-bottom: 1px solid var(--border, #eee); cursor: pointer; }
.mem-text { white-space: pre-wrap; word-break: break-word; }
.mem-tags em { font-style: normal; font-size: .75em; opacity: .7; margin-left: 4px; }
.mem-age { font-size: .75em; opacity: .6; white-space: nowrap; }
.mem-foot { display: flex; align-items: center; gap: 12px; }
.mem-pager { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.mem-pager button { cursor: pointer; }
.mem-empty { opacity: .6; padding: 16px; text-align: center; }
.tools-manage { margin-top: 10px; cursor: pointer; }

/* PWA install card */
.pwa-card-body { margin-top: 8px; }
.pwa-install-btn {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent, #2f81f7);
  color: #fff;
}
.pwa-install-btn:hover { filter: brightness(1.05); }
.pwa-status { margin-top: 6px; font-size: 0.85em; opacity: 0.75; }
.pwa-ios-hint, .pwa-unsupported { font-size: 0.9em; line-height: 1.4; opacity: 0.85; }
.pwa-installed { font-weight: 600; opacity: 0.8; }

/* Tools → Settings: chat text-size control */
.tools-fontsize-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tools-fontsize-btn {
  flex: 1 1 auto;
  min-width: 72px;
  padding: 8px 12px;
  background: var(--chip-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.tools-fontsize-btn:hover {
  background: var(--chip-bg-hover);
}

.tools-fontsize-btn.active {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
}

/* Selector must out-specify `.tools-card p` (0,1,1), which would otherwise pin
   font-size to 16px and stop the preview reflecting --font-scale. */
.tools-card p.tools-fontsize-preview {
  margin: 14px 0 0 0;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  /* Reflect the chosen scale live, the same way chat bubbles do. */
  font-size: calc(16px * var(--font-scale));
  line-height: 1.5;
}
