:root {
  --bg: #f6f2ea;
  --surface: #ffffff;
  --warm: #faf5ea;
  --ink: #18272e;
  --muted: #616d73;
  --brand: #173b47;
  --gold: #a8823c;
  --gold-dark: #7d5c22;
  --danger: #b03e32;
  --success: #246848;
  --border: rgba(23, 59, 71, 0.14);
  --serif: 'Noto Serif SC', 'STZhongsong', 'Songti SC', 'Microsoft YaHei', serif;
  --sans: 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--sans); background: var(--bg); color: var(--ink); line-height: 1.6; }

.topbar {
  position: relative; z-index: 40;
  background: linear-gradient(180deg, rgba(253,251,246,0.98), rgba(246,240,229,0.96));
  border-bottom: 1px solid rgba(168,130,60,0.28);
  box-shadow: 0 4px 20px rgba(17,43,53,0.05);
}
.topbar-inner {
  max-width: 1260px; margin: 0 auto; padding: 10px 20px 8px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.zen-seal {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  border: 1.5px solid var(--gold); color: var(--brand); background: #fffdf8;
  font-family: var(--serif); font-size: 15px; font-weight: 700; letter-spacing: 0.12em;
  display: grid; place-items: center;
}
.brand-hairline { width: 1px; height: 32px; background: linear-gradient(180deg, transparent, rgba(168,130,60,0.6), transparent); }
.brand-title { margin: 0; font-family: var(--serif); font-size: 18px; color: var(--brand); letter-spacing: 0.08em; }
.brand-sub { font-size: 12px; color: var(--gold-dark); letter-spacing: 0.06em; }
.top-links { display: flex; gap: 8px; flex-wrap: wrap; }

.portal-nav {
  max-width: 1260px; margin: 0 auto; padding: 4px 20px 10px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.nav-tab {
  text-align: left; padding: 8px 12px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--border); background: #fff; color: var(--ink);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.nav-tab:hover { border-color: var(--gold); box-shadow: 0 3px 10px rgba(168,130,60,0.12); }
.nav-tab.active { background: linear-gradient(135deg, #173b47, #245768); color: #fff; border-color: #173b47; }
.tab-kicker { display: block; font-size: 11px; opacity: 0.78; }
.tab-label { display: block; font-weight: 700; font-size: 13.5px; margin-top: 1px; }

.shell { max-width: 1260px; margin: 20px auto 56px; padding: 0 20px; }
.section { margin-bottom: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 20px; box-shadow: 0 6px 22px rgba(23,59,71,0.04);
}
.card-warm { background: linear-gradient(135deg, #fff, var(--warm)); border-color: rgba(168,130,60,0.32); }
.hero {
  position: relative; border-radius: 20px; overflow: hidden; min-height: 250px;
  display: flex; align-items: flex-end; background: #14262e; margin-bottom: 20px;
}
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.62; }
.hero-scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(16,32,40,0.18), rgba(16,32,40,0.88)); }
.hero-body { position: relative; z-index: 2; padding: 26px; color: #fff; max-width: 820px; }
.hero .pill, .hero .pill-gold {
  background: rgba(20, 42, 50, 0.72);
  border: 1px solid rgba(244, 217, 152, 0.68);
  color: #fce8b2;
  backdrop-filter: blur(6px);
}
.hero-title { margin: 8px 0 8px; font-family: var(--serif); font-size: 26px; line-height: 1.3; }
.hero-sub { margin: 0; font-size: 14px; opacity: 0.92; }

.kicker { font-size: 12px; font-weight: 700; color: var(--gold-dark); letter-spacing: 0.08em; }
.h2 { margin: 4px 0 6px; font-family: var(--serif); font-size: 20px; color: var(--brand); }
.desc { margin: 0 0 12px; font-size: 13px; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 920px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
@media (max-width: 620px) { .portal-nav { grid-template-columns: 1fr; } }

.pill {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; background: rgba(36,104,72,0.1); color: var(--success);
}
.pill-gold { background: rgba(168,130,60,0.16); color: var(--gold-dark); }
.pill-brand { background: rgba(23,59,71,0.1); color: var(--brand); }
.pill-danger { background: rgba(176,62,50,0.12); color: var(--danger); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 700; font-size: 13.5px; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-gold { background: linear-gradient(135deg, #b58d43, #926d2a); color: #fff; }
.btn-outline { background: #fff; color: var(--brand); border-color: var(--border); }
.btn-ghost-dark { background: rgba(255,255,255,0.14); color: #fff; border-color: rgba(255,255,255,0.48); }
.btn-ghost-dark:hover { background: rgba(255,255,255,0.24); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border);
  font-family: inherit; font-size: 13.5px; background: #fff; color: var(--ink);
}
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }

.media-box { border-radius: 12px; overflow: hidden; aspect-ratio: 16/10; background: #e8e2d5; margin-bottom: 8px; }
.media-box img { width: 100%; height: 100%; object-fit: cover; display: block; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--ink);
}
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th { background: var(--warm); color: var(--brand); font-weight: 700; }

.tp-backdrop {
  position: fixed; inset: 0; z-index: 200; background: #0c1418;
  display: flex; flex-direction: column;
}
.tp-backdrop[hidden] { display: none !important; }
.tp-shell { max-width: 900px; width: 100%; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; height: 100%; }
.tp-bar { display: flex; justify-content: space-between; align-items: center; padding-bottom: 14px; border-bottom: 1px solid rgba(255,255,255,0.16); }
.tp-hook { margin: 14px 0; padding: 12px 16px; border-radius: 12px; background: rgba(168,130,60,0.22); color: #f7dca0; font-size: 18px; font-weight: 700; }
.tp-body { flex: 1; overflow-y: auto; color: #fff; font-size: 32px; line-height: 1.75; font-family: var(--serif); padding: 16px 6px 120px; }

.footer { text-align: center; padding: 24px 20px 44px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); }
.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #142c35; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 13px; box-shadow: 0 10px 26px rgba(0,0,0,0.25); }

.auth-user-bar { display: inline-flex; align-items: center; gap: 8px; }
.auth-user-bar[hidden], #tri-nav[hidden], #app-root[hidden], .auth-gate[hidden], .auth-error[hidden] { display: none !important; }
.auth-gate {
  min-height: calc(100vh - 210px);
  display: grid; place-items: center;
  padding: 32px 20px 48px;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: linear-gradient(180deg, #fffdf9, #fbf6ec);
  border: 1px solid rgba(168,130,60,0.34);
  border-radius: 22px; padding: 30px 28px 24px;
  box-shadow: 0 18px 46px rgba(23,59,71,0.09);
}
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-seal { width: 54px; height: 54px; font-size: 18px; margin: 0 auto; border-radius: 14px; }
.auth-title { margin: 6px 0 8px; font-family: var(--serif); font-size: 21px; color: var(--brand); letter-spacing: 0.04em; }
.auth-error {
  margin: 8px 0 12px; padding: 9px 12px; border-radius: 10px;
  background: rgba(176,62,50,0.1); border: 1px solid rgba(176,62,50,0.28);
  color: var(--danger); font-size: 13px; font-weight: 600;
}
.auth-submit { width: 100%; padding: 11px 16px; margin-top: 6px; font-size: 14.5px; }
.auth-footnote {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border);
  display: flex; justify-content: center; flex-wrap: wrap; gap: 6px;
  font-size: 11.5px; color: var(--muted);
}
