body {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: rgba(var(--c), 0.8);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── App shell: fixed sidebar + content column ── */

.shell { display: flex; min-height: 100vh; }
.shell-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

main { flex: 1; padding: 1.5rem 2rem; display: flex; flex-direction: column; min-height: 0; }
#app { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ── Sidebar (primary nav) ── */

.sidebar {
  flex: 0 0 var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--surface-alt);
  border-right: 1px solid var(--border);
  padding: 1.125rem 0.75rem;
}
.sidebar-logo { padding: 0 0.5rem; margin-bottom: 1.25rem; }
.sidebar-logo a {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 500;
  color: rgba(var(--c), 0.78);
  text-decoration: none;
  font-size: 0.875rem;
  letter-spacing: -0.01em;
  transition: opacity 0.15s ease-in;
}
.sidebar-logo a:hover { opacity: 0.6; }
.sidebar-nav { display: flex; flex-direction: column; gap: 0.0625rem; }
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.55);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0.375rem 0.5rem;
  border-radius: 4px;
  transition: background 0.1s ease-in, color 0.1s ease-in;
}
.sidebar-nav-item svg { flex-shrink: 0; opacity: 0.75; }
.sidebar-nav-item:hover { background: rgba(var(--c), 0.05); color: rgba(var(--c), 0.85); }
.sidebar-nav-kbd {
  margin-left: auto;
  font-family: 'GT America Mono', ui-monospace, SFMono-Regular, monospace;
  font-size: 0.625rem;
  color: rgba(var(--c), 0.3);
  border: 1px solid rgba(var(--c), 0.12);
  border-radius: 4px;
  padding: 0 0.3rem;
  line-height: 1.4;
}
/* ── Pinned shortcuts ── */

.sidebar-shortcuts {
  display: flex;
  flex-direction: column;
  gap: 0.0625rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(var(--c), 0.06);
}
.sidebar-shortcut-item { position: relative; }
.sidebar-shortcut-item.grabbing { cursor: grabbing; }
.sidebar-shortcut-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  flex-shrink: 0;
  opacity: 0.75;
}
.sidebar-shortcut-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-shortcut-item.dragging { opacity: 0.3; }
.sidebar-shortcut-item.drag-over-above { box-shadow: inset 0 2px 0 rgba(var(--accent), 0.5); }
.sidebar-shortcut-item.drag-over-below { box-shadow: inset 0 -2px 0 rgba(var(--accent), 0.5); }

/* ── Shortcut toggle (pin/unpin the current item) ── */

.shortcut-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 4px;
  color: rgba(var(--c), 0.3);
  cursor: pointer;
  transition: color 0.15s ease-in, background 0.15s ease-in;
}
.shortcut-toggle:hover { color: rgba(var(--c), 0.6); background: rgba(var(--c), 0.05); }
.shortcut-toggle.active { color: rgba(var(--accent), 0.85); }
.shortcut-toggle.active:hover { color: rgba(var(--accent), 1); }

.sidebar-spacer { flex: 1; }
/* Bottom pad closes the gap between .sidebar's 1.125rem pad and the footer's
   1.5rem, so the user button baseline matches the copyright line. */
.sidebar-user { position: relative; padding: 0.25rem 0.5rem 0.375rem; }
.sidebar-user-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: rgba(var(--c), 0.45);
  cursor: pointer;
  transition: color 0.1s ease-in;
}
.sidebar-user-btn:hover { color: rgba(var(--c), 0.75); }
.sidebar-user-btn svg { flex-shrink: 0; opacity: 0.7; }
.sidebar-user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Top bar (breadcrumb + search) ── */

.nav {
  display: flex;
  align-items: center;
  padding: 0.625rem 1.5rem;
  gap: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.nav-breadcrumb {
  flex: 1;
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.35);
  position: relative;
  top: 1px;
}
.nav-breadcrumb a {
  color: rgba(var(--c), 0.45);
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--c), 0.08);
  transition: color 0.15s ease-in;
}
.nav-breadcrumb a:hover { color: rgba(var(--c), 0.7); }
.nav-breadcrumb .sep { margin: 0 0.375rem; color: rgba(var(--c), 0.15); }
footer {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 12px; /* opt out of the global scale — stays small */
  color: rgba(var(--c), 0.35);
  padding: 0 2rem 1.5rem;
}

/* ── Forms ── */

select, input[type="text"] {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8125rem;
  padding: 0.25rem 0.375rem;
  border: 1px solid rgba(var(--c), 0.1);
  border-radius: 4px;
  background: rgba(var(--c), 0.03);
  color: rgba(var(--c), 0.8);
  outline: none;
  transition: border-color 0.15s ease-in;
}
select:focus, input[type="text"]:focus { border-color: rgba(var(--c), 0.3); }
select option { background: var(--bg); }
input[type="text"]::placeholder { color: rgba(var(--c), 0.3); }

button {
  font-family: inherit;
  font-size: 0.75rem;
  border: none; background: none; padding: 0;
  color: rgba(var(--c), 0.4);
  cursor: pointer;
  transition: color 0.15s ease-in;
}
button:hover { color: rgba(var(--c), 0.5); }

/* ── Grid header ── */

.grid-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.grid-title {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 500;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  color: rgba(var(--c), 0.85);
}

.grid-source {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.35);
}
.grid-meta a {
  color: rgba(var(--c), 0.55);
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--c), 0.15);
  transition: color 0.15s ease-in;
}
.grid-meta a:hover { color: rgba(var(--c), 0.8); }
.grid-meta-time { cursor: help; }
.grid-type-link {
  color: rgba(var(--c), 0.7);
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--c), 0.15);
  transition: color 0.15s ease-in;
}
.grid-type-link:hover { color: rgba(var(--c), 0.9); }

