  --bg-hover:    #1a1a2e;
  --gold:        #c9a84c;
  --gold-light:  #e0c070;
  --gold-dim:    #7a6030;
  --gold-border: #3d3010;
  --red-dark:    #8b1a1a;
  --red-mid:     #b52a2a;
  --border:      #2a2a40;
  --text:        #e8e0d0;
  --text-muted:  #8a8070;
  --text-dim:    #5a5448;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 8px 40px rgba(0,0,0,.6);
  --glow:        0 0 30px rgba(201,168,76,.12);
}

/* ═══════════════════════════════════════════════════════════
   RESET
═══════════════════════════════════════════════════════════ */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { scroll-behavior: smooth; }
body  {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ═══════════════════════════════════════════════════════════
   STARFIELD BACKGROUND
═══════════════════════════════════════════════════════════ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1px 1px at 15% 20%, rgba(201,168,76,.35) 0%, transparent 100%),
    radial-gradient(1px 1px at 72%  8%, rgba(201,168,76,.25) 0%, transparent 100%),
    radial-gradient(1px 1px at 38% 55%, rgba(201,168,76,.20) 0%, transparent 100%),
    radial-gradient(1px 1px at 88% 42%, rgba(201,168,76,.30) 0%, transparent 100%),
    radial-gradient(1px 1px at  5% 78%, rgba(201,168,76,.20) 0%, transparent 100%),
    radial-gradient(1px 1px at 60% 85%, rgba(201,168,76,.25) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 80% 15%, rgba(255,255,255,.15) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 45% 70%, rgba(255,255,255,.10) 0%, transparent 100%);
}
.page { position: relative; z-index: 1; }

/* ═══════════════════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════════════════ */
.site-header {
  text-align: center;
  padding: 56px 20px 40px;
}
.site-header::after {
  content: '';
  display: block;
  width: 160px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 28px auto 0;
  opacity: .5;
}
.logo-eyebrow {
  font-size: 11px;
  letter-spacing: .3em;
  color: var(--gold);
  text-transform: uppercase;
  opacity: .7;
  margin-bottom: 12px;
  font-weight: 500;
}
.logo-text {
  font-family: 'Playfair Display', serif;
  font-size: clamp(28px, 7vw, 50px);
  font-weight: 600;
  color: var(--gold);
  line-height: 1.15;
  text-shadow: 0 0 60px rgba(201,168,76,.3);
}
.logo-star {
  display: inline-block;
  animation: starPulse 3s ease-in-out infinite;
  margin: 0 4px;
}
@keyframes starPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .6; transform: scale(.85); }
}
.tagline {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: clamp(13px, 2.5vw, 15px);
  color: var(--text-muted);
  margin-top: 10px;
}
.header-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  opacity: .4;
}
.orn-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--gold); }
.orn-dot.lg { width: 6px; height: 6px; }
.orn-line { width: 40px; height: 1px; background: var(--gold); opacity: .5; }

/* ═══════════════════════════════════════════════════════════
   API KEY SECTION (collapsible)
═══════════════════════════════════════════════════════════ */
.api-section { max-width: 580px; margin: 0 auto 20px; padding: 0 20px; }

.api-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  color: var(--text-muted);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.api-toggle-btn:hover { border-color: var(--gold-dim); color: var(--text); }
.api-toggle-btn .chevron { margin-left: auto; transition: transform .25s; font-style: normal; }
.api-toggle-btn.open .chevron { transform: rotate(180deg); }

.api-key-panel {
  overflow: hidden;
  max-height: 0;
  transition: max-height .35s ease;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.api-key-panel.open { max-height: 200px; }
.api-key-inner { padding: 14px; }

.api-key-row { display: flex; gap: 8px; align-items: center; }
.api-key-row input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 9px 12px;
  min-height: 38px;
  outline: none;
  transition: border-color .2s;
}
.api-key-row input:focus { border-color: var(--gold-dim); }

.btn-icon, .btn-save {
  padding: 9px 12px;
  min-height: 38px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, color .15s;
}
.btn-icon:hover, .btn-save:hover { border-color: var(--gold-dim); color: var(--text); }
.btn-save { color: var(--gold); border-color: var(--gold-dim); }

.api-note {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 8px;
  line-height: 1.55;
}
.api-note a { color: var(--gold-dim); text-decoration: none; }
.api-note a:hover { color: var(--gold); }

.api-saved-msg {
  display: none;
  font-size: 11px;
  color: #4ade80;
  margin-top: 6px;
}
.api-saved-msg.show { display: block; }

/* ═══════════════════════════════════════════════════════════
   FORM SECTION
═══════════════════════════════════════════════════════════ */
.form-section {
  padding: 0 20px 72px;
  display: flex;
  justify-content: center;
}
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: clamp(24px, 5vw, 48px);
  width: 100%;
  max-width: 580px;
  box-shadow: var(--shadow), var(--glow), inset 0 1px 0 rgba(201,168,76,.08);
  position: relative;
  overflow: hidden;
}
.form-card::before,
.form-card::after {
  content: '';
  position: absolute;
  width: 60px; height: 60px;
  border-color: var(--gold-dim);
  border-style: solid;
  opacity: .4;
}
.form-card::before { top: 16px; left: 16px; border-width: 1px 0 0 1px; }
.form-card::after  { bottom: 16px; right: 16px; border-width: 0 1px 1px 0; }

