:root {
  --blue: #0b6bcb;
  --blue-dark: #085095;
  --blue-light: #e8f1fb;
  --ink: #1a2433;
  --ink-2: #5d6b7d;
  --line: #e3e9f0;
  --bg: #f4f7fb;
  --card: #fff;
  --ok: #16a36a;
  --warn: #c2761a;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(15, 42, 76, .07);
}

* { box-sizing: border-box; }

/* hidden 属性必须能压住组件自身的 display，否则加载圈不会消失 */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 18px; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 66px;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0b6bcb, #1f9cea);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: .5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; }
.brand-text small { color: var(--ink-2); font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.quota-badge {
  font-size: 13px;
  background: var(--blue-light);
  color: var(--blue-dark);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.quota-badge b { font-size: 15px; }
.quota-badge.ok { background: #e7f7ef; color: #0d7a4d; }

/* ---------- 公告 ---------- */
.announce {
  background: #fff8e6;
  border-bottom: 1px solid #f3e3bd;
}
.announce-inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 18px;
  font-size: 13.5px;
  color: #6b4a12;
}
.announce-icon {
  flex: none;
  background: #e8a33d;
  color: #fff;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 5px;
  margin-top: 2px;
}
.announce p { margin: 0; flex: 1; }
.announce-close {
  flex: none;
  border: 0; background: transparent; cursor: pointer;
  color: #9a7b3f; font-size: 18px; line-height: 1;
  padding: 0 2px;
}

/* ---------- 主体 ---------- */
.main { padding: 30px 18px 50px; }

.hero { text-align: center; margin-bottom: 26px; }
.hero h1 { font-size: 26px; margin: 0 0 10px; letter-spacing: .5px; }
.hero p { color: var(--ink-2); margin: 0 auto; max-width: 660px; }
.hero-tags {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  margin-top: 14px;
}
.hero-tags span {
  font-size: 12.5px;
  color: var(--blue-dark);
  background: var(--blue-light);
  border-radius: 999px;
  padding: 4px 12px;
}

.alert {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
  font-size: 14px;
  border: 1px solid #f0d9a8;
  background: #fffaf0;
  color: #7a5310;
}
.alert code { background: #fff; padding: 2px 6px; border-radius: 4px; }

.tool-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: #f1f5fa;
  border-radius: 10px;
  padding: 5px;
  margin-bottom: 18px;
}
.tab {
  border: 0;
  background: transparent;
  padding: 10px 6px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
  font-family: inherit;
  transition: .18s;
  white-space: nowrap;
}
.tab.active {
  background: #fff;
  color: var(--blue);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(11, 107, 203, .12);
}

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

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  border: 2px dashed #c6d6e8;
  border-radius: 12px;
  padding: 30px 16px;
  cursor: pointer;
  transition: .18s;
  background: #fbfdff;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--blue);
  background: #f2f8ff;
}
.dz-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.dz-title { font-weight: 600; font-size: 15px; }
.dz-sub { color: var(--ink-2); font-size: 12.5px; }
.dz-name { color: var(--ok); font-size: 13px; margin-top: 4px; word-break: break-all; }

.opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}
.opt { display: flex; flex-direction: column; gap: 6px; }
.opt > span { font-size: 13px; color: var(--ink-2); }
.opt select, .opt input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}

.hint { color: var(--ink-2); font-size: 13px; margin: 12px 0 16px; }

.perm-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  background: #f8fafd;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--ink-2);
}
.perm-title { font-weight: 600; color: var(--ink); }
.perm-box label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.perm-box input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--blue); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 11px 20px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: .18s;
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.primary:disabled { opacity: .6; cursor: not-allowed; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn.block { width: 100%; }
.btn.small { padding: 7px 14px; font-size: 13px; border-radius: 8px; }

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 26px 0 8px;
}
.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--blue-light);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading p { color: var(--ink-2); font-size: 14px; margin: 0; }

.result { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.result-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.result-body .file-line {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdff;
  word-break: break-all;
}
.result-body .file-line span { font-size: 13.5px; }

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 26px;
}
.feature {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 2px 12px rgba(15, 42, 76, .05);
}
.feature h3 { margin: 0 0 6px; font-size: 15px; color: var(--blue-dark); }
.feature p { margin: 0; color: var(--ink-2); font-size: 13px; }

