/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-width: 280px;
  --color-bg: #f4f4f0;
  --color-surface: #ffffff;
  --color-sidebar: #2c2c3a;
  --color-sidebar-text: #d4d4e0;
  --color-sidebar-heading: #8888aa;
  --color-accent: #5b6af0;
  --color-accent-hover: #4455e0;
  --color-text: #1a1a2e;
  --color-muted: #6b7280;
  --color-border: #e2e2ea;
  --color-other-entry: #fff8e6;
  --color-other-badge: #f59e0b;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  height: 100vh;
  overflow: hidden;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
}

#sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar);
  color: var(--color-sidebar-text);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

#content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#main-panels {
  flex: 1;
  display: flex;
  overflow: hidden;
}

#page-panel {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#page-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.page-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  border-right: 1px solid var(--color-border);
  color: var(--color-muted);
  user-select: none;
}

.page-tab:hover { background: var(--color-bg); color: var(--color-text); }
.page-tab.active { color: var(--color-text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--color-accent); }

.tab-close {
  background: none; border: none; cursor: pointer;
  font-size: 1rem; color: var(--color-muted); padding: 0 1px; line-height: 1;
}
.tab-close:hover { color: #dc2626; }

#page-view {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

#discussion-panel {
  width: 420px;
  flex-shrink: 0;
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#discussion-view {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar-header {
  padding: 20px 16px 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.version {
  font-size: 0.7rem;
  color: var(--color-sidebar-heading);
}

.sidebar-section {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-section h2 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-sidebar-heading);
  margin-bottom: 10px;
}

.input-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.input-row input {
  flex: 1;
  padding: 6px 8px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  font-size: 0.8rem;
}

.input-row input::placeholder { color: rgba(255,255,255,0.3); }

.input-row button {
  padding: 6px 10px;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

.input-row button:hover { background: var(--color-accent-hover); }

.item-list {
  list-style: none;
}

.item-list li {
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--color-sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-list li:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.item-list li.active {
  background: var(--color-accent);
  color: #fff;
}

/* ── Identity ────────────────────────────────────────────────────────────── */
.identity-display {
  font-size: 0.82rem;
  margin-bottom: 10px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius);
  min-height: 30px;
}

.identity-display .no-identity { color: var(--color-sidebar-heading); font-style: italic; }
.identity-display .identity-name { color: #fff; font-weight: 600; }
.identity-display .identity-id { color: var(--color-sidebar-heading); font-size: 0.7rem; }

/* ── Welcome ──────────────────────────────────────────────────────────────── */
.welcome-panel {
  max-width: 480px;
  margin: 60px auto;
  padding: 24px;
  text-align: center;
}

.welcome-panel h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--color-text);
}

.welcome-panel p {
  color: var(--color-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

.feature-list {
  list-style: none;
  text-align: left;
  display: inline-block;
  margin-bottom: 20px;
}

.feature-list li {
  color: var(--color-muted);
  padding: 4px 0;
  font-size: 0.9rem;
}

.feature-list li::before {
  content: '✓ ';
  color: var(--color-accent);
  font-weight: 700;
}

.hint {
  font-size: 0.85rem;
  color: #aaa;
}

/* ── Page viewer ──────────────────────────────────────────────────────────── */
.page-container {
  max-width: 720px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--color-border);
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.page-header .source-url {
  font-size: 0.75rem;
  color: var(--color-muted);
}

.export-btn {
  padding: 6px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--color-text);
}

.export-btn:hover { background: var(--color-border); }

.page-story { line-height: 1.7; }

.fedwiki-paragraph { margin-bottom: 16px; color: var(--color-text); }

.fedwiki-item {
  margin-bottom: 12px;
  padding: 12px;
  background: var(--color-surface);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

/* ── Discussion ───────────────────────────────────────────────────────────── */
.discussion-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.discussion-header {
  padding-bottom: 12px;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 16px;
  flex-shrink: 0;
}

.discussion-header h2 { font-size: 1.3rem; font-weight: 700; }

.messages-area {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 16px;
}

.message {
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--color-surface);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

/* Messages written by someone other than the person of record */
.message.written-by-other {
  background: var(--color-other-entry);
  border-color: #fcd34d;
}

.message.written-by-other .other-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--color-other-badge);
  color: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}