.grid-header-left { display: flex; align-items: baseline; gap: 0.5rem; }

.grid-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: rgba(var(--c), 0.3);
  cursor: pointer;
  user-select: none;
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(var(--c), 0.08);
  border-radius: 4px;
  transition: all 0.15s ease-in;
}
.filter-btn:hover { color: rgba(var(--c), 0.5); border-color: rgba(var(--c), 0.25); }
.filter-btn.active { color: rgba(var(--accent), 0.6); border-color: rgba(var(--accent), 0.15); }
.filter-badge {
  font-size: 0.625rem;
  background: rgba(var(--accent), 0.12);
  color: rgba(var(--accent), 0.7);
  padding: 0 0.3rem;
  border-radius: 4px;
  min-width: 1rem;
  text-align: center;
}

.table-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  margin-top: 0.375rem;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.pagination button {
  font-size: 0.8125rem;
  padding: 0.125rem 0.375rem;
  color: rgba(var(--c), 0.3);
}
.pagination button:disabled { color: rgba(var(--c), 0.08); cursor: default; }
.pagination button:not(:disabled):hover { color: rgba(var(--c), 0.6); }
.page-info {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.3);
  padding: 0 0.25rem;
}

.status {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.3);
}

/* ── Filter drawer (RHS overlay) ── */

.filter-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 22rem;
  max-width: 80vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  z-index: 50;
  padding: 2rem 1.5rem;
  transform: translateX(100%);
  transition: transform 0.2s ease-in-out;
  overflow-y: auto;
}
.filter-drawer.open { transform: translateX(0); }

.filter-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.filter-drawer-title {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.filter-drawer-close {
  font-size: 1.125rem;
  color: rgba(var(--c), 0.35);
  line-height: 1;
}
.filter-drawer-close:hover { color: rgba(var(--c), 0.5); }

/* filter condition card */
.filter-card {
  border: 1px solid rgba(var(--c), 0.06);
  border-radius: 4px;
  padding: 0.5rem 0.625rem;
  margin-bottom: 0.5rem;
}

.filter-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.375rem;
  position: relative;
}

.filter-field-btn {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.7);
  cursor: pointer;
  transition: color 0.15s ease-in;
}
.filter-field-btn:hover { color: rgba(var(--c), 0.9); }

.filter-x { font-size: 1rem; padding: 0 0.125rem; line-height: 1; color: rgba(var(--c), 0.12); flex-shrink: 0; }
.filter-x:hover { color: rgba(255, 80, 80, 0.5); }

.filter-card-bottom {
  display: flex;
  gap: 0.375rem;
  align-items: center;
}
/* Reference/enum filter value picker — bordered box matching the text input,
   with the borderless .ref-input typeahead inside. */
.filter-ref {
  flex: 1;
  min-width: 4rem;
  display: flex;
  align-items: center;
  border: 1px solid rgba(var(--c), 0.1);
  border-radius: 4px;
  background: rgba(var(--c), 0.03);
  padding: 0.125rem 0.375rem;
}
.filter-ref:focus-within { border-color: rgba(var(--c), 0.3); }
.filter-card-bottom select { flex: 0 0 auto; }
.filter-card-bottom input[type="text"] { flex: 1; min-width: 0; }

.filter-conj-label {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.25);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  padding: 0.25rem 0;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.conj-toggle { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.05em; user-select: none; margin-left: auto; }
.conj-opt { cursor: pointer; transition: color 0.15s ease-in; }
.conj-opt.on { color: rgba(var(--c), 0.4); }
.conj-opt.off { color: rgba(var(--c), 0.1); }
.conj-opt:hover { color: rgba(var(--c), 0.55); }
.conj-sep { color: rgba(var(--c), 0.06); margin: 0 0.1875rem; }

.filter-error {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.75rem;
  color: rgba(255, 80, 80, 0.6);
  margin-top: 0.375rem;
  min-height: 1rem;
}

/* drawer sections */
.drawer-section { margin-bottom: 1.5rem; }
.drawer-section-label {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

/* grid description in drawer */
.grid-desc-input {
  width: 100%;
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8125rem;
  padding: 0.375rem 0.5rem;
  border: 1px solid rgba(var(--c), 0.1);
  border-radius: 4px;
  background: rgba(var(--c), 0.03);
  color: rgba(var(--c), 0.8);
  outline: none;
  resize: vertical;
  min-height: 3rem;
  transition: border-color 0.15s ease-in;
}
.grid-desc-input:focus { border-color: rgba(var(--c), 0.3); }
.grid-desc-input::placeholder { color: rgba(var(--c), 0.25); }

/* grid delete button in drawer */
.grid-delete-btn {
  font-family: inherit;
  font-size: 0.75rem;
  color: rgba(255, 80, 80, 0.5);
  cursor: pointer;
  padding: 0.375rem 0.625rem;
  border: 1px solid rgba(255, 80, 80, 0.15);
  border-radius: 4px;
  background: transparent;
  transition: all 0.15s ease-in;
}
.grid-delete-btn:hover { color: rgba(255, 80, 80, 0.7); border-color: rgba(255, 80, 80, 0.3); }

/* sort */
.sort-card {
  display: flex;
  gap: 0.375rem;
  align-items: center;
  margin-bottom: 0.375rem;
}
.sort-field-btn {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.7);
  cursor: pointer;
  flex: 1;
  text-align: left;
}
.sort-field-btn:hover { color: rgba(var(--c), 0.9); }
.sort-dir {
  font-family: inherit;
  font-size: 0.75rem;
  color: rgba(var(--c), 0.35);
  cursor: pointer;
  padding: 0.125rem 0.375rem;
  border: 1px solid rgba(var(--c), 0.08);
  border-radius: 4px;
  transition: all 0.15s ease-in;
  user-select: none;
}
.sort-dir:hover { color: rgba(var(--c), 0.55); border-color: rgba(var(--c), 0.25); }

