/* 证书管理系统 - 公共样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
  background: #f4f3ee;
  color: #1a1b1c;
  font-size: 14px;
}
a { text-decoration: none; color: inherit; }
.container { max-width: 1280px; margin: 0 auto; padding: 16px; }

/* 顶栏 */
.topbar {
  background: #fff;
  border-bottom: 1px solid #e4e3dd;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.topbar .brand { font-size: 17px; font-weight: 600; }
.topbar .user-info { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #555; }
.topbar .btn-logout {
  background: #fff; border: 1px solid #d0cfc9; border-radius: 8px;
  padding: 6px 14px; cursor: pointer; font-size: 13px; color: #555;
}
.topbar .btn-logout:hover { background: #f4f3ee; }

/* 卡片 */
.card {
  background: #fff; border: 1px solid #e4e3dd; border-radius: 12px;
  padding: 16px; margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

/* 统计卡片组 */
.stat-grid {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.stat-card {
  flex: 1 1 150px; min-width: 140px; background: #fff;
  border: 1px solid #e4e3dd; border-radius: 12px; padding: 14px;
}
.stat-card .label { font-size: 12px; color: #6b7280; }
.stat-card .value { font-size: 22px; font-weight: 600; margin-top: 4px; }
.stat-card .sub { font-size: 11px; color: #6b7280; margin-top: 2px; }
.stat-card.green .value { color: #2f9e44; }
.stat-card.red .value { color: #c92a2a; }
.stat-card.orange .value { color: #e8590c; }
.stat-card.blue .value { color: #1971c2; }

/* 按钮 */
.btn {
  display: inline-block; background: #1971c2; color: #fff;
  border: none; border-radius: 8px; padding: 7px 16px;
  font-size: 13px; cursor: pointer;
}
.btn:hover { opacity: 0.9; }
.btn-secondary { background: #fff; color: #333; border: 1px solid #d0cfc9; }
.btn-danger { background: #c92a2a; }
.btn-small { padding: 4px 10px; font-size: 12px; }
.btn-green { background: #2f9e44; }
.btn-orange { background: #e8590c; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #ecebe5; white-space: nowrap; }
th { background: #faf9f6; font-weight: 600; color: #444; }
tr:hover { background: #faf9f6; }
td.warn-red { color: #c92a2a; font-weight: 600; }
td.warn-orange { color: #e8590c; font-weight: 600; }

/* 徽标 */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 12px; background: #eef0f3; color: #444;
}
.badge.red { background: #ffe3e3; color: #c92a2a; }
.badge.orange { background: #fff3bf; color: #e8590c; }
.badge.green { background: #d3f9d8; color: #2f9e44; }
.badge.blue { background: #d0ebff; color: #1971c2; }
.badge.gray { background: #e9ecef; color: #495057; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.form-item { display: flex; flex-direction: column; gap: 4px; }
.form-item label { font-size: 12px; color: #555; }
.form-item input, .form-item select, .form-item textarea {
  border: 1px solid #d0cfc9; border-radius: 8px; padding: 8px 10px;
  font-size: 13px; font-family: inherit; background: #fff;
}
.form-item textarea { min-height: 60px; resize: vertical; }
.form-item input:focus, .form-item select:focus, .form-item textarea:focus {
  outline: none; border-color: #1971c2;
}
.form-actions { margin-top: 12px; display: flex; gap: 8px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: none; align-items: center; justify-content: center; z-index: 999;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 14px; padding: 20px;
  width: 92%; max-width: 720px; max-height: 90vh; overflow-y: auto;
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.modal-close {
  float: right; border: none; background: none; font-size: 20px;
  cursor: pointer; color: #888; line-height: 1;
}

/* 提示条 */
.toast {
  position: fixed; top: 16px; right: 16px; background: #1a1b1c; color: #fff;
  padding: 10px 18px; border-radius: 8px; font-size: 13px; z-index: 1200;
  opacity: 0; transform: translateY(-8px); transition: all .25s;
  max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #2f9e44; }
.toast.error { background: #c92a2a; }
.toast.warn { background: #e8590c; }

/* 页签 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid #e4e3dd; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 9px 18px; font-size: 14px; cursor: pointer; color: #555;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: #1971c2; border-bottom-color: #1971c2; font-weight: 600; }

/* 柱状图（纯CSS） */
.bar-chart { display: flex; align-items: flex-end; gap: 18px; min-height: 180px; padding-top: 10px; flex-wrap: wrap; }
.bar-item { display: flex; flex-direction: column; align-items: center; flex: 1 1 60px; min-width: 56px; }
.bar-value { font-size: 11px; color: #555; margin-bottom: 4px; }
.bar-bar {
  width: 32px; background: linear-gradient(180deg, #74a9f0, #1971c2);
  border-radius: 6px 6px 0 0; min-height: 4px;
}
.bar-name { font-size: 12px; color: #6b7280; margin-top: 6px; text-align: center; }

/* 滚动公告 */
.marquee {
  overflow: hidden; white-space: nowrap; background: #fff;
  border: 1px solid #e4e3dd; border-radius: 12px; padding: 12px 0;
}
.marquee-inner { display: inline-block; padding-left: 100%; animation: scroll 22s linear infinite; }
@keyframes scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }
.marquee-item { display: inline-block; margin-right: 60px; font-size: 16px; font-weight: 500; }
.marquee-item .tag { color: #e8590c; margin-right: 8px; font-weight: 600; }

/* 大屏 */
.screen-body {
  background: #101418; color: #f8f9fa; min-height: 100vh;
  display: flex; flex-direction: column; gap: 18px; padding: 24px 32px;
}
.screen-title { font-size: 30px; font-weight: 700; letter-spacing: 2px; }
.screen-sub { font-size: 14px; color: #adb5bd; }
.screen-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.screen-stat {
  flex: 1 1 180px; background: #1c2128; border: 1px solid #2c333d;
  border-radius: 14px; padding: 18px;
}
.screen-stat .label { font-size: 13px; color: #adb5bd; }
.screen-stat .value { font-size: 34px; font-weight: 700; margin-top: 6px; }
.screen-table table { font-size: 15px; }
.screen-table th { background: #1c2128; color: #adb5bd; }
.screen-table td { border-bottom-color: #2c333d; }
.screen-table tr:hover { background: #1c2128; }

/* 空状态 */
.empty { text-align: center; color: #999; padding: 40px 0; font-size: 13px; }

/* 公告横幅（总报表第一屏醒目位置） */
.ann-banner {
  border: 2px solid #e8590c; background: linear-gradient(135deg, #fff4e6, #fff);
  margin-bottom: 18px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}
.ann-banner .ann-list { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.ann-banner .ann-item { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.ann-banner .card-title { color: #e8590c; font-size: 16px; }
.ann-list { display: flex; flex-direction: column; gap: 10px; }
.ann-item { padding: 12px 14px; background: #fff; border: 2px solid #ffd8a8; border-left: 4px solid #e8590c; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.ann-item b { font-size: 15px; color: #1a1b1c; }
.ann-item .ann-period { display: block; margin-left: 0; margin-top: 5px; font-size: 12px; color: #e8590c; font-weight: 600; }
.ann-item .ann-content { margin-top: 6px; font-size: 13px; color: #444; white-space: pre-wrap; line-height: 1.7; background: #fff9f0; border: 1px dashed #ffd8a8; border-radius: 8px; padding: 8px 10px; }
.ann-item .ann-period { margin-left: 10px; font-size: 12px; color: #999; }
.ann-item .ann-content { margin-top: 6px; font-size: 13px; color: #444; white-space: pre-wrap; line-height: 1.7; }

/* 到期提醒名单（单行紧凑：姓名·证书·到期日·剩N天） */
.due-list { display: flex; flex-direction: column; gap: 8px; }
.due-count { font-weight: 400; color: #555; font-size: 12px; margin-left: 4px; }
.due-item {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 11px 14px; border-radius: 10px; font-size: 14px;
  border: 2px solid transparent;
}
.due-item.due-red { background: #fff0f0; color: #b91c1c; border-color: #dc2626; }
.due-item.due-orange { background: #fff8e6; color: #b45309; border-color: #f59e0b; }
.due-name { font-weight: 800; font-size: 16px; }
.due-cert { font-weight: 700; }
.due-date { font-weight: 800; font-size: 15px; }
.due-days { font-weight: 700; padding: 1px 8px; border-radius: 10px; background: #e8590c; color: #fff; }
.due-days.due-days-red { background: #c92a2a; animation: due-blink 1.2s infinite; }
@keyframes due-blink { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }
.due-period { font-size: 12px; opacity: 0.8; }

/* 筛选行 */
.filter-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filter-row input, .filter-row select {
  border: 1px solid #d0cfc9; border-radius: 8px; padding: 7px 10px; font-size: 13px;
}

@media (max-width: 600px) {
  .topbar { padding: 10px 14px; }
  .container { padding: 10px; }
  .stat-card { flex: 1 1 100%; }
  table { font-size: 12px; }
}

.due-toggle { cursor: pointer; user-select: none; }
.due-toggle:hover { color: #1b6ec2; }
.fold-arrow { font-size: 12px; color: #888; margin-left: 6px; }