.message-replies {
  margin-top: 8px;
  margin-left: 20px;
  border-left: 2px solid var(--color-border);
  padding-left: 12px;
}

.message-meta {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-bottom: 6px;
}

.message-author { font-weight: 600; color: var(--color-text); }

.message-content { font-size: 0.9rem; line-height: 1.6; }

.page-ref-tag {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.75rem;
  padding: 2px 8px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 3px;
  color: var(--color-accent);
  cursor: pointer;
}

.page-ref-tag:hover { background: #e0e7ff; }

.reply-btn {
  font-size: 0.72rem;
  color: var(--color-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  margin-top: 4px;
}

.reply-btn:hover { color: var(--color-accent); }

/* ── Compose ──────────────────────────────────────────────────────────────── */
.compose-area {
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
  flex-shrink: 0;
}

.compose-area textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9rem;
  resize: vertical;
  min-height: 80px;
  margin-bottom: 8px;
}

.compose-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.compose-actions label {
  font-size: 0.8rem;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.compose-actions .send-btn {
  padding: 8px 18px;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  cursor: pointer;
}

.compose-actions .send-btn:hover { background: var(--color-accent-hover); }

.replying-to-banner {
  font-size: 0.8rem;
  color: var(--color-muted);
  background: #f0f4ff;
  padding: 4px 10px;
  border-radius: var(--radius);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.replying-to-banner button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--color-muted);
}

/* ── Story items & item toolbar ───────────────────────────────────────────── */
.story-item {
  position: relative;
  margin-bottom: 4px;
}

.item-toolbar {
  position: absolute;
  right: 6px; top: 6px;
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 2;
}

.story-item:hover .item-toolbar { opacity: 1; }

.item-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.72rem;
  cursor: pointer;
  color: var(--color-muted);
  white-space: nowrap;
}