/* group */
.group-picker {
  display: flex;
  gap: 0.375rem;
  align-items: center;
  margin-bottom: 0.375rem;
}
.group-picker label {
  font-size: 0.75rem;
  color: rgba(var(--c), 0.4);
  min-width: 5rem;
}
.group-picker select {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.7);
  background: transparent;
  border: 1px solid rgba(var(--c), 0.08);
  border-radius: 4px;
  padding: 0.125rem 0.375rem;
  flex: 1;
  cursor: pointer;
}
.group-header td {
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.85);
  padding: 0.5rem 0.75rem;
  background: rgba(var(--c), 0.03);
  border-bottom: 1px solid rgba(var(--c), 0.06);
  cursor: pointer;
  user-select: none;
}
.subgroup-header td {
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.7);
  padding: 0.375rem 0.75rem 0.375rem 2rem;
  background: rgba(var(--c), 0.015);
  border-bottom: 1px solid rgba(var(--c), 0.04);
  cursor: pointer;
  user-select: none;
}
.group-toggle, .subgroup-toggle {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.75rem;
  margin-right: 0.5rem;
  display: inline-block;
  width: 1em;
}
.group-count, .subgroup-count {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.3);
  margin-left: 0.5rem;
}
.group-header-right {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  line-height: calc(0.8125rem * 1.5);
}
.group-header-right button {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.3);
  cursor: pointer;
  padding: 0 0.25rem;
  border: none;
  background: none;
}
.group-header-right button:hover { color: rgba(var(--c), 0.6); }
.group-header-right button:disabled { opacity: 0.3; cursor: default; }
.group-header-right .page-info {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.3);
}

/* ── Table ── */

.table-scroll {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; }
tbody tr:last-child td { border-bottom: none; }

th {
  text-align: left;
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-weight: normal;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(var(--c), 0.4);
  padding: 0.3125rem 0.625rem;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8125rem;
  padding: 0.3125rem 0.625rem;
  border-bottom: 1px solid rgba(var(--c), 0.05);
  color: rgba(var(--c), 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 24rem;
}

th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num, td.sys { font-family: 'GT America Mono', ui-monospace, SFMono-Regular, monospace; }
tbody tr { transition: background 0.08s ease-in; }
tbody tr:hover td { background: rgba(var(--c), 0.015); }
td.col-hover { background: rgba(var(--c), 0.015); }
tbody tr:hover td.col-hover { background: rgba(var(--c), 0.04); }

th.col-h { position: relative; user-select: none; cursor: grab; }
th.col-h:active { cursor: grabbing; }
th.col-h .col-menu-btn {
  opacity: 0;
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.4);
  margin-left: 0.375rem;
  vertical-align: middle;
  transition: opacity 0.12s ease-in;
  cursor: pointer;
  position: relative;
  top: -0.5px;
}
th.col-h:hover .col-menu-btn { opacity: 1; }
th.col-h .col-menu-btn:hover { color: rgba(var(--c), 0.5); }

th.col-h.dragging { opacity: 0.25; }
th.col-h.drag-before { box-shadow: inset 2px 0 0 rgba(var(--accent), 0.45); }
th.col-h.drag-after { box-shadow: inset -2px 0 0 rgba(var(--accent), 0.45); }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; }

th.col-add { width: 2rem; text-align: center; cursor: default; }
th.col-add button { font-size: 0.875rem; color: rgba(var(--c), 0.25); }
th.col-add button:hover { color: rgba(var(--c), 0.4); }
td.col-add { width: 2rem; }

/* ── Dropdown ── */

.dropdown {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  z-index: 100;
  min-width: 9rem;
  transform-origin: top;
  animation: dropdown-in 0.11s ease-out;
}
@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .dropdown, .col-browser-col.col-enter, .search-modal { animation: none; }
}
.dropdown-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.375rem 0.75rem;
  font-family: inherit;
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.6);
  cursor: pointer;
  transition: background 0.08s;
  white-space: nowrap;
}
.dropdown-item:hover { background: rgba(var(--c), 0.05); }
.dropdown-item .dim { font-size: 0.6875rem; color: rgba(var(--c), 0.3); margin-left: 1rem; }
.dropdown-item.danger { color: rgba(255, 80, 80, 0.55); }
.dropdown-item.danger:hover { background: rgba(255, 80, 80, 0.06); }
.dropdown-divider { border-bottom: 1px solid rgba(var(--c), 0.06); margin: 0; }
.dropdown-label { padding: 0.35rem 1rem 0.15rem; font-size: 10.4px; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.4; pointer-events: none; }
.dropdown-rich { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 1rem; cursor: pointer; transition: background 0.08s; }
.dropdown-rich:hover { background: rgba(var(--c), 0.05); }
.dropdown-rich .icon { flex-shrink: 0; color: rgba(var(--c), 0.35); display: flex; align-items: center; }
.dropdown-rich .text { display: flex; flex-direction: column; gap: 0.1rem; }
.dropdown-rich .text .name { font-size: 13px; color: rgba(var(--c), 0.7); }
.dropdown-rich .text .desc { font-size: 11px; color: rgba(var(--c), 0.35); line-height: 1.3; }
.new-menu-col { flex: 1; min-width: 0; padding: 0.25rem 0; overflow-y: auto; overscroll-behavior: contain; }
.new-menu-col-domain { border-left: 1px solid rgba(var(--c), 0.06); }
.dropdown-search { padding: 0.375rem; border-bottom: 1px solid rgba(var(--c), 0.06); }
.dropdown-search input { width: 100%; }
.dropdown-list { max-height: 16rem; overflow-y: auto; }

