/* ============================================================
   倒数万年历 · 管理后台样式
   沿用「侧边栏 + 内容区」的经典后台布局，无第三方依赖
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --brand: #2f6fed;
  --brand-dark: #1f57c9;
  --bg: #f4f6fa;
  --panel: #ffffff;
  --line: #e4e8f0;
  --text: #1f2733;
  --text-2: #5b6675;
  --text-3: #949eae;
  --ok: #12a150;
  --warn: #e08a00;
  --danger: #d93838;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- 登录 ---------------- */
.login-page {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2f6fed 0%, #1f3f8f 100%);
}
.login-box {
  width: 360px; background: #fff; border-radius: 14px;
  padding: 36px 32px; box-shadow: 0 18px 50px rgba(0,0,0,.22);
}
.login-logo {
  font-size: 20px; font-weight: 700; text-align: center;
  margin-bottom: 6px; color: var(--text);
}
.login-sub {
  text-align: center; color: var(--text-3); font-size: 12px;
  margin-bottom: 26px;
}
.login-input {
  width: 100%; height: 44px; padding: 0 14px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; outline: none; transition: border-color .15s;
}
.login-input:focus { border-color: var(--brand); }
.login-btn {
  width: 100%; height: 44px; border: none; border-radius: 8px;
  background: var(--brand); color: #fff; font-size: 15px;
  font-weight: 600; cursor: pointer; transition: background .15s;
}
.login-btn:hover { background: var(--brand-dark); }

/* ---------------- 布局 ---------------- */
.main-page { display: flex; min-height: 100vh; }

.sidebar {
  width: 210px; flex: 0 0 210px;
  background: #1c2434; color: #c8d1e0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-logo {
  padding: 22px 20px 18px; font-size: 16px; font-weight: 700; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08); line-height: 1.4;
}
.sidebar-logo small { display:block; font-size:11px; color:#7d8ba3; font-weight:400; margin-top:4px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.nav-item {
  display: block; padding: 11px 20px; cursor: pointer;
  font-size: 14px; color: #c8d1e0; border-left: 3px solid transparent;
  transition: all .15s; user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: rgba(47,111,237,.18); color: #fff;
  border-left-color: var(--brand); font-weight: 600;
}
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.logout-btn {
  width: 100%; height: 36px; border: 1px solid rgba(255,255,255,.18);
  background: transparent; color: #c8d1e0; border-radius: 7px;
  cursor: pointer; font-size: 13px;
}
.logout-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

.content { flex: 1; padding: 26px 30px 60px; min-width: 0; }
.section { display: none; }
.section.active { display: block; }
.section-title { font-size: 19px; font-weight: 700; margin-bottom: 6px; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}

/* ---------------- 卡片 / 统计 ---------------- */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; margin: 18px 0;
}
.stat-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px; display: flex; align-items: center; gap: 14px;
}
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover { border-color: var(--brand); }
.stat-icon { font-size: 26px; }
.stat-num { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px; margin-bottom: 16px;
}
.panel-title {
  font-size: 15px; font-weight: 700; margin-bottom: 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line);
}

