/* ==========================================================================
 * pc/css/app.css —— PC 打印台「屏幕态」样式
 *
 * 设计令牌沿用基线 错题本.html 的 :root 变量（同一套米色纸感配色），
 * 保证父亲在手机上截图、在电脑上操作时视觉一致。
 *
 * 只管「操作界面」；纸张本身的样式一律在 print.css（1:1 基线，勿动）。
 * ========================================================================== */

:root {
  --bg: #f4f1ea;
  --panel: #ffffff;
  --ink: #2b2b2b;
  --sub: #6b6b6b;
  --line: #e3ddd0;
  --brand: #3b6ea5;
  --brand-soft: #eaf1f8;
  --warn: #c4623d;
  --ok: #3f8f6b;
  --warn-soft: #fbeede;
  --ok-soft: #e6f3ec;
  --shadow: 0 6px 22px rgba(60, 50, 30, .10);
  --radius: 14px;
  font-size: 15px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

/* ---------------- 顶栏 ---------------- */
header.top {
  background: linear-gradient(120deg, #3b6ea5, #5b86b8);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}

header.top .logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

header.top h1 {
  font-size: 19px;
  margin: 0;
  font-weight: 700;
  letter-spacing: .5px;
}

header.top .meta {
  font-size: 12.5px;
  opacity: .9;
  margin-top: 2px;
}

header.top .spacer {
  flex: 1;
}

/* ---------------- 连接条 ---------------- */
.connbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}

.connbar .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #c9c2b4;
  display: inline-block;
}

.connbar .dot.on {
  background: var(--ok);
}

.connbar .dot.off {
  background: var(--warn);
}

.connbar input {
  width: auto;
  min-width: 190px;
  padding: 6px 10px;
  font-size: 13px;
}

.connbar .stat {
  color: var(--sub);
}

.connbar .spacer {
  flex: 1;
}

/* ---------------- Tab ---------------- */
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 18px 0;
  background: var(--bg);
}

.tabs button {
  border: none;
  background: transparent;
  color: var(--sub);
  font-size: 14.5px;
  padding: 10px 16px;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  font-weight: 600;
  transition: .15s;
}

.tabs button.active {
  background: var(--panel);
  color: var(--brand);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, .04);
}

main {
  padding: 20px 22px 60px;
  max-width: 1180px;
  margin: 0 auto;
}

.card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
}

.hidden {
  display: none !important;
}

h2.card-title {
  margin-top: 0;
  font-size: 17px;
}

/* ---------------- 表单 ---------------- */
label.fld {
  display: block;
  margin-bottom: 14px;
}

label.fld .lab {
  font-size: 13px;
  color: var(--sub);
  font-weight: 600;
  margin-bottom: 5px;
  display: block;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 14.5px;
  font-family: inherit;
  background: #fcfbf8;
  color: var(--ink);
}

textarea {
  resize: vertical;
  min-height: 64px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.row3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.row4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 14px;
}

@media (max-width: 680px) {
  .row,
  .row3,
  .row4 {
    grid-template-columns: 1fr;
  }
}

/* ---------------- 按钮 ---------------- */
.btn {
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
  font-family: inherit;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: #2f5a89;
}

.btn-ghost {
  background: var(--brand-soft);
  color: var(--brand);
}

.btn-ghost:hover {
  background: #dce8f4;
}

.btn-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.btn-line {
  background: #fff;
  color: var(--sub);
  border: 1px solid var(--line);
}

.btn-line:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.btn[disabled] {
  opacity: .5;
  cursor: not-allowed;
}

.btn-lg {
  padding: 14px 26px;
  font-size: 16px;
}

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

/* ---------------- 题库表格 ---------------- */
table.q {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.q th,
table.q td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

table.q th {
  color: var(--sub);
  font-weight: 600;
  font-size: 12.5px;
  background: #faf8f3;
}

table.q tr:hover {
  background: #faf8f3;
}

.q-text {
  white-space: pre-wrap;
  max-width: 420px;
}

.mini {
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
  border: none;
}

.mini.del {
  background: var(--warn-soft);
  color: var(--warn);
}

.mini.edt {
  background: var(--brand-soft);
  color: var(--brand);
}

.empty {
  text-align: center;
  color: var(--sub);
  padding: 40px 10px;
}

.hint {
  font-size: 12.5px;
  color: var(--sub);
  background: #faf8f3;
  border-left: 3px solid var(--brand);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  margin: 10px 0;
}

.hint.warn {
  border-left-color: var(--warn);
  background: var(--warn-soft);
}

.hint.ok {
  border-left-color: var(--ok);
  background: var(--ok-soft);
}

/* ---------------- 状态徽标 ---------------- */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.pill.math {
  background: var(--brand-soft);
  color: #2f5a89;
}

.pill.eng {
  background: var(--warn-soft);
  color: #a8542c;
}

.pill.oth {
  background: var(--ok-soft);
  color: #2f7a59;
}

.pill.status-w {
  background: var(--warn-soft);
  color: #a8542c;
}

.pill.status-r {
  background: #fff4d6;
  color: #9a7b16;
}

.pill.status-d {
  background: var(--ok-soft);
  color: #2f7a59;
}

.pill.todo {
  background: #f0ece2;
  color: #8a7f6a;
}

/* ---------------- 统计方块 ---------------- */
.stat {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.stat .box {
  flex: 1;
  min-width: 120px;
  background: #faf8f3;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}

.stat .num {
  font-size: 26px;
  font-weight: 800;
  color: var(--brand);
}

.stat .cap {
  font-size: 12.5px;
  color: var(--sub);
}

/* ---------------- 预览区 ---------------- */
.print-controls {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
}

.print-preview {
  background: #fff;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 26px;
  max-width: 820px;
  margin: 0 auto;
}

/* ---------------- 拖拽上传 ---------------- */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 34px 16px;
  text-align: center;
  color: var(--sub);
  background: #fcfbf8;
  transition: .15s;
}

.dropzone.over {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

/* ---------------- 浮动提示 ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(43, 43, 43, .93);
  color: #fff;
  padding: 11px 22px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: .2s;
  z-index: 999;
  max-width: 76vw;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.err {
  background: rgba(160, 60, 40, .95);
}

/* ---------------- 编辑抽屉 ---------------- */
.editor {
  background: #fcfbf8;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}

.editor h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

code {
  background: #f0ece2;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 13px;
}