/* ── Context menu ── */

.context-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid rgba(var(--c), 0.12);
  border-radius: 4px;
  z-index: 110;
  min-width: 10rem;
  padding: 0.25rem 0;
}
.context-menu-item {
  display: block;
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-family: inherit;
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.6);
  cursor: pointer;
  transition: background 0.08s;
  white-space: nowrap;
  text-align: left;
  border: none;
  background: none;
}
.context-menu-item:hover { background: rgba(var(--c), 0.05); }
.context-menu-item.danger { color: rgba(255, 80, 80, 0.55); }
.context-menu-item.danger:hover { background: rgba(255, 80, 80, 0.06); }
.context-menu-divider { border-bottom: 1px solid rgba(var(--c), 0.06); margin: 0.25rem 0; }

.empty {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  color: rgba(var(--c), 0.3);
  font-size: 0.8125rem;
  padding: 2rem 0;
}

/* ── Breadcrumb ── */

.breadcrumb {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.75rem;
  color: rgba(var(--c), 0.4);
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}
.breadcrumb a {
  color: rgba(var(--c), 0.35);
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--c), 0.08);
  transition: color 0.15s ease-in;
}
.breadcrumb a:hover { color: rgba(var(--c), 0.6); }
.breadcrumb .sep { margin: 0 0.375rem; color: rgba(var(--c), 0.12); }

/* ── Home page ── */

.home-section { margin-top: 2rem; }
.home-section-title {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}
.type-list { list-style: none; }
.type-list li { margin-bottom: 0.375rem; }
.type-link, .grid-link {
  color: rgba(var(--c), 0.6);
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--c), 0.06);
  transition: color 0.15s ease-in;
  font-size: 0.875rem;
}
.type-link:hover, .grid-link:hover { color: rgba(var(--c), 0.85); }
.type-count {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.25);
  margin-left: 0.5rem;
}

/* ── Column browser (Finder-style) ── */

.col-browser {
  display: flex;
  flex: 1;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.col-browser-col {
  min-width: 14rem;
  max-width: 20rem;
  flex: 0 0 14rem;
  border-right: 1px solid rgba(var(--c), 0.06);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.col-browser-col:last-child { border-right: none; }
.col-browser-col.drop-target { background: rgba(var(--accent), 0.04); }
.col-browser-col.col-enter { animation: col-enter-in 0.16s ease-out; }
@keyframes col-enter-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.625rem;
  border-bottom: 1px solid rgba(var(--c), 0.06);
  flex-shrink: 0;
}
.col-header-name {
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.45);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease-in;
}
.col-header-name:hover { color: rgba(var(--c), 0.7); }
.col-header-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}
.col-header-btn {
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.25);
  padding: 0 0.125rem;
  line-height: 1;
}
.col-header-btn:hover { color: rgba(var(--c), 0.5); }

.col-items { flex: 1; padding: 0.25rem 0; }

.col-item {
  display: flex;
  align-items: center;
  padding: 0.3125rem 0.625rem;
  cursor: default;
  user-select: none;
  transition: background 0.06s;
  gap: 0.375rem;
}
.col-item:hover { background: rgba(var(--c), 0.03); }
.col-item.selected { background: rgba(var(--accent), 0.08); }
.col-item.drag-over-above { box-shadow: inset 0 2px 0 rgba(var(--accent), 0.4); }
.col-item.drag-over-on { background: rgba(var(--accent), 0.12); }
.col-item.drag-over-below { box-shadow: inset 0 -2px 0 rgba(var(--accent), 0.4); }
.col-item.dragging { opacity: 0.3; }

.col-item-icon {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.2);
  flex-shrink: 0;
  width: 0.875rem;
  text-align: center;
}
.col-item-name {
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.col-item.selected .col-item-name { color: rgba(var(--c), 0.9); }
.col-item-arrow {
  font-size: 0.625rem;
  color: rgba(var(--c), 0.15);
  flex-shrink: 0;
}
.col-item.selected .col-item-arrow { color: rgba(var(--c), 0.35); }
.col-item-go {
  font-size: 0.75rem;
  color: rgba(var(--c), 0.15);
  text-decoration: none;
  flex-shrink: 0;
  cursor: pointer;
  transition: color 0.12s ease-in;
  padding: 0 0.125rem;
}
.col-item:hover .col-item-go { color: rgba(var(--c), 0.35); }
.col-item-go:hover { color: rgba(var(--c), 0.6) !important; }

.col-rename-input {
  font-family: inherit;
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.8);
  background: rgba(var(--c), 0.04);
  border: 1px solid rgba(var(--c), 0.15);
  border-radius: 4px;
  padding: 0 0.25rem;
  outline: none;
  flex: 1;
  min-width: 0;
}
.col-rename-input:focus { border-color: rgba(var(--c), 0.3); }

.col-empty {
  font-size: 0.75rem;
  color: rgba(var(--c), 0.2);
  padding: 0.3125rem 0.625rem;
}

