/* ============ 阿青驾考 · 管理后台样式 ============ */
:root {
  --primary: #15803D;
  --primary-light: #22C55E;
  --primary-bg: #dcfce7;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --amber: #d97706;
  --sidebar: #0f172a;
  --sidebar-text: #cbd5e1;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #14532d 100%);
}
.login-card {
  background: #fff; padding: 40px; border-radius: 16px; width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card .sub { color: var(--muted); margin-bottom: 24px; font-size: 13px; }
.login-card .logo { font-size: 40px; margin-bottom: 10px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.sidebar .brand {
  padding: 20px; font-size: 17px; font-weight: 700; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 8px;
}
.sidebar nav { padding: 12px 8px; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  border-radius: 8px; color: var(--sidebar-text); margin-bottom: 2px;
  transition: background 0.15s, color 0.15s;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar .side-foot { padding: 16px 20px; font-size: 12px; color: #64748b; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
}
.topbar .title { font-size: 16px; font-weight: 600; }
.topbar .user { display: flex; align-items: center; gap: 12px; }
.topbar .user .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.content { padding: 24px; overflow: auto; flex: 1; }

/* ---------- 卡片 / 表格 ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 20px;
}
.card h3 { font-size: 15px; margin-bottom: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.stat-card .label { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.stat-card .value { font-size: 26px; font-weight: 700; }
.stat-card .value.green { color: var(--primary); }
.stat-card .value.amber { color: var(--amber); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: center; }
.toolbar .spacer { flex: 1; }

input, select, textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
textarea { resize: vertical; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 13px; background: #f8fafc; white-space: nowrap; }
td { vertical-align: middle; }
tbody tr:hover { background: #f8fafc; }
.q-text { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  border-radius: 8px; border: 1px solid transparent; font-size: 13px; font-weight: 500;
  transition: all 0.15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #166534; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; }
.badge-green { background: var(--primary-bg); color: var(--primary); }
.badge-red { background: #fee2e2; color: var(--danger); }
.badge-gray { background: #f1f5f9; color: var(--muted); }
.badge-amber { background: #fef3c7; color: var(--amber); }
.badge-blue { background: #dbeafe; color: #2563eb; }

.pager { display: flex; align-items: center; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.pager button { border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 5px 10px; }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.pager .info { color: var(--muted); margin-right: 8px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,0.5); display: flex;
  align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; z-index: 100;
}
.modal {
  background: #fff; border-radius: 12px; width: 720px; max-width: 100%;
  padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal h2 { font-size: 17px; margin-bottom: 18px; }
.modal .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal .full { grid-column: 1 / -1; }
.modal label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.modal input, .modal select, .modal textarea { width: 100%; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal .hint { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.5; }

/* ---------- 其他 ---------- */
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.loading { text-align: center; color: var(--muted); padding: 40px 0; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-row .name { width: 90px; color: var(--muted); }
.bar-row .track { flex: 1; background: #f1f5f9; border-radius: 6px; height: 20px; overflow: hidden; }
.bar-row .fill { display: block; height: 100%; background: var(--primary-light); border-radius: 6px; }
.bar-row .num { width: 60px; text-align: right; font-weight: 600; }

#toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 14px; z-index: 200; display: none; box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
#toast.show { display: block; }
#toast.success { background: var(--primary); }
#toast.error { background: var(--danger); }

.import-zone {
  border: 2px dashed var(--border); border-radius: 10px; padding: 30px;
  text-align: center; color: var(--muted);
}
.import-zone.drag { border-color: var(--primary); background: var(--primary-bg); }

.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.muted { color: var(--muted); }

/* ---------- 题干缩略图 ---------- */
.q-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.q-thumb { width: 42px; height: 42px; border-radius: 6px; object-fit: cover; flex-shrink: 0; cursor: pointer; background: #f1f5f9; border: 1px solid var(--border); }

/* ---------- 媒体上传控件 ---------- */
.upload-box { border: 1px dashed var(--border); border-radius: 8px; padding: 10px; background: #fafbfc; }
.upload-row { display: flex; align-items: center; gap: 8px; }
.upload-filename { flex: 1; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-preview { display: block; max-width: 100%; max-height: 180px; margin-top: 8px; border-radius: 6px; border: 1px solid var(--border); }

/* ---------- 表单分区 ---------- */
.form-section { grid-column: 1 / -1; font-size: 13px; font-weight: 700; color: var(--primary); margin-top: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

/* ---------- ICP 备案页脚（备案核查要求）---------- */
.site-foot { padding: 10px 16px; text-align: center; font-size: 12px; color: #64748b; }
.site-foot a { color: #64748b; }
.site-foot a:hover { color: #009a61; text-decoration: underline; }
.login-wrap { min-height: calc(100vh - 37px); }
.layout { min-height: calc(100vh - 37px); }
