/* ── Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&family=Playfair+Display:wght@700;800&display=swap');

/* ── Variables ── */
:root {
  --bg:      #0A0A0F;
  --surface: #14141F;
  --card:    #111118;
  --border:  #1A1A2E;
  --border2: #252540;
  --text:    #F5F0E8;
  --muted:   #8B9D83;
  --dim:     #C8C0B0;
  --gold:    #C9A227;
  --gold2:   #e0b52a;
  --red:     #E63946;
  --up:      #4ade80;
  --up-bg:   rgba(74,222,128,.1);
  --up-bd:   rgba(74,222,128,.3);
  --down:    #f87171;
  --down-bg: rgba(248,113,113,.1);
  --down-bd: rgba(248,113,113,.3);
  --warn:    #fbbf24;
  --r:       3px;
  --r-sm:    2px;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-mono:  'JetBrains Mono', 'Courier New', monospace;
  --font-body:  'Inter', -apple-system, BlinkMacSystemFont, 'Noto Sans KR', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ═══════════════════════════════════════
   TOP NAV
═══════════════════════════════════════ */

.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,15,.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--gold);
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 24px;
}

.nav-brand {
  display: flex;
  align-items: center;
  margin-right: 32px;
  flex-shrink: 0;
}

.nav-brand img {
  height: 28px;
  width: auto;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--dim);
  font-size: 12.5px;
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(201,162,39,.06);
}

.nav-link.active {
  color: var(--gold);
  border-color: rgba(201,162,39,.4);
  background: rgba(201,162,39,.08);
}

.nav-link.disabled {
  opacity: .3;
  pointer-events: none;
  cursor: default;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: rgba(201,162,39,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.nav-name {
  font-size: 12px;
  color: var(--dim);
  font-family: var(--font-mono);
}

.nav-badge {
  background: rgba(201,162,39,.15);
  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border: 1px solid rgba(201,162,39,.4);
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-family: var(--font-mono);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}

.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* ═══════════════════════════════════════
   PAGE WRAPPER
═══════════════════════════════════════ */

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* ═══════════════════════════════════════
   PAGE HEADER
═══════════════════════════════════════ */

.page-head {
  padding: 2rem 0 1.75rem;
  border-bottom: 1px solid var(--gold);
  margin-bottom: 2rem;
}

.page-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--muted);
  margin-bottom: 10px;
  transition: color .12s;
}

.page-back:hover { color: var(--gold); }

.page-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--text);
  line-height: 1.15;
}

.page-subtitle {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.4rem;
  letter-spacing: .03em;
}

/* ═══════════════════════════════════════
   SECTION
═══════════════════════════════════════ */

.section { margin-bottom: 2.5rem; }

.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--red);
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

/* ═══════════════════════════════════════
   MARKET STAT CHIPS
═══════════════════════════════════════ */

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 1.25rem;
}

.stat-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 18px;
  min-width: 140px;
  flex: 1;
}

.stat-chip.up { border-color: var(--up-bd); }
.stat-chip.down { border-color: var(--down-bd); }

.chip-label {
  font-size: 9.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  font-family: var(--font-mono);
  margin-bottom: 6px;
}

.chip-val {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1;
  margin-bottom: 4px;
}

.chip-rate {
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.stat-chip.up .chip-rate { color: var(--up); }
.stat-chip.down .chip-rate { color: var(--down); }
.chip-rate.neutral { color: var(--muted); }

/* Global index badges */
.global-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0.5rem;
}

.g-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 12px;
}

.g-badge .g-name {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.g-badge .g-rate {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 11px;
}

.g-badge.up { border-color: var(--up-bd); }
.g-badge.up .g-rate { color: var(--up); }
.g-badge.down { border-color: var(--down-bd); }
.g-badge.down .g-rate { color: var(--down); }

/* ═══════════════════════════════════════
   HERO — LATEST BRIEFING
═══════════════════════════════════════ */

.hero {
  border: 1px solid var(--gold);
  border-radius: var(--r);
  padding: 2rem 2rem 1.75rem;
  margin-bottom: 2.5rem;
  background: linear-gradient(135deg, rgba(201,162,39,.06) 0%, transparent 60%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--red));
}

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.hero-live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,162,39,.2);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(201,162,39,.2); }
  50% { box-shadow: 0 0 0 6px rgba(201,162,39,.05); }
}

.hero-link { display: block; color: inherit; }

.hero-date {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 1.1;
  margin-bottom: 0.4rem;
}

.hero-slot {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--gold);
  margin-bottom: 0.8rem;
}

.hero-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  border-bottom: 1px solid rgba(201,162,39,.4);
  padding-bottom: 1px;
  transition: all .15s;
}

.hero-link:hover .hero-cta {
  color: var(--red);
  border-bottom-color: var(--red);
}

.hero-link:hover .hero-date { color: var(--gold); }

.archive-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.archive-label {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.archive-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

/* ═══════════════════════════════════════
   BRIEFING GRID (HISTORY)
═══════════════════════════════════════ */

.month-group { margin-bottom: 2rem; }

.month-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.month-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.b-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 8px;
}