.folder-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 0;
  margin-bottom: 0.75rem;
}
.folder-title {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 500;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  color: rgba(var(--c), 0.85);
}

.folder-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.folder-actions button {
  font-family: inherit;
  font-size: 0.75rem;
  color: rgba(var(--c), 0.4);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(var(--c), 0.1);
  border-radius: 4px;
  background: transparent;
  transition: all 0.15s ease-in;
}
.folder-actions button:hover { color: rgba(var(--c), 0.65); border-color: rgba(var(--c), 0.2); }
.folder-icon, .grid-icon {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.25);
  margin-right: 0.375rem;
}
.grid-target {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.3);
  margin-left: 0.5rem;
}

/* ── Entity detail ── */

.entity-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 0;
  margin-bottom: 1.25rem;
}
.entity-header .entity-display {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 500;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  color: rgba(var(--c), 0.85);
}
.entity-header .entity-meta {
  font-family: 'GT America Mono', ui-monospace, SFMono-Regular, monospace;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.4);
}

.entity-detail {
  max-width: 40rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.field-row {
  display: flex;
  padding: 0.5rem 0.875rem;
  border-bottom: 1px solid rgba(var(--c), 0.05);
}
.field-row:last-child { border-bottom: none; }
.field-label {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(var(--c), 0.4);
  width: 10rem;
  flex-shrink: 0;
  padding-top: 0.1875rem;
}
.field-label-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease-in, border-color 0.15s ease-in;
}
.field-label-link:hover {
  color: rgba(var(--c), 0.7);
  border-bottom-color: rgba(var(--c), 0.25);
}
.field-value {
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.8);
  word-break: break-word;
}
.field-value a {
  color: rgba(var(--accent), 0.55);
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--accent), 0.15);
  transition: color 0.15s ease-in;
}
.field-value a:hover { color: rgba(var(--accent), 0.8); }

.row-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: rgba(var(--c), 0.12);
  text-decoration: none;
  font-size: 0.75rem;
  transition: color 0.15s ease-in;
}
.row-link:hover { color: rgba(var(--c), 0.5); }
td.sys-toggle-col { padding: 0; }
td.sys-toggle-col .row-link { padding: 0.375rem 0.25rem; }
td[data-col] { cursor: pointer; position: relative; overflow: hidden; }
td[data-col] a {
  color: rgba(var(--accent), 0.55);
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--accent), 0.15);
  transition: color 0.15s ease-in;
}
td[data-col] a:hover { color: rgba(var(--accent), 0.8); }
td[data-col] .cell-history {
  position: absolute;
  bottom: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 0 0 0;
  border-color: transparent transparent rgba(var(--c), 0.08) transparent;
  cursor: pointer;
  transition: border-width 0.1s ease-out, border-color 0.1s ease-out;
}
td[data-col]:hover .cell-history {
  border-width: 0 0 8px 8px;
  border-color: transparent transparent rgba(var(--c), 0.15) transparent;
}
td[data-col] .cell-history:hover {
  border-width: 0 0 12px 12px;
  border-color: transparent transparent rgba(var(--c), 0.25) transparent;
}
td[data-col].editing {
  padding: 0;
  overflow: visible;
}
td[data-col].editing input,
td[data-col].editing select,
td[data-col].editing textarea {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8125rem;
  width: 100%;
  height: 100%;
  padding: 0.375rem 0.75rem;
  border: none;
  border-bottom: 2px solid rgba(var(--accent), 0.4);
  background: rgba(var(--accent), 0.04);
  color: rgba(var(--c), 0.8);
  outline: none;
  box-sizing: border-box;
}

/* ── Reference editor ── */

.ref-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  min-height: 1.75rem;
  border-bottom: 2px solid rgba(var(--accent), 0.4);
  background: rgba(var(--accent), 0.04);
}
.ref-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.75rem;
  color: rgba(var(--c), 0.7);
  background: rgba(var(--c), 0.06);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  white-space: nowrap;
}
.ref-pill-x {
  font-size: 0.875rem;
  color: rgba(var(--c), 0.25);
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.ref-pill-x:hover { color: rgba(255, 80, 80, 0.5); }
.ref-input {
  flex: 1;
  min-width: 4rem;
  border: none !important;
  background: none !important;
  padding: 0.125rem 0 !important;
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.8);
  outline: none;
}
.ref-input::placeholder { color: rgba(var(--c), 0.25); }
.ref-results {
  position: fixed;
  background: var(--surface);
  border: 1px solid rgba(var(--c), 0.12);
  border-top: none;
  border-radius: 0 0 2px 2px;
  z-index: 100;
  max-height: 12rem;
  overflow-y: auto;
}
.ref-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0.75rem;
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.6);
  cursor: pointer;
  transition: background 0.08s;
  white-space: nowrap;
}
.ref-result-item:hover { background: rgba(var(--c), 0.05); }
.ref-result-item .dim { font-size: 0.6875rem; color: rgba(var(--c), 0.3); margin-left: 1rem; }

/* ── System columns toggle ── */

.sys-toggle {
  font-size: 0.75rem;
  color: rgba(var(--c), 0.3);
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease-in;
}
.sys-toggle:hover { color: rgba(var(--c), 0.45); }
th.sys-toggle-col, td.sys-toggle-col { width: 1.5rem; padding: 0.375rem 0.25rem; text-align: center; }
td.sys { color: rgba(var(--c), 0.3); }

/* ── History popup ── */