.form-title {
  font-family: 'Playfair Display', serif;
  font-size: 19px;
  font-weight: 500;
  color: var(--gold);
  text-align: center;
  margin-bottom: 5px;
  letter-spacing: .04em;
}
.form-sub {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 28px;
  font-style: italic;
}

/* Fields */
.field { margin-bottom: 20px; }

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 7px;
}
.field-label .req { color: var(--red-mid); margin-left: 3px; }

input[type="text"],
input[type="number"],
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  padding: 11px 15px;
  min-height: 44px;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--gold-dim);
  background: var(--bg-hover);
  box-shadow: 0 0 0 3px rgba(201,168,76,.08);
}
input::placeholder { color: var(--text-dim); }

.select-wrap { position: relative; }
.select-wrap::after {
  content: '▾';
  position: absolute;
  right: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
  font-size: 12px;
  pointer-events: none;
}
select { padding-right: 34px; cursor: pointer; }
select option { background: #1a1a2e; color: var(--text); }

/* Toggle groups */
.toggle-group { display: flex; gap: 8px; flex-wrap: wrap; }
.toggle-group input[type="radio"] { display: none; }

.toggle-btn {
  flex: 1;
  min-width: 80px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s, color .2s;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.toggle-btn:hover { border-color: var(--gold-dim); color: var(--text); }
input[type="radio"]:checked + .toggle-btn {
  border-color: var(--gold);
  background: rgba(201,168,76,.08);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(201,168,76,.1);
}

/* Date row */
.date-row { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 10px; }
.date-row .field { margin-bottom: 0; }

/* Calendar note */
.cal-note {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 6px;
  padding-left: 4px;
  min-height: 16px;
}

/* Leap month */
.leap-field {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(201,168,76,.04);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-sm);
}
.leap-field.visible { display: flex; }
.leap-field label {
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.custom-cb {
  width: 18px; height: 18px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.custom-cb.on { background: rgba(201,168,76,.15); border-color: var(--gold); }
.custom-cb.on::after { content: '✓'; font-size: 11px; color: var(--gold); line-height: 1; }

/* Divider */
.field-divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; opacity: .5; }

/* Errors */
.err-msg {
  font-size: 12px;
  color: #e05050;
  margin-top: 5px;
  padding-left: 4px;
  display: none;
}
.field.err input,
.field.err select { border-color: var(--red-dark); box-shadow: 0 0 0 2px rgba(139,26,26,.15); }
.field.err .err-msg { display: block; }

/* Submit */
.btn-submit {
  width: 100%;
  padding: 15px 24px;
  min-height: 52px;
  background: linear-gradient(135deg, #c9a84c 0%, #a07830 50%, #c9a84c 100%);
  background-size: 200% 100%;
  border: none;
  border-radius: var(--radius-sm);
  color: #0a0a0f;
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .08em;
  cursor: pointer;
  transition: background-position .4s, transform .15s, box-shadow .3s;
  box-shadow: 0 4px 20px rgba(201,168,76,.25);
}
.btn-submit:hover {
  background-position: 100% 0;
  box-shadow: 0 6px 30px rgba(201,168,76,.4);
  transform: translateY(-1px);
}
.btn-submit:active  { transform: translateY(0); }
.btn-submit:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ═══════════════════════════════════════════════════════════
   GLOBAL LOADING OVERLAY
═══════════════════════════════════════════════════════════ */
#loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,10,15,.88);
  backdrop-filter: blur(4px);
  z-index: 200;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
#loading-overlay.active { display: flex; }
.spinner-ring {
  width: 52px; height: 52px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  color: var(--text-muted);
  font-size: 15px;
  letter-spacing: .06em;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: .5; } 50% { opacity: 1; } }

/* ═══════════════════════════════════════════════════════════
   RESULT SECTION
═══════════════════════════════════════════════════════════ */
#result-section {
  display: none;
  padding: 0 20px 72px;
}
#result-section.visible {
  display: block;
  animation: fadeUp .5s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.result-wrap { max-width: 900px; margin: 0 auto; }

/* Result header card */
#result-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 2px solid var(--gold-dim);
  border-radius: 20px;
  padding: 28px 36px;
  margin-bottom: 16px;
  text-align: center;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
#result-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.result-name {
  font-family: 'Playfair Display', serif;
  font-size: clamp(22px, 5vw, 32px);
  color: var(--gold);
  margin-bottom: 10px;
}
.result-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: center; margin-top: 10px; }
.meta-chip {
  background: rgba(201,168,76,.06);
  border: 1px solid var(--gold-border);
  border-radius: 20px;
  padding: 3px 13px;
  font-size: 13px;
  color: var(--text-muted);
}
.meta-chip span { color: var(--gold-light); font-weight: 500; }

/* Action buttons */
.result-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.btn-action {
  padding: 9px 18px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .18s, color .18s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-action:hover { border-color: var(--gold-dim); color: var(--gold); }

/* ═══════════════════════════════════════════════════════════
   TAB NAVIGATION
═══════════════════════════════════════════════════════════ */
.result-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab-btn {
  padding: 10px 20px;
  min-height: 44px;
  white-space: nowrap;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color .2s, border-color .2s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ═══════════════════════════════════════════════════════════
   CHART CONTAINER & GRID
═══════════════════════════════════════════════════════════ */
#chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px 16px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.la-so-title {
  font-family: 'Playfair Display', serif;
  color: var(--gold);
  font-size: 15px;
  text-align: center;
  margin-bottom: 14px;
  letter-spacing: .1em;
  opacity: .8;
}
.la-so-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 3px;
  min-width: 460px;
  aspect-ratio: 1 / 1;
}