/* ---------- 底部 ---------- */
.footer {
  border-top: 1px solid var(--line);
  background: #fff;
  margin-top: 30px;
}
.footer-inner { padding: 22px 18px; text-align: center; }
.footer-links {
  display: flex;
  gap: 18px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
}
.footer-links a { color: var(--ink-2); display: inline-flex; align-items: center; gap: 5px; }
.footer-links a:hover { color: var(--blue); }
.footer-links .police svg { color: #2b6cb0; }
.footer-copy { margin-top: 10px; color: #93a0b0; font-size: 12.5px; }
.muted { color: #93a0b0; }

/* ---------- 后台 ---------- */
.admin-body { background: #eef2f7; }
.admin-wrap { max-width: 900px; margin: 0 auto; padding: 26px 16px 60px; }
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 4px; font-size: 18px; }
.card .desc { color: var(--ink-2); font-size: 13px; margin: 0 0 16px; }

.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.form-row .tip { color: var(--ink-2); font-size: 12.5px; font-weight: 400; margin-top: 4px; }
.form-row input[type=text], .form-row input[type=password], .form-row input[type=number],
.form-row textarea, .form-row select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
.form-row textarea { min-height: 96px; resize: vertical; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}
.switch-row:last-of-type { border-bottom: 0; }
.switch { position: relative; display: inline-block; width: 48px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0;
  background: #cbd5e1; border-radius: 999px;
  transition: .2s; cursor: pointer;
}
.switch span::before {
  content: ""; position: absolute;
  width: 20px; height: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::before { transform: translateX(22px); }

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

.admin-nav {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.admin-nav a {
  background: #fff; border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 9px; font-size: 13.5px; color: var(--ink-2);
}
.admin-nav a.active { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.admin-nav a:hover { text-decoration: none; }

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: #16324f; color: #fff;
  padding: 10px 20px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .24s; z-index: 100;
}
.toast.show { opacity: 1; bottom: 44px; }

table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list th, table.list td {
  text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line);
}
table.list th { color: var(--ink-2); font-weight: 600; background: #f8fafd; }
table.list td { word-break: break-all; }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .topbar-inner { height: auto; padding: 12px 0; flex-wrap: wrap; }
  .brand-text small { display: none; }
  .hero h1 { font-size: 22px; }
  .hero p { font-size: 13.5px; }
  .tabs { grid-template-columns: repeat(2, 1fr); }
  .opts, .grid2 { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr; }
  .tool-card { padding: 14px; }
  .dropzone { padding: 24px 12px; }
  .main { padding: 22px 14px 40px; }
  .quota-badge { font-size: 12px; padding: 4px 10px; }
}

/* ================= 工具分组卡片 ================= */
.tool-group { margin-bottom: 26px; }
.group-head { margin-bottom: 12px; }
.group-head h2 {
  margin: 0 0 2px;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.group-head h2::before {
  content: "";
  width: 4px;
  height: 16px;
  background: var(--blue);
  border-radius: 2px;
}
.group-head p { margin: 0; color: var(--ink-2); font-size: 13px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.tool-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  color: inherit;
  transition: .18s;
  box-shadow: 0 1px 6px rgba(15, 42, 76, .04);
}
.tool-item:hover {
  text-decoration: none;
  border-color: var(--blue);
  box-shadow: 0 6px 18px rgba(11, 107, 203, .12);
  transform: translateY(-1px);
}
.tool-item.disabled { opacity: .55; }
.tool-item.disabled .tool-arrow { display: none; }

.tool-icon {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--blue);
  letter-spacing: .5px;
}
.tool-icon.big { width: 46px; height: 46px; font-size: 17px; }
.icon-pdf { background: linear-gradient(135deg, #e0574f, #f07167); }
.icon-convert { background: linear-gradient(135deg, #0b6bcb, #2aa0ea); }
.icon-topdf { background: linear-gradient(135deg, #16a36a, #2cc383); }

.tool-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tool-text strong { font-size: 14.5px; }
.tool-text small {
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tool-arrow { flex: none; color: #b8c4d4; font-size: 18px; }

/* ================= 工具详情页 ================= */
.crumb {
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 14px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.crumb b { color: var(--ink); }

.tool-page { margin-bottom: 20px; }
.tool-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.tool-head h1 { margin: 0 0 4px; font-size: 22px; }
.tool-head p { margin: 0; color: var(--ink-2); font-size: 13.5px; }

@media (max-width: 720px) {
  .card-grid { grid-template-columns: 1fr; }
  .tool-head h1 { font-size: 19px; }
  .tool-icon { width: 34px; height: 34px; font-size: 13px; }
}
