/* 带 display 的元素（.modal-mask 等）会压过浏览器默认的 [hidden]，这里统一兜住 */
[hidden] { display: none !important; }

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #e4e9f0;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }

.topbar {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; margin-right: 40px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff; display: grid; place-items: center; font-size: 17px;
}
.nav { display: flex; gap: 6px; flex: 1; }
.nav:empty { display: none; }
.tool-hero { display: flex; gap: 18px; align-items: flex-start; }
.tool-hero-icon { width: 60px; height: 60px; font-size: 30px; flex: none; }
.tool-hero-main { flex: 1; min-width: 0; }
.tool-hero-title { margin: 0 0 8px; font-size: 24px; line-height: 1.35; }
.tool-hero-desc { margin: 0; }
.tool-hero-status { margin-top: 10px; }
.nav a { padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a:hover, .nav a.active { background: #eef2ff; color: var(--primary); }
.top-right { display: flex; align-items: center; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #dbeafe; color: var(--primary);
  display: grid; place-items: center; font-weight: 700;
}

.container { max-width: 1180px; margin: 0 auto; padding: 32px 24px 64px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.4px; }
.page-head p { margin: 0; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 24px; }
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 860px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.tool-card { padding: 24px; display: flex; flex-direction: column; gap: 14px; transition: transform .18s, box-shadow .18s; }
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(15,23,42,.10); }
.tool-icon { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; font-size: 24px; background: #f1f5f9; }
.tool-name { font-size: 18px; font-weight: 700; margin: 0; }
.tool-desc { color: var(--muted); min-height: 48px; margin: 0; }
.tool-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; gap: 10px; }
.price { font-size: 20px; font-weight: 700; color: var(--text); }
.price small { font-size: 12px; color: var(--muted); font-weight: 400; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.off { background: #f1f5f9; color: var(--muted); }
.badge.warn { background: #fef3c7; color: #b45309; }
.badge.info { background: #dbeafe; color: #1d4ed8; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 9px 16px; border-radius: 9px; cursor: pointer; font-weight: 600;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-soft); border-color: #cbd5e1; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; margin-bottom: 6px; color: var(--muted); font-weight: 500; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 9px; background: #fff; color: var(--text); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.10); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; word-break: break-word; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--surface-soft); }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input { max-width: 280px; }
.spacer { flex: 1; }

.stat-card { padding: 22px; }
.stat-value { font-size: 30px; font-weight: 750; margin: 6px 0 2px; }
.stat-label { color: var(--muted); font-size: 13px; }

.container.container-auth { max-width: none; width: 100%; margin: 0; padding: 0; }
.auth-page { min-height: calc(100vh - 64px); display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 32px 16px; background: radial-gradient(circle at 15% 10%, #e0e7ff, transparent 42%), radial-gradient(circle at 85% 90%, #dbeafe, transparent 40%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; min-width: 0; padding: 34px; }
.auth-card h1 { margin: 18px 0 4px; font-size: 24px; }
.auth-card .sub { color: var(--muted); margin: 0 0 26px; }
.auth-switch { text-align: center; color: var(--muted); margin-top: 20px; font-size: 13px; }
.auth-switch a { color: var(--primary); font-weight: 600; }
.hint { background: var(--surface-soft); border: 1px dashed var(--border); padding: 12px 14px; border-radius: 10px; color: var(--muted); font-size: 12px; margin-top: 18px; }

.section-title { font-size: 16px; font-weight: 700; margin: 0 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.empty { text-align: center; color: var(--muted); padding: 36px 12px; }

.toast-box { position: fixed; right: 24px; top: 80px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { background: #111827; color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); min-width: 220px; animation: slide .2s ease; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
@keyframes slide { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: grid; place-items: center; z-index: 80; padding: 20px; }
.modal { width: 100%; max-width: 460px; background: #fff; border-radius: 16px; padding: 24px; box-shadow: 0 24px 60px rgba(0,0,0,.2); }
.modal h3 { margin: 0 0 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.plan { border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.plan-name { font-weight: 700; margin-bottom: 4px; }
.plan-price { font-size: 22px; font-weight: 700; color: var(--primary); }
.steps { margin: 0; padding-left: 20px; color: var(--muted); }
.steps li { margin-bottom: 6px; }
.breadcrumb { color: var(--muted); margin-bottom: 18px; font-size: 13px; }
.breadcrumb a:hover { color: var(--primary); }
.pagination { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 16px; }

/* ---------- 手机端适配 ---------- */
@media (max-width: 720px) {
  .topbar {
    height: auto;
    min-height: 56px;
    padding: 10px 12px;
    flex-wrap: wrap;
    row-gap: 8px;
    column-gap: 8px;
  }
  .brand { margin-right: auto; font-size: 16px; gap: 8px; }
  .brand-mark { width: 30px; height: 30px; font-size: 16px; border-radius: 8px; }
  .nav {
    order: 3;
    flex: 0 0 100%;
    width: 100%;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; padding: 7px 11px; font-size: 13px; }
  .top-right { gap: 8px; margin-left: auto; }
  .user-name { display: none; }
  .top-right .btn { padding: 7px 11px; }

  .container { padding: 20px 14px 48px; }
  .container.container-auth { padding: 0; }
  .page-head { margin-bottom: 18px; gap: 10px; }
  .page-head h1 { font-size: 22px; }
  .page-head p { font-size: 13px; }
  .card-pad { padding: 18px; }
  .grid { gap: 14px; }

  .auth-page { min-height: calc(100dvh - 57px); padding: 24px 14px; }
  .auth-card { padding: 24px 20px; max-width: 100%; }
  .auth-card h1 { font-size: 22px; }

  .tool-card { padding: 18px; }
  .tool-desc { min-height: 0; }
  .tool-hero { gap: 12px; }
  .tool-hero-icon { width: 48px; height: 48px; font-size: 24px; }
  .tool-hero-title { font-size: 20px; }
  .tool-hero-desc { font-size: 13px; }
  .tool-hero-status { margin-top: 8px; }
  .tool-foot { align-items: flex-end; }
  .price { font-size: 18px; }

  .stat-value { font-size: 26px; }
  .section-title { font-size: 15px; }

  .toolbar { gap: 8px; }
  .toolbar input { max-width: none; flex: 1 1 180px; }
  .toolbar select { max-width: none !important; flex: 1 1 160px; }

  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 720px; }
  .table-wrap table.responsive { min-width: 0; }
  th, td { padding: 10px 12px; }

  /* 宽表格在手机端转为卡片列表 */
  .responsive thead { display: none; }
  .responsive tbody { display: block; }
  .responsive tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: var(--surface);
  }
  .responsive tr:last-child { margin-bottom: 0; }
  .responsive td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 5px 0;
    border: none;
    text-align: right;
  }
  .responsive td::before {
    content: attr(data-label);
    flex: none;
    text-align: left;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    padding-top: 2px;
  }
  .responsive td.cell-main {
    display: block;
    text-align: left;
    padding: 0 0 8px;
    margin-bottom: 6px;
    border-bottom: 1px dashed var(--border);
  }
  .responsive td.cell-main::before { display: none; }
  .responsive td.hide-mobile { display: none; }
  .responsive td[data-label="操作"] {
    display: block;
    text-align: left;
    border-top: 1px dashed var(--border);
    margin-top: 6px;
    padding-top: 10px;
  }
  .responsive td[data-label="操作"]::before { display: none; }
  .responsive td[data-label="操作"] .actions { justify-content: flex-start; }
  .responsive td.empty { display: block; text-align: center; }
  .pagination { justify-content: space-between; }

  .toast-box { left: 12px; right: 12px; top: 72px; }
  .toast { min-width: 0; }

  .modal { padding: 20px; max-height: 90dvh; overflow-y: auto; }
  .modal-foot .btn { flex: 1; }

  input, select, textarea { font-size: 16px; }
  .hint { font-size: 11px; }
  .breadcrumb { margin-bottom: 12px; }
  .steps { padding-left: 18px; }
}

@media (max-width: 380px) {
  .brand { font-size: 15px; }
  .top-right .btn { padding: 6px 9px; }
  .nav a { padding: 6px 9px; }
  .card-pad, .tool-card { padding: 16px; }
}
