/* ============================================================================
   CardCrow shell — the redesign's left rail replaces the old top nav + hero.
   Brand, five-mode nav with live sub-counts, upload, batch status, account.
   Collapses to a top bar with horizontal nav under 920px.
   ============================================================================ */
.app { display: flex; min-height: 100vh; background: var(--bg-app); }

.rail {
  width: var(--rail-width); flex-shrink: 0; align-self: stretch;
  background: var(--bg-chrome); border-right: 1px solid var(--border);
  padding: 20px 16px; display: flex; flex-direction: column; gap: 20px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}

.railBrand { display: flex; align-items: center; gap: 14px; padding: 4px 4px 2px; }
.railBrand img { width: 58px; height: 58px; object-fit: contain; flex-shrink: 0; }
.railBrand .brandText { display: flex; flex-direction: column; line-height: 1.05; }
.railBrand b {
  font-family: var(--font-display); font-size: 27px; font-weight: var(--weight-semibold);
  letter-spacing: -0.01em; color: var(--ink-50); line-height: 1.05;
}
.railBrand span {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.26em;
  text-transform: uppercase; color: var(--gold-400); margin-top: 2px;
}

.railNav { display: flex; flex-direction: column; gap: 4px; }
.railNav a {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 10px 12px; border-radius: var(--radius-md); cursor: pointer;
  background: transparent; border: 1px solid transparent;
  color: var(--text-secondary); text-decoration: none;
  transition: all var(--dur-fast) var(--ease-out);
}
.railNav a:hover { background: var(--surface-raised); color: var(--text-secondary); }
.railNav a.active {
  background: var(--gold-tint); border-color: var(--gold-700);
  color: var(--gold-300); box-shadow: var(--edge-top);
}
.railNav a svg { flex-shrink: 0; }
.railNav .navText { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.railNav .navLabel { font-size: var(--text-md); font-weight: var(--weight-medium); }
.railNav a.active .navLabel { font-weight: var(--weight-semibold); }
.railNav .navSub {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.02em;
  color: var(--text-faint); font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.railNav a.active .navSub { color: var(--gold-600); }

.railSpacer { flex: 1; }

.railStatus {
  border-top: 1px solid var(--border); padding-top: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.railStatus .counts {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary);
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
}
.railStatus .msg { font-size: 11px; color: var(--text-muted); line-height: 1.45; }
.railGhostBtn {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 0; cursor: pointer; padding: 2px 0;
  font-family: var(--font-sans); font-size: 12px; color: var(--text-faint);
}
.railGhostBtn:hover { color: var(--seal-400); }
.railGhostBtn.gold:hover { color: var(--gold-400); }

.railAccount {
  display: flex; align-items: center; gap: 8px; margin-top: 4px;
  border-top: 1px solid var(--border-soft); padding-top: 10px; min-width: 0;
}
.railAccount .who {
  flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 10.5px;
  color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.railAccount .who .dot { color: var(--success-400); }
.railAccount button { flex-shrink: 0; }

/* Content area */
.appMain { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.viewPad { padding: 28px 32px; max-width: 1600px; width: 100%; }

/* Legacy view wrapper — every existing module renders .metaView */
.metaView { max-width: 1600px; padding: 28px 32px 60px; color: var(--text-primary); }
.metaHeader {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 22px;
}
.metaHeader h2 {
  margin: 0; font-family: var(--font-display); font-size: var(--text-2xl);
  font-weight: var(--weight-semibold); letter-spacing: -0.015em;
}
.metaSub {
  margin: 6px 0 0; font-family: var(--font-mono); font-size: var(--text-2xs);
  letter-spacing: var(--tracking-wider); text-transform: uppercase; color: var(--text-muted);
  order: -1;
}
.metaHeader > div { display: flex; flex-direction: column; }

.placeholderView { max-width: 640px; margin: 60px auto; padding: 0 20px; text-align: center; color: var(--text-primary); }
.placeholderView h2 { font-family: var(--font-display); font-size: var(--text-2xl); margin-bottom: 10px; }
.placeholderView p { color: var(--text-muted); font-size: var(--text-md); line-height: 1.5; }

.metaLoading, .metaEmpty { color: var(--text-muted); padding: 30px 10px; text-align: center; font-family: var(--font-mono); font-size: var(--text-sm); }
.metaError {
  color: var(--seal-400); background: var(--seal-tint); border: 1px solid var(--seal-600);
  border-radius: var(--radius-lg); padding: 12px 14px; font-size: var(--text-sm);
}
.metaTag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--success-400);
  border: 1px solid rgba(106,157,115,0.4); border-radius: var(--radius-pill); padding: 2px 9px;
}

/* Mobile: rail becomes a top bar with scrollable nav */
@media (max-width: 920px) {
  .app { flex-direction: column; }
  .rail {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 60;
    flex-direction: row; align-items: center; gap: 12px;
    padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border);
    overflow-x: auto; overflow-y: hidden;
  }
  .railBrand img { width: 40px; height: 40px; }
  .railBrand b { font-size: 20px; }
  .railBrand span { display: none; }
  .railNav { flex-direction: row; gap: 4px; }
  .railNav a { padding: 7px 11px; }
  .railNav .navSub { display: none; }
  .railNav .navLabel { font-size: var(--text-sm); white-space: nowrap; }
  .railSpacer { display: none; }
  .railStatus { border-top: 0; padding-top: 0; flex-direction: row; align-items: center; margin-left: auto; }
  .railStatus .msg, .railStatus .counts { display: none; }
  .railAccount { border-top: 0; padding-top: 0; margin-top: 0; }
  .railAccount .who { max-width: 120px; }
  #railUploadBtn { white-space: nowrap; }
  .viewPad, .metaView { padding: 18px 14px 60px; }
}

/* Upload + Cardmarket link pair in the rail */
.railUploadRow { display: flex; flex-direction: column; gap: 8px; }
.railUploadRow .btn { width: 100%; }
#railUploadBtn { background: linear-gradient(var(--gold-400), var(--gold-500)); color: var(--on-accent); border-color: var(--gold-600); box-shadow: var(--edge-top), var(--shadow-sm); font-weight: var(--weight-semibold); }
#railUploadBtn:hover { filter: brightness(1.06); }
.railCmLink { text-decoration: none; }
.railCmLink:hover { color: var(--gold-300); border-color: var(--gold-700); background: var(--gold-tint-soft); }
@media (max-width: 920px) {
  .railUploadRow { flex-direction: row; gap: 6px; }
  #railUploadBtn, .railCmLink { white-space: nowrap; }
}
