/* ============================================================
   MOE 许可证分发 · 新拟物派 Neumorphism 设计系统
   浅色单色系 + 双光源阴影，元素从背景中"挤压/凹陷"
   光源固定：左上为亮(-X/-Y, #ffffff)，右下为暗(+X/+Y, #b8bcc2)
   ============================================================ */

:root {
  /* ---- 表面（同一色系）---- */
  --surface: #e0e5ec;
  --surface-raised: #f0f0f3;

  /* ---- 双光源阴影颜色 ---- */
  --sh-dark: #b8bcc2;
  --sh-light: #ffffff;

  /* ---- 文字 ---- */
  --text: #3a3f47;
  --text-muted: #5b6470;
  --text-faint: #8b94a3;

  /* ---- 强调色（交互 / CTA）---- */
  --accent: #6d5dfc;
  --accent-deep: #5a49e6;
  --accent-soft: rgba(109, 93, 252, 0.14);

  /* ---- 状态色（保证 WCAG AA 对比度）---- */
  --danger: #a13a34;
  --success: #256b45;
  --warn: #6f540f;

  /* ---- 圆角 ---- */
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-pill: 999px;

  /* ---- 阴影 token（亮左上 / 暗右下）---- */
  --out-xs: 4px 4px 8px var(--sh-dark), -4px -4px 8px var(--sh-light);
  --out-sm: 6px 6px 12px var(--sh-dark), -6px -6px 12px var(--sh-light);
  --out-lg: 8px 8px 16px var(--sh-dark), -8px -8px 16px var(--sh-light);
  --in-xs: inset 2px 2px 4px var(--sh-dark), inset -2px -2px 4px var(--sh-light);
  --in-sm: inset 4px 4px 8px var(--sh-dark), inset -4px -4px 8px var(--sh-light);
  --in-md: inset 6px 6px 12px var(--sh-dark), inset -6px -6px 12px var(--sh-light);

  /* ---- 动效（软塑料柔韧感）---- */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 0.3s;
}

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

html, body { min-height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--text);
  background: var(--surface);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- 主卡片：凸起 ---- */
.box {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--out-lg);
}

.box.wide { max-width: 640px; }
.box.full { max-width: 1180px; }

/* ---- 标题 ---- */
h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: .3px;
  text-align: center;
  margin-bottom: 8px;
  color: var(--text);
}

h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.subtitle {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 26px;
  line-height: 1.6;
}

/* ---- 表单 ---- */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: .2px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  color: var(--text);
  background: var(--surface);
  border: 0;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-family: inherit;
  box-shadow: var(--in-sm);
  transition: box-shadow var(--dur) var(--ease);
}

.form-group input::placeholder { color: var(--text-faint); }

/* 聚焦时减小内阴影深度：暗示通道打开（非加压） */
.form-group input:focus {
  outline: none;
  box-shadow: var(--in-xs);
}

.form-group input[readonly] { color: var(--text-faint); }

/* ---- 按钮：凸起 → hover 缩小 → active 凹陷（无位移）---- */
.btn {
  width: 100%;
  padding: 13px;
  color: #ffffff;
  border: 0;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: var(--accent);
  box-shadow: var(--out-sm);
  transition: box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}

.btn:hover {
  box-shadow: var(--out-xs);
  background: var(--accent-deep);
}

.btn:active {
  box-shadow: var(--in-sm);
  background: var(--accent-deep);
}

/* ---- 状态提示：凹陷面板 + 文字前缀（不靠颜色单独传递状态）---- */
.error,
.success,
.tip {
  border-radius: var(--r-sm);
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
  box-shadow: var(--in-sm);
  background: var(--surface);
}

.error { color: var(--danger); }
.error::before { content: "⚠ 错误："; font-weight: 600; }

.success { color: var(--success); }
.success::before { content: "✓ 成功："; font-weight: 600; }

.tip { color: var(--warn); margin: 12px 0; }
.tip::before { content: "ℹ 提示："; font-weight: 600; }

/* ---- 通告面板（不含前缀，保留原文案）---- */
.notice {
  border-radius: var(--r-sm);
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
  box-shadow: var(--in-sm);
  background: var(--surface);
  color: var(--warn);
  font-weight: 600;
}

/* ---- 链接 / 次级按钮 ---- */
.admin-link { text-align: center; margin-top: 20px; font-size: 12.5px; }
.admin-link a { color: var(--text-muted); text-decoration: none; transition: color var(--dur) var(--ease); }
.admin-link a:hover { color: var(--accent); }

.btn-link {
  display: inline-block;
  padding: 9px 18px;
  margin: 4px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--r-sm);
  font-size: 13px;
  background: var(--surface);
  box-shadow: var(--out-xs);
  transition: box-shadow var(--dur) var(--ease), color var(--dur) var(--ease);
}

.btn-link:hover { color: var(--accent); box-shadow: var(--out-xs); }
.btn-link:active { box-shadow: var(--in-xs); }

/* ---- 信息表（status.php）---- */
.info-table { width: 100%; border-collapse: collapse; margin: 20px 0; }

