/* SubSeq Registry — catalog UI on the main SPA design system.
   Palette/typography come from /css/main.css + light.css|dark.css;
   this file only adds registry layout. */

:root {
  --bg: var(--bg-primary);
  --bg2: var(--surface-sunken);
  --panel: var(--bg-secondary);
  --panel2: var(--surface-raised);
  --line: var(--border);
  --line-strong: var(--header-divider);
  --teal: var(--primary);
  --teal-bright: var(--primary);
  --text: var(--text-primary);
  --muted: var(--secondary);
  --topbar: var(--header-bg);
  --mol: var(--tech-accent);
  --on-primary: #0d1512;
}
:root[data-theme="light"] { --on-primary: #ffffff; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  line-height: 1.4;
  color: var(--text);
  background-color: var(--bg);
  overflow: hidden;
}
.hidden { display: none !important; }

/* ---------- top bar (same thickness as SPA .header) ---------- */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 2rem;
  background: var(--topbar);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: var(--glow);
  z-index: 20;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
  white-space: nowrap;
}
.brand-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--teal);
  flex-shrink: 0;
}
.brand-glyph svg { display: block; }
.brand-word { font-size: 1.1rem; font-weight: 600; letter-spacing: 0.75px; }
.brand-word em { font-style: normal; color: var(--teal); font-weight: 500; }

.search-wrap { flex: 1; max-width: 520px; }
#search {
  width: 100%;
  padding: 0.45rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--text);
  background: var(--accent);
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#search:focus { border-color: var(--teal); box-shadow: var(--glow); }
#search::placeholder { color: var(--muted); }

.top-actions { display: flex; align-items: center; gap: 16px; margin-left: auto; }

/* ---------- buttons ---------- */
.btn-primary {
  padding: 0.32rem 0.95rem;
  font-size: 1.05rem;
  font-weight: 400;
  min-height: 2rem;
  color: var(--text);
  background: var(--accent);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s ease;
}
.btn-primary:hover {
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: var(--glow);
}
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-ghost,
.icon-btn,
.btn-copy,
.btn-tiny,
.btn-dl {
  padding: 0.45rem 0.95rem;
  font-size: 1.05rem;
  font-family: var(--font-mono);
  color: var(--text);
  background: var(--accent);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: box-shadow 0.15s, border-color 0.15s, color 0.15s;
}
.btn-ghost:hover, .icon-btn:hover, .btn-copy:hover, .btn-dl:hover {
  color: var(--teal);
  border-color: var(--teal);
  box-shadow: var(--glow);
}
.btn-tiny { border-style: dashed; color: var(--muted); }
.btn-tiny:hover { color: var(--teal); }

/* ---------- shell: fixed rail + scrolling rows ---------- */
#shell {
  position: fixed;
  top: 40px; left: 0; right: 0; bottom: 0;
  display: flex;
}