/* ---------------- 表格 ---------------- */
.table-wrap {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; overflow-x: auto;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; padding: 12px 14px; background: #f8fafc;
  color: var(--text-2); font-weight: 600; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.data-table td {
  padding: 11px 14px; border-bottom: 1px solid #f0f3f8;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfe; }
.empty-row { text-align: center; color: var(--text-3); padding: 34px 0; }

/* ---------------- 按钮 ---------------- */
.btn-add, .btn-save {
  height: 38px; padding: 0 18px; border: none; border-radius: 8px;
  background: var(--brand); color: #fff; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: background .15s;
}
.btn-add:hover, .btn-save:hover { background: var(--brand-dark); }
.btn-sm {
  height: 30px; padding: 0 11px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--text-2); font-size: 12.5px;
  cursor: pointer; margin-right: 6px; transition: all .15s;
}
.btn-sm:hover { border-color: var(--brand); color: var(--brand); }
.btn-sm.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-ghost { background: #fff; color: var(--text-2); border: 1px solid var(--line); }
.btn-ghost:hover { background: #f5f7fb; }

/* ---------------- 表单 ---------------- */
.settings-form { max-width: 760px; }
.config-tip {
  font-size: 12.5px; color: var(--text-2); line-height: 1.75;
  background: #f0f6ff; border-left: 3px solid var(--brand);
  padding: 11px 14px; border-radius: 6px; margin-bottom: 18px;
}
.config-tip.warn { background: #fff8e8; border-left-color: var(--warn); }
.config-tip.danger { background: #fef1f1; border-left-color: var(--danger); }
.config-group-title {
  font-size: 13px; font-weight: 700; color: var(--text-2);
  margin: 20px 0 10px; padding-bottom: 7px; border-bottom: 1px dashed var(--line);
}
.config-group-title:first-child { margin-top: 0; }
.setting-item { margin-bottom: 16px; }
.setting-item > label {
  display: block; font-size: 13px; font-weight: 600;
  margin-bottom: 6px; color: var(--text);
}
.setting-item .hint { display:block; font-size:12px; color:var(--text-3); font-weight:400; margin-top:4px; line-height:1.6; }
.setting-input {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 7px;
  font-size: 13.5px; outline: none; background: #fff; color: var(--text);
  font-family: inherit;
}
.setting-input:focus { border-color: var(--brand); }
textarea.setting-input { height: auto; padding: 10px 12px; line-height: 1.7; resize: vertical; }
select.setting-input { cursor: pointer; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .row-2, .row-3 { grid-template-columns: 1fr; } }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { width: 17px; height: 17px; cursor: pointer; }

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11.5px; line-height: 18px; white-space: nowrap;
}
.tag-official { background: #e7f6ed; color: var(--ok); }
.tag-estimated { background: #fff4e0; color: var(--warn); }
.tag-rule { background: #eaf1ff; color: var(--brand); }
.tag-date { background: #f0ecff; color: #6b4ee6; }
.tag-festival { background: #ffeef0; color: #d9385f; }
.tag-off { background: #f0f2f6; color: var(--text-3); }
.tag-on { background: #e7f6ed; color: var(--ok); }
.tag-pin { background: #fff2d9; color: #b47400; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20,26,38,.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 50px 16px; overflow-y: auto; z-index: 100;
}
.modal {
  width: 620px; max-width: 100%; background: #fff;
  border-radius: 12px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 18px; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line);
}

.toast {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  background: #1f2733; color: #fff; padding: 11px 22px;
  border-radius: 8px; font-size: 13.5px; z-index: 999;
  box-shadow: 0 8px 26px rgba(0,0,0,.25); max-width: 80vw;
}
.toast.ok { background: #12a150; }
.toast.err { background: #d93838; }

/* ---------------- 图表（纯 CSS 柱状） ---------------- */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 130px; padding: 10px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 42px; background: linear-gradient(180deg,#5b8def,#2f6fed); border-radius: 4px 4px 0 0; min-height: 3px; }
.bar-val { font-size: 11px; color: var(--text-2); font-weight: 600; }
.bar-label { font-size: 10.5px; color: var(--text-3); white-space: nowrap; }

.simple-list { display: flex; flex-direction: column; gap: 9px; }
.simple-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.simple-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.simple-row .cnt { color: var(--text-2); font-variant-numeric: tabular-nums; font-weight: 600; }
.simple-row .track { flex: 0 0 120px; height: 7px; background: #eef1f7; border-radius: 4px; overflow: hidden; }
.simple-row .track > i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }

code.inline {
  background: #f2f4f8; padding: 1.5px 6px; border-radius: 4px;
  font-family: ui-monospace, Consolas, monospace; font-size: 12.5px;
  color: #b3341f;
}

/* ===== 登录页脚注（站点名 / ICP 备案号） ===== */
.login-icp {
  margin-top: 14px;
  font-size: 12px;
  color: #8a93a0;
  text-align: center;
  min-height: 16px;
}
