:root {
  color-scheme: light;
  --page-bg: #ffffff;
  --header-bg: #ffffff;
  --text-color: #17191f;
  --muted-color: #707784;
  --border-color: #e7e9ee;
  --panel-bg: #ffffff;
  --soft-bg: #f7f8fa;
  --button-bg: #f4f4f5;
  --button-hover: #e9e9eb;
  --accent: #5b6cff;
  --shadow: 0 8px 28px rgba(20, 25, 40, .045);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #101114;
  --header-bg: #17191e;
  --text-color: #f5f6f8;
  --muted-color: #a6acb8;
  --border-color: #2b2e36;
  --panel-bg: #17191e;
  --soft-bg: #20232b;
  --button-bg: #252832;
  --button-hover: #323642;
  --accent: #8995ff;
  --shadow: 0 8px 28px rgba(0, 0, 0, .14);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  min-height: 100vh; background: var(--page-bg); color: var(--text-color);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  transition: background-color 180ms ease, color 180ms ease;
}
.site-header {
  width: 100%; min-height: 68px; padding: 0 5%; display: flex; align-items: center;
  justify-content: space-between; background: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
}
.site-logo { color: var(--text-color); font-size: 21px; font-weight: 800; text-decoration: none; letter-spacing: -.6px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 40px; padding: 0 14px; border: 1px solid var(--border-color);
  border-radius: 9px; background: var(--button-bg); color: var(--text-color);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.theme-toggle:hover { background: var(--button-hover); }
.theme-toggle:focus-visible, .site-logo:focus-visible, .history-bar:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme-icon { font-size: 18px; line-height: 1; }
.home-page { min-height: calc(100vh - 69px); }
.sentiment-section { width: min(1160px, calc(100% - 40px)); margin: 0 auto; padding: 52px 0 64px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 1.5px; }
h1 { margin: 0; font-size: clamp(28px, 4vw, 40px); line-height: 1.15; letter-spacing: -1.2px; }
.section-intro { max-width: 720px; margin: 12px 0 0; color: var(--muted-color); font-size: 15px; line-height: 1.7; }
.live-indicator { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 11px; border: 1px solid var(--border-color); border-radius: 999px; color: var(--muted-color); font-size: 12px; white-space: nowrap; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #20b779; box-shadow: 0 0 0 4px rgba(32,183,121,.12); }
.sentiment-grid { display: grid; grid-template-columns: minmax(280px, .82fr) minmax(0, 1.5fr); gap: 18px; }
.panel { background: var(--panel-bg); border: 1px solid var(--border-color); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
.panel-topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel h2 { margin: 0; font-size: 16px; letter-spacing: -.2px; }
.source-tag { padding: 5px 8px; border-radius: 6px; background: var(--soft-bg); color: var(--muted-color); font-size: 10px; font-weight: 700; }
.subtle-text { color: var(--muted-color); font-size: 11px; }
.gauge-wrap { display: flex; justify-content: center; padding: 34px 0 18px; }
.gauge {
  --gauge-angle: 0deg; --gauge-color: #9298a5;
  width: 206px; height: 206px; display: grid; place-items: center; border-radius: 50%;
  background: conic-gradient(from -90deg, var(--gauge-color) var(--gauge-angle), var(--soft-bg) 0);
  position: relative;
}
.gauge::before { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: var(--panel-bg); }
.gauge-inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.gauge-value { font-size: 58px; line-height: 1; font-weight: 800; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.gauge-out-of { color: var(--muted-color); font-size: 10px; font-weight: 700; letter-spacing: 1.3px; }
.sentiment-label { margin: 0; text-align: center; font-size: 20px; font-weight: 800; }
.updated-line { margin: 8px 0 0; color: var(--muted-color); text-align: center; font-size: 11px; }
.gauge-caption { margin: 19px 0 14px; color: var(--muted-color); text-align: center; font-size: 12px; }
.scale-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px 13px; padding-top: 14px; border-top: 1px solid var(--border-color); }
.scale-legend span { display: inline-flex; align-items: center; gap: 5px; color: var(--muted-color); font-size: 10px; }
.legend-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; }
.extreme-fear { background: #e34b55; } .fear { background: #f08a4b; } .neutral { background: #e6bd4b; } .greed { background: #9abd57; } .extreme-greed { background: #25a978; }
.history-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 24px 0 28px; }
.history-stat { min-width: 0; padding: 14px 12px; border-radius: 10px; background: var(--soft-bg); }
.stat-label, .stat-description { display: block; color: var(--muted-color); font-size: 11px; }
.history-stat strong { display: block; margin: 7px 0 4px; font-size: 25px; letter-spacing: -.7px; font-variant-numeric: tabular-nums; }
.stat-description { font-size: 10px; }
.history-chart-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.history-chart-heading h3 { margin: 0; font-size: 13px; }
.history-chart-heading span { color: var(--muted-color); font-size: 10px; }
.history-chart { height: 154px; display: flex; align-items: flex-end; gap: 4px; padding: 12px 4px 0; border-bottom: 1px solid var(--border-color); background: repeating-linear-gradient(to bottom, transparent 0, transparent 37px, var(--border-color) 38px, transparent 39px); }
.chart-loading { align-self: center; width: 100%; color: var(--muted-color); text-align: center; font-size: 12px; }
.history-bar { flex: 1 1 0; min-width: 3px; max-width: 18px; height: var(--bar-height); padding: 0; border: 0; border-radius: 4px 4px 0 0; background: var(--bar-color); cursor: pointer; opacity: .82; transition: opacity .15s, transform .15s; }
.history-bar:hover, .history-bar.selected { opacity: 1; transform: scaleY(1.04); transform-origin: bottom; }
.chart-axis { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted-color); font-size: 9px; }
.chart-note { margin: 12px 0 7px; color: var(--muted-color); font-size: 10px; line-height: 1.5; }
.selected-reading { color: var(--text-color); font-size: 11px; font-weight: 600; min-height: 16px; }
.explanation-panel, .methodology-panel { margin-top: 18px; }
.score-guide { display: grid; gap: 0; margin-top: 14px; }
.score-row { display: grid; grid-template-columns: 94px 1fr; gap: 15px; align-items: start; padding: 15px 0; border-top: 1px solid var(--border-color); }
.score-range { display: inline-flex; justify-content: center; padding: 7px 8px; border-radius: 7px; font-size: 12px; font-weight: 800; }
.range-extreme-fear { color: #d83f4b; background: rgba(227,75,85,.12); }
.range-fear { color: #dc783b; background: rgba(240,138,75,.13); }
.range-neutral { color: #b28b19; background: rgba(230,189,75,.16); }
.range-greed { color: #719b35; background: rgba(154,189,87,.16); }
.range-extreme-greed { color: #16865d; background: rgba(37,169,120,.13); }
.score-row strong { display: block; margin: 1px 0 4px; font-size: 13px; }
.score-row p, .factor-item p { margin: 0; color: var(--muted-color); font-size: 12px; line-height: 1.6; }
.method-intro { margin: 13px 0 18px; color: var(--muted-color); font-size: 13px; line-height: 1.7; }
.factor-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.factor-item { display: flex; gap: 11px; padding: 14px; border-radius: 10px; background: var(--soft-bg); }
.factor-icon { flex: 0 0 30px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--panel-bg); color: var(--accent); font-size: 15px; font-weight: 800; }
.factor-item strong { display: block; margin: 1px 0 5px; font-size: 12px; }
.factor-item p { font-size: 11px; }
.method-footnote { margin: 15px 0 0; color: var(--muted-color); font-size: 10px; line-height: 1.6; }
.disclaimer { margin-top: 18px; padding: 16px 18px; border: 1px solid var(--border-color); border-left: 3px solid var(--accent); border-radius: 10px; background: var(--soft-bg); color: var(--muted-color); font-size: 12px; line-height: 1.7; }
.disclaimer strong { color: var(--text-color); }
.data-attribution { margin: 15px 0 0; color: var(--muted-color); text-align: center; font-size: 11px; }
.data-attribution a { color: var(--accent); text-decoration: none; }
.data-attribution a:hover { text-decoration: underline; }
@media (max-width: 800px) {
  .sentiment-grid { grid-template-columns: 1fr; }
  .factor-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .site-header { min-height: 62px; padding: 0 16px; }
  .site-logo { font-size: 18px; }
  .theme-toggle { min-height: 38px; padding: 0 11px; font-size: 13px; }
  .sentiment-section { width: min(100% - 28px, 1160px); padding: 34px 0 45px; }
  .section-heading { display: block; }
  .live-indicator { margin-top: 16px; }
  .panel { padding: 18px 15px; border-radius: 13px; }
  .history-stats { gap: 7px; }
  .history-stat { padding: 12px 9px; }
  .history-stat strong { font-size: 21px; }
  .factor-grid { grid-template-columns: 1fr; }
  .score-row { grid-template-columns: 78px 1fr; gap: 10px; }
  .score-range { font-size: 11px; }
  .gauge { width: 190px; height: 190px; }
  .history-chart { gap: 2px; }
}

/* Nafalogy Market Status / segmented Fear & Greed gauge */
.section-heading { margin-bottom: 20px; }
.section-heading h1 { font-size: clamp(25px, 3.5vw, 32px); letter-spacing: -.7px; }
.heading-chevron { color: var(--muted-color); font-size: 1.15em; font-weight: 400; margin-left: 5px; }
.sentiment-grid { grid-template-columns: minmax(300px, .95fr) minmax(0, 1fr); gap: 16px; }
.current-panel {
  background: #222631; color: #f7f8fb; border-color: #303645;
  border-radius: 18px; padding: 24px 24px 20px; box-shadow: none;
}
.current-panel .panel-topline { justify-content: flex-start; }
.current-panel h2 { color: #aab1c2; font-size: 17px; font-weight: 500; }
.current-panel .source-tag { margin-left: auto; background: #2c3240; color: #b5bdcd; }
.gauge-wrap { padding: 23px 0 0; }
.semi-gauge { width: min(100%, 270px); height: 166px; position: relative; margin: 0 auto; }
.gauge-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.gauge-segment { fill: none; stroke-width: 12; stroke-linecap: round; }
.seg-red { stroke: #f04452; }
.seg-orange { stroke: #f28a00; }
.seg-yellow { stroke: #f4d32e; }
.seg-lime { stroke: #8bd500; }
.seg-green { stroke: #12bd91; }
.gauge-marker { fill: #fff; stroke: #222631; stroke-width: 3; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
.gauge-number { position: absolute; left: 50%; top: 55%; transform: translate(-50%, -50%); }
.gauge-value { color: #fff; font-size: 34px; line-height: 1; font-weight: 800; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.current-panel .sentiment-label {
  display: table; margin: -3px auto 0; padding: 5px 13px 6px;
  border-radius: 999px; color: #fff; background: #f04452;
  font-size: 15px; line-height: 1; font-weight: 700;
}
.current-panel .sentiment-label.state-fear { background: #f28a00; }
.current-panel .sentiment-label.state-neutral { background: #c49b23; }
.current-panel .sentiment-label.state-greed { background: #72a927; }
.current-panel .sentiment-label.state-extreme-greed { background: #12a878; }
.current-panel .updated-line { color: #929bad; margin-top: 13px; font-size: 10px; }
.current-panel .gauge-caption { color: #929bad; margin: 12px 0 0; font-size: 10px; }
.history-panel { border-radius: 18px; }
.history-panel .history-chart { min-height: 154px; }
@media (max-width: 800px) {
  .sentiment-grid { grid-template-columns: 1fr; }
  .current-panel { min-height: 300px; }
  .semi-gauge { width: min(100%, 280px); }
}
@media (max-width: 520px) {
  .sentiment-grid { gap: 12px; }
  .current-panel { padding: 20px 17px 18px; }
  .semi-gauge { width: min(100%, 260px); height: 155px; }
  .gauge-wrap { padding-top: 18px; }
}


/* Nafalogy layout repair + polished dashboard overrides */
html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
body { margin: 0; }
.home-page { width: 100%; min-height: calc(100vh - 69px); }
.sentiment-section {
  display: block !important;
  width: min(1180px, calc(100% - 48px)) !important;
  max-width: 1180px !important;
  margin: 0 auto !important;
  padding: 44px 0 64px !important;
  position: relative;
  left: auto !important;
  right: auto !important;
}
.section-heading {
  width: 100%;
  display: flex !important;
  align-items: flex-end !important;
  justify-content: space-between !important;
  gap: 20px;
  margin: 0 0 24px !important;
}
.section-heading h1 { font-size: clamp(29px, 3.2vw, 39px) !important; line-height: 1.12; }
.section-intro { margin-top: 9px !important; max-width: 650px; }
.sentiment-grid {
  width: 100%;
  display: grid !important;
  grid-template-columns: minmax(300px, .88fr) minmax(0, 1.35fr) !important;
  align-items: stretch;
  gap: 18px !important;
}
.panel {
  min-width: 0;
  border-radius: 18px !important;
  padding: 23px !important;
  box-shadow: var(--shadow);
}
.current-panel {
  background: #222631 !important;
  color: #f7f8fb !important;
  border: 1px solid #303645 !important;
  border-radius: 19px !important;
  padding: 23px 22px 20px !important;
}
.current-panel h2 { color: #aab1c2 !important; font-size: 17px !important; }
.current-panel .panel-topline { justify-content: space-between !important; }
.current-panel .source-tag { background: #2c3240 !important; color: #b5bdcd !important; }
.gauge-wrap { width: 100%; padding: 20px 0 0 !important; }
.semi-gauge { display: block !important; width: min(100%, 285px) !important; height: 170px !important; margin: 0 auto !important; position: relative !important; }
.gauge-svg { display: block !important; width: 100% !important; height: 100% !important; overflow: visible !important; }
.gauge-segment { fill: none !important; stroke-width: 12 !important; stroke-linecap: round !important; }
.seg-red { stroke: #f04452 !important; }
.seg-orange { stroke: #f28a00 !important; }
.seg-yellow { stroke: #f4d32e !important; }
.seg-lime { stroke: #8bd500 !important; }
.seg-green { stroke: #12bd91 !important; }
.gauge-marker { fill: #fff !important; stroke: #222631 !important; stroke-width: 3 !important; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
.gauge-number { position: absolute !important; left: 50% !important; top: 58% !important; transform: translate(-50%, -50%) !important; }
.gauge-value { color: #fff !important; font-size: 34px !important; font-weight: 800 !important; line-height: 1 !important; }
.current-panel .sentiment-label {
  display: table !important; margin: -3px auto 0 !important; padding: 6px 13px !important;
  border-radius: 999px !important; color: #fff !important; background: #f04452 !important;
  font-size: 14px !important; line-height: 1 !important; font-weight: 700 !important;
}
.current-panel .sentiment-label.state-fear { background: #f28a00 !important; }
.current-panel .sentiment-label.state-neutral { background: #c49b23 !important; }
.current-panel .sentiment-label.state-greed { background: #72a927 !important; }
.current-panel .sentiment-label.state-extreme-greed { background: #12a878 !important; }
.current-panel .updated-line, .current-panel .gauge-caption { color: #929bad !important; text-align: center; }
.history-panel { background: var(--panel-bg) !important; }
.history-stats { margin-top: 22px !important; }
.history-stat { border: 1px solid var(--border-color); }
.history-chart { width: 100%; }
.explanation-panel, .methodology-panel { margin-top: 18px !important; }
@media (max-width: 820px) {
  .sentiment-grid { grid-template-columns: 1fr !important; }
  .sentiment-section { width: min(100% - 32px, 680px) !important; padding-top: 30px !important; }
}
@media (max-width: 520px) {
  .section-heading { display: block !important; }
  .panel { padding: 18px !important; }
  .sentiment-section { width: calc(100% - 24px) !important; }
  .semi-gauge { width: min(100%, 270px) !important; }
}


/* Shared Nafalogy navigation */
.site-header { gap: 24px; }
.site-nav { display:flex; align-items:center; gap:8px; margin-left:auto; margin-right:18px; }
.site-nav a { color:var(--muted-color); text-decoration:none; font-size:14px; font-weight:650; padding:10px 13px; border-radius:9px; }
.site-nav a:hover, .site-nav a.active { color:var(--text-color); background:var(--soft-bg); }
.header-actions { flex:0 0 auto; }
@media(max-width:600px) {
  .site-header { flex-wrap:wrap; padding-top:10px!important; padding-bottom:10px!important; gap:8px; }
  .site-nav { order:3; width:100%; margin:0; }
  .site-nav a { padding:8px 11px; }
}

/* Top market page */
.top-market { width:min(1600px, calc(100% - 48px)); margin:0 auto; padding:42px 0 64px; }
.top-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin-bottom:24px; }
.top-heading h1 { margin:0; font-size:clamp(28px,3vw,38px); letter-spacing:-1px; }
.top-heading p { color:var(--muted-color); margin:9px 0 0; line-height:1.6; font-size:14px; }
.top-heading-actions { display:flex; align-items:center; gap:10px; }
.top-refresh { border:1px solid var(--border-color); border-radius:9px; padding:10px 13px; background:var(--panel-bg); color:var(--text-color); font-weight:650; cursor:pointer; }
.top-refresh:hover { background:var(--soft-bg); }
.top-stats { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; margin-bottom:20px; }
.top-stat { background:var(--panel-bg); border:1px solid var(--border-color); border-radius:13px; padding:17px 19px; box-shadow:var(--shadow); }
.top-stat span { display:block; color:var(--muted-color); font-size:12px; margin-bottom:8px; }
.top-stat strong { font-size:22px; letter-spacing:-.5px; font-variant-numeric:tabular-nums; }
.top-toolbar { display:flex; justify-content:space-between; align-items:center; gap:14px; margin:18px 0 12px; }
.top-search { width:min(360px,100%); min-height:42px; padding:0 13px; color:var(--text-color); background:var(--panel-bg); border:1px solid var(--border-color); border-radius:9px; outline:none; }
.top-search:focus { border-color:var(--accent); }
.top-meta { color:var(--muted-color); font-size:12px; }
.market-table-wrap { overflow:auto; border:1px solid var(--border-color); border-radius:13px; background:var(--panel-bg); box-shadow:var(--shadow); }
.market-table { width:100%; min-width:1180px; border-collapse:collapse; font-size:13px; font-variant-numeric:tabular-nums; }
.market-table thead { background:var(--soft-bg); }
.market-table th { color:var(--muted-color); text-align:right; padding:15px 13px; white-space:nowrap; font-size:11px; font-weight:750; border-bottom:1px solid var(--border-color); }
.market-table th:first-child, .market-table td:first-child,
.market-table th:nth-child(2), .market-table td:nth-child(2),
.market-table th:nth-child(3), .market-table td:nth-child(3) { text-align:left; }
.market-table td { padding:15px 13px; text-align:right; border-bottom:1px solid var(--border-color); white-space:nowrap; }
.market-table tbody tr:hover { background:var(--soft-bg); }
.market-table tbody tr:last-child td { border-bottom:0; }
.sort-button { border:0; padding:0; background:none; color:inherit; font:inherit; cursor:pointer; white-space:nowrap; }
.sort-button:hover { color:var(--text-color); }
.coin-rank { color:var(--muted-color); width:38px; }
.coin-name-cell { display:flex; align-items:center; gap:9px; min-width:180px; }
.coin-logo { width:28px; height:28px; display:grid; place-items:center; border-radius:50%; background:var(--soft-bg); color:var(--text-color); font-weight:800; font-size:11px; flex:0 0 28px; }
.coin-name { color:var(--text-color); font-weight:750; }
.coin-symbol { color:var(--muted-color); font-size:11px; }
.price-cell { font-weight:700; }
.positive { color:#11b981!important; }
.negative { color:#f04452!important; }
.neutral-change { color:var(--muted-color)!important; }
.change-pill { font-weight:700; }
.trend-badge { display:inline-flex; align-items:center; gap:5px; padding:5px 8px; border-radius:6px; font-size:11px; font-weight:750; }
.trend-up { background:rgba(17,185,129,.12); color:#11b981; }
.trend-down { background:rgba(240,68,82,.12); color:#f04452; }
.trend-flat { background:var(--soft-bg); color:var(--muted-color); }
.supply-cell { min-width:145px; }
.supply-track { height:4px; margin-top:7px; background:var(--soft-bg); border-radius:10px; overflow:hidden; }
.supply-track span { display:block; height:100%; background:#858da0; border-radius:10px; }
.table-loading, .table-error { padding:36px!important; text-align:center!important; color:var(--muted-color); }
.table-footer { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:14px 16px; border-top:1px solid var(--border-color); color:var(--muted-color); font-size:12px; }
.pagination { display:flex; align-items:center; gap:7px; }
.pagination button { border:1px solid var(--border-color); background:var(--panel-bg); color:var(--text-color); border-radius:7px; padding:7px 10px; cursor:pointer; }
.pagination button:disabled { opacity:.4; cursor:not-allowed; }
.top-footnote { color:var(--muted-color); font-size:11px; line-height:1.6; margin:13px 2px 0; }
@media(max-width:700px) {
  .top-market { width:calc(100% - 24px); padding-top:28px; }
  .top-heading { display:block; }
  .top-heading-actions { margin-top:14px; }
  .top-stats { grid-template-columns:1fr; gap:9px; }
  .top-stat { padding:14px 16px; }
  .top-stat strong { font-size:19px; }
  .top-toolbar { align-items:stretch; flex-direction:column; }
  .top-search { width:100%; }
  .table-footer { align-items:flex-start; flex-direction:column; }
}

.header-actions{display:flex;align-items:center;gap:9px}.auth-link{font-size:13px;font-weight:650;text-decoration:none;color:var(--text-color);padding:9px 11px;border:1px solid var(--border-color);border-radius:8px;white-space:nowrap}.auth-link:hover{background:var(--soft-bg)}.auth-register{background:var(--accent);border-color:var(--accent);color:#fff}.nav-user{font-size:12px;color:var(--muted-color);white-space:nowrap}@media(max-width:760px){.header-actions{flex-wrap:wrap;justify-content:flex-end}.nav-user{display:none}}@media(max-width:560px){.site-header{align-items:center}.header-actions{gap:5px}.auth-link{padding:8px;font-size:12px}}

/* Auth navigation buttons: cache-safe visual override */
.site-header .header-actions { display:flex!important; align-items:center!important; gap:10px!important; }
.site-header .header-actions a.auth-link,
.site-header .header-actions a.auth-link:visited {
  display:inline-flex!important; align-items:center!important; justify-content:center!important;
  min-height:40px!important; padding:0 14px!important;
  border:1px solid var(--border-color)!important; border-radius:9px!important;
  background:var(--button-bg)!important; color:var(--text-color)!important;
  font-size:13px!important; font-weight:700!important; line-height:1!important;
  text-decoration:none!important; white-space:nowrap!important;
}
.site-header .header-actions a.auth-link:hover { background:var(--button-hover)!important; text-decoration:none!important; }
.site-header .header-actions a.auth-link.auth-register,
.site-header .header-actions a.auth-link.auth-register:visited {
  background:var(--accent)!important; border-color:var(--accent)!important; color:#fff!important;
}
@media(max-width:760px) {
  .site-header .header-actions { flex-wrap:wrap; justify-content:flex-end; gap:6px!important; }
  .site-header .header-actions a.auth-link { min-height:36px!important; padding:0 10px!important; font-size:12px!important; }
}


/* =========================================================
   NAFALOGY COMPLETE-SITE RESPONSIVE LAYER
   Applies across homepage, markets, auth, profiles and nav.
   ========================================================= */
*,*::before,*::after { box-sizing:border-box; }
html,body { max-width:100%; overflow-x:hidden; }
img,svg,canvas,video { max-width:100%; }
button,input,select,textarea { max-width:100%; }
main { min-width:0; }
.site-header {
  width:100%; min-width:0; padding-left:clamp(12px,2.2vw,32px)!important;
  padding-right:clamp(12px,2.2vw,32px)!important;
}
.site-logo { flex-shrink:0; }
.site-nav { min-width:0; }
.site-nav a { white-space:nowrap; }
.header-actions { min-width:0; }
.home-page { width:100%; max-width:1440px; margin:0 auto; padding-left:clamp(12px,2vw,28px); padding-right:clamp(12px,2vw,28px); }
.sentiment-section { max-width:100%; }
.sentiment-grid { min-width:0; }
.panel { min-width:0; }
.auth-page { width:100%; min-width:0; padding-left:16px; padding-right:16px; }
.auth-card { width:min(100%,460px); min-width:0; }
.profile-page,.public-profile { width:min(940px,calc(100% - 32px)); min-width:0; }
.profile-card,.public-card { min-width:0; }
.profile-fields > * { min-width:0; }
.profile-form input,.profile-form textarea { min-width:0; }
.top-market { width:min(1600px,calc(100% - 40px)); min-width:0; }
.market-table-wrap { max-width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
.market-table { min-width:1050px; }
.table-footer { flex-wrap:wrap; }
.public-card .cover,.profile-cover { background-size:cover; }
.admin-table-wrap,.table-wrap { max-width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }

@media (max-width: 900px) {
  .site-header { flex-wrap:wrap; gap:8px 14px!important; padding-top:10px!important; padding-bottom:10px!important; }
  .site-nav { margin-left:auto!important; margin-right:0!important; }
  .header-actions { gap:6px!important; }
  .sentiment-grid { grid-template-columns:1fr!important; }
  .top-market { width:calc(100% - 28px); }
  .top-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 640px) {
  .site-header {
    display:grid!important; grid-template-columns:minmax(0,1fr) auto;
    align-items:center!important; gap:9px 8px!important; padding:11px 12px!important;
  }
  .site-logo { font-size:21px!important; }
  .site-nav {
    grid-column:1/-1; grid-row:2; order:initial!important;
    display:grid!important; grid-template-columns:repeat(3,minmax(0,1fr));
    width:100%; gap:5px!important; margin:0!important;
  }
  .site-nav a {
    min-width:0; justify-content:center!important; padding:9px 4px!important;
    font-size:11px!important; text-align:center; overflow:hidden; text-overflow:ellipsis;
  }
  .header-actions {
    grid-column:2; grid-row:1; display:flex!important; flex-wrap:wrap;
    align-items:center!important; justify-content:flex-end!important; gap:5px!important;
  }
  .site-header .header-actions .nav-user { display:none!important; }
  .site-header .header-actions a.auth-link,
  .site-header .header-actions .theme-toggle {
    min-height:34px!important; padding:0 8px!important; font-size:10px!important;
    border-radius:8px!important;
  }
  .home-page { padding-left:12px!important; padding-right:12px!important; }
  .section-heading { gap:8px!important; }
  .section-heading h1,.section-heading h2 { font-size:22px!important; }
  .sentiment-section { width:calc(100% - 24px)!important; padding-top:22px!important; }
  .sentiment-grid { gap:12px!important; }
  .panel { padding:15px!important; border-radius:13px!important; }
  .history-stats { grid-template-columns:repeat(2,minmax(0,1fr))!important; }
  .gauge-wrap { max-width:100%; }
  .semi-gauge { width:min(100%,260px)!important; }
  .auth-page { min-height:calc(100svh - 105px); padding:24px 12px!important; }
  .auth-card { padding:25px 19px!important; border-radius:16px!important; }
  .auth-card h1 { font-size:25px!important; }
  .auth-form input { width:100%; min-height:46px; }
  .profile-page,.public-profile { width:calc(100% - 20px)!important; margin:22px auto 38px!important; }
  .profile-cover,.cover { height:145px!important; }
  .profile-avatar-wrap,.avatar-wrap { margin-top:-45px!important; padding-left:16px!important; padding-right:16px!important; }
  .profile-avatar,.avatar { width:88px!important; height:88px!important; }
  .profile-content,.body { padding:14px 16px 22px!important; }
  .profile-fields { grid-template-columns:minmax(0,1fr)!important; }
  .profile-fields .full { grid-column:auto!important; }
  .profile-form input,.profile-form textarea { width:100%!important; }
  .top-market { width:calc(100% - 20px)!important; padding:23px 0 36px!important; }
  .top-heading { display:block!important; margin-bottom:16px!important; }
  .top-heading h1 { font-size:25px!important; }
  .top-heading-actions { margin-top:12px; }
  .top-stats { grid-template-columns:repeat(2,minmax(0,1fr))!important; gap:8px!important; }
  .top-stat { padding:12px!important; min-width:0; }
  .top-stat strong { font-size:17px!important; overflow-wrap:anywhere; }
  .top-stat span { font-size:10px!important; }
  .top-toolbar { display:flex!important; flex-direction:column!important; align-items:stretch!important; }
  .top-search { width:100%!important; }
  .market-table-wrap { border-radius:10px!important; }
  .market-table { min-width:980px!important; font-size:11px!important; }
  .market-table th,.market-table td { padding:11px 9px!important; }
  .table-footer { align-items:flex-start!important; flex-direction:column!important; padding:12px!important; }
  .pagination { flex-wrap:wrap; }
  .bubble-page { padding-left:10px!important; padding-right:10px!important; }
}
@media (max-width: 380px) {
  .site-logo { font-size:19px!important; }
  .site-header .header-actions a.auth-link { padding:0 6px!important; font-size:9px!important; }
  .site-header .header-actions .theme-toggle { padding:0 6px!important; font-size:9px!important; }
  .site-nav a { font-size:10px!important; }
  .top-stats { grid-template-columns:1fr 1fr!important; }
  .auth-card { padding:22px 15px!important; }
}

/* Nafalogy header polish: consistent navigation, no default underlined links */
.site-header {
  display:flex!important; align-items:center!important; justify-content:space-between!important;
  gap:18px!important; min-height:76px!important; padding:12px clamp(16px,3vw,44px)!important;
  background:var(--header-bg)!important; border-bottom:1px solid var(--border-color)!important;
  box-shadow:0 5px 22px rgba(0,0,0,.12)!important; position:relative; z-index:20;
}
.site-header a { text-decoration:none!important; }
.site-logo { flex:0 0 auto!important; font-size:clamp(20px,1.6vw,25px)!important; font-weight:850!important; letter-spacing:-.8px!important; white-space:nowrap!important; }
.site-nav {
  display:flex!important; flex:1 1 auto!important; justify-content:center!important; align-items:center!important;
  gap:6px!important; margin:0!important; min-width:0!important;
}
.site-nav a {
  display:inline-flex!important; align-items:center!important; justify-content:center!important;
  min-height:40px!important; padding:0 15px!important; border:1px solid transparent!important;
  border-radius:11px!important; color:var(--muted-color)!important; font-size:14px!important;
  font-weight:700!important; line-height:1!important; white-space:nowrap!important; transition:background .16s ease,color .16s ease,border-color .16s ease;
}
.site-nav a:hover { color:var(--text-color)!important; background:var(--soft-bg)!important; }
.site-nav a.active { color:var(--accent)!important; background:var(--soft-bg)!important; border-color:var(--border-color)!important; }
.site-header .header-actions {
  display:flex!important; flex:0 0 auto!important; align-items:center!important; justify-content:flex-end!important;
  flex-wrap:nowrap!important; gap:8px!important; min-width:0!important;
}
.site-header .header-actions a.auth-link {
  display:inline-flex!important; align-items:center!important; justify-content:center!important;
  min-height:39px!important; padding:0 12px!important; border:1px solid var(--border-color)!important;
  border-radius:10px!important; color:var(--text-color)!important; background:var(--panel-bg)!important;
  font-size:13px!important; font-weight:700!important; line-height:1!important; white-space:nowrap!important;
}
.site-header .header-actions a.auth-link:hover { background:var(--soft-bg)!important; border-color:var(--accent)!important; }
.site-header .header-actions .nav-user {
  display:inline-flex!important; align-items:center!important; min-height:34px!important; padding:0 9px!important;
  border-radius:9px!important; background:var(--soft-bg)!important; color:var(--muted-color)!important;
  font-size:12px!important; font-weight:650!important; white-space:nowrap!important;
}
.site-header .header-actions .theme-toggle {
  min-height:40px!important; padding:0 13px!important; border-radius:10px!important;
  white-space:nowrap!important; font-size:13px!important;
}
@media(max-width:1180px) {
  .site-header { flex-wrap:wrap!important; gap:10px 14px!important; }
  .site-nav { order:3!important; flex:1 0 100%!important; justify-content:flex-start!important; }
  .site-header .header-actions { margin-left:auto!important; }
}
@media(max-width:640px) {
  .site-header { display:flex!important; flex-wrap:wrap!important; min-height:0!important; padding:11px 12px!important; gap:9px!important; }
  .site-logo { order:0!important; font-size:21px!important; }
  .site-header .header-actions { order:1!important; margin-left:auto!important; gap:5px!important; flex-wrap:wrap!important; }
  .site-header .header-actions .nav-user { display:none!important; }
  .site-header .header-actions a.auth-link { min-height:34px!important; padding:0 8px!important; font-size:11px!important; }
  .site-header .header-actions .theme-toggle { min-height:34px!important; padding:0 8px!important; font-size:11px!important; }
  .site-nav { order:2!important; flex:1 0 100%!important; display:flex!important; width:100%!important; gap:5px!important; overflow-x:auto!important; justify-content:flex-start!important; }
  .site-nav a { flex:1 0 auto!important; min-height:36px!important; padding:0 11px!important; font-size:12px!important; }
}


/* Header refresh: cache-busted, consistent navigation on every page */
.site-header {
  min-height:78px!important; padding:12px clamp(18px,3.4vw,56px)!important;
  display:grid!important; grid-template-columns:auto minmax(250px,1fr) auto!important;
  align-items:center!important; column-gap:clamp(22px,3vw,58px)!important;
  background:var(--header-bg)!important; border-bottom:1px solid var(--border-color)!important;
}
.site-header a, .site-header a:visited { text-decoration:none!important; }
.site-logo { color:var(--text-color)!important; font-size:25px!important; font-weight:850!important; letter-spacing:-.9px!important; }
.site-nav { display:flex!important; justify-content:center!important; align-items:center!important; gap:8px!important; margin:0!important; min-width:0!important; }
.site-nav a {
  display:inline-flex!important; align-items:center!important; justify-content:center!important;
  min-height:42px!important; padding:0 16px!important; border:1px solid transparent!important;
  border-radius:11px!important; color:var(--muted-color)!important; background:transparent!important;
  font-size:14px!important; font-weight:700!important; white-space:nowrap!important;
  text-decoration:none!important; transition:background .16s ease,color .16s ease,border-color .16s ease!important;
}
.site-nav a:hover,.site-nav a.active { color:var(--text-color)!important; background:var(--soft-bg)!important; border-color:var(--border-color)!important; }
.site-header .header-actions {
  display:flex!important; align-items:center!important; justify-content:flex-end!important;
  gap:8px!important; min-width:0!important; flex-wrap:nowrap!important;
}
.site-header .header-actions a.auth-link,.site-header .header-actions a.auth-link:visited {
  display:inline-flex!important; align-items:center!important; justify-content:center!important;
  min-height:40px!important; padding:0 13px!important; border:1px solid var(--border-color)!important;
  border-radius:10px!important; background:var(--panel-bg)!important; color:var(--text-color)!important;
  font-size:13px!important; font-weight:700!important; line-height:1!important; white-space:nowrap!important;
  text-decoration:none!important;
}
.site-header .header-actions a.auth-link:hover { background:var(--soft-bg)!important; border-color:var(--accent)!important; }
.site-header .header-actions .nav-user {
  display:inline-flex!important; align-items:center!important; min-height:36px!important;
  padding:0 10px!important; border-radius:9px!important; background:var(--soft-bg)!important;
  color:var(--muted-color)!important; font-size:12px!important; font-weight:650!important; white-space:nowrap!important;
}
.site-header .header-actions .theme-toggle {
  min-height:40px!important; padding:0 14px!important; border:1px solid var(--border-color)!important;
  border-radius:10px!important; background:var(--button-bg)!important; color:var(--text-color)!important;
  font-size:13px!important; font-weight:700!important; white-space:nowrap!important;
}
.site-header .header-actions .theme-toggle:hover { background:var(--button-hover)!important; }
@media(max-width:1450px) {
  .site-header { grid-template-columns:auto 1fr!important; row-gap:8px!important; }
  .site-nav { grid-column:1 / -1!important; grid-row:2!important; justify-content:flex-start!important; overflow-x:auto!important; }
  .site-header .header-actions { grid-column:2!important; grid-row:1!important; }
}
@media(max-width:760px) {
  .site-header { display:flex!important; flex-wrap:wrap!important; min-height:0!important; padding:12px 14px!important; gap:10px!important; }
  .site-logo { font-size:21px!important; }
  .site-header .header-actions { margin-left:auto!important; flex-wrap:wrap!important; gap:5px!important; }
  .site-header .header-actions .nav-user { display:none!important; }
  .site-header .header-actions a.auth-link { min-height:34px!important; padding:0 9px!important; font-size:11px!important; }
  .site-header .header-actions .theme-toggle { min-height:34px!important; padding:0 9px!important; font-size:11px!important; }
  .site-nav { order:3!important; flex:1 0 100%!important; width:100%!important; gap:5px!important; justify-content:flex-start!important; }
  .site-nav a { min-height:36px!important; padding:0 12px!important; font-size:12px!important; }
}
