/* ============ 考勤表工具 样式 ============ */
:root {
  --ink: #1d3557;          /* 主深蓝 */
  --ink-soft: #3d5678;
  --paper: #f6f1e7;        /* 纸感背景 */
  --card: #fffdf8;
  --line: #e2dacb;         /* 卡片描边 */
  --line-soft: #ece4d5;
  --seal: #b03a2e;         /* 印章红 */
  --seal-deep: #8f2f24;
  --rest: #2e7d5b;         /* 休息绿 */
  --text: #2c3038;
  --muted: #7a7f8a;
  --accent: #2c6e9c;
  --shadow: 0 10px 30px rgba(45, 40, 30, .08);
  --radius: 14px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(44, 110, 156, .10), transparent 60%),
    radial-gradient(900px 420px at -10% 10%, rgba(176, 58, 46, .06), transparent 55%),
    var(--paper);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255,255,255,.6);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: var(--ink);
  color: #fff;
  font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
  font-size: 22px;
  border-radius: 10px 10px 10px 2px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}

.brand-text h1 { font-size: 19px; font-weight: 700; letter-spacing: .5px; color: var(--ink); }
.brand-text p { font-size: 12px; color: var(--muted); letter-spacing: 2px; margin-top: 2px; }

.topbar-right { display: flex; align-items: center; gap: 14px; }

.pill-num {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line-soft);
  padding: 6px 12px;
  border-radius: 999px;
}

/* 印章：签名视觉元素 */
.seal {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: grid; place-items: center;
  border: 3px solid var(--seal);
  color: var(--seal);
  font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  text-indent: 2px;
  background: rgba(255, 253, 248, .35);
  box-shadow: 0 0 0 3px rgba(176, 58, 46, .12);
  user-select: none;
}

/* ---------- 主区 ---------- */
.main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* ---------- 模式切换 ---------- */
.modes {
  display: flex;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px;
  width: fit-content;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.mode-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .18s, color .18s;
}

.mode-btn:hover { color: var(--ink); }
.mode-btn.active { background: var(--ink); color: #fff; }

/* ---------- 面板 ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px 24px;
  margin-bottom: 20px;
}

.panel.hidden { display: none; }

.panel-head h2 { font-size: 16px; color: var(--ink); margin-bottom: 4px; }
.panel-desc { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px 18px;
}

.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.field-wide { grid-column: 1 / -1; }

.field input[type="text"], .field select {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.field input[type="text"]:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(44, 110, 156, .14);
}

.field .field { flex-direction: row; align-items: center; }
.field .field input { width: 84px; }

.panel-actions { margin-top: 18px; display: flex; gap: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 9px;
  padding: 10px 20px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .06s, box-shadow .18s, background .18s, color .18s;
}

.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 6px 16px rgba(29, 53, 87, .22); }
.btn-primary:hover { background: #24466f; }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-solid { background: var(--seal); color: #fff; box-shadow: 0 6px 16px rgba(176, 58, 46, .22); }
.btn-solid:hover { background: var(--seal-deep); }

.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* ---------- 上传区 ---------- */
.upload-zone {
  border: 2px dashed var(--line);
  border-radius: 12px;
  background: #fffdf8;
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s;
}

.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: #f4f9fc; }

.upload-icon {
  width: 46px; height: 46px;
  margin: 0 auto 10px;
  display: grid; place-items: center;
  font-size: 20px;
  color: var(--accent);
  background: #eaf2f8;
  border-radius: 50%;
}

.upload-inner p { font-size: 14px; color: var(--text); }
.upload-inner .upload-hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.upload-meta { margin-top: 18px; display: grid; gap: 14px; }
.upload-meta .field { flex-direction: column; }
.upload-meta .field > span { margin-bottom: 4px; }
.upload-meta .row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- 预览区 ---------- */
.preview-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 26px 26px;
}

.preview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.preview-head h2 { font-size: 16px; color: var(--ink); }
.preview-meta { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.sheet-scroll { overflow-x: auto; }

.sheet {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-family: "Songti SC", SimSun, serif;
  font-size: 13px;
  background: #fff;
  box-shadow: 0 2px 0 rgba(45, 40, 30, .05);
}

.sheet th, .sheet td {
  border: 1px solid #c9c2b4;
  padding: 7px 6px;
  text-align: center;
  white-space: nowrap;
}

.sheet th {
  background: #edf0f4;
  color: var(--ink);
  font-weight: 700;
  font-size: 12.5px;
}

.sheet tr td:first-child { font-variant-numeric: tabular-nums; }

.sheet td.rest { background: #eef6f1; color: var(--rest); font-weight: 600; }
.sheet td.sun { color: var(--seal); }
.sheet td.sat { color: var(--accent); }
.sheet td.work { color: var(--text); }
.sheet td.time { font-variant-numeric: tabular-nums; }
.sheet td.sign { color: var(--seal); font-weight: 600; }

.sheet .row-rest td { background: #f4f8f6; color: #8aa397; }

/* ---------- 底部操作 ---------- */
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 20px);
  background: #23272f;
  color: #fff;
  font-size: 13.5px;
  padding: 11px 20px;
  border-radius: 10px;
  box-shadow: 0 10px 26px rgba(0,0,0,.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 60;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--seal-deep); }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .topbar { padding: 14px 16px; }
  .main { padding: 16px 12px 70px; }
  .panel, .preview-wrap { padding: 16px; }
  .actions { flex-direction: column; }
  .actions .btn { width: 100%; }
  .modes { width: 100%; }
  .mode-btn { flex: 1; }
  .seal { width: 44px; height: 44px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}