.history-popup {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  z-index: 100;
  min-width: 14rem;
  max-width: 24rem;
  max-height: 20rem;
  overflow-y: auto;
  padding: 0.5rem 0;
}
.history-popup-header {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.75rem 0.5rem;
  border-bottom: 1px solid rgba(var(--c), 0.06);
}
.history-entry {
  padding: 0.375rem 0.75rem;
  border-bottom: 1px solid rgba(var(--c), 0.03);
}
.history-entry:last-child { border-bottom: none; }
.history-value {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.65);
  word-break: break-word;
  white-space: normal;
}
.history-time {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.625rem;
  color: rgba(var(--c), 0.3);
  margin-top: 0.125rem;
}
.history-empty {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.3);
  padding: 0.5rem 0.75rem;
}

/* ── Form drawer ── */

.form-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 26rem;
  max-width: 85vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  z-index: 50;
  padding: 2rem 1.5rem;
  transform: translateX(100%);
  transition: transform 0.2s ease-in-out;
  overflow-y: auto;
}
.form-drawer.open { transform: translateX(0); }
.form-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.form-drawer-title {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8125rem;
  padding: 0.375rem 0.5rem;
  border: 1px solid rgba(var(--c), 0.1);
  border-radius: 4px;
  background: rgba(var(--c), 0.03);
  color: rgba(var(--c), 0.8);
  outline: none;
  transition: border-color 0.15s ease-in;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: rgba(var(--c), 0.3);
}
.form-group textarea { min-height: 4rem; resize: vertical; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.form-submit {
  font-size: 0.75rem;
  padding: 0.375rem 0.75rem;
  background: rgba(var(--accent), 0.15);
  color: rgba(var(--accent), 0.8);
  border: 1px solid rgba(var(--accent), 0.2);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease-in;
}
.form-submit:hover { background: rgba(var(--accent), 0.25); }
.form-cancel {
  font-size: 0.75rem;
  color: rgba(var(--c), 0.35);
  cursor: pointer;
}
.form-error {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.75rem;
  color: rgba(255, 80, 80, 0.6);
  margin-top: 0.5rem;
  min-height: 1rem;
}
.form-success {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.75rem;
  color: rgba(var(--accent), 0.7);
  margin-top: 0.5rem;
  min-height: 1rem;
}
.form-group-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.form-group-check label {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.form-group-check input[type="checkbox"] {
  accent-color: rgba(var(--accent), 0.7);
}

/* ── Attachment ── */

.attachment-wrap { display: flex; align-items: center; gap: 0.5rem; }
.attachment-file {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8125rem;
  color: rgba(var(--accent), 0.55);
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--accent), 0.15);
  transition: color 0.15s ease-in;
}
.attachment-file:hover { color: rgba(var(--accent), 0.8); }
.attachment-size {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.3);
}
.attachment-remove {
  font-size: 0.875rem;
  color: rgba(var(--c), 0.2);
  cursor: pointer;
  line-height: 1;
}
.attachment-remove:hover { color: rgba(255, 80, 80, 0.5); }
input[type="file"] {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.75rem;
  color: rgba(var(--c), 0.5);
}

/* ── Inline editing ── */

.field-value-display { display: inline-block; cursor: pointer; padding: 0.25rem 0.5rem; margin: -0.25rem -0.5rem; border-radius: 4px; transition: background 0.1s; }
.field-value-display:hover { background: rgba(var(--c), 0.04); }
.field-edit { display: flex; gap: 0.375rem; align-items: center; flex: 1; }
.field-edit input, .field-edit select, .field-edit textarea {
  flex: 1;
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8125rem;
  padding: 0.25rem 0.375rem;
  border: 1px solid rgba(var(--c), 0.15);
  border-radius: 4px;
  background: rgba(var(--c), 0.03);
  color: rgba(var(--c), 0.8);
  outline: none;
}
.field-edit textarea { min-height: 3rem; resize: vertical; }
.field-edit .fe-save { color: rgba(var(--accent), 0.7); font-size: 0.875rem; cursor: pointer; }
.field-edit .fe-cancel { color: rgba(var(--c), 0.3); font-size: 0.875rem; cursor: pointer; }

/* ── Delete / action buttons on detail ── */

.entity-actions { margin-top: 2rem; }
.btn-delete {
  font-family: inherit;
  font-size: 0.75rem;
  color: rgba(255, 80, 80, 0.5);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(255, 80, 80, 0.12);
  border-radius: 4px;
  transition: all 0.15s ease-in;
}
.btn-delete:hover { color: rgba(255, 80, 80, 0.8); border-color: rgba(255, 80, 80, 0.25); }

/* ── Spotlight search ── */

.search-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: var(--sidebar-w);
  background: rgba(20, 22, 26, 0.3);
  z-index: 300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
}
.search-modal {
  width: 100%;
  max-width: 34rem;
  max-height: 60vh;
  margin: 0 1rem;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: dropdown-in 0.16s ease-out;
}
/* The base form-input rule (`input[type="text"]`, in Forms above) outranks a
   single class selector on specificity alone, so its border/background/font
   would otherwise leak through — !important matches the .ref-input precedent
   used for the same conflict elsewhere. */
