/* fan-web / assets/styles.css */
:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #1f2a37;
  --ink-soft: #5b6776;
  --line: #e2e8f0;
  --brand: #1f6feb;
  --brand-d: #1450b8;
  --accent: #eef4ff;
  --ok: #1a7f4b;
  --warn: #b8860b;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans JP", "Noto Sans KR", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(90deg, var(--brand), var(--brand-d));
  color: #fff; padding: 10px 18px; position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.topbar .brand { font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.topbar .tag { font-size: 12px; opacity: .85; margin-left: 4px; }
.topbar .spacer { flex: 1; }
.topbar a.btn {
  color: #fff; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35);
  padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600;
}
.topbar a.btn:hover { background: rgba(255,255,255,.28); text-decoration: none; }
.topbar select {
  background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 8px; padding: 6px 8px; font-size: 13px; cursor: pointer;
}
.topbar select option { color: #1f2a37; }

/* ---------- Layout ---------- */
.layout { display: flex; align-items: flex-start; }
.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--panel); border-right: 1px solid var(--line);
  min-height: calc(100vh - 53px); padding: 14px 10px; position: sticky; top: 53px;
}
.sidebar a.nav {
  display: block; padding: 9px 12px; border-radius: 8px; color: var(--ink); font-size: 14px;
  margin-bottom: 4px; border: 1px solid transparent;
}
.sidebar a.nav:hover { background: var(--accent); text-decoration: none; }
.sidebar a.nav.active { background: var(--accent); border-color: #cfe0ff; color: var(--brand-d); font-weight: 600; }
.main { flex: 1; padding: 22px 26px 60px; max-width: 1100px; }
@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; min-height: 0; position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .sidebar a.nav { margin: 0; }
}

/* ---------- Cards / panels ---------- */
h1.page-title { font-size: 24px; margin: 0 0 4px; }
.page-sub { color: var(--ink-soft); margin: 0 0 20px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px;
}
.card h2 { font-size: 17px; margin: 0 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.field .sym { font-family: "Cambria Math", "Times New Roman", serif; font-style: italic; color: var(--brand-d); }
.field input, .field select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
  background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus { outline: 2px solid #bcd4ff; border-color: var(--brand); }
.unit { font-size: 12px; color: var(--ink-soft); }

.actions { display: flex; gap: 10px; margin: 8px 0 4px; }
button.primary {
  background: var(--brand); color: #fff; border: none; padding: 10px 18px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
button.primary:hover { background: var(--brand-d); }
button.ghost {
  background: #fff; color: var(--ink); border: 1px solid var(--line); padding: 10px 16px;
  border-radius: 8px; font-size: 14px; cursor: pointer;
}
button.ghost:hover { background: #f0f4f9; }

/* ---------- Result ---------- */
.result {
  background: var(--accent); border: 1px solid #cfe0ff; border-radius: 8px; padding: 14px 16px;
  margin-top: 6px; display: none;
}
.result.show { display: block; }
.result .big { font-size: 26px; font-weight: 700; color: var(--brand-d); }
.result table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.result td, .result th { border: 1px solid var(--line); padding: 6px 8px; text-align: left; font-size: 13px; }
.result .pos { color: var(--ok); font-weight: 600; }
.warn { color: #b00020; font-weight: 600; background: #fff0f0; border: 1px solid #ffc9c9; border-radius: 8px; padding: 8px 12px; margin-top: 10px; font-size: 13px; display: none; }
.okb { color: var(--ok); font-weight: 600; background: #f0faf3; border: 1px solid #c3e8cf; border-radius: 8px; padding: 8px 12px; margin-top: 10px; font-size: 13px; display: none; }

.formula {
  font-family: "Cambria Math", "Times New Roman", serif; background: #fbfcfe;
  border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; font-size: 14px;
  color: var(--ink-soft); overflow-x: auto; white-space: nowrap;
}
.note { font-size: 13px; color: var(--ink-soft); margin-top: 10px; }
.disclaimer {
  font-size: 12px; color: var(--ink-soft); border-top: 1px solid var(--line);
  padding-top: 12px; margin-top: 24px;
}

/* ---------- Tables (catalog / perf) ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; }
table.data th { background: #f0f4f9; position: sticky; top: 0; }
table.data tbody tr:nth-child(even) { background: #fafcff; }
.scroll { max-height: 520px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; min-width: 200px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { background: #fff; border: none; padding: 8px 12px; cursor: pointer; font-size: 13px; }
.seg button.active { background: var(--brand); color: #fff; }

.modules { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.module-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); display: block; color: var(--ink);
}
.module-card:hover { border-color: var(--brand); text-decoration: none; transform: translateY(-2px); transition: .15s; }
.module-card h3 { margin: 0 0 6px; color: var(--brand-d); font-size: 16px; }
.module-card p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.module-card .ic { font-size: 26px; }
.row-actions { display:flex; gap:6px; }
.mini { font-size: 12px; padding: 4px 8px; }
.backtop { position: fixed; right: 18px; bottom: 18px; background: var(--brand); color:#fff; border:none; border-radius: 50%; width: 42px; height: 42px; cursor: pointer; font-size: 18px; box-shadow: var(--shadow); display:none; }
.backtop.show { display:block; }
