/* ============ 油价监控 全局样式 ============ */
:root {
  --bg: #0b1220;
  --panel: #101a2e;
  --panel2: #15213a;
  --border: #22314f;
  --text: #e9eefb;
  --muted: #8fa2c0;
  --accent: #f59e0b;
  --accent2: #fb923c;
  --up: #ef4444;      /* 涨价红 */
  --down: #22c55e;    /* 降价绿 */
  --radius: 12px;
  /* 扩展配色 */
  --bg-glow: #14203a;
  --topbar-bg: rgba(11, 18, 32, .85);
  --card-bg: linear-gradient(180deg, #101a2e 0%, rgba(16,26,46,.72) 100%);
  --th-bg: rgba(21, 34, 58, .55);
  --row-border: rgba(34, 49, 79, .55);
  --hl-bg: rgba(245, 158, 11, .10);
  --today-fg: #fcd34d;
  --code-bg: rgba(10, 14, 23, .9);
  --code-fg: #a8e063;
  --chart-split: rgba(34, 49, 79, .55);
  --float-bg: rgba(16, 26, 46, .72);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: radial-gradient(1200px 500px at 20% -10%, var(--bg-glow) 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }

/* 顶部导航 */
.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 18px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd27a, var(--accent) 55%, #b45309);
  box-shadow: 0 0 10px rgba(245, 158, 11, .7);
}
.brand-sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 2px; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-link {
  padding: 7px 14px; border-radius: 8px; color: var(--muted);
  transition: .18s; font-size: 14px; line-height: 1.5;
}
.nav-link:hover { color: var(--text); background: var(--panel2); }
.nav-link.on { color: var(--text); background: linear-gradient(135deg, rgba(245,158,11,.22), rgba(245,158,11,.08)); box-shadow: inset 0 0 0 1px rgba(245,158,11,.35); font-weight: 600; }

/* 汉堡按钮（前台移动端导航，≤768px 显示） */
.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--panel2);
  border-radius: 8px;
  width: 42px; height: 38px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.nav-toggle span { display: block; width: 17px; height: 2px; border-radius: 2px; background: var(--muted); transition: .2s; }
.nav-toggle:hover span { background: var(--accent); }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* 布局 */
.wrap { max-width: 1180px; margin: 0 auto; padding: 22px 18px 40px; width: 100%; flex: 1; }
.footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 16px; padding-bottom: 16px; }

/* 卡片 */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card h2, .card h3 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h2 .hint, .card h3 .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: 1fr; } .grid-2 { grid-template-columns: 1fr; } }
.mt { margin-top: 16px; }
.mt-sm { margin-top: 8px; }