.info-table td {
  padding: 12px 14px;
  font-size: 14px;
  vertical-align: top;
}

.info-table td:first-child {
  color: var(--text-muted);
  width: 140px;
  white-space: nowrap;
}

.info-table tr + tr td { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 -1px 0 rgba(184, 188, 194, 0.35); }

/* ---- 步骤区（凹陷嵌面，非嵌套卡片）---- */
.step {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--in-md);
}

.step h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--text); }

/* ---- 命令框 ---- */
.cmd-box { display: flex; gap: 10px; align-items: center; }

.cmd-box code {
  flex: 1;
  padding: 11px 14px;
  color: var(--text);
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 13.5px;
  overflow-x: auto;
  white-space: nowrap;
  background: var(--surface);
  border-radius: var(--r-sm);
  box-shadow: var(--in-sm);
}

.copy-btn {
  flex-shrink: 0;
  padding: 11px 18px;
  color: var(--text-muted);
  border: 0;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  white-space: nowrap;
  background: var(--surface);
  box-shadow: var(--out-xs);
  transition: box-shadow var(--dur) var(--ease), color var(--dur) var(--ease);
}

.copy-btn:hover { color: var(--accent); }
.copy-btn:active { box-shadow: var(--in-xs); }
.copy-btn.done { color: var(--success); box-shadow: var(--in-xs); }

/* ---- 帮助文字 ---- */
.help-content {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.75;
}

.help-content b { color: var(--text); }

.help-content code {
  padding: 1px 7px;
  border-radius: 6px;
  color: var(--accent-deep);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  background: var(--surface);
  box-shadow: var(--in-xs);
}

/* ---- 操作系统标签页（凸起，选中为凹陷）---- */
.os-tabs { display: flex; gap: 10px; margin-bottom: 16px; }

.os-tab {
  flex: 1;
  text-align: center;
  padding: 11px 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  background: var(--surface);
  border-radius: var(--r-sm);
  box-shadow: var(--out-xs);
  transition: box-shadow var(--dur) var(--ease), color var(--dur) var(--ease);
}

.os-tab:hover { color: var(--text); }

.os-tab.active {
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--in-xs);
}

.os-panel { display: none; }
.os-panel.active { display: block; }

/* ---- 管理后台表格 ---- */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  padding: 11px 13px;
  text-align: left;
  white-space: nowrap;
}

.admin-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12.5px;
}

.admin-table tbody tr { transition: background var(--dur) var(--ease); }
.admin-table tbody tr:hover td { background: var(--accent-soft); }

.admin-table tbody td {
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.5), inset 0 1px 0 rgba(184, 188, 194, 0.28);
  color: var(--text);
}

/* ---- 搜索框 ---- */
.search-box { margin-bottom: 18px; display: flex; gap: 10px; }

.search-box input {
  flex: 1;
  padding: 12px 16px;
  color: var(--text);
  background: var(--surface);
  border: 0;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-family: inherit;
  box-shadow: var(--in-sm);
  transition: box-shadow var(--dur) var(--ease);
}

.search-box input::placeholder { color: var(--text-faint); }
.search-box input:focus { outline: none; box-shadow: var(--in-xs); }

.search-box button {
  flex-shrink: 0;
  padding: 12px 22px;
  color: var(--text-muted);
  border: 0;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  box-shadow: var(--out-xs);
  transition: box-shadow var(--dur) var(--ease), color var(--dur) var(--ease);
}

.search-box button:hover { color: var(--accent); }
.search-box button:active { box-shadow: var(--in-xs); }

/* ---- 表格操作按钮 ---- */
.op-btn {
  font-size: 12px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  background: var(--surface);
  box-shadow: var(--out-xs);
  transition: box-shadow var(--dur) var(--ease), color var(--dur) var(--ease);
  text-decoration: none;
  display: inline-block;
}

.op-btn:active { box-shadow: var(--in-xs); }

