:root {
  --c-primary: #2b5cff;
  --c-primary-d: #1f47d6;
  --c-tax: #1a9b5b;
  --c-tax-d: #147a47;
  --c-admin: #7b53ff;
  --c-admin-d: #5f37db;
  --c-danger: #e54545;
  --c-warn: #e6a23c;
  --c-bg: #f3f5f9;
  --c-card: #ffffff;
  --c-text: #1f2530;
  --c-sub: #6b7280;
  --c-border: #e6e9ef;
  --radius: 12px;
  --shadow: 0 4px 18px rgba(20, 30, 60, 0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--c-primary); text-decoration: none; }

/* ===== 顶部导航 ===== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 58px;
  background: #fff;
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.navbar .brand { font-weight: 700; font-size: 16px; color: var(--c-text); }
.navbar .nav-right { display: flex; align-items: center; gap: 16px; color: var(--c-sub); font-size: 13px; }
.navbar .nav-user b { color: var(--c-text); }

/* ===== 布局容器 ===== */
.container { max-width: 1000px; margin: 0 auto; padding: 22px 20px 60px; }
.page-tip { color: var(--c-sub); font-size: 13px; margin-bottom: 14px; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; cursor: pointer; transition: .15s; font-weight: 500;
  background: #eef1f6; color: var(--c-text); user-select: none;
}
.btn:hover { filter: brightness(0.97); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-d); }
.btn-tax { background: var(--c-tax); color: #fff; }
.btn-tax:hover { background: var(--c-tax-d); }
.btn-admin { background: var(--c-admin); color: #fff; }
.btn-admin:hover { background: var(--c-admin-d); }
.btn-ghost { background: #fff; border-color: var(--c-border); color: var(--c-text); }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== 年份/季度选择条 ===== */
.yearbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 18px;
}
.yearbar .yb-label { font-size: 14px; color: var(--c-sub); }
.yearbar select {
  padding: 7px 12px; border-radius: 8px; border: 1px solid var(--c-border);
  font-size: 14px; background: #fff; color: var(--c-text); cursor: pointer;
}
.yearbar .spacer { flex: 1; }

/* ===== 季度汇总四块 ===== */
.summary {
  background: linear-gradient(135deg, var(--c-primary), #5a82ff);
  color: #fff; border-radius: var(--radius); padding: 22px 22px 18px;
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.summary.tax { background: linear-gradient(135deg, var(--c-tax), #43c98b); }
.summary .summary-label { font-size: 14px; opacity: .92; margin-bottom: 14px; }
.quarter-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.q-block { background: rgba(255,255,255,.14); border-radius: 10px; padding: 14px; }
.q-block .q-name { font-size: 13px; opacity: .92; }
.q-block .q-range { font-size: 12px; opacity: .8; margin-top: 2px; }
.q-block .q-value { font-size: 26px; font-weight: 700; margin-top: 8px; }

/* ===== 卡片列表 ===== */
.card {
  background: var(--c-card); border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.card-row { font-size: 13px; color: var(--c-sub); display: flex; justify-content: space-between; padding: 3px 0; }
.card-row .v { color: var(--c-text); }
.card-action { margin-top: 12px; }
.empty { color: var(--c-sub); text-align: center; padding: 30px 0; font-size: 13px; }

/* ===== 标签 ===== */
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; }
.tag-draft { background: #fff4e5; color: #c77700; }
.tag-submitted { background: #e7f7ef; color: #1a9b5b; }
.tag-disabled { background: #fdecec; color: #d63a3a; }

/* ===== 登录页 ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2b5cff 0%, #7b53ff 100%); padding: 20px; }
.login-card { width: 100%; max-width: 440px; background: #fff; border-radius: 16px; padding: 30px; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.login-card h1 { font-size: 20px; text-align: center; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--c-sub); font-size: 13px; margin-bottom: 20px; }
.entry-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.entry-card {
  border: 2px solid var(--c-border); border-radius: 12px; padding: 16px 12px; text-align: center;
  cursor: pointer; transition: .15s; background: #fff;
}
.entry-card .ec-icon { font-size: 26px; }
.entry-card .ec-name { font-weight: 600; margin-top: 6px; }
.entry-card .ec-desc { font-size: 12px; color: var(--c-sub); margin-top: 2px; }
.entry-card.active { border-color: var(--c-primary); background: #f3f6ff; box-shadow: 0 0 0 3px rgba(43,92,255,.12); }
.entry-card.admin.active { border-color: var(--c-admin); background: #f6f3ff; box-shadow: 0 0 0 3px rgba(123,83,255,.12); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--c-sub); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 11px 14px; border: 1px solid var(--c-border); border-radius: 9px;
  font-size: 14px; outline: none; transition: .15s;
}
.field input:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(43,92,255,.1); }
.err-msg { color: var(--c-danger); font-size: 13px; min-height: 18px; margin-bottom: 8px; text-align: center; }
.demo-box { margin-top: 16px; border-top: 1px dashed var(--c-border); padding-top: 14px; }
.demo-box .db-title { font-size: 12px; color: var(--c-sub); margin-bottom: 8px; }
.demo-item { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; background: #f7f9fc; border-radius: 8px; margin-bottom: 6px; font-size: 13px; }
.demo-item .di-meta { color: var(--c-sub); font-size: 12px; }
.demo-item .di-fill { color: var(--c-primary); cursor: pointer; font-weight: 600; }

/* ===== 填报页 ===== */
.form-block { background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { flex: 1; min-width: 200px; margin-bottom: 0; }
.history-list { margin-top: 6px; }
.history-item { display: flex; align-items: center; justify-content: space-between; padding: 11px 4px; border-bottom: 1px dashed var(--c-border); font-size: 13px; }
.history-item:last-child { border-bottom: none; }
.history-item .hi-period { font-weight: 500; }
.history-item .hi-amount { color: var(--c-primary); font-weight: 600; margin: 0 14px; }
.hint { font-size: 12px; color: var(--c-sub); margin-top: 10px; }
.lock-tip { color: #d63a3a; background: #fdecec; border: 1px solid #f5c2c2; padding: 6px 10px; border-radius: 6px; margin-top: 6px; line-height: 1.5; }

/* ===== 表格（管理后台） ===== */
.table-wrap { background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 18px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--c-border); }
th { background: #f7f9fc; color: var(--c-sub); font-weight: 600; font-size: 12px; }
tr:last-child td { border-bottom: none; }
td .row-actions { display: flex; gap: 6px; }
.section-title { font-size: 16px; font-weight: 700; margin: 22px 0 12px; display: flex; align-items: center; gap: 10px; }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 8px 16px; border-radius: 8px; background: #fff; border: 1px solid var(--c-border); cursor: pointer; font-size: 13px; color: var(--c-sub); }
.tab.active { background: var(--c-admin); color: #fff; border-color: var(--c-admin); }

/* ===== 弹窗 ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,20,35,.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 14px; width: 90%; max-width: 380px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.modal-content { color: var(--c-sub); font-size: 14px; margin-bottom: 20px; white-space: pre-wrap; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ===== toast ===== */
.toast-layer { position: fixed; top: 18px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 200; pointer-events: none; }
.toast { background: #2b3140; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; opacity: 0; transform: translateY(-8px); transition: .25s; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 90%; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: #1a9b5b; }
.toast-error { background: #e54545; }

.text-muted { color: var(--c-sub); }
.mt-12 { margin-top: 12px; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-end { justify-content: flex-end; }