/* 数据卡 */
.stat-card .k { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; align-items: center; }
.stat-card .v { font-size: 26px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-card .v small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.stat-card .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.big-tag { font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.big-tag.up { background: rgba(239,68,68,.15); color: #fca5a5; }
.big-tag.down { background: rgba(34,197,94,.15); color: #86efac; }
.big-tag.hold { background: rgba(143,162,192,.15); color: var(--muted); }
.big-tag.warn { background: rgba(245,158,11,.16); color: #fcd34d; }

/* 表格 */
.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th {
  text-align: center; font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  background: var(--th-bg); white-space: nowrap;
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--row-border); white-space: nowrap; }
.tbl tbody tr:hover { background: rgba(59,130,246,.07); }
.tbl .num { text-align: right; }
.tbl th.num { text-align: right; }
tr.hl { background: var(--hl-bg); }
tr.hl td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.up-c { color: var(--up); }
.down-c { color: var(--down); }

/* 徽章 */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.up { background: rgba(239,68,68,.16); color: #f87171; }
.badge.down { background: rgba(34,197,94,.16); color: #4ade80; }
.badge.hold { background: rgba(143,162,192,.16); color: var(--muted); }
.badge.future { background: rgba(59,130,246,.14); color: #93c5fd; }

/* 表单 */
.form-row { margin-bottom: 14px; }
label.f { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel2); color: var(--text);
  font-size: 14px; outline: none; transition: .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,158,11,.15); }
input.small { width: 140px; }
.btn {
  display: inline-block; padding: 9px 18px; border-radius: 8px; border: none; cursor: pointer;
  background: linear-gradient(135deg, #f59e0b, #f97316); color: #1a1206; font-weight: 700; font-size: 14px;
  transition: .18s;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); font-weight: 500; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); transform: none; }
.btn.danger { background: transparent; border: 1px solid rgba(239,68,68,.5); color: #f87171; font-weight: 500; }
.btn.danger:hover { background: rgba(239,68,68,.12); transform: none; }
.btn.sm { padding: 5px 12px; font-size: 12px; }

/* 搜索与工具条 */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.toolbar label.f { display: inline; margin: 0; line-height: 1; }
.search-box { position: relative; }
.search-box input { width: 220px; padding-left: 32px; }
.search-box::before {
  content: "⌕"; position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 15px;
}

/* 页头 */
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 22px; }
.page-head .desc { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* 图表容器 */
.chart { width: 100%; }
.chart-lg { height: 420px; }

/* 切换标签 */
.tabs { display: inline-flex; gap: 4px; background: var(--panel2); padding: 4px; border-radius: 10px; border: 1px solid var(--border); flex-wrap: wrap; max-width: 100%; }
.tab { padding: 6px 16px; border-radius: 7px; cursor: pointer; color: var(--muted); font-size: 13px; transition: .15s; white-space: nowrap; flex: none; }
.tab.on { background: var(--accent); color: #1a1206; font-weight: 700; }
.tab:hover:not(.on) { color: var(--text); }

/* 日历 */
.cal-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 900px) { .cal-grid { grid-template-columns: repeat(2, 1fr); } }
.cal-cell { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--panel); }
.cal-cell .m { font-weight: 700; color: var(--accent); margin-bottom: 8px; font-size: 14px; }
.cal-cell .d { display: flex; justify-content: space-between; align-items: center; padding: 5px 8px; border-radius: 6px; margin-bottom: 4px; font-size: 13px; }
.cal-cell .d:hover { background: var(--panel2); }
.cal-cell .d.done { color: var(--muted); }
.cal-cell .d.today { background: rgba(245,158,11,.14); color: var(--today-fg); font-weight: 600; }
.cal-cell .d.future { color: var(--text); }

/* 提示条 */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.notice.info { background: rgba(59,130,246,.10); border: 1px solid rgba(59,130,246,.3); color: #bfdbfe; }
.notice.warn { background: rgba(245,158,11,.10); border: 1px solid rgba(245,158,11,.35); color: #fde68a; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: #1e293b; color: #fff; padding: 10px 20px; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); opacity: 0; pointer-events: none;
  transition: .25s; z-index: 99; font-size: 14px; border: 1px solid var(--border);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-color: rgba(34,197,94,.5); }
.toast.err { border-color: rgba(239,68,68,.5); }

/* 后台 */
.admin-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 900px) { .admin-links { grid-template-columns: 1fr; } }
.alink {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: var(--panel);
  transition: .18s;
}
.alink:hover { border-color: var(--accent); transform: translateY(-2px); }
.alink .t { font-weight: 700; margin-bottom: 4px; }
.alink .d { font-size: 12px; color: var(--muted); }
.login-wrap { max-width: 380px; margin: 60px auto; }
.login-title { text-align: center; margin-bottom: 20px; }
.login-title .brand { justify-content: center; font-size: 22px; }
.login-title p { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* 迷你统计行 */
.mini { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.mini .item { font-size: 12px; color: var(--muted); background: var(--panel2); border: 1px solid var(--border); padding: 4px 10px; border-radius: 20px; }
.mini .item b { color: var(--text); }

/* 辅助文字 / 表格不换行 */
.tip { font-size: 12px; color: var(--muted); line-height: 1.7; margin-top: 6px; }
.nowrap { white-space: nowrap; }

/* ============ 响应式 ============ */
/* 平板及以下：网格降列 */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .cal-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-links { grid-template-columns: 1fr; }
}

/* 小屏 / 手机：前台导航折叠为汉堡菜单（后台导航项少，保持折行） */
@media (max-width: 768px) {
  .topbar-inner:has(.nav-toggle) {
    height: auto;
    flex-wrap: wrap;
    padding: 10px 14px;
    gap: 6px 10px;
  }
  .nav-toggle { display: flex; }
  .topbar-inner:has(.nav-toggle) .nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 2px;
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
  }
  .topbar-inner:has(.nav-toggle) .nav.open { display: flex; }
  .nav-link { padding: 11px 14px; border-radius: 8px; }
  .chart-lg { height: 340px; }
  .footer-inner { flex-direction: column; }
}

/* 手机窄屏 */
@media (max-width: 480px) {
  .wrap { padding: 16px 12px 32px; }
  .brand { font-size: 16px; }
  .brand-sub { display: none; }
  .grid-4 { grid-template-columns: 1fr; }
  .cal-grid { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  .page-head h1 { font-size: 18px; }
  .stat-card .v { font-size: 22px; }
  .chart-lg { height: 280px; }
  .tbl th, .tbl td { padding: 9px 10px; font-size: 13px; }
  .tab { padding: 6px 10px; font-size: 12px; }
  .search-box input { width: 130px; }
  .login-wrap { margin: 28px auto; }
  .admin-links .alink { padding: 12px; }
}

/* 使用帮助页 */
.code-block { display: block; background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; line-height: 1.6; word-break: break-all; color: var(--code-fg); }
.doc-body { font-size: 14px; line-height: 1.75; }
.doc-body h1 { font-size: 20px; margin: 18px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.doc-body h2 { font-size: 17px; margin: 18px 0 8px; }
.doc-body h3 { font-size: 15px; margin: 14px 0 6px; color: var(--accent); }
.doc-body h4 { font-size: 14px; margin: 12px 0 4px; }
.doc-body p { margin: 8px 0; }
.doc-body ul, .doc-body ol { margin: 8px 0 8px 22px; }
.doc-body li { margin: 3px 0; }
.doc-body pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; overflow-x: auto; margin: 10px 0; }
.doc-body pre code { background: none; border: none; padding: 0; color: var(--code-fg); }
.doc-body code { background: var(--th-bg); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 12.5px; color: var(--accent2); }
.doc-body table { margin: 10px 0; }

/* ============ 浅色主题（默认深色，点导航右侧按钮切换） ============ */
html[data-theme="light"] {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel2: #f7f9fc;
  --border: #e2e8f2;
  --text: #172033;
  --muted: #64748b;
  --accent: #e8890c;
  --accent2: #ea7c07;
  --bg-glow: #e8eff9;
  --topbar-bg: rgba(255, 255, 255, .92);
  --card-bg: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, .74) 100%);
  --th-bg: rgba(241, 245, 251, .9);
  --row-border: rgba(226, 232, 242, .9);
  --hl-bg: rgba(245, 158, 11, .09);
  --today-fg: #b45309;
  --code-bg: #f2f5fa;
  --code-fg: #0b7a4b;
  --chart-split: rgba(226, 232, 242, .95);
  --float-bg: rgba(255, 255, 255, .72);
}
html[data-theme="light"] .notice.info { background: rgba(59, 130, 246, .08); border-color: rgba(59, 130, 246, .26); color: #1d4ed8; }
html[data-theme="light"] .notice.warn { background: rgba(245, 158, 11, .10); border-color: rgba(245, 158, 11, .32); color: #a16207; }
html[data-theme="light"] .big-tag.up { background: rgba(239, 68, 68, .12); color: #b91c1c; }
html[data-theme="light"] .big-tag.down { background: rgba(34, 197, 94, .12); color: #15803d; }
html[data-theme="light"] .big-tag.warn { background: rgba(245, 158, 11, .14); color: #a16207; }
html[data-theme="light"] .big-tag.hold { background: rgba(100, 116, 139, .12); color: #475569; }
html[data-theme="light"] .badge.up { background: rgba(239, 68, 68, .12); color: #b91c1c; }
html[data-theme="light"] .badge.down { background: rgba(34, 197, 94, .12); color: #15803d; }
html[data-theme="light"] .badge.hold { background: rgba(100, 116, 139, .12); color: #475569; }
html[data-theme="light"] .badge.future { background: rgba(59, 130, 246, .12); color: #1d4ed8; }
html[data-theme="light"] .toast { background: #ffffff; color: var(--text); box-shadow: 0 8px 24px rgba(15, 23, 42, .16); }
html[data-theme="light"] .tbl tbody tr:hover { background: rgba(59, 130, 246, .06); }
html[data-theme="light"] .btn.ghost { color: var(--text); }

/* 右下角浮动工具：切换主题 + 回到顶部（闲置自动隐藏） */
.float-tools {
  position: fixed;
  right: 16px;
  bottom: 18px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: opacity .3s ease, transform .3s ease;
}
.float-tools.idle { opacity: 0; transform: translateY(8px); pointer-events: none; }
.float-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--float-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--muted);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .16);
  cursor: pointer;
  transition: color .15s, border-color .15s, transform .15s, background .15s;
}
.float-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--panel); }
.float-btn:active { transform: scale(.94); }
.float-btn svg { width: 18px; height: 18px; }
.float-btn.top-btn { display: none; }
.float-btn.top-btn.show { display: inline-flex; }
@media (max-width: 768px) {
  .float-tools { right: 12px; bottom: 14px; gap: 8px; }
  .float-btn { width: 40px; height: 40px; }
  .float-btn svg { width: 16px; height: 16px; }
}