.op-edit { color: var(--accent); }
.op-edit:hover { color: var(--accent-deep); }
.op-reset { color: var(--danger); }
.op-del { color: var(--danger); }
.op-del:hover { color: #7e2c27; }
.op-his { color: var(--success); }

/* ---- 许可证规范弹窗 ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(58, 63, 71, 0.38);
}

.modal-overlay.show { display: flex; }

.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  max-height: 86vh;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--out-lg);
}

.modal-header { padding: 26px 30px 10px; }

.modal-header h2 { margin: 0; font-size: 19px; color: var(--text); }

.modal-body {
  flex: 1;
  min-height: 0;
  padding: 0 30px 10px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-muted);
}

.modal-intro { margin-bottom: 8px; }

.modal-body h4 { margin: 16px 0 6px; font-size: 13.5px; color: var(--text); }

.modal-body b { color: var(--text); }

.modal-view { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.modal-view[hidden] { display: none; }

.modal-success-text { margin: 4px 0 8px; font-size: 14px; color: var(--text); line-height: 1.8; }
.modal-success-hint { font-size: 13px; color: var(--text-muted); }

.modal-body a { color: var(--accent); text-decoration: none; }
.modal-body a:hover { text-decoration: underline; }

.modal-actions a.btn { display: inline-block; text-align: center; text-decoration: none; }

.modal-body ol { margin: 0; padding-left: 20px; }
.modal-body li { margin-bottom: 4px; }

.modal-footer {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 30px 26px;
}

.modal-agree {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.agree-check {
  position: relative;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--in-sm);
  cursor: pointer;
  transition: box-shadow var(--dur) var(--ease);
}

.agree-check:checked { box-shadow: var(--in-xs); }

.agree-check:checked::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 6px;
  height: 11px;
  border: solid var(--accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }

.modal-actions .btn { width: auto; padding: 11px 24px; }

.btn.ghost { background: var(--surface); color: var(--text-muted); box-shadow: var(--out-xs); }
.btn.ghost:hover { color: var(--text); box-shadow: var(--out-xs); }
.btn.ghost:active { box-shadow: var(--in-xs); }

.btn[disabled] { opacity: 0.55; cursor: not-allowed; box-shadow: var(--out-xs); }
.btn[disabled]:active { box-shadow: var(--out-xs); }

/* ---- 危险按钮 ---- */
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #8f322d; box-shadow: var(--out-xs); }
.btn.danger:active { background: #8f322d; box-shadow: var(--in-sm); }

/* ---- 数据统计卡 ---- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 18px 20px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--in-md);
  text-align: center;
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.stat-label { font-size: 12.5px; color: var(--text-muted); }
.stat-sub { font-size: 12px; color: var(--text-faint); }

.stat-row { display: flex; align-items: center; justify-content: center; gap: 14px; }

/* ---- 开关（新拟物胶囊）---- */
.toggle-form { display: inline-flex; }

.switch {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  width: 52px;
  height: 28px;
}

.switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--in-sm);
  transition: box-shadow var(--dur) var(--ease);
}

.slider::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--out-xs);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}

.switch input:checked + .slider::before { transform: translateX(24px); background: var(--accent); }
.switch input:focus-visible + .slider { box-shadow: var(--in-xs); }

/* ---- 列表工具栏（搜索 + 导出）---- */
.list-toolbar {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 18px;
}

.list-toolbar .search-box { flex: 1; margin-bottom: 0; }

.export-link {
  margin: 0;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

/* ---- 分页控件 ---- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
}

.page-size {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.page-select {
  padding: 8px 10px;
  color: var(--text);
  background: var(--surface);
  border: 0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  box-shadow: var(--in-sm);
  cursor: pointer;
}

.page-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.page-btn {
  display: inline-block;
  padding: 8px 16px;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: 8px;
  font-size: 13px;
  text-decoration: none;
  box-shadow: var(--out-xs);
  transition: box-shadow var(--dur) var(--ease), color var(--dur) var(--ease);
}

.page-btn:hover { color: var(--accent); }
.page-btn:active { box-shadow: var(--in-xs); }
.page-btn.disabled { color: var(--text-faint); box-shadow: none; cursor: not-allowed; }

.page-jump-form { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }

.page-input {
  width: 62px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--surface);
  border: 0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  text-align: center;
  box-shadow: var(--in-sm);
}

.page-input:focus { outline: none; box-shadow: var(--in-xs); }

.page-jump-btn {
  padding: 8px 14px;
  color: var(--text-muted);
  background: var(--surface);
  border: 0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  box-shadow: var(--out-xs);
  transition: box-shadow var(--dur) var(--ease), color var(--dur) var(--ease);
}

.page-jump-btn:hover { color: var(--accent); }
.page-jump-btn:active { box-shadow: var(--in-xs); }

/* ---- 弹窗变体：窄弹窗 / 表单弹窗 ---- */
.modal-sm { max-width: 460px; }

.modal-form { display: flex; flex: 1; flex-direction: column; min-height: 0; }

.confirm-text { font-size: 13.5px; line-height: 1.8; color: var(--text-muted); }
.confirm-text b { color: var(--text); }

.confirm-warn {
  display: inline-block;
  margin-top: 8px;
  color: var(--danger);
  font-weight: 600;
}

/* ---- 响应式：桌面端增大阴影/间距 ---- */
@media (min-width: 768px) {
  .box { padding: 48px; }
  .box.full { padding: 44px; }
}

@media (max-width: 560px) {
  .box { padding: 26px 20px; }
  h1 { font-size: 20px; }
  .os-tabs { flex-direction: column; }
  .stats { grid-template-columns: 1fr; }
  .list-toolbar { flex-direction: column; align-items: stretch; }
  .export-link { justify-content: center; }
  .pagination { justify-content: center; }
  .modal-header { padding: 20px 20px 8px; }
  .modal-body { padding: 0 20px 8px; }
  .modal-footer { padding: 14px 20px 20px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  .modal-sm { max-width: 100%; }
}

/* ---- 无障碍：尊重减少动态效果 ---- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
