/* 隧道资料分发站 - 站点样式（移动端自适应） */
:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f6fa;
  --card: #ffffff;
  --ok: #0f9d58;
  --bad: #dc2626;
  --warn-bg: #fff7ed;
  --warn-line: #fdba74;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
               "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12.5px;
  word-break: break-all;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  background: #111c33;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.brand {
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .5px;
}
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; margin-left: 6px; flex-wrap: wrap; }
.nav a {
  color: #cbd5e1;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 14px;
}
.nav a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.nav a.active { background: var(--brand); color: #fff; }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.who { font-size: 13.5px; color: #cbd5e1; }
.who em {
  font-style: normal;
  margin-left: 6px;
  background: rgba(37,99,235,.28);
  border: 1px solid rgba(147,197,253,.5);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
  color: #dbeafe;
}

/* ---------------- 布局 ---------------- */
.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 16px 40px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.card-title { font-size: 16px; margin: 0; }
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.card-foot { margin: 12px 0 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.hero h1 { margin: 0 0 6px; font-size: 22px; }
.hero p { margin: 0; }

/* ---------------- 表单 ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); }
input[type=text], input[type=password], select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 14px;
  align-items: end;
}
.field-action { justify-content: flex-end; }
.field-action .btn { width: 100%; }

.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14.5px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  line-height: 1.4;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #fff; border-color: #cbd5e1; color: var(--ink); }
.btn-ghost:hover { background: #f8fafc; }
.btn-danger { background: #fff; border-color: #fca5a5; color: var(--bad); }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 6px 12px; font-size: 13.5px; }
.btn-block { width: 100%; display: block; }
.btn.disabled { opacity: .45; pointer-events: none; }

/* ---------------- 提示条 ---------------- */
.flash-area { margin-bottom: 14px; }
.alert {
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  margin-bottom: 14px;
  border: 1px solid transparent;
  word-break: break-all;
}
.alert-ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-line); color: #9a3412; }

/* ---------------- 登录页 ---------------- */
.login-wrap { display: flex; justify-content: center; padding: 6vh 0 0; }
.login-card { width: 100%; max-width: 400px; text-align: center; padding: 30px 26px; }
.login-logo {
  width: 52px; height: 52px; line-height: 52px;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: var(--brand);
  color: #fff; font-size: 24px; font-weight: 700;
}
.login-title { font-size: 19px; margin: 0 0 4px; }
.login-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }
.login-card .field { text-align: left; margin-bottom: 14px; }
.login-tip { font-size: 12.5px; color: var(--muted); margin: 14px 0 0; }

.error-card { text-align: center; }
.error-code { font-size: 44px; font-weight: 800; color: var(--brand); line-height: 1.1; }
.error-msg { margin: 8px 0 18px; color: var(--muted); }

/* ---------------- 下载区 ---------------- */
.dl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 14px 16px;
}
.dl-name { font-weight: 600; word-break: break-all; }
.dl-note { margin: 10px 0 0; }
.tips { margin: 0; padding-left: 20px; }
.tips li { margin-bottom: 6px; }

/* ---------------- 表格 ---------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
.table th { background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
.table tbody tr:hover { background: #fcfdff; }
.ua-cell { max-width: 320px; word-break: break-all; color: #475569; font-size: 12.5px; }

.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 12.5px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag-ok { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.tag-bad { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.tag-self { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; margin-left: 6px; font-size: 11.5px; }
.tag-exe { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.tag-web { background: #f8fafc; border-color: #e2e8f0; color: #475569; }

.actions-cell { min-width: 260px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0 6px 6px 0; flex-wrap: nowrap; }
.mini-input { width: 130px; padding: 6px 8px; font-size: 13px; }

/* ---------------- 分页 ---------------- */
.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.pager-info { color: var(--muted); font-size: 13.5px; }
.pager-sizes { margin-left: auto; color: var(--muted); font-size: 13.5px; }
.chip {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 7px;
  margin: 0 2px;
  font-size: 13px;
  color: var(--muted);
}
.chip-on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip-on:hover { text-decoration: none; color: #fff; }

/* ---------------- 页脚 ---------------- */
.foot {
  text-align: center;
  color: #9ca3af;
  font-size: 12.5px;
  padding: 10px 16px 26px;
}

/* ---------------- 移动端 ---------------- */
@media (max-width: 820px) {
  .form-grid { grid-template-columns: 1fr; }
  .topbar-inner { padding: 9px 12px; }
  .brand { font-size: 15px; }
  .userbox { width: 100%; justify-content: space-between; }
  .wrap { padding: 14px 12px 32px; }
  .card { padding: 15px 14px; }
  .login-card { padding: 24px 18px; }
  .login-wrap { padding-top: 3vh; }
}

@media (max-width: 760px) {
  /* 表格转卡片式排布 */
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr {
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 6px 12px;
    background: #fff;
  }
  .table.responsive td {
    border: none;
    padding: 6px 0;
    display: flex;
    gap: 10px;
    align-items: flex-start;
  }
  .table.responsive td::before {
    content: attr(data-label);
    flex: 0 0 82px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
  }
  .table.responsive td.ua-cell { max-width: none; }
  .actions-cell { min-width: 0; }
  .inline-form { width: 100%; justify-content: flex-start; }
  .mini-input { flex: 1 1 auto; width: auto; }
  .dl-row { flex-direction: column; align-items: stretch; }
  .dl-row .btn { width: 100%; }
  .pager-sizes { margin-left: 0; }
}