.item-btn:hover { background: #eef2ff; border-color: var(--color-accent); color: var(--color-accent); }
.item-btn.active { background: #eef2ff; border-color: var(--color-accent); color: var(--color-accent); opacity: 1 !important; }

.story-item.highlighted > .fedwiki-item,
.story-item.highlighted > .fedwiki-paragraph {
  outline: 2px solid var(--color-accent);
  border-radius: var(--radius);
}

/* ── Rendered markdown ────────────────────────────────────────────────────── */
.fedwiki-markdown { line-height: 1.7; }
.fedwiki-markdown h1 { font-size: 1.3rem; font-weight: 700; margin: 16px 0 8px; }
.fedwiki-markdown h2 { font-size: 1.1rem; font-weight: 700; margin: 14px 0 6px; }
.fedwiki-markdown h3 { font-size: 1rem;   font-weight: 700; margin: 12px 0 4px; }
.fedwiki-markdown strong { font-weight: 700; }
.fedwiki-markdown em { font-style: italic; }
.fedwiki-markdown p { margin: 0 0 10px; }
.fedwiki-markdown p:last-child { margin-bottom: 0; }
.fedwiki-markdown ul, .fedwiki-markdown ol { margin: 6px 0 10px 20px; }
.fedwiki-markdown li { margin-bottom: 3px; }
.fedwiki-markdown li input[type="checkbox"] {
  margin-right: 6px;
  accent-color: var(--color-accent);
  cursor: default;
}
.fedwiki-markdown code {
  background: #f0f0f8;
  border-radius: 3px;
  padding: 1px 5px;
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
}
.fedwiki-markdown pre {
  background: #f0f0f8;
  border-radius: var(--radius);
  padding: 12px;
  overflow-x: auto;
  margin: 8px 0;
}
.fedwiki-markdown pre code { background: none; padding: 0; }
.fedwiki-markdown hr { border: none; border-top: 1px solid var(--color-border); margin: 12px 0; }
.fedwiki-markdown blockquote {
  border-left: 3px solid var(--color-border);
  margin: 8px 0;
  padding: 4px 12px;
  color: var(--color-muted);
}

/* ── Inline edit form — split pane ────────────────────────────────────────── */
.item-edit-form {
  padding: 8px;
  background: #f8f9ff;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
  margin-bottom: 4px;
}

.edit-split {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.edit-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pane-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin-bottom: 4px;
}

.edit-pane textarea {
  flex: 1;
  width: 100%;
  min-height: 160px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  resize: vertical;
  line-height: 1.5;
  background: #fff;
  color: var(--color-text);
}

.edit-pane textarea:focus { outline: none; border-color: var(--color-accent); }

.edit-preview {
  min-height: 160px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  font-size: 0.9rem;
  overflow-y: auto;
}

.item-edit-form textarea {
  width: 100%;
  min-height: 80px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9rem;
  resize: vertical;
  margin-bottom: 8px;
}

.item-edit-actions {
  display: flex;
  gap: 8px;
}

.item-edit-actions button {
  padding: 5px 14px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}

.item-edit-actions .save-btn {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.item-edit-actions .save-btn:hover { background: var(--color-accent-hover); }

/* ── Add-after form ───────────────────────────────────────────────────────── */
.add-item-row {
  height: 20px;
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity 0.12s;
}

.story-item:hover + .add-item-row,
.add-item-row:hover { opacity: 1; }

.add-here-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--color-muted);
  padding: 0 4px;
}

.add-here-btn:hover { color: var(--color-accent); }

.add-item-form {
  padding: 8px;
  background: #f8f9ff;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.add-item-form textarea {
  width: 100%;
  min-height: 60px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9rem;
  resize: vertical;
  margin-bottom: 8px;
}

/* ── Lift-to-page button in messages ──────────────────────────────────────── */
.lift-btn {
  font-size: 0.72rem;
  color: var(--color-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  margin-top: 4px;
  margin-left: 4px;
}

.lift-btn:hover { color: var(--color-accent); }

/* ── Pinned paragraph banner (compose) ───────────────────────────────────── */
.pinned-para-banner {
  font-size: 0.8rem;
  background: #f0f4ff;
  border-left: 3px solid var(--color-accent);
  padding: 6px 10px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pinned-para-banner .para-text {
  flex: 1;
  font-style: italic;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pinned-para-banner button {
  background: none; border: none; cursor: pointer;
  font-size: 0.85rem; color: var(--color-muted); flex-shrink: 0;
}

/* ── Paragraph quote in message ──────────────────────────────────────────── */
.msg-para-ref {
  margin-bottom: 8px;
  padding: 6px 10px;
  background: #f8f8ff;
  border-left: 3px solid var(--color-accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--color-muted);
  cursor: pointer;
}

.msg-para-ref:hover { background: #eef2ff; color: var(--color-text); }

.msg-para-ref .ref-page {
  font-size: 0.7rem;
  color: var(--color-accent);
  font-style: normal;
  display: block;
  margin-bottom: 2px;
}

/* ── Privacy sidebar button ───────────────────────────────────────────────── */
.privacy-sidebar-btn {
  width: 100%;
  padding: 7px 10px;
  background: rgba(255,255,255,0.08);
  color: var(--color-sidebar-text);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
}
.privacy-sidebar-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }

/* ── Privacy panel ────────────────────────────────────────────────────────── */
#privacy-panel {
  flex: 1;
  overflow-y: auto;
  padding: 32px 24px;
}

.privacy-container { max-width: 960px; margin: 0 auto; }

.privacy-header {
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--color-border);
}

.privacy-header h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 12px; }

.privacy-notice {
  background: #fef9ec;
  border: 1px solid #fcd34d;
  border-left: 4px solid #f59e0b;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #92400e;
  line-height: 1.5;
}

.privacy-section { margin-bottom: 36px; }
.privacy-section h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; }

.privacy-section-desc {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.privacy-empty {
  font-size: 0.87rem;
  color: var(--color-muted);
  font-style: italic;
  padding: 12px 0;
}

/* ── Permission grid table ────────────────────────────────────────────────── */
.permissions-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.permissions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  background: var(--color-surface);
}

.permissions-table thead tr:first-child th {
  padding: 10px 12px;
  background: #f0f0f8;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  text-align: left;
}

.permissions-table .page-header-row th {
  padding: 6px 4px;
  background: #f8f8fc;
  border-bottom: 2px solid var(--color-border);
  text-align: center;
}

.hide-group-header {
  text-align: center !important;
  border-left: 2px solid var(--color-border);
  color: #555 !important;
  font-size: 0.72rem !important;
  font-style: italic;
}

.page-col-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  line-height: 1;
  height: 72px;
  cursor: default;
}