.search-modal-input {
  width: 100%;
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 1rem !important;
  padding: 0.875rem 1rem !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
  background: none !important;
  color: rgba(var(--c), 0.85) !important;
  outline: none;
  flex-shrink: 0;
}
.search-modal-input::placeholder { color: rgba(var(--c), 0.3); }
.search-modal-results { overflow-y: auto; min-height: 0; }
.search-result-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: background 0.08s;
  text-decoration: none;
  color: inherit;
}
.search-result-item:hover,
.search-result-item.active { background: rgba(var(--c), 0.05); }
.search-result-name {
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-type {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.625rem;
  color: rgba(var(--c), 0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.search-result-match {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.35);
  margin-left: auto;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 10rem;
}
.search-empty {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.75rem;
  color: rgba(var(--c), 0.3);
  padding: 1rem 0.75rem;
}

@media (max-width: 48em) {
  .sidebar { display: none; }
  .nav { padding: 0.75rem 1rem; }
  main { padding: 1rem; }
  footer { padding: 0 1rem 1rem; }
  .filter-drawer { width: 100%; max-width: 100%; }
  .form-drawer { width: 100%; max-width: 100%; }
  .field-label { width: 7rem; }
  .search-overlay { left: 0; }
}

/* ── Memo (markdown) cell + popup ── */
.memo-td { text-align: center; cursor: pointer; }
.memo-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  color: rgba(var(--c), 0.5);
  line-height: 0;
  transition: color 0.12s ease-in, background 0.12s ease-in;
}
.memo-open:hover, .memo-td:hover .memo-open {
  color: rgba(var(--accent), 0.9);
  background: rgba(var(--c), 0.05);
}
.memo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 24, 14, 0.35);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.memo-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 68rem;
  height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.memo-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.memo-header-left { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.memo-title {
  font-family: 'GT America', -apple-system, sans-serif;
  font-weight: 500;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
  color: rgba(var(--c), 0.75);
}
.memo-meta {
  font-family: 'GT America', -apple-system, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.4);
  min-height: 0.9rem;
}
.memo-meta a {
  color: rgba(var(--c), 0.55);
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--c), 0.15);
  transition: color 0.15s ease-in;
}
.memo-meta a:hover { color: rgba(var(--c), 0.8); }
.memo-meta-time { cursor: help; }
.memo-header-right { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.memo-x {
  font-size: 1.15rem;
  line-height: 1;
  color: rgba(var(--c), 0.38);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 0.15rem;
  transition: color 0.12s ease-in;
}
.memo-x:hover { color: rgba(var(--c), 0.75); }
.memo-content { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.memo-outline {
  flex-shrink: 0;
  width: 14.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem 0.75rem;
  opacity: 1;
  border-right: 1px solid var(--border);
  transition: width 0.16s ease, padding 0.16s ease, opacity 0.12s ease-in;
}
.memo-outline.collapsed {
  width: 0;
  padding-left: 0;
  padding-right: 0;
  opacity: 0;
}
.memo-sidebar-label {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.35);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 0.5rem;
  margin-bottom: 0.5rem;
}
.memo-outline-item {
  display: block;
  font-family: 'GT America', -apple-system, sans-serif;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: rgba(var(--c), 0.5);
  text-decoration: none;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  transition: color 0.15s ease-in, background 0.15s ease-in;
}
.memo-outline-item:hover { color: rgba(var(--c), 0.85); background: rgba(var(--c), 0.05); }
.memo-outline-item.lvl-2 { padding-left: 1.25rem; }
.memo-outline-item.lvl-3 { padding-left: 2rem; }
.memo-outline-toggle {
  flex-shrink: 0;
  width: 0.875rem;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: rgba(var(--c), 0.2);
  font-size: 0.625rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease-in, background 0.15s ease-in;
}
.memo-outline-toggle:not(:disabled):hover { color: rgba(var(--c), 0.6); background: rgba(var(--c), 0.04); }
.memo-outline-toggle:disabled, .memo-tags-toggle:disabled { cursor: default; opacity: 0.4; }
.memo-tags-toggle {
  flex-shrink: 0;
  width: 0.875rem;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: rgba(var(--c), 0.2);
  font-size: 0.625rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease-in, background 0.15s ease-in;
}
.memo-tags-toggle:not(:disabled):hover { color: rgba(var(--c), 0.6); background: rgba(var(--c), 0.04); }
.memo-tags {
  flex-shrink: 0;
  width: 14.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem 0.75rem;
  opacity: 1;
  border-left: 1px solid var(--border);
  transition: width 0.16s ease, padding 0.16s ease, opacity 0.12s ease-in;
}
.memo-tags.collapsed {
  width: 0;
  padding-left: 0;
  padding-right: 0;
  opacity: 0;
}
.memo-tag-row { display: flex; align-items: center; gap: 0.125rem; }
.memo-tag-item {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-family: 'GT America', -apple-system, sans-serif;
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.5);
  text-decoration: none;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  transition: color 0.15s ease-in, background 0.15s ease-in;
}
.memo-tag-item:hover { color: rgba(var(--c), 0.85); background: rgba(var(--c), 0.05); }
.memo-tag-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.memo-tag-count {
  flex-shrink: 0;
  font-family: 'GT America Mono', ui-monospace, SFMono-Regular, monospace;
  font-size: 0.625rem;
  color: rgba(var(--c), 0.4);
  background: rgba(var(--c), 0.07);
  border-radius: 999px;
  padding: 0.05rem 0.35rem;
}
.memo-tag-open {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 4px;
  color: rgba(var(--c), 0.25);
  text-decoration: none;
  font-size: 0.75rem;
  transition: color 0.15s ease-in, background 0.15s ease-in;
}
.memo-tag-open:hover { color: rgba(var(--accent), 0.9); background: rgba(var(--c), 0.05); }
.memo-empty { opacity: 0.4; font-family: 'GT America', -apple-system, sans-serif; }
.memo-body {
  flex: 1;
  min-width: 0;
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.85rem;
  color: rgba(var(--c), 0.82);
  line-height: 1.6;
  padding: 1.5rem 1.75rem;
  overflow-y: auto;
}
.memo-body > *:first-child { margin-top: 0; }
.memo-body h1, .memo-body h2, .memo-body h3, .memo-body h4 {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.35;
  color: rgba(var(--c), 0.9);
}
.memo-body h1 { font-size: 1.4rem; font-weight: 600; margin: 0 0 0.75rem; }
.memo-body h2 { font-size: 1.1rem; font-weight: 600; margin: 2.25rem 0 0.75rem; }
.memo-body h3 { font-size: 0.95rem; font-weight: 400; margin: 2rem 0 0.6rem; }
.memo-body h4 { font-size: 0.85rem; font-weight: 600; margin: 1.75rem 0 0.5rem; }
.memo-body p { margin: 0 0 1.1rem; }
.memo-body ul, .memo-body ol { margin: 0 0 1.1rem 1.5rem; }
.memo-body li { margin: 0.3rem 0; }
.memo-body a { color: rgba(var(--accent), 0.9); border-bottom: 1px solid rgba(var(--accent), 0.25); text-decoration: none; }
.memo-body a.entity-tag-link { border-bottom-style: dotted; }
.memo-body img { max-width: 100%; height: auto; border-radius: 4px; }
.memo-body code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.85em;
  background: rgba(var(--c), 0.05);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.memo-body pre {
  background: rgba(var(--c), 0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  margin: 0.75rem 0;
}
.memo-body pre code { background: none; padding: 0; font-size: 0.8125rem; }
.memo-body blockquote {
  margin: 0.75rem 0;
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: 2px solid rgba(var(--c), 0.15);
  color: rgba(var(--c), 0.6);
  font-style: italic;
}
.memo-body hr { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
@media (prefers-reduced-motion: reduce) {
  .memo-outline, .memo-tags { transition: none; }
}
.memo-btn {
  font-family: 'GT America', -apple-system, sans-serif;
  font-size: 0.75rem;
  padding: 0.25rem 0.7rem;
  border-radius: 3px;
  border: 1px solid rgba(var(--accent), 0.35);
  background: rgba(var(--accent), 0.9);
  color: #fff;
  cursor: pointer;
  transition: background 0.12s ease-in, color 0.12s ease-in;
}
.memo-btn:hover { background: rgba(var(--accent), 1); }
.memo-btn.ghost {
  background: none;
  color: rgba(var(--c), 0.6);
  border-color: var(--border);
}
.memo-btn.ghost:hover { color: rgba(var(--c), 0.9); background: rgba(var(--c), 0.04); }
.memo-editor { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.memo-textarea {
  flex: 1;
  min-height: 0;
  width: calc(100% - 3rem);
  margin: 1.25rem 1.5rem 0.5rem;
  resize: none;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: rgba(var(--c), 0.85);
  background: rgba(var(--c), 0.02);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.85rem 1rem;
  box-sizing: border-box;
}
.memo-textarea:focus { outline: none; border-color: rgba(var(--accent), 0.5); }
.memo-hint {
  margin: 0 1.5rem 1.25rem;
  font-family: 'GT America', -apple-system, sans-serif;
  font-size: 0.6875rem;
  color: rgba(var(--c), 0.4);
}
.memo-hint a {
  color: rgba(var(--c), 0.55);
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--c), 0.15);
  transition: color 0.15s ease-in;
}
.memo-hint a:hover { color: rgba(var(--c), 0.8); }
.memo-hint-key {
  font-family: 'GT America Mono', ui-monospace, SFMono-Regular, monospace;
  font-size: 0.625rem;
  color: rgba(var(--c), 0.5);
  border: 1px solid rgba(var(--c), 0.12);
  border-radius: 4px;
  padding: 0 0.3rem;
  line-height: 1.4;
}

/* ── @mention dropdown ── */

.mention-dropdown { min-width: 15rem; max-width: 17rem; padding: 0.25rem; z-index: 310; }
.mention-list { max-height: 14rem; overflow-y: auto; }
.mention-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
}
.mention-item:hover, .mention-item.active { background: rgba(var(--c), 0.05); }
.mention-item-name {
  font-size: 0.8125rem;
  color: rgba(var(--c), 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mention-item-type {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.625rem;
  color: rgba(var(--c), 0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.mention-empty {
  font-family: 'GT America', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.75rem;
  color: rgba(var(--c), 0.3);
  padding: 0.5rem 0.6rem;
}

/* ── New frontend (Preact) additions ── */

/* Route fade-in: content swaps immediately; only the reveal animates.
   (The legacy 70ms fade-out was timer-gated and stalled in throttled tabs.) */
@keyframes route-enter { from { opacity: 0; } to { opacity: 1; } }
.route-enter { animation: route-enter 110ms ease-out; }
@media (prefers-reduced-motion: reduce) {
  .route-enter { animation: none; }
}

/* Form drawer slides in on mount (the element is created already-open, so the
   transform transition alone never fires — legacy toggled .open instead). */
@keyframes drawer-in { from { transform: translateX(100%); } }
.form-drawer.open { animation: drawer-in 0.2s ease-in-out; }

/* Route crossfade via the View Transitions API (replaces the legacy timer-
   gated fade-out; degrades to an instant swap when unsupported or hidden). */
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 150ms; }

@media (prefers-reduced-motion: reduce) {
  .form-drawer.open { animation: none; }
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none; }
}