.b-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  color: var(--text);
  transition: all .15s;
  position: relative;
  overflow: hidden;
}

.b-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transition: transform .15s;
  transform-origin: left;
}

.b-card:hover {
  border-color: rgba(201,162,39,.4);
  background: rgba(20,20,31,.9);
}

.b-card:hover::after { transform: scaleX(1); }

.b-date {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -.01em;
  margin-bottom: 5px;
  color: var(--text);
}

.b-slot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gold);
  font-family: var(--font-mono);
  margin-bottom: 10px;
}

.b-slot-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.b-meta {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* ═══════════════════════════════════════
   BRIEFING DETAIL — CLUSTER CARDS
═══════════════════════════════════════ */

.cat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  margin-top: 8px;
}

.cat-tag {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--red);
}

.cat-line { flex: 1; height: 1px; background: var(--border); }

.cluster-card {
  padding: 0 0 1.25rem 1rem;
  border-left: 3px solid var(--border);
  margin-bottom: 1.25rem;
  transition: border-color .15s;
}

.cluster-card:hover { border-left-color: var(--gold); }

.cluster-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}

.cluster-idx {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  min-width: 18px;
  padding-top: 3px;
  flex-shrink: 0;
}

.cluster-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.45;
  flex: 1;
}

.cluster-summary {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.75;
  margin-bottom: 0.6rem;
  padding-left: 28px;
  opacity: .88;
}

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

.art-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  font-family: var(--font-mono);
  color: var(--muted);
  cursor: pointer;
  margin-left: 28px;
  user-select: none;
  transition: color .12s;
}

.art-toggle:hover { color: var(--gold); }

.art-list {
  list-style: none;
  margin-top: 8px;
  padding: 8px 0 2px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.art-item { display: flex; align-items: baseline; gap: 8px; }

.art-link {
  font-size: 0.85rem;
  color: var(--dim);
  flex: 1;
  line-height: 1.5;
  border-bottom: 1px solid transparent;
  transition: color .12s, border-color .12s;
}

.art-link:hover { color: var(--red); border-bottom-color: var(--red); }

.art-src {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════
   ADMIN / TABLE
═══════════════════════════════════════ */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead tr { border-bottom: 1px solid var(--border); }

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgba(255,255,255,.02); }

/* badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 10.5px;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: .03em;
}

.badge-active   { background: var(--up-bg);  border: 1px solid var(--up-bd);  color: var(--up); }
.badge-pending  { background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.3); color: var(--warn); }
.badge-rejected { background: var(--down-bg); border: 1px solid var(--down-bd); color: var(--down); }
.badge-admin    { background: rgba(201,162,39,.1); border: 1px solid rgba(201,162,39,.3); color: var(--gold); }
.badge-member   { background: var(--surface); border: 1px solid var(--border); color: var(--muted); }

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}

.btn-primary {
  background: var(--gold);
  color: #0A0A0F;
  width: 100%;
  font-family: var(--font-body);
  font-weight: 600;
}

.btn-primary:hover { background: var(--gold2); }
.btn-success { background: #166534; color: #fff; border: 1px solid #15803d; }
.btn-success:hover { background: #15803d; }
.btn-danger  { background: #7f1d1d; color: #fff; border: 1px solid #991b1b; }
.btn-danger:hover  { background: #991b1b; }
.btn-xs { padding: 3px 10px; font-size: 11px; border-radius: 2px; }

/* ═══════════════════════════════════════
   AUTH PAGES
═══════════════════════════════════════ */

body.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.auth-wrap {
  width: 100%;
  max-width: 380px;
  padding: 20px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo img { height: 38px; width: auto; }

.auth-logo-name {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.auth-box {
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: var(--r);
  padding: 28px;
}

.auth-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.auth-sub {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 22px;
}

.form-fields { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }

.field-input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}

.field-input:focus { border-color: var(--gold); }
.field-input::placeholder { color: var(--muted); }

.auth-footer {
  text-align: center;
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.auth-footer a { color: var(--gold); }

/* Alerts */
.alert {
  padding: 10px 14px;
  border-radius: var(--r-sm);
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
}

.alert-error { background: var(--down-bg); border: 1px solid var(--down-bd); color: #fca5a5; }
.alert-info  { background: rgba(201,162,39,.1); border: 1px solid rgba(201,162,39,.3); color: var(--gold); }

/* ═══════════════════════════════════════
   UTILITIES
═══════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 3rem 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .04em;
}

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */

@media (max-width: 640px) {
  .topnav { padding: 0 14px; }
  .nav-brand { margin-right: 14px; }
  .nav-link svg { display: none; }
  .nav-link { padding: 5px 8px; font-size: 12px; }
  .nav-name { display: none; }
  .page { padding: 1rem 0.75rem 3rem; }
  .page-title { font-size: 1.5rem; }
  .b-grid { grid-template-columns: 1fr 1fr; }
  .stat-row { gap: 8px; }
  .stat-chip { min-width: 120px; }
  .chip-val { font-size: 1.3rem; }
  .btn-logout span { display: none; }
}
