/* ---------- 基础 ---------- */
/* 设计 tokens（统一配色/圆角/阴影/字体） */
:root{
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: rgba(15, 23, 42, .08);
  --line-strong: rgba(15, 23, 42, .12);

  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --danger: #dc2626;

  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow-md: 0 10px 26px rgba(15,23,42,.08);

  --r-sm: 10px;
  --r-md: 14px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 800px at 20% 0%, rgba(37,99,235,.08), transparent 55%),
              radial-gradient(900px 600px at 90% 10%, rgba(220,38,38,.05), transparent 60%),
              var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- 顶栏 ---------- */
.header {
  background: linear-gradient(135deg, #0b1220 0%, #0f172a 60%, #111a2f 100%);
  color: #fff;
  margin: 0 -1.25rem;
  padding: 1rem 1.25rem;
  box-shadow: 0 8px 26px rgba(2, 6, 23, .35);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.header-left{
  display:flex;
  align-items:center;
  gap: .75rem;
}
.header-right{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap: .6rem;
  flex-wrap: wrap;
}

.userbar {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.userbar-text {
  color: rgba(226,232,240,.92);
  font-size: 0.85rem;
  white-space: nowrap;
  padding: 0.28rem 0.55rem;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  border-radius: 999px;
}
.userbar-btn.btn-light {
  background: rgba(255,255,255,.08);
  color: rgba(226,232,240,.96);
  border: 1px solid rgba(255,255,255,.18);
}
.userbar-btn.btn-light:hover { background: rgba(255,255,255,.12); }

.logo {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,.96);
}

.nav {
  display: flex;
  gap: 0.3rem;
  padding: 0.25rem;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  border-radius: 999px;
}
.nav-link {
  color: rgba(148,163,184,.95);
  text-decoration: none;
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  font-size: 0.9rem;
  transition: color .15s, background .15s, transform .05s;
}
.nav-link:hover { color: rgba(226,232,240,.96); background: rgba(255,255,255,.08); }
.nav-link:active { transform: scale(0.98); }
.nav-link.active { color: #0b1220; background: rgba(255,255,255,.92); }

/* ---------- 主内容 ---------- */
.main { flex: 1; padding: 1.6rem 0; }
.panel { display: block; }

.card {
  background: var(--card);
  border-radius: var(--r-md);
  padding: 1.4rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}

.card-title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.hint {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0 0 1.25rem;
}
.hint strong { color: rgba(15,23,42,.86); }

/* ---------- 表单 ---------- */
.form-row { margin-bottom: 1rem; }
.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(51,65,85,.96);
  margin-bottom: 0.4rem;
}

.file-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(180deg, rgba(37,99,235,.05), rgba(37,99,235,.02));
  border: 1px dashed rgba(37,99,235,.35);
  border-radius: var(--r-md);
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.file-wrap::before{
  content: "点击选择或拖拽文件到此处";
  color: rgba(71,85,105,.95);
  font-size: .86rem;
  font-weight: 600;
  white-space: nowrap;
}
.file-wrap.has-file::before{
  content: "已选择文件";
  color: rgba(37,99,235,.95);
}
.file-wrap:hover {
  background: linear-gradient(180deg, rgba(37,99,235,.07), rgba(37,99,235,.03));
  border-color: rgba(37,99,235,.55);
  box-shadow: 0 0 0 4px rgba(37,99,235,.10);
}
.file-input {
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}
.file-name { font-size: 0.92rem; color: var(--muted); pointer-events: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name.has-file { color: var(--text); font-weight: 600; }

.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.field-full { grid-column: 1 / -1; }

.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  padding: 0.62rem 0.9rem;
  border: 1px solid rgba(15,23,42,.14);
  border-radius: 8px;
  font-size: 0.9rem;
  transition: border-color .15s, box-shadow .15s, background .15s;
  background: #fff;
}
.field input[type="text"]:focus,
.field input[type="password"]:focus {
  outline: none;
  border-color: rgba(37,99,235,.70);
  box-shadow: 0 0 0 4px rgba(37,99,235,.14);
}

.form-actions {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(15,23,42,.08);
}

.btn {
  padding: 0.62rem 1.15rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, transform .05s, box-shadow .15s, opacity .15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(37,99,235,.18); }
.btn-primary:hover:not(:disabled) { background: var(--primary-600); }
.btn-primary:disabled { opacity: 0.65; cursor: not-allowed; }

/* ---------- 结果展示 ---------- */
.result-duplicate {
  padding: 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: #b91c1c;
  animation: duplicate-pulse 0.3s ease-in-out 2;
}
.result-duplicate .message { margin: 0 0 0.75rem; font-weight: 600; }
.result-duplicate .message strong { color: #b91c1c; }

.result-content-duplicate {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}
.result-content-duplicate .message strong { color: #b91c1c; }
.result-content-duplicate .matched-info { color: #7f1d1d; background: rgba(255,255,255,.7); }

.matched-info {
  background: rgba(255,255,255,.7);
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
}
.matched-info p { margin: 0.25rem 0; }

.result-similar .summary { margin: 0.25rem 0 1rem; color: #475569; font-size: 0.9rem; }
.similar-list-title { font-size: 0.95rem; font-weight: 600; color: #334155; margin: 0 0 0.75rem; }
.similar-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: #fafbfc;
}
.similar-item:last-child { margin-bottom: 0; }
.similar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.similar-header .filename { font-weight: 500; color: #1e293b; font-size: 0.9rem; }
.similarity-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}
.similarity-badge.high { background: #fef3c7; color: #b45309; }
.similarity-badge.mid  { background: #dbeafe; color: #1d4ed8; }
.similarity-badge.low  { background: #f1f5f9; color: #64748b; }
.diff-list {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.5;
}
.diff-list li { margin-bottom: 0.2rem; }
.no-similar { color: #64748b; font-size: 0.9rem; margin: 0; }

/* ---------- 历史记录 ---------- */
.state-text { margin: 0 0 0.5rem; font-size: 0.9rem; }
.state-loading { color: #64748b; }
.state-error { color: #dc2626; }
.state-empty { color: #94a3b8; padding: 1rem 0; }

.history-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  padding: 0.75rem 0 1rem;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 0.75rem;
}

.history-search {
  display: flex;
  gap: 0.5rem;
}

.history-search input {
  flex: 1;
  padding: 0.55rem 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9rem;
}

.history-search input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.history-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #475569;
  font-size: 0.9rem;
  user-select: none;
}

.history-meta {
  display: flex;
  gap: 1rem;
  color: #64748b;
  font-size: 0.85rem;
}

.logs-actions { justify-content: flex-start; }
.logs-meta { justify-content: flex-end; }

.pager{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: .75rem;
  margin: .75rem 0 0.25rem;
  flex-wrap: wrap;
}
.pager-mid{
  display:flex;
  align-items:center;
  gap: .5rem;
  flex-wrap: wrap;
}
.pager-text{ color: var(--muted); font-size: .9rem; }
.pager-input{
  width: 88px;
  padding: .5rem .65rem;
  border: 1px solid rgba(15,23,42,.14);
  border-radius: 10px;
  font-size: .9rem;
}
.pager-input:focus{
  outline:none;
  border-color: rgba(37,99,235,.70);
  box-shadow: 0 0 0 4px rgba(37,99,235,.14);
}

.btn-light {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
  padding: 0.55rem 0.9rem;
}

.btn-light:hover { background: #e7eef8; border-color: rgba(37,99,235,.25); }

.btn-danger {
  background: #dc2626;
  color: #fff;
  padding: 0.55rem 0.9rem;
}

.btn-danger:disabled { opacity: 0.65; cursor: not-allowed; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

/* 表格列表展示 */
.history-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(15,23,42,.10);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}

.history-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}

.history-table thead th {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #f8fafc, #f3f6fb);
  color: #334155;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(15,23,42,.12);
  white-space: nowrap;
  z-index: 1;
}

.history-table tbody td {
  font-size: 0.88rem;
  color: #1e293b;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}
.history-table tbody tr:nth-child(even) td { background: rgba(15,23,42,.015); }
.history-table tbody tr:hover td { background: rgba(37,99,235,.06); }
.history-table tbody tr:last-child td { border-bottom: none; }

.history-table .col-check { width: 64px; }
.history-table .col-actions { width: 90px; }
.history-table .col-time { width: 170px; white-space: nowrap; color: #475569; }
.history-table .col-filename { max-width: 260px; }
.history-table .col-address { max-width: 320px; }
.history-table .col-remark { max-width: 260px; }
.history-table .col-filename,
.history-table .col-address,
.history-table .col-remark {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-detail-row td {
  background: #f9fafb;
  font-size: 0.85rem;
}
.log-detail-wrap {
  padding: 0.4rem 0.25rem 0.7rem;
}
.log-detail-title {
  font-weight: 500;
  color: #475569;
  margin-bottom: 0.25rem;
}
.log-detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.log-detail-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.15rem;
}
.log-detail-list .text { color: #64748b; }
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.pill-saved {
  background: #dcfce7;
  color: #166534;
}
.pill-dup {
  background: #fee2e2;
  color: #b91c1c;
}

.btn-delete {
  flex-shrink: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.btn-delete:hover { background: #fee2e2; }
.btn-delete[disabled] {
  opacity: .5;
  cursor: not-allowed;
  background: #f9fafb;
  color: #9ca3af;
  border-color: #e5e7eb;
}

/* ---------- 页脚 ---------- */
.footer {
  padding: 1rem 0;
  text-align: center;
  font-size: 0.8rem;
  color: #94a3b8;
  border-top: 1px solid rgba(15,23,42,.08);
  margin-top: auto;
}

@keyframes duplicate-pulse {
  0%   { transform: translateX(0);   box-shadow: 0 0 0 rgba(248,113,113,0.0); }
  25%  { transform: translateX(-3px); box-shadow: 0 0 0 3px rgba(248,113,113,0.4); }
  50%  { transform: translateX(3px);  box-shadow: 0 0 0 2px rgba(248,113,113,0.3); }
  75%  { transform: translateX(-2px); box-shadow: 0 0 0 1px rgba(248,113,113,0.2); }
  100% { transform: translateX(0);   box-shadow: 0 0 0 rgba(248,113,113,0.0); }
}

@media (max-width: 520px) {
  .meta-grid { grid-template-columns: 1fr; }
  .header-inner { flex-direction: column; align-items: flex-start; gap: .6rem; }
  .header-right { width: 100%; justify-content: space-between; }
  .history-actions { justify-content: flex-start; }
}

/* ---------- 登录页 ---------- */
.page-auth .auth-main {
  display: block;
  padding-top: 1.25rem;
  padding-bottom: 1.6rem;
}

.auth-layout {
  display: block;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
}

.auth-intro {
  border-radius: var(--r-md);
  padding: 1.6rem 1.7rem;
  background:
    radial-gradient(900px 600px at 0% 0%, rgba(37,99,235,.18), transparent 60%),
    linear-gradient(135deg, #0b1220 0%, #111827 55%, #020617 100%);
  color: #e5e7eb;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(15,23,42,.85);
}
.auth-intro-inner { max-width: 760px; }
.auth-tagline {
  margin: 0 0 .4rem;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(191,219,254,.9);
}
.auth-heading {
  margin: 0 0 .7rem;
  font-size: 1.4rem;
  font-weight: 650;
}
.auth-desc {
  margin: 0 0 0.9rem;
  font-size: 0.9rem;
  color: rgba(226,232,240,.9);
}
.auth-points {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.86rem;
  color: rgba(226,232,240,.92);
}
.auth-points li { margin-bottom: 0.2rem; }

.auth-actions { display:flex; gap:.6rem; align-items:center; }
.auth-sso-btn { text-decoration:none; display:inline-flex; align-items:center; justify-content:center; }
.auth-cta {
  margin-top: 1rem;
  border: 1px solid rgba(148,163,184,.3);
  border-radius: 12px;
  background: rgba(15,23,42,.38);
  padding: .95rem 1rem;
}
.auth-cta-title {
  margin: 0;
  font-size: 1rem;
  color: #f8fafc;
}
.auth-cta-desc {
  margin: .22rem 0 .65rem;
  font-size: .88rem;
  color: rgba(226,232,240,.9);
}

@media (max-width: 768px) {
  .page-auth .auth-main { padding-top: .9rem; }
  .auth-intro {
    padding: 1.2rem 1.2rem;
  }
}