/* ─── CUNG CELL — 3-zone layout ───────────────────────────── */
.cung-cell {
  background: #0b0b18;
  border: 1px solid #222236;
  border-radius: 5px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-height: 110px;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  animation: cellIn .4s ease forwards;
  position: relative;
}
@keyframes cellIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
.cung-cell:hover { background: #101022; border-color: #3a3a55; transition: background .18s, border-color .18s; }
.cung-cell.is-menh {
  border: 2px solid var(--gold);
  box-shadow: inset 0 0 20px rgba(201,168,76,.08), 0 0 10px rgba(201,168,76,.1);
}
.cung-cell.is-than {
  border: 2px solid #6a9fd8;
  box-shadow: inset 0 0 16px rgba(106,159,216,.08);
}

/* Zone 1: Header */
.cung-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 6px 2px;
  background: #08080f;
  border-bottom: 1px solid #1c1c2e;
  gap: 4px;
  flex-shrink: 0;
}
.cung-name {
  font-size: clamp(7px, .9vw, 10px);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-dim);
  line-height: 1;
}
.cung-chi {
  font-family: 'Playfair Display', serif;
  font-size: clamp(10px, 1.3vw, 13px);
  font-weight: 600;
  color: #6b7280;
  line-height: 1;
  flex-shrink: 0;
}

