:root {
  --brand: #15706a;
  --brand-dark: #0f524e;
  --brand-soft: #e6f2f0;
  --bg: #f4f6f7;
  --card: #ffffff;
  --line: #e2e8e8;
  --text: #1f2a2e;
  --muted: #6b7b80;
  --danger: #c0392b;
  --warn: #b7791f;
  --ok: #1f8a52;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

a { color: var(--brand); }

button {
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
}

.hidden { display: none !important; }

/* ---------------- 登录 ---------------- */

.auth-wrap {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* 底部留出备案号的位置，注册表单撑高时也不会压到它 */
  padding: 24px 16px 52px;
  background: linear-gradient(140deg, #0f524e, #15706a 55%, #2a9d8f);
}

.auth-beian {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  text-align: center;
  font-size: 12px;
}

.auth-beian a { color: rgba(255, 255, 255, .72); text-decoration: none; }
.auth-beian a:hover { color: #fff; text-decoration: underline; }

.auth-card {
  width: 420px;
  background: #fff;
  border-radius: 14px;
  padding: 32px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .22);
}

/* 副标题去掉后，标题和标签页之间要自己撑开间距 */
.auth-card h1 { margin: 0 0 22px; font-size: 20px; }

.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  background: var(--bg);
  padding: 4px;
  border-radius: 8px;
}

.auth-tabs button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px;
  border-radius: 6px;
  color: var(--muted);
}

.auth-tabs button.active { background: #fff; color: var(--brand); font-weight: 600; }

.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

/* ---------------- 布局 ---------------- */

.shell { display: flex; min-height: 100vh; }

.side {
  width: 210px;
  background: var(--brand-dark);
  color: #cfe4e2;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.side .brand {
  padding: 20px 18px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  line-height: 1.4;
}

.side .brand small { display: block; font-weight: 400; font-size: 12px; color: #9fc4c0; margin-top: 4px; }

.side nav { flex: 1; padding: 10px 0; }

.side nav button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  border: none;
  background: transparent;
  color: #cfe4e2;
  text-align: left;
  padding: 11px 18px;
  border-left: 3px solid transparent;
}

.side nav button:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side nav button.active { background: rgba(255, 255, 255, .12); color: #fff; border-left-color: #6fd3c7; }

.side .side-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; color: #9fc4c0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.topbar h2 { margin: 0; font-size: 16px; }
.topbar .who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }

.content { padding: 20px; flex: 1; }

/* ---------------- 组件 ---------------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
}

.card > h3 { margin: 0 0 4px; font-size: 15px; }
.card > .desc { margin: 0 0 14px; color: var(--muted); font-size: 13px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

.stat .n { font-size: 26px; font-weight: 600; color: var(--brand); }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 4px; }
.stat.warn .n { color: var(--warn); }
.stat.danger .n { color: var(--danger); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.toolbar .spacer { flex: 1; }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
}

.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f0c8c3; }
.btn.danger:hover { background: #fdf1ef; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; }

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th { background: #fafbfb; color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
tbody tr:hover { background: #fafcfc; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn { margin-left: 6px; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.tag.ok { background: #e4f5ea; color: var(--ok); }
.tag.warn { background: #fdf3e0; color: var(--warn); }
.tag.danger { background: #fbeae8; color: var(--danger); }
.tag.mute { background: #eef1f1; color: var(--muted); }

code.mono {
  font-family: Consolas, "Courier New", monospace;
  background: #f2f5f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.muted { color: var(--muted); }
.empty { padding: 36px; text-align: center; color: var(--muted); }

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 28, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal {
  background: #fff;
  border-radius: 12px;
  width: 560px;
  max-width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 22px;
}

.modal h3 { margin: 0 0 16px; font-size: 16px; }
.modal .modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin: 0 0 14px; }
legend { padding: 0 6px; color: var(--muted); font-size: 13px; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #22343a;
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  z-index: 100;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .25);
  max-width: 420px;
}

.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }

.banner {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  background: #fdf3e0;
  color: var(--warn);
  border: 1px solid #f2dfba;
}

.banner.danger { background: #fbeae8; color: var(--danger); border-color: #f0c8c3; }

/* ---------------- 使用说明 ---------------- */

.guide-flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }

.guide-step {
  background: #fafcfc;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 8px;
  padding: 14px 16px;
}

.guide-step h4 { margin: 0 0 6px; font-size: 13.5px; color: var(--brand-dark); }
.guide-step p { margin: 0; font-size: 13px; line-height: 1.7; color: var(--muted); }

.guide-faq { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.guide-faq:last-child { border-bottom: none; padding-bottom: 0; }
.guide-faq h4 { margin: 0 0 5px; font-size: 13.5px; }
.guide-faq p { margin: 0; font-size: 13px; line-height: 1.7; color: var(--muted); }

.card h4 { margin: 18px 0 8px; font-size: 13.5px; color: var(--brand-dark); }

code.mono.can-copy { cursor: pointer; user-select: all; }
code.mono.can-copy:hover { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------------- 记住密码 ---------------- */

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 16px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.checkline input { width: 15px; height: 15px; accent-color: var(--brand); }

/* ---------------- 回收站 ---------------- */

.trash-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.trash-main { flex: 1; min-width: 0; }
.trash-ops { display: flex; gap: 8px; flex-shrink: 0; }

.warn-line { margin-top: 6px; font-size: 12px; color: #b26a00; }

/* ---------------- 自适应 ---------------- */

/* 宽屏放不下时先横向滚，窄屏再转成卡片 */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 38px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  flex-shrink: 0;
}

.nav-toggle span { display: block; height: 2px; background: var(--text); border-radius: 2px; }
.nav-toggle:hover { border-color: var(--brand); }
.nav-toggle:hover span { background: var(--brand); }

.nav-mask { display: none; }

/* 横屏平板：侧栏收窄，正文留白减少 */
@media (max-width: 1024px) {
  .side { width: 180px; }
  .content { padding: 16px; }
  th, td { padding: 9px 10px; }
}

/* 竖屏平板与手机：侧栏改成抽屉 */
@media (max-width: 900px) {
  .nav-toggle { display: flex; }

  .side {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    z-index: 46;
    transform: translateX(-100%);
    transition: transform .22s ease;
  }

  .shell.nav-open .side { transform: none; }

  .nav-mask {
    position: fixed;
    inset: 0;
    background: rgba(15, 25, 28, .45);
    z-index: 45;
  }

  .shell.nav-open .nav-mask { display: block; }

  .side nav button { padding: 13px 18px; }

  .topbar { padding: 0 14px; gap: 10px; }
  .topbar h2 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .who { min-width: 0; }

  .topbar .who span {
    display: block;
    max-width: 42vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* 手机：表格转卡片、表单单列、控件加大 */
@media (max-width: 720px) {
  .content { padding: 12px; }
  .card { padding: 14px; border-radius: 8px; }

  .table-wrap { overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }

  tr {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 4px 0;
  }

  tbody tr:hover { background: #fff; }

  td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 12px;
    border-bottom: none;
    text-align: right;
  }

  /* 表头没了，用每格自己的字段名当标签 */
  td[data-label]:not(.actions)::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12.5px;
    text-align: left;
  }

  td.actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
  }

  td.actions .btn { margin-left: 0; }

  .field-row { flex-direction: column; gap: 0; }

  .toolbar { gap: 8px; }
  .toolbar input, .toolbar select { width: 100%; min-width: 0; }
  .toolbar .spacer { display: none; }

  .btn { padding: 9px 14px; }
  .btn.sm { padding: 7px 12px; }

  .stat { padding: 13px; }
  .stat .n { font-size: 22px; }

  .modal { padding: 18px; border-radius: 10px; }
  .modal-mask { align-items: flex-start; padding: 24px 12px 12px; }

  .toast { left: 14px; right: 14px; bottom: 14px; max-width: none; }

  /* 回收站在窄屏改成上下堆叠，按钮撑满好点 */
  .trash-item { flex-direction: column; align-items: stretch; }
  .trash-ops { justify-content: flex-end; }
}

/* 小屏手机：登录卡片撑满 */
@media (max-width: 520px) {
  .auth-wrap { padding: 16px 16px 48px; }
  .auth-card { width: 100%; padding: 24px 20px; }
  .auth-card h1 { font-size: 18px; }
}
