* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: #f4f6fa;
  color: #1f2d3d;
  min-height: 100vh;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 28px;
  background: linear-gradient(135deg, #1f4e79, #2d6cb5);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { font-size: 30px; }
.brand h1 { font-size: 20px; font-weight: 700; }
.brand .sub { font-size: 12px; opacity: 0.85; margin-top: 2px; }

.search-box { display: flex; align-items: center; gap: 10px; }
.search-box label { font-size: 13px; opacity: 0.9; }
.code-wrap { position: relative; }
#stockCode {
  width: 130px; padding: 8px 10px; border: none; border-radius: 6px;
  font-size: 15px; outline: none;
}
.company-name { font-size: 14px; min-width: 120px; font-weight: 600; }

.autocomplete {
  position: absolute; top: 42px; left: 0; z-index: 50;
  background: #fff; color: #1f2d3d; border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18); width: 220px; max-height: 280px; overflow-y: auto;
}
.autocomplete .item { padding: 8px 12px; cursor: pointer; font-size: 14px; display: flex; gap: 8px; }
.autocomplete .item:hover, .autocomplete .item.active { background: #eef3fb; }
.autocomplete .code { color: #2d6cb5; font-weight: 600; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 4px; padding: 0 28px; background: #fff; border-bottom: 1px solid #e3e8f0; }
.tab {
  border: none; background: none; padding: 14px 22px; font-size: 15px; cursor: pointer;
  color: #5a6b7e; border-bottom: 3px solid transparent; font-weight: 600;
}
.tab.active { color: #1f4e79; border-bottom-color: #1f4e79; }

main { padding: 22px 28px; max-width: 1280px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; }

/* ---------- 报表类型 Tab（财务结果内） ---------- */
.report-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px;
  border-bottom: 1px solid #e3e8f0; padding-bottom: 0;
}
.report-tab {
  border: none; background: #f1f4f9; color: #5a6b7e; cursor: pointer;
  padding: 9px 18px; font-size: 14px; font-weight: 600; border-radius: 8px 8px 0 0;
  border: 1px solid transparent; border-bottom: none;
}
.report-tab:hover { background: #e7eef8; }
.report-tab.active {
  background: #fff; color: #1f4e79; border-color: #e3e8f0;
  box-shadow: 0 -2px 0 #1f4e79 inset;
}
.report-body { margin-top: 4px; }

/* ---------- 控件 ---------- */
.controls {
  background: #fff; border: 1px solid #e3e8f0; border-radius: 10px;
  padding: 18px 20px; margin-bottom: 18px;
}
.control-group { margin-bottom: 16px; }
.control-label { display: block; font-size: 13px; color: #5a6b7e; margin-bottom: 8px; font-weight: 600; }
.chk-row { display: flex; flex-wrap: wrap; gap: 14px; }
.chk-row label, .chk-grid label { font-size: 14px; cursor: pointer; display: flex; align-items: center; gap: 5px; }
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 14px; }

.year-row { display: flex; align-items: center; gap: 10px; }
.year-row input {
  padding: 7px 10px; border: 1px solid #cfd8e3; border-radius: 6px; font-size: 14px; width: 110px;
}
.year-row input[type="date"] { width: 150px; }

.btn-row { display: flex; gap: 12px; margin-top: 4px; }
.btn {
  padding: 9px 20px; border: 1px solid #cfd8e3; background: #fff; border-radius: 6px;
  font-size: 14px; cursor: pointer; color: #1f2d3d; font-weight: 600;
}
.btn:hover { background: #f0f4fa; }
.btn.primary { background: #1f4e79; color: #fff; border-color: #1f4e79; }
.btn.primary:hover { background: #16385a; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- 结果区 ---------- */
.result { min-height: 60px; }
.result table { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; margin-top: 6px; }
.result th, .result td { border: 1px solid #e3e8f0; padding: 7px 10px; text-align: right; white-space: nowrap; }
.result th { background: #1f4e79; color: #fff; font-weight: 600; position: sticky; top: 0; z-index: 2; text-align: center; }
.result td:first-child { text-align: left; position: sticky; left: 0; background: #f7f9fc; font-weight: 600; z-index: 1; }
.result th:first-child { left: 0; z-index: 3; background: #1f4e79; }
.result tr:nth-child(even) td { background: #fafcff; }
.result .sheet-title { font-size: 15px; font-weight: 700; color: #1f4e79; margin: 18px 0 6px; }
.result .unit-note { font-size: 12px; color: #8a98a8; margin-bottom: 4px; }

.table-scroll { overflow: auto; max-height: 560px; border: 1px solid #e3e8f0; border-radius: 8px; }
.loading { color: #5a6b7e; padding: 20px; font-size: 14px; }
.error { color: #c0392b; padding: 16px; font-size: 14px; background: #fdecea; border-radius: 8px; }
.empty { color: #8a98a8; padding: 20px; font-size: 14px; }

/* 公告表 */
.ann-table td:nth-child(4), .ann-table td:nth-child(5),
.ann-table th:nth-child(4), .ann-table th:nth-child(5) { text-align: left; }
.ann-table td:nth-child(5) { min-width: 280px; white-space: normal; }
.ann-table a.dl { color: #1f4e79; text-decoration: none; font-weight: 600; }
.ann-table a.dl:hover { text-decoration: underline; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; background: #eef3fb; color: #2d6cb5; font-size: 12px; }

/* 公告：关键词/打包下载相关 */
.btn.small { padding: 4px 12px; font-size: 12px; }
.result .unit-note { display: flex; justify-content: space-between; align-items: center; }
.ann-table .ann-sel { width: 36px; text-align: center; padding-left: 4px; padding-right: 4px; }
.ann-table td.ann-sel { text-align: center; }
.ann-table th.ann-sel { text-align: center; }

/* ---------- 报表卡片 / 分页 ---------- */
.sheet-block { background: #fff; border: 1px solid #e3e8f0; border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.sheet-block .sheet-title { margin-top: 0; }
.pager { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.pg-btn { padding: 6px 14px; border: 1px solid #cfd8e3; background: #fff; border-radius: 6px; font-size: 13px; cursor: pointer; color: #1f2d3d; }
.pg-btn:hover:not(:disabled) { background: #f0f4fa; }
.pg-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pg-info { font-size: 13px; color: #5a6b7e; }
.export-unit { font-size: 13px; color: #5a6b7e; display: flex; align-items: center; gap: 6px; }
.export-unit select { padding: 6px 8px; border: 1px solid #cfd8e3; border-radius: 6px; font-size: 13px; }

/* ---------- 页脚 ---------- */
.footer { text-align: center; color: #8a98a8; font-size: 12px; padding: 24px; }

@media (max-width: 700px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .search-box { width: 100%; }
}