/* Badges Mệnh / Thân */
.badge-mt {
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .03em;
  padding: 1px 4px;
  border-radius: 2px;
  line-height: 1.4;
  flex-shrink: 0;
}
.badge-m { background: rgba(201,168,76,.18); color: var(--gold); border: 1px solid var(--gold-dim); }
.badge-t { background: rgba(96,165,250,.15); color: #93c5fd; border: 1px solid #1d4ed8; }

/* Zone 2: Phụ tinh 2 cột (trái=cát, phải=hung) */
.cung-sao-wrapper {
  display: flex;
  gap: 0;
  padding: 3px 5px 2px;
  min-height: 0;
  overflow: hidden;
}
.cung-sao-tot,
.cung-sao-xau {
  flex: 1;
  min-width: 0;
  font-size: clamp(7px, .8vw, 9px);
  line-height: 1.45;
  overflow: hidden;
}
.cung-sao-xau { text-align: right; }
.phu-tinh-item {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Zone 3: Chính tinh */
.cung-chinh-tinh {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px 4px;
  gap: 2px;
  border-top: 1px solid #151528;
  border-bottom: 1px solid #151528;
  text-align: center;
}
.chinh-tinh-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  animation: saoIn .35s ease both;
}
@keyframes saoIn { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
.ct-name {
  font-size: clamp(9px, 1.2vw, 13px);
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: .01em;
  line-height: 1.2;
}
.badge-mieu  { background:#0d2b1a; color:#4ade80; font-size:7px; padding:1px 5px; border-radius:2px; border:1px solid #166534; }
.badge-vuong { background:#0c1e3a; color:#93c5fd; font-size:7px; padding:1px 5px; border-radius:2px; border:1px solid #1d4ed8; }
.badge-dac   { background:#1e1e1e; color:#d1d5db; font-size:7px; padding:1px 5px; border-radius:2px; border:1px solid #374151; }
.badge-binh  { background:#111;    color:#6b7280; font-size:7px; padding:1px 5px; border-radius:2px; border:1px solid #2a2a2a; }
.badge-ham   { background:#2d0a0a; color:#fca5a5; font-size:7px; padding:1px 5px; border-radius:2px; border:1px solid #7f1d1d; }

/* ── Tứ Hóa badges ── */
.badge-hoa-loc   { background:#78350f; color:#fbbf24; font-size:7px; padding:1px 6px; border-radius:2px; border:1px solid #92400e; }
.badge-hoa-quyen { background:#7c2d12; color:#fb923c; font-size:7px; padding:1px 6px; border-radius:2px; border:1px solid #9a3412; }
.badge-hoa-khoa  { background:#4c1d95; color:#c4b5fd; font-size:7px; padding:1px 6px; border-radius:2px; border:1px solid #5b21b6; }
.badge-hoa-ky    { background:#7f1d1d; color:#fca5a5; font-size:7px; padding:1px 6px; border-radius:2px; border:1px solid #991b1b; }
.hoa-badge       { display:inline-flex; align-items:center; font-weight:700; letter-spacing:.02em; }
.hoa-badge-row   { display:flex; justify-content:center; margin-top:1px; }

/* ── Suffix ngắn đi kèm tên sao ── */
.hoa-suffix {
  font-size: 8px;
  font-weight: 700;
  margin-left: 2px;
  vertical-align: middle;
  position: relative;
  cursor: default;
}

/* ── Tooltip ── */
.hoa-suffix[data-tooltip],
.hoa-badge[data-tooltip] {
  position: relative;
}
.hoa-suffix[data-tooltip]::after,
.hoa-badge[data-tooltip]::after  {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: #e8e0d0;
  font-size: 10px;
  font-style: normal;
  font-weight: 400;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #3a3a55;
  box-shadow: 0 4px 12px rgba(0,0,0,.6);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 100;
}
.hoa-suffix[data-tooltip]:hover::after,
.hoa-badge[data-tooltip]:hover::after { opacity: 1; }

/* ── Chính tinh có Tứ Hóa: glow mạnh hơn ── */
.chinh-tinh-item.has-hoa .ct-name { filter: brightness(1.15); }

/* Zone 4: Vòng Tràng Sinh */
.cung-trang-sinh {
  text-align: center;
  font-size: clamp(7px, .8vw, 9px);
  font-style: italic;
  padding: 2px 4px;
  border-top: 1px solid #111124;
  color: var(--text-dim);
  opacity: .82;
  line-height: 1.3;
  transition: opacity .2s;
}
.cung-trang-sinh.trang-sinh-tot {
  font-weight: 600;
  font-style: normal;
  letter-spacing: .02em;
}
.cung-trang-sinh.trang-sinh-xau {
  font-style: italic;
  text-decoration: underline dotted 1px;
}

/* ── Tuần & Triệt ──────────────────────────────────── */
.cung-co-tuan   { border-top: 3px solid #f97316 !important; }
.cung-co-triet  { border-top: 3px solid #dc2626 !important; }
.cung-co-ca-hai { border-top: 3px solid #dc2626 !important;
                  box-shadow: inset 0 2px 0 #f97316; }

.cung-co-tuan  .cung-chinh-tinh,
.cung-co-triet .cung-chinh-tinh,
.cung-co-ca-hai .cung-chinh-tinh { opacity: .65; filter: grayscale(20%); }

.badge-tuan  {
  font-size: 8px; color: #fb923c;
  border: 1px solid #f97316; padding: 0 3px; border-radius: 2px;
  margin-left: 2px; cursor: default;
}
.badge-triet {
  font-size: 8px; color: #fca5a5;
  border: 1px solid #dc2626; padding: 0 3px; border-radius: 2px;
  margin-left: 2px; cursor: default;
}

/* ── Career Report ─────────────────────────────────── */
.career-header {
  background: linear-gradient(135deg, rgba(201,168,76,.08) 0%, rgba(96,165,250,.06) 100%);
  border: 1px solid rgba(201,168,76,.2);
  border-radius: 12px;
  padding: 20px 28px !important;
  text-align: center;
}
.career-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #78350f, #92400e);
  color: #fbbf24;
  font-family: 'Playfair Display', serif;
  font-size: clamp(13px, 2.5vw, 17px);
  font-weight: 600;
  letter-spacing: .06em;
  padding: 7px 20px;
  border-radius: 6px;
  margin-bottom: 10px;
  box-shadow: 0 2px 12px rgba(201,168,76,.2);
}
.career-report h2 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(18px, 3.5vw, 22px);
  color: var(--gold);
  margin: 28px 0 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(201,168,76,.2);
  letter-spacing: .04em;
}
.career-report .report-subtitle {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  letter-spacing: .06em;
  margin-bottom: 24px;
  text-align: center;
}
.career-report h3 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(14px, 2vw, 16px);
  font-weight: 600;
  color: var(--gold-light);
  margin: 24px 0 10px;
  padding: 8px 14px;
  background: rgba(201,168,76,.05);
  border-left: 3px solid var(--gold);
  border-radius: 0 6px 6px 0;
  letter-spacing: .03em;
}
.career-report p  { font-size: clamp(13px, 2vw, 15px); color: #d8d0c0; margin-bottom: 12px; line-height: 1.9; }
.career-report ul { padding-left: 20px; margin: 8px 0 14px; }
.career-report li { font-size: clamp(13px, 2vw, 15px); color: #d8d0c0; margin-bottom: 7px; line-height: 1.75; }
.career-report li::marker { color: var(--gold-dim); }
.career-report strong { color: var(--gold-light); font-weight: 600; }
.career-report ol { padding-left: 20px; margin: 8px 0 14px; counter-reset: none; }
.career-report ol li { color: #d8d0c0; margin-bottom: 10px; line-height: 1.75; }
/* Separator giữa các mục */
.career-report h3 + p:first-of-type { margin-top: 4px; }

/* ── Tứ Hóa item trong zone phụ tinh ─────────────── */
.tu-hoa-item { letter-spacing: -.01em; }
.tu-hoa-item[data-tooltip] { position: relative; cursor: default; }
.tu-hoa-item[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 4px); left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e; color: #e8e0d0;
  font-size: 10px; white-space: nowrap;
  padding: 4px 8px; border-radius: 4px;
  border: 1px solid #3a3a55; box-shadow: 0 4px 12px rgba(0,0,0,.6);
  pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 100;
}
.tu-hoa-item[data-tooltip]:hover::after { opacity: 1; }

/* Center 2×2 */
.cell-center {
  grid-column: 2 / 4;
  grid-row: 2 / 4;
  background: #080810;
  border: 1px solid #1e1e32;
  border-radius: 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 10px;
  gap: 5px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cell-center::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(201,168,76,.04) 0%, transparent 70%);
  pointer-events: none;
}
.c-name  { font-family: 'Playfair Display', serif; font-size: clamp(12px, 2vw, 16px); font-weight: 600; color: var(--gold); line-height: 1.2; word-break: break-word; }
.c-year  { font-size: clamp(9px, 1.3vw, 12px); color: var(--text-muted); font-style: italic; }
.c-line  { width: 36px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-dim), transparent); opacity: .5; margin: 1px 0; }
.c-row   { font-size: clamp(9px, 1.2vw, 12px); color: var(--text-muted); line-height: 1.5; }
.c-row span { color: var(--gold-light); font-weight: 500; }
.c-gender { font-size: 9px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--gold-border); color: var(--gold); background: rgba(201,168,76,.06); margin-top: 1px; }

/* Legacy — kept for fallback */
.sao-name { font-size: clamp(8px, 1.1vw, 12px); font-weight: 600; color: var(--gold); white-space: nowrap; }
.sao-tag  { font-size: clamp(6px, .85vw, 9px); font-weight: 600; padding: 0 3px; border-radius: 3px; border: 1px solid; white-space: nowrap; line-height: 1.5; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════
   SUMMARY TAB
═══════════════════════════════════════════════════════════ */
.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.summary-title {
  font-family: 'Playfair Display', serif;
  color: var(--gold);
  font-size: 18px;
  margin-bottom: 20px;
  text-align: center;
  letter-spacing: .06em;
}
.sum-table { width: 100%; border-collapse: collapse; }
.sum-table tr { border-bottom: 1px solid var(--border); }
.sum-table tr:last-child { border-bottom: none; }
.sum-table tr:hover td { background: rgba(201,168,76,.03); }
.sum-table td { padding: 11px 14px; font-size: 14px; line-height: 1.5; vertical-align: top; }
.sum-table td:first-child {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  width: 36%;
  white-space: nowrap;
}
.sum-table td .hl { color: var(--gold-light); font-weight: 500; }
.sao-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(201,168,76,.06);
  border: 1px solid var(--gold-border);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 3px 2px 0;
}
.sao-chip .sc { color: var(--gold-light); font-weight: 500; }

/* ═══════════════════════════════════════════════════════════
   AI INTERPRETATION
═══════════════════════════════════════════════════════════ */
.ai-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px;
  box-shadow: var(--shadow);
  min-height: 200px;
}
.api-key-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.api-key-bar label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.api-key-bar input {
  flex: 1;
  min-width: 180px;
  min-height: 40px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  transition: border-color .2s;
}
.api-key-bar input:focus { border-color: var(--gold-dim); }

.btn-eye, .btn-luangiai {
  padding: 9px 14px;
  min-height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.btn-eye:hover { border-color: var(--gold-dim); color: var(--text); }
.btn-luangiai {
  background: rgba(201,168,76,.08);
  border-color: var(--gold-dim);
  color: var(--gold);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
}
.btn-luangiai:hover { background: rgba(201,168,76,.15); box-shadow: 0 0 16px rgba(201,168,76,.15); }
.btn-luangiai:disabled { opacity: .4; cursor: not-allowed; }

.ai-placeholder { text-align: center; color: var(--text-dim); padding: 32px 20px; }
.ph-icon { font-size: 28px; display: block; margin-bottom: 10px; opacity: .4; }

/* AI result */
.ai-header {
  text-align: center;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.ai-header::after {
  content: '';
  display: block;
  width: 70px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 14px auto 0;
  opacity: .6;
}
.ai-header h2 { font-family: 'Playfair Display', serif; font-size: clamp(18px, 4vw, 24px); font-weight: 600; color: var(--gold); letter-spacing: .06em; margin-bottom: 5px; }
.ai-subtitle   { font-size: 12px; color: var(--text-dim); font-style: italic; letter-spacing: .04em; }

.ai-prose { max-width: 720px; margin: 0 auto; line-height: 1.85; color: #e8e0d0; }
.ai-prose h3 { font-family: 'Playfair Display', serif; font-size: clamp(14px, 2.5vw, 17px); font-weight: 600; color: var(--gold-light); margin: 26px 0 10px; padding-bottom: 5px; border-bottom: 1px solid var(--gold-border); letter-spacing: .03em; }
.ai-prose h3:first-child { margin-top: 0; }
.ai-prose p  { font-size: clamp(13px, 2vw, 15px); margin-bottom: 11px; color: #d8d0c0; }
.ai-prose ul { padding-left: 18px; margin-bottom: 11px; }
.ai-prose li { font-size: clamp(13px, 2vw, 15px); color: #d8d0c0; margin-bottom: 5px; line-height: 1.7; }
.ai-prose li::marker { color: var(--gold-dim); }
.ai-prose strong { color: var(--gold-light); font-weight: 600; }

/* AI loading */
.ai-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 52px 20px; gap: 18px; }
.ai-spinner { width: 44px; height: 44px; border: 2px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: spin .9s linear infinite; }
.loading-career-tag { display:inline-block; background:rgba(201,168,76,.12); color:var(--gold); font-size:11px; font-weight:600; letter-spacing:.04em; padding:2px 8px; border-radius:4px; border:1px solid var(--gold-dim); margin-right:6px; vertical-align:middle; }
.ai-loading-text { font-family: 'Playfair Display', serif; font-style: italic; color: var(--text-muted); font-size: 15px; letter-spacing: .05em; animation: pulse 1.8s ease-in-out infinite; }
.ai-loading-dots::after { content: ''; animation: dots 1.5s steps(4,end) infinite; }
@keyframes dots { 0%{content:''}25%{content:'.'}50%{content:'..'}75%{content:'...'}100%{content:''} }

/* AI error */
.ai-error { text-align: center; padding: 36px 20px; }
.ai-error-icon { font-size: 32px; margin-bottom: 10px; opacity: .6; }
.ai-error h4 { font-family: 'Playfair Display', serif; color: #f87171; font-size: 16px; margin-bottom: 7px; }
.ai-error p  { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; line-height: 1.6; }
.btn-retry {
  padding: 9px 22px;
  min-height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-retry:hover { border-color: var(--gold-dim); color: var(--gold); }

/* ═══════════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════════ */
.site-footer {
  text-align: center;
  padding: 28px 20px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
}
.site-footer p + p { margin-top: 5px; font-size: 11px; opacity: .6; }
.site-footer a { color: var(--gold-dim); text-decoration: none; }
.site-footer a:hover { color: var(--gold); }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 560px) {
  .form-card   { padding: 22px 16px; border-radius: 16px; }
  .date-row    { grid-template-columns: 1fr 1fr; }
  .date-row .year-field { grid-column: 1 / -1; }
  #result-header { padding: 22px 18px; }
  .summary-card, .ai-card { padding: 22px 16px; }
  .tab-btn     { padding: 10px 14px; font-size: 13px; }
  .api-key-bar input { min-width: 120px; }
  .la-so-grid  { min-width: 340px; }
  .cung-cell   { min-height: 90px; }
  .ct-name     { font-size: 9px !important; }
  .cung-name   { font-size: 7px; }
  .cung-sao-tot, .cung-sao-xau { font-size: 7px; }
  .cung-trang-sinh { font-size: 7px; }
}
@media (max-width: 400px) {
  .toggle-group { flex-direction: column; }
  .la-so-grid   { min-width: 300px; }
}
@media (max-width: 340px) {
  .la-so-grid { min-width: 260px; }
}

/* ═══════════════════════════════════════════════════════════
   PRINT
═══════════════════════════════════════════════════════════ */
@media print {
  *, *::before, *::after { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body { background: #fff !important; color: #111 !important; }
  body::before, .site-header, .form-section, .api-section, #loading-overlay,
  .result-actions, .api-key-bar, .btn-luangiai, .ai-placeholder, .site-footer { display: none !important; }
  #result-section { display: block !important; padding: 0; }
  .result-wrap    { max-width: 100%; }
  #result-header  { border: 1px solid #ccc; border-radius: 4px; background: #fafafa !important; box-shadow: none; padding: 16px; margin-bottom: 12px; }
  .result-name    { color: #222 !important; }
  .meta-chip      { border: 1px solid #ddd; background: #f5f5f5 !important; }
  .meta-chip span { color: #333 !important; }
  .result-tabs    { display: none; }
  .tab-panel      { display: block !important; }
  #chart-container { background: #fff !important; border: 1px solid #ccc; box-shadow: none; border-radius: 4px; }
  .cung-cell    { background: #fafafa !important; border: 1px solid #ccc !important; border-radius: 2px; animation: none !important; opacity: 1 !important; }
  .cung-cell.is-menh { border: 2px solid #996600 !important; }
  .cung-cell.is-than { border: 2px solid #336699 !important; }
  .cung-name, .cung-chi, .sao-name { color: #222 !important; }
  .cell-center  { background: #f5f5f0 !important; border: 1px solid #ccc !important; }
  .c-name { color: #996600 !important; }
  .c-row, .c-row span, .c-year { color: #444 !important; }
  .sao-tag { border: 1px solid #999 !important; color: #333 !important; background: #eee !important; }
  .badge-m { background: #fff3cc !important; color: #996600 !important; border-color: #cc9900 !important; }
  .badge-t { background: #d0e8f5 !important; color: #1a5276 !important; border-color: #2980b9 !important; }
  .ai-card, .summary-card { background: #fff !important; border: 1px solid #ccc; box-shadow: none; border-radius: 4px; }
  .ai-header h2, .summary-title { color: #996600 !important; }
  .ai-prose h3 { color: #774400 !important; border-bottom-color: #ddd; }
  .ai-prose p, .ai-prose li { color: #222 !important; }
  .sum-table td { color: #222 !important; border-bottom-color: #eee; }
  .sum-table td:first-child { color: #555 !important; }
  .sao-chip { border: 1px solid #ccc !important; background: #f5f5f5 !important; }
  .sao-chip .sc { color: #663300 !important; }
  @page { margin: 1.5cm; }
}
</style>
<style>
/* ── Topic Selection Panel ── */
.topic-panel {
  display: none;
  max-width: 760px;
  margin: 0 auto 24px;
  animation: fadeUp .45s ease both;
}
.topic-panel.visible { display: block; }

.topic-header {
  text-align: center;
  padding: 28px 24px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 2px solid var(--gold-dim);
  border-radius: 16px 16px 0 0;
}
.topic-header h3 {
  font-family: 'Playfair Display', serif;
  color: var(--gold);
  font-size: clamp(15px, 3vw, 20px);
  margin-bottom: 8px;
  letter-spacing: .04em;
}
.topic-header p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 480px;
  margin: 0 auto;
}
.topic-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
  margin: 0;
}
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 16px 16px;
  overflow: hidden;
}
.topic-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 18px 20px;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  transition: background .18s;
  font-family: 'Inter', sans-serif;
  position: relative;
}
.topic-btn:last-child { border-right: none; }
.topic-btn:nth-last-child(-n+3) { border-bottom: none; }
.topic-btn:hover { background: rgba(201,168,76,.06); }
.topic-btn.active {
  background: rgba(201,168,76,.1);
  border-color: var(--gold-dim);
}
.topic-btn.active::after {
  content: '✦';
  position: absolute;
  top: 10px; right: 12px;
  color: var(--gold);
  font-size: 10px;
}
.topic-icon {
  font-size: 22px;
  line-height: 1;
}
.topic-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: .02em;
}
.topic-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.45;
}
.topic-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid;
}
.tag-free { background: rgba(74,222,128,.08); border-color: rgba(74,222,128,.3); color: #4ade80; }
.tag-detail { background: rgba(201,168,76,.08); border-color: var(--gold-dim); color: var(--gold); }
.tag-new { background: rgba(96,165,250,.08); border-color: rgba(96,165,250,.3); color: #60a5fa; }

/* ── Inline loading for topic detail ── */
#topic-result-area {
  max-width: 760px;
  margin: 0 auto;
  animation: fadeUp .4s ease both;
}
.result-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 36px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

/* ── Overview result (auto-shown after form submit) ── */
.overview-result {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 2px solid var(--gold-dim);
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.overview-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--gold-border);
  width: 100%;
}

/* ── Back to overview button ── */
.btn-back-overview {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  padding: 8px 16px;
  cursor: pointer;
  margin-bottom: 16px;
  transition: border-color .15s, color .15s;
}
.btn-back-overview:hover { border-color: var(--gold-dim); color: var(--gold); }

/* ── Chart mini in overview ── */
.overview-chart-wrap {
  margin: 16px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

/* ── State: loading topic detail ── */
.topic-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  gap: 16px;
}
.topic-spinner {
  width: 40px; height: 40px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
.topic-loading-text {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  color: var(--text-muted);
  font-size: 14px;
  letter-spacing: .04em;
  animation: pulse 1.8s ease-in-out infinite;
}

/* ── Scrollable section anchors ── */
html { scroll-behavior: smooth; }
</style>


/* ═══════════════════════════════════════════════════════════
   WORDPRESS THEME — ADDITIONAL STYLES
═══════════════════════════════════════════════════════════ */

/* Site header (WP nav) */
.site-header-wp {
  background: rgba(10,10,15,.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 100;
  padding: 0 20px;
}
.site-header-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center;
  gap: 24px; height: 60px;
}
.site-brand {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; font-family: 'Playfair Display', serif;
  color: var(--gold); font-size: 16px; font-weight: 600;
  white-space: nowrap;
}
.brand-star { font-size: 12px; opacity: .7; }
.site-nav { flex: 1; }
.nav-list { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-list a {
  color: var(--text-muted); font-size: 14px; text-decoration: none;
  padding: 6px 12px; border-radius: 6px; transition: color .15s, background .15s;
}
.nav-list a:hover { color: var(--gold); background: rgba(201,168,76,.08); }
.header-auth { display: flex; align-items: center; gap: 8px; }
.btn-header-login {
  padding: 7px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--gold-dim); background: rgba(201,168,76,.08);
  color: var(--gold); font-size: 13px; font-weight: 500;
  font-family: 'Inter', sans-serif; cursor: pointer; transition: background .15s;
}
.btn-header-login:hover { background: rgba(201,168,76,.15); }
.user-menu { position: relative; }
.btn-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(201,168,76,.15); border: 1px solid var(--gold-dim);
  color: var(--gold); font-weight: 600; font-size: 15px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-family: 'Inter', sans-serif;
}
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  min-width: 200px; z-index: 200; overflow: hidden;
}
.user-info { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.user-name  { font-weight: 600; font-size: 14px; color: var(--text); }
.user-email { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 0; }
.user-dropdown a {
  display: block; padding: 10px 16px; font-size: 13px;
  color: var(--text-muted); text-decoration: none; transition: background .15s;
}
.user-dropdown a:hover { background: var(--bg-hover); color: var(--text); }

/* Auth modal */
.auth-modal {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
}
.auth-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
}
.auth-box {
  position: relative; z-index: 1;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; padding: 36px 32px;
  width: min(420px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.6);
  animation: fadeUp .3s ease both;
}
.auth-close {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none; color: var(--text-muted);
  font-size: 18px; cursor: pointer; padding: 4px;
}
.auth-header { text-align: center; margin-bottom: 24px; }
.auth-logo { font-size: 28px; color: var(--gold); margin-bottom: 8px; }
.auth-title { font-family: 'Playfair Display', serif; color: var(--gold); font-size: 22px; margin-bottom: 4px; }
.auth-sub   { font-size: 13px; color: var(--text-muted); }
.btn-google {
  width: 100%; padding: 11px; display: flex; align-items: center;
  justify-content: center; gap: 10px;
  background: #fff; border: none; border-radius: var(--radius-sm);
  color: #444; font-size: 14px; font-weight: 500; cursor: pointer;
  font-family: 'Inter', sans-serif; transition: box-shadow .15s;
}
.btn-google:hover { box-shadow: 0 2px 12px rgba(0,0,0,.2); }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0; font-size: 12px; color: var(--text-dim);
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.auth-tabs { display: flex; gap: 4px; margin-bottom: 18px; background: var(--bg-input); border-radius: 8px; padding: 3px; }
.auth-tab {
  flex: 1; padding: 7px; border: none; border-radius: 6px;
  background: none; color: var(--text-muted); font-size: 13px;
  cursor: pointer; font-family: 'Inter', sans-serif; transition: all .15s;
}
.auth-tab.active { background: var(--bg-card); color: var(--gold); font-weight: 500; }
.auth-field { margin-bottom: 14px; position: relative; }
.auth-field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; font-weight: 500; }
.auth-field input {
  width: 100%; padding: 10px 12px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px; font-family: 'Inter', sans-serif;
  outline: none; transition: border-color .15s;
}
.auth-field input:focus { border-color: var(--gold-dim); }
.auth-eye {
  position: absolute; right: 10px; bottom: 10px;
  background: none; border: none; cursor: pointer; font-size: 14px; padding: 2px;
}
.auth-forgot { text-align: right; margin: -6px 0 10px; }
.auth-forgot a { font-size: 12px; color: var(--gold); text-decoration: none; }
.btn-auth-submit {
  width: 100%; padding: 12px; background: rgba(201,168,76,.12);
  border: 1px solid var(--gold-dim); border-radius: var(--radius-sm);
  color: var(--gold); font-size: 14px; font-weight: 600;
  font-family: 'Inter', sans-serif; cursor: pointer; transition: background .15s;
  margin-top: 4px;
}
.btn-auth-submit:hover { background: rgba(201,168,76,.2); }
.auth-msg { font-size: 13px; margin-top: 12px; text-align: center; min-height: 18px; }

/* Save option in form */
.save-option {
  background: rgba(201,168,76,.05); border: 1px solid var(--gold-border);
  border-radius: var(--radius-sm); padding: 14px 16px; margin-top: 16px;
}
.save-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-muted); cursor: pointer;
}
.save-label input[type=checkbox] { accent-color: var(--gold); width: 15px; height: 15px; }

/* Save toast */
.save-toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  background: rgba(74,222,128,.15); border: 1px solid rgba(74,222,128,.3);
  color: #4ade80; padding: 12px 20px; border-radius: 8px;
  font-size: 14px; animation: fadeUp .3s ease both;
}

/* Dashboard */
.tuvi-dashboard-wrap { max-width: 960px; margin: 0 auto; padding: 40px 20px; }
.dashboard-header { text-align: center; margin-bottom: 32px; }
.dashboard-title { font-family: 'Playfair Display', serif; color: var(--gold); font-size: 28px; }
.dashboard-sub { color: var(--text-muted); margin-top: 6px; }
.dash-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px; color: var(--text-muted); }
.dash-empty { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: .5; }
.btn-dash-login, .btn-dash-new {
  display: inline-block; margin-top: 16px; padding: 10px 24px;
  background: rgba(201,168,76,.1); border: 1px solid var(--gold-dim);
  border-radius: var(--radius-sm); color: var(--gold); font-size: 14px;
  font-weight: 500; text-decoration: none; cursor: pointer;
  font-family: 'Inter', sans-serif; transition: background .15s;
}
.btn-dash-login:hover, .btn-dash-new:hover { background: rgba(201,168,76,.2); }
.dash-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr));
  gap: 16px;
}
.dash-chart-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  transition: border-color .18s; box-shadow: 0 4px 20px rgba(0,0,0,.3);
}
.dash-chart-card:hover { border-color: var(--gold-dim); }
.chart-card-header { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.chart-card-icon { font-size: 24px; }
.chart-card-name { font-weight: 600; color: var(--gold-light); font-size: 15px; }
.chart-card-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.chart-card-info { display: flex; gap: 16px; font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.chart-card-info strong { color: var(--text); }
.chart-card-footer { display: flex; justify-content: space-between; align-items: center; }
.chart-date { font-size: 11px; color: var(--text-dim); }
.chart-card-actions { display: flex; gap: 6px; }
.chart-card-actions button {
  padding: 5px 12px; border-radius: 6px; font-size: 12px;
  cursor: pointer; font-family: 'Inter', sans-serif; transition: all .15s;
  background: rgba(201,168,76,.08); border: 1px solid var(--gold-border);
  color: var(--gold);
}
.chart-card-actions button:hover { background: rgba(201,168,76,.15); }
.chart-card-actions .btn-delete { background: rgba(185,28,28,.08); border-color: rgba(185,28,28,.3); color: #f87171; }
.chart-card-actions .btn-delete:hover { background: rgba(185,28,28,.15); }

/* Chart modal */
.chart-modal { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center; }
.chart-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); }
.chart-modal-box {
  position: relative; z-index: 1; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 36px 32px; width: min(700px, 94vw); max-height: 85vh;
  overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.6);
}

/* Site footer */
.site-footer-wp { padding: 32px 20px; text-align: center; border-top: 1px solid var(--border); margin-top: 60px; }
.footer-brand { font-family: 'Playfair Display', serif; color: var(--gold-dim); font-size: 14px; margin-bottom: 4px; }
.footer-note  { font-size: 12px; color: var(--text-dim); }
.footer-copy  { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* WP body cleanup */
body { background: var(--bg) !important; }
#wpadminbar { display: none; }
html { margin-top: 0 !important; }