#rail {
  width: 230px;
  flex-shrink: 0;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.rail-section {
  margin-bottom: 16px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.rail-footer {
  flex-shrink: 0;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#rail #submit-btn { width: 100%; justify-content: center; }
#rail .theme-toggle { display: flex; justify-content: center; }

/* ---------- account / login (matches SPA header controls) ---------- */
.account-info { display: flex; align-items: center; }
a.user-email,
a.login-button {
  color: var(--text);
  text-decoration: none;
}
.user-email {
  padding: 0.32rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 6px;
}
.user-email:hover { color: var(--teal); }
.login-button {
  padding: 0.32rem 0.95rem;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  background: var(--accent);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s ease;
}
.login-button:hover {
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: var(--glow);
}
.rail-section h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
}
.type-list { list-style: none; margin: 0; padding: 0; }
.type-toggle {
  padding: 3px 8px;
  margin: 2px 0 0;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.type-toggle:hover { color: var(--teal); }
.type-item {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 8px;
  margin: 1px 0;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  user-select: none;
}
.type-item:hover { background: var(--accent); }
.type-item.active { background: var(--accent); }
.type-symbol {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.type-item.active .type-sym { background: var(--tic, var(--teal)); color: var(--on-primary); }
.type-label { font-size: 1.05rem; }
.type-count { margin-left: auto; color: var(--muted); font-size: 1.05rem; }

#rows-wrap { flex: 1; overflow-y: auto; padding: 20px 26px 60px; }

/* ---------- rows: compact table on the main SPA .data-table look ---------- */
.rows-table {
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--emboss-inset);
  overflow: hidden;
}
.rows-head, .row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) minmax(0, 2fr) 90px 240px 92px;
  gap: 12px;
  align-items: center;
  padding: 4px 12px;
}
.rows-head {
  padding: 6px 12px;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--machine-line);
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.row {
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background-color 0.15s;
}
.row:last-child { border-bottom: none; }
.row:hover { background: var(--accent); }
.row-sym {
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.row-main { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.row-name {
  font-weight: 400;
  font-size: 1.05rem;
  min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-sub {
  color: var(--muted);
  font-size: 0.9rem;
  min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-desc {
  color: var(--muted);
  font-size: 0.9rem;
  min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-types {
  display: flex; align-items: center; gap: 7px;
  min-width: 0; overflow: hidden;
  flex-shrink: 0;
}
.row-type {
  display: inline-flex; align-items: center;
  color: var(--teal);
  cursor: inherit;
}
.row-metrics {
  display: flex; gap: 8px;
  min-width: 0; overflow: hidden;
  flex-shrink: 0;
}
.metric-pill {
  padding: 2px 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--teal-bright);
  white-space: nowrap;
}
.metric-pill span { color: var(--muted); }
.row-date { color: var(--muted); font-size: 0.9rem; white-space: nowrap; flex-shrink: 0; }

/* ---------- type icons ----------
   Per-type tinted circle behind each glyph: hue per slug (--tic, teal
   fallback), 30% potency (between wash 14% and disc 100%), lines in
   theme text color, glyphs stay hollow line art. */
.type-sym {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tic, var(--teal)) 30%, transparent);
  color: var(--text);
  font-size: 0.95rem;
}
.type-icon { display: block; width: 17px; height: 17px; }
.type-chip.selected .type-sym {
  color: var(--on-primary);
  background: color-mix(in srgb, var(--on-primary) 14%, transparent);
}

/* per-type hues */
.ti-binder { --tic: #2f9db3; }
.ti-cage   { --tic: #7d8ee0; }
.ti-enzyme { --tic: #de8437; }
.ti-pore   { --tic: #46a06a; }
.ti-sensor { --tic: #d8504e; }
.ti-motor  { --tic: #9a6cd8; }
.ti-fold   { --tic: #3d87d1; }
.ti-scaf   { --tic: #b0713f; }
.ti-switch { --tic: #cdb43b; }
.ti-pep    { --tic: #3fb5a0; }
.ti-fil    { --tic: #8b93a8; }
.ti-mech   { --tic: #cf5f9e; }
.ti-adhes  { --tic: #7d9c3e; }
.ti-cond   { --tic: #b0468c; }

.rows-empty { color: var(--muted); padding: 40px 10px; text-align: center; }

/* ---------- detail slide-over ---------- */
.scrim {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 30;
}
.detail {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(680px, 92vw);
  background: var(--panel);
  border-left: 1px solid var(--line-strong);
  z-index: 40;
  display: flex;
  flex-direction: column;
  box-shadow: -30px 0 60px var(--depth-shadow);
}
.detail-head {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.detail-head h2 { margin: 0; font-size: 1.3rem; font-weight: 700; }
.detail-meta { color: var(--muted); font-size: 0.95rem; margin-top: 4px; }
.icon-btn {
  width: 34px; height: 34px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.detail-body { overflow-y: auto; padding: 20px 24px 40px; }

.viewer {
  width: 100%;
  height: 340px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
.viewer-hint { color: var(--muted); font-size: 0.9rem; text-align: center; margin: 6px 0 18px; }

.metric-cards { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.metric-card {
  padding: 10px 14px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 110px;
}
.metric-card .v { font-family: var(--font-mono); font-size: 1.05rem; color: var(--teal-bright); }
.metric-card .k { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }

.detail-desc { margin-bottom: 20px; }
.detail-block { margin-bottom: 20px; }
.detail-block h4 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.block-hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--teal); }
.seq-block {
  margin: 0;
  padding: 12px 14px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--teal-bright);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 180px;
  overflow-y: auto;
}
.fp-row { display: flex; align-items: center; gap: 10px; }
.fp-code {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--teal-bright);
  word-break: break-all;
}
.fp-time { color: var(--muted); font-size: 0.95rem; margin-top: 8px; }
.dl-row { display: flex; gap: 10px; }

/* ---------- submit modal ---------- */
.modal {
  position: fixed; inset: 0;
  z-index: 50;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 20px;
  background: rgba(0, 0, 0, 0.55);
  overflow-y: auto;
}
.modal-card {
  width: 560px;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 24px 26px;
  box-shadow: var(--glow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { margin: 0; font-size: 1.3rem; }
.submit-login { text-align: center; padding: 20px 0; color: var(--muted); }
.submit-login .btn-primary { margin-top: 12px; }
.submit-form label {
  display: block;
  margin-bottom: 14px;
  font-size: 1.05rem;
  color: var(--muted);
}
.submit-form label small { color: var(--muted); opacity: 0.8; }
.submit-form input[type="text"],
.submit-form input:not([type]),
.submit-form textarea,
.submit-form input[type="file"] {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 0.45rem 0.7rem;
  font-size: 1.05rem;
  font-family: var(--font-mono);
  color: var(--text);
  background: var(--accent);
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}
.submit-form textarea { resize: vertical; }
.submit-form input:focus, .submit-form textarea:focus { border-color: var(--teal); box-shadow: var(--glow); }
.f-label { display: block; color: var(--muted); margin-bottom: 6px; }
.f-types, .f-metrics { margin-bottom: 14px; }
.type-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.type-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--accent);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.05rem;
  color: var(--text);
  user-select: none;
}
.type-chip:hover { border-color: var(--teal); box-shadow: var(--glow); }
.type-chip.selected { background: var(--teal); color: var(--on-primary); border-color: var(--teal); }
.type-chip .order-num { font-family: var(--font-mono); font-size: 0.9rem; }
.metric-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.metric-row { display: flex; gap: 8px; }
.metric-row input {
  padding: 0.45rem 0.6rem;
  font-size: 1.05rem;
  font-family: var(--font-mono);
  color: var(--text);
  background: var(--accent);
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}
.metric-row input:focus { border-color: var(--teal); }
.metric-row input[name="m-name"] { width: 40%; }
.metric-row input[name="m-value"] { width: 25%; }
.metric-row input[name="m-unit"] { width: 25%; }
.metric-row .rm {
  width: 34px;
  background: var(--accent);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
}
.metric-row .rm:hover { color: var(--text); border-color: var(--teal); }
.check-row { display: flex !important; align-items: center; gap: 9px; }
.check-row input { width: auto !important; margin: 0 !important; }
.submit-error {
  padding: 10px 14px;
  margin-bottom: 14px;
  background: var(--accent-bad);
  border: 1px solid var(--bad);
  border-radius: 6px;
  color: var(--bad);
  font-size: 1.05rem;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- narrow screens ---------- */
@media (max-width: 900px) {
  #rail { display: none; }
  .rows-head, .row { grid-template-columns: 26px minmax(0, 1fr) 60px; }
  .rh-desc, .row-desc, .rh-metrics, .row-metrics, .rh-date, .row-date { display: none; }
}
