/*
 * Torve Portal Layout - shared layout system for all /app/ pages.
 * Provides consistent page shell, content widths, cards, and spacing.
 */

/* ── Page shell ────────────────────────────────────────────────────── */
.portal-page {
  margin-top: 64px;
  min-height: calc(100vh - 64px);
  padding: 0 32px 80px;
}

/* 2-column with sticky rail */
.portal-2col {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
  align-items: start;
  padding-top: 20px;
}

/* Single column (wider) */
.portal-1col {
  max-width: 1100px;
  margin: 0 auto;
  padding-top: 20px;
}

.portal-primary { min-width: 0; }

/* ── Page header ───────────────────────────────────────────────────── */
.portal-page-title {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  letter-spacing: -.02em;
}
.portal-page-intro {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 32px;
  max-width: 560px;
}

/* ── Sticky rail ───────────────────────────────────────────────────── */
.portal-rail {
  position: sticky;
  top: 80px;
}
.portal-rail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 16px;
}
.portal-rail-card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 14px;
}

/* Rail nav links */
.portal-rail-nav { list-style: none; padding: 0; margin: 0; }
.portal-rail-nav li { margin-bottom: 2px; }
.portal-rail-nav a {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 6px;
  transition: color .2s, background .2s;
}
.portal-rail-nav a:hover { color: var(--text); background: rgba(255,255,255,.03); }
.portal-rail-nav a.active { color: var(--accent); background: rgba(200,164,78,.06); }

.portal-rail-help {
  display: block;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
}
.portal-rail-help:hover { text-decoration: underline; }

/* Rail stat row */
.portal-rail-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.portal-rail-stat:last-child { border-bottom: none; }
.portal-rail-stat-label { font-size: 13px; color: var(--text-muted); }
.portal-rail-stat-value { font-size: 14px; font-weight: 600; color: #fff; }
.portal-rail-stat-value.accent { color: var(--accent); }
.portal-rail-stat-value.success { color: #4ade80; }
.portal-rail-stat-value.warn { color: #fbbf24; }

/* ── Section groups ────────────────────────────────────────────────── */
.portal-section {
  margin-bottom: 36px;
  scroll-margin-top: 100px;
}
.portal-section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.portal-section-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}
.portal-section-header .portal-section-desc {
  font-size: 13px;
  color: var(--text-muted);
}
.portal-section-header a {
  margin-left: auto;
  font-size: 12px;
  color: var(--accent);
  text-decoration: underline;
  flex-shrink: 0;
}

/* ── Card grid ─────────────────────────────────────────────────────── */
.portal-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.portal-card-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* ── Cards ─────────────────────────────────────────────────────────── */
.portal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  transition: border-color .2s, box-shadow .2s;
}
.portal-card:hover {
  border-color: rgba(255,255,255,.14);
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
}
.portal-card-accent {
  border-color: rgba(200,164,78,.15);
  background: linear-gradient(175deg, rgba(200,164,78,.04) 0%, var(--bg-card) 40%);
}
.portal-card-accent:hover {
  border-color: rgba(200,164,78,.3);
}
.portal-card-accent .portal-card-header h3 {
  color: var(--accent);
}
.portal-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}
.portal-card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin: 0;
}
.portal-card p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0;
}

/* ── Info/content card ─────────────────────────────────────────────── */
.portal-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 12px;
}
.portal-info-card h3 { font-size: 14px; font-weight: 600; color: #fff; margin-bottom: 6px; }
.portal-info-card p { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-bottom: 8px; }
.portal-info-card ul { margin: 0 0 8px 16px; }
.portal-info-card li { font-size: 13px; color: var(--text-muted); line-height: 1.5; padding: 1px 0; }
.portal-info-card li strong { color: var(--text); }
.portal-info-card a { color: var(--accent); text-decoration: underline; }

/* ── Empty state ───────────────────────────────────────────────────── */
.portal-empty {
  padding: 32px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.portal-empty p { font-size: 14px; color: var(--text-muted); line-height: 1.5; }

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .portal-2col {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .portal-rail { position: static; }
}
@media (max-width: 640px) {
  .portal-page { padding: 0 16px 60px; }
  .portal-card-grid { grid-template-columns: 1fr; }
  .portal-card-grid-3 { grid-template-columns: 1fr; }
}
