/* Fluxgate theme — dark-tech palette from owner's 五行 (喜火、辅土). See /workspace/fluxgate/reports/五行配色.md */
:root {
  --bg: #14100d;
  --bg2: #1b1511;
  --card: #231c16;
  --line: #3f3228;
  --txt: #f6efe6;
  --mut: #b49a86;
  --ink: #f6efe6;
  --ac: #e07030;
  --ac2: #c45218;
  --gold: #e0b04a;
  --soft: rgba(224, 112, 48, 0.16);
  --ok: #3dbe7a;
  --warn: #f0a020;
  --bad: #e24b32;
  --bd: #3f3228;
  --acc: #e07030;
  --acc2: #e0b04a;
}

html, body {
  background: var(--bg) !important;
  color: var(--txt) !important;
}

a { color: var(--ac); }
a:hover { color: #f0a15c; }

header.top,
.topbar,
header {
  background: rgba(20, 16, 13, 0.88) !important;
  border-bottom-color: var(--line) !important;
  box-shadow: none !important;
  color: var(--txt) !important;
}
header.top .brand,
.topbar .brand,
.brand,
.brand .wm,
.logo,
.logo span {
  color: var(--txt) !important;
  background: none !important;
  -webkit-text-fill-color: var(--txt);
}
.brand .wm {
  background: linear-gradient(90deg, #f6efe6 0%, #e0b04a 100%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
}

nav.m a, .topnav a, .nav a.link { color: var(--mut) !important; }
nav.m a:hover, .topnav a:hover, .nav a.link:hover { color: var(--gold) !important; }

.btn, .btn.primary, button.btn {
  background: #c45218 !important;
  color: #fff !important;
  border-color: #c45218 !important;
}
.btn:hover, .btn.primary:hover { background: #9a3412 !important; border-color: #9a3412 !important; }
.btn.ghost, .btn.w {
  background: transparent !important;
  color: var(--txt) !important;
  border: 1px solid var(--line) !important;
}
.btn.ghost:hover, .btn.w:hover {
  border-color: var(--ac) !important;
  color: var(--gold) !important;
}

.hero {
  background: linear-gradient(180deg, rgba(224, 112, 48, 0.10) 0%, rgba(20, 16, 13, 0.2) 55%, var(--bg) 100%) !important;
  color: var(--txt) !important;
}
.hero h1 em,
h1 em {
  background: linear-gradient(90deg, #ff7a3c, #e0b04a) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  color: transparent !important;
}

.card, .box, .panel, .kpi, .mcard, .chip, .urlbox,
.side, footer, .prof, .faq, .cta, .cta-block, .banner {
  background: var(--card) !important;
  border-color: var(--line) !important;
  color: var(--txt) !important;
}
.cta-block, .banner {
  background: linear-gradient(120deg, rgba(224, 112, 48, 0.16), rgba(224, 176, 74, 0.08)) !important;
  border-color: rgba(224, 112, 48, 0.35) !important;
}
.hero .cta { background: transparent !important; border: 0 !important; box-shadow: none !important; }
.side { background: var(--bg2) !important; }
.side a { color: var(--mut) !important; }
.side a:hover, .side a.on { background: var(--soft) !important; color: var(--gold) !important; }

input, select, textarea, .tools input, .tools select, select.lang, .right select, .topbar select {
  background: var(--bg2) !important;
  color: var(--txt) !important;
  border-color: var(--line) !important;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ac) !important;
  box-shadow: 0 0 0 3px rgba(224, 112, 48, 0.18) !important;
}

table th { background: var(--bg2) !important; color: var(--mut) !important; }
table td, table th { border-bottom-color: var(--line) !important; color: var(--txt); }
tbody tr:hover { background: rgba(224, 112, 48, 0.06) !important; }

.sub, .lead, p.l, .note, .fine, footer, footer a { color: var(--mut) !important; }
footer a:hover { color: var(--gold) !important; }
footer a { display: inline-block; }

pre, .codebox { background: #0c0a08 !important; border-color: var(--line) !important; color: #f3e6d4 !important; }
code { color: #f3e6d4; background: rgba(224, 112, 48, 0.10); }

#lowBalBar { background: rgba(240, 160, 32, 0.15) !important; border-color: rgba(240, 160, 32, 0.35) !important; color: var(--warn) !important; }
#annBar { background: var(--soft) !important; border-color: rgba(224, 112, 48, 0.3) !important; color: var(--gold) !important; }

.tag.ok { background: rgba(61, 190, 122, 0.16); color: #7ee0a8; }
.tag.warn { background: rgba(240, 160, 32, 0.16); color: #f0c36b; }
.tag.soft { background: rgba(255,255,255,0.06); color: var(--mut); }

.chart div, .chart .bar { background: linear-gradient(180deg, #f0a15c, #e07030) !important; }
.donut { background: conic-gradient(#e07030 0 55%, #e0b04a 55% 100%) !important; }
.donut::after { background: var(--card) !important; }

.hot { background: rgba(226, 75, 50, 0.18); color: #ff8a74; }

canvas#fg-particles, canvas#dots, canvas#bg, canvas.fg-particles {
  pointer-events: none;
}
canvas#dots.fg-intro-on {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 40 !important;
  opacity: 1 !important;
  pointer-events: auto;
}
body.fg-intro-active .hero { z-index: 40 !important; }
body.fg-intro-active > section:not(.hero) { z-index: 0 !important; }
#fg-intro-skip {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 41;
  color: #d7c4b0;
  font-size: 12.5px;
  letter-spacing: .06em;
  pointer-events: none;
  text-shadow: 0 1px 8px rgba(20,16,13,.8);
}
canvas#fg-particles, canvas.fg-particles {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
.hero #dots { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.85; }
body > header, body > .topbar, body > .shell, body > main, body > footer,
body > section, body > .auth, body > .top, body > #annBar, body > #lowBalBar {
  position: relative;
  z-index: 1;
}
header.top, .topbar { z-index: 50 !important; }

@media (prefers-reduced-motion: reduce) {
  canvas#fg-particles, canvas#dots, canvas#bg, canvas.fg-particles { display: none !important; }
}

.legal { color: var(--txt); }
.legal p, .legal li { color: #d7c4b0 !important; }

.fg-ember {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse 70% 55% at 50% 32%, rgba(224,112,48,0.28), rgba(224,176,74,0.08) 42%, transparent 70%);
}
@media (prefers-reduced-motion: reduce) {
  .hero {
    background: radial-gradient(ellipse 80% 60% at 50% 30%, rgba(224,112,48,0.22), #14100d 70%) !important;
  }
}

/* console / forms that used raw #fff */
.topbar, .chip, .kpi, .mcard, .prof, .gate, .seg b, .seg span {
  background: var(--card) !important;
  color: var(--txt);
  border-color: var(--line) !important;
}
.topbar { background: rgba(20,16,13,0.92) !important; }
.side a { color: var(--mut) !important; }
.urlbox { background: var(--bg2) !important; color: var(--txt) !important; }
.donut::after { background: var(--card) !important; }
.fgroup h5, .fopt, .um, .who, .topnav a, .rule { color: var(--txt) !important; }
.um:hover, .fopt:hover { background: var(--soft) !important; color: var(--gold) !important; }
.hrow, .noti, .fgroup { border-bottom-color: var(--line) !important; }
th { background: var(--bg2) !important; }
header .brand, header .tag { color: #f6efe6; }

/* admin gate + header */
.gate { background: var(--card) !important; border-color: var(--line) !important; color: var(--txt) !important; }

#fg-cookie {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  background: #231c16;
  color: #f6efe6;
  border: 1px solid #3f3228;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
#fg-cookie p { margin: 0; font-size: 13.5px; line-height: 1.55; color: #d7c4b0; }
:focus-visible {
  outline: 2px solid #e07030;
  outline-offset: 2px;
}
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #e07030;
  outline-offset: 2px;
}

/* Shared header layout so pages without inline .top CSS keep spaced nav links */
header.top .wrap {
  display: flex !important;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
  box-sizing: border-box;
}
header.top .brand {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  text-decoration: none;
}
header.top nav.m {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px !important;
  flex: 1;
  min-width: 0;
}
header.top nav.m a {
  white-space: nowrap;
  text-decoration: none;
  font-size: 14px;
}
header.top .right {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
body.fg-cookie-on { padding-bottom: 88px; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  background: #c45218;
  color: #fff;
  padding: 8px 12px;
  z-index: 100;
  border-radius: 8px;
  text-decoration: none;
}
.skip-link:focus, .skip-link:focus-visible {
  top: 12px;
  outline: 2px solid #e0b04a;
  outline-offset: 2px;
}

@media (max-width: 700px) {
  html, body { overflow-x: hidden; }
  header.top { height: auto !important; padding: 8px 0 !important; }
  header.top .wrap {
    flex-wrap: wrap !important;
    gap: 10px;
    height: auto !important;
    min-height: 0;
    padding: 8px 16px !important;
  }
  header.top .brand { font-size: 17px !important; }
  header.top .brand .mk { width: 24px !important; height: 24px !important; }
  header.top nav.m {
    order: 3;
    width: 100%;
    flex: 1 1 100% !important;
    display: flex !important;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 14px !important;
    padding: 6px 0 2px;
  }
  header.top nav.m a {
    margin: 0 !important;
    font-size: 13.5px !important;
    white-space: nowrap;
  }
  header.top .right {
    margin-left: auto;
    gap: 8px !important;
    flex-wrap: wrap;
    max-width: 100%;
  }
  header.top .right .btn { padding: 7px 12px !important; font-size: 13px !important; }
  header.top .right select,
  header.top select.lang { max-width: 92px !important; }
  .g2, .g3, .g4, .g5, .layout, .split { grid-template-columns: 1fr !important; }
  header.top, .top {
    left: auto !important;
    right: auto !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
  }
  .layout, .layout > *, main { min-width: 0; max-width: 100%; }
  pre, .codebox { max-width: 100%; overflow-x: auto; }
  .wrap-table { max-width: 100%; overflow-x: auto; }
  footer .wrap { flex-wrap: wrap !important; max-width: 100%; box-sizing: border-box; }
  footer .wrap > * { min-width: 0 !important; max-width: 100%; }
  footer .wrap > div { flex: 1 1 100% !important; min-width: 0 !important; max-width: 100% !important; }
  footer a { display: inline-block; white-space: normal; }
}

/* Responsive content must fit without depending on root overflow clipping. */
.layout > * { min-width: 0; }
.table-scroll {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
.table-scroll > table { width: 100%; }
@media (max-width: 900px) {
  header > .nav {
    height: auto;
    min-height: 64px;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  header > .nav a.link { display: inline-block; }
  header > .nav .spacer { display: none; }
  header > .nav .brand { flex: 1 0 100%; }
}

/* One footer extension per footer, in normal flow at every viewport size. */
footer .fg-footer-links {
  display: flex;
  flex-wrap: wrap;
  flex: 1 1 100%;
  gap: 8px 16px;
  position: static;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto;
  margin-top: 12px;
  box-sizing: border-box;
  white-space: normal;
}
footer .fg-footer-links a {
  margin: 0 !important;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