/* Data rows */
.grant-row td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.grant-row:last-child td { border-bottom: none; }
.grant-row:hover td { background: #fafafe; }

.grant-row.row-no-access td { color: var(--color-muted); background: #fafafa; }

.person-col { min-width: 140px; padding-left: 14px !important; }
.access-col { min-width: 110px; }
.page-col   { width: 46px; text-align: center; border-left: 1px solid var(--color-border); }
.action-col { width: 70px; text-align: right; padding-right: 10px !important; }

.page-check-cell {
  text-align: center;
  border-left: 1px solid var(--color-border);
}

.page-check-cell input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--color-accent);
}

.cell-na { background: #f5f5f5; }
.na-label { font-size: 0.7rem; color: #bbb; }

.grant-name { font-weight: 600; font-size: 0.88rem; }

.access-select {
  padding: 4px 6px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: var(--font);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  width: 100%;
}

.access-select:focus { outline: none; border-color: var(--color-accent); }

.revoke-btn-sm {
  padding: 4px 8px;
  background: #fff;
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  font-size: 0.72rem;
  color: #dc2626;
  cursor: pointer;
  white-space: nowrap;
}

.revoke-btn-sm:hover { background: #fee2e2; border-color: #dc2626; }

/* Save row */
.save-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.save-changes-btn {
  padding: 7px 18px;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.85rem;
  cursor: pointer;
  font-family: var(--font);
}

.save-changes-btn:hover { background: var(--color-accent-hover); }

.save-confirm {
  font-size: 0.85rem;
  color: #16a34a;
  font-weight: 600;
}

/* ── Grant form ───────────────────────────────────────────────────────────── */
.grant-form-inline {
  max-width: 400px;
  position: relative;
}

.grant-form-inline input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-family: var(--font);
  background: var(--color-surface);
  color: var(--color-text);
}

.grant-form-inline input:focus { outline: none; border-color: var(--color-accent); }

.grant-results {
  margin-top: 4px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  overflow: hidden;
}

.grant-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
}

.grant-result-item:last-child { border-bottom: none; }
.grant-result-item:hover { background: var(--color-bg); }

.grant-result-name { font-size: 0.88rem; font-weight: 500; }

.grant-result-empty {
  padding: 10px 14px;
  font-size: 0.84rem;
  color: var(--color-muted);
  font-style: italic;
}

.grant-btn {
  padding: 5px 12px;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.78rem;
  cursor: pointer;
  flex-shrink: 0;
}

.grant-btn:hover { background: var(--color-accent-hover); }

/* ── Activity log ─────────────────────────────────────────────────────────── */
.access-log-list {
  list-style: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.log-item {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 0.83rem;
}

.log-item:last-child { border-bottom: none; }

.log-who { font-weight: 600; }
.log-action { color: var(--color-text); }
.log-time { color: var(--color-muted); white-space: nowrap; font-size: 0.75rem; }

/* ── scp-field (read-only display in Groove) ──────────────────────────────── */
.scp-field-ro {
  border-left: 3px solid var(--color-accent);
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  background: var(--color-surface);
  border-radius: 0 4px 4px 0;
}
.scp-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text);
  margin-bottom: 0.2rem;
}
.scp-hint {
  font-size: 0.78rem;
  color: var(--color-muted);
  margin-bottom: 0.35rem;
}
.scp-widget-ro {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.25rem;
}
.scp-value-pill {
  display: inline-block;
  background: #eef0fd;
  color: var(--color-accent);
  border-radius: 99px;
  padding: 0.15rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 500;
}
.scp-value-pill.scp-yes { background: #dcfce7; color: #166534; }
.scp-value-pill.scp-no  { background: #f3f4f6; color: var(--color-muted); }
.scp-value-empty { font-size: 0.85rem; color: var(--color-muted); font-style: italic; }
.scp-value-text {
  font-size: 0.9rem;
  color: var(--color-text);
  line-height: 1.45;
  white-space: pre-wrap;
}
.scp-comments-ro {
  margin-top: 0.4rem;
  font-size: 0.82rem;
  color: var(--color-muted);
}
.scp-comments-label { font-weight: 600; }

/* ── Utilities ────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.loading { color: var(--color-muted); font-style: italic; padding: 20px; text-align: center; }
.error-msg { color: #dc2626; font-size: 0.85rem; padding: 8px; }
