/* ============================================================
   SAASAI 建站系统 v6.1 · 后台视觉增强层
   叠加在 admin.css 之后加载，不删除/不覆盖原有类名，只做统一提质。
   设计语言：克制的靛蓝主色 + 大留白 + 柔和层次 + 清晰状态反馈。
   ============================================================ */
:root {
  --v6-primary: #4f46e5;
  --v6-primary-2: #7c3aed;
  --v6-ink: #0f172a;
  --v6-muted: #64748b;
  --v6-line: #e8ecf3;
  --v6-soft: #f7f9fc;
  --v6-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .05);
  --v6-shadow-lg: 0 12px 40px rgba(15, 23, 42, .10);
  --v6-radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f6f8fc;
  color: var(--v6-ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { transition: color .18s ease; }
h1, h2, h3 { color: var(--v6-ink); letter-spacing: -.35px; }
h1 { font-size: 23px; font-weight: 750; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; margin: 26px 0 14px; }
code { background: #f1f5f9; border: 1px solid #e6ebf2; border-radius: 5px; padding: 1px 5px; font-size: 12px; color: #475569; }

/* ---------- 侧栏 ---------- */
.app { background: #f6f8fc; }
.sidebar {
  width: 242px; flex: 0 0 242px;
  background: linear-gradient(178deg, #141a2e 0%, #101426 58%, #0d1120 100%);
  padding: 22px 14px 16px;
  border-right: 1px solid rgba(255,255,255,.05);
  box-shadow: 4px 0 24px rgba(15,23,42,.06);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }
.logo, .auth-logo {
  font-size: 21px; font-weight: 800; letter-spacing: -.8px;
  padding: 6px 12px 26px; color: #fff;
}
.logo span, .auth-logo span {
  background: linear-gradient(120deg, #a5b4fc, #c4b5fd);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sidebar nav { gap: 3px; }
.sidebar nav a {
  padding: 9px 12px; border-radius: 9px; font-size: 13.5px; color: #aeb8cf;
  border: 1px solid transparent; transition: all .18s ease; white-space: nowrap;
}
.sidebar nav a:hover {
  color: #fff; background: rgba(255,255,255,.07); text-decoration: none; transform: translateX(2px);
}
.sidebar nav a.active {
  color: #fff; font-weight: 650;
  background: linear-gradient(100deg, rgba(99,102,241,.32), rgba(139,92,246,.18));
  border-color: rgba(165,180,252,.24);
  box-shadow: inset 3px 0 0 #a5b4fc;
}
.sidebar-bottom { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { gap: 10px; }
.user-chip .avatar {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(140deg, #6366f1, #8b5cf6); color: #fff; font-weight: 700;
}
.user-chip small { color: #8e9ab4; font-size: 11.5px; }
.logout { border-radius: 8px; transition: background .18s ease; }

/* ---------- 顶栏 ---------- */
.main { min-width: 0; flex: 1; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.88); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--v6-line);
  padding: 15px 30px; min-height: 66px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar h1 { margin: 0; }
.content { padding: 26px 30px 56px; max-width: 1440px; }

/* ---------- 卡片 / 面板 ---------- */
.panel, .widget, .stat-card, .item-card, .template-card, .auth-card {
  background: #fff; border: 1px solid var(--v6-line);
  border-radius: var(--v6-radius); box-shadow: var(--v6-shadow);
}
.panel, .widget { padding: 22px 24px; margin-bottom: 20px; }
.panel:hover, .widget:hover { box-shadow: var(--v6-shadow-lg); }
.panel-head { border-bottom: 1px solid var(--v6-line); margin: -4px 0 18px; padding-bottom: 14px; }
.stats-grid { gap: 16px; margin-bottom: 22px; }
.stat-card { padding: 18px 20px; transition: transform .18s ease, box-shadow .18s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--v6-shadow-lg); }
.stat-value { font-size: 26px; font-weight: 780; letter-spacing: -.8px; color: var(--v6-ink); }
.stat-label { color: var(--v6-muted); font-size: 12.5px; margin-top: 4px; }

/* ---------- 按钮 ---------- */
.btn-primary, .btn-secondary, .btn-ghost, .add-btn, .icon-btn {
  border-radius: 9px; font-weight: 620; font-size: 13.5px;
  transition: all .18s ease; border: 1px solid transparent;
}
.btn-primary {
  background: linear-gradient(120deg, var(--v6-primary), var(--v6-primary-2));
  box-shadow: 0 4px 14px rgba(79,70,229,.22);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(79,70,229,.30); }
.btn-ghost, .btn-secondary { background: #fff; border-color: var(--v6-line); color: #334155; }
.btn-ghost:hover, .btn-secondary:hover { border-color: #c7d2fe; color: var(--v6-primary); background: #fafaff; }
.link-danger { color: #dc2626; }
.link-danger:hover { color: #b91c1c; }

/* ---------- 表单 ---------- */
.form-grid { gap: 16px 18px; }
.form-grid label, .widget-form label, .auth-card label {
  font-size: 13px; color: #475569; font-weight: 600; display: block;
}
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=url], input[type=search], select, textarea, .code-area {
  width: 100%; border: 1px solid #dfe5ee; border-radius: 9px;
  padding: 9px 12px; font-size: 13.5px; color: var(--v6-ink); background: #fff;
  transition: border-color .18s ease, box-shadow .18s ease;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus, .code-area:focus {
  outline: none; border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
input::placeholder, textarea::placeholder { color: #a3aec0; }
textarea, .code-area { min-height: 96px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500 !important; color: #475569 !important; }
.check input { width: auto; accent-color: var(--v6-primary); }
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; padding-top: 6px; }
.span-2 { grid-column: 1 / -1; }

/* ---------- 存储方式二选一卡片 ---------- */
.storage-modes {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px; margin-bottom: 4px;
}
.mode-card { position: relative; display: block; cursor: pointer; font-weight: 400 !important; }
.mode-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mode-body {
  display: block; position: relative; height: 100%;
  padding: 18px 18px 16px; border: 1.5px solid var(--v6-line); border-radius: 13px;
  background: #fff; transition: all .2s ease;
}
.mode-card:hover .mode-body { border-color: #c7d2fe; box-shadow: var(--v6-shadow); }
.mode-card input:checked ~ .mode-body {
  border-color: var(--v6-primary);
  background: linear-gradient(160deg, #f8f8ff, #fff);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12), var(--v6-shadow);
}
.mode-card input:checked ~ .mode-body::after {
  content: "✓ 当前使用"; position: absolute; top: 14px; right: 14px;
  font-size: 11px; font-weight: 700; color: #fff;
  background: linear-gradient(120deg, var(--v6-primary), var(--v6-primary-2));
  padding: 3px 9px; border-radius: 20px;
}
.mode-card.is-disabled { cursor: not-allowed; opacity: .58; }
.mode-icon { display: block; font-size: 22px; line-height: 1; margin-bottom: 10px; color: var(--v6-primary); }
.mode-title { display: block; font-size: 15px; font-weight: 700; color: var(--v6-ink); margin-bottom: 6px; }
.mode-desc { display: block; font-size: 12.5px; color: var(--v6-muted); line-height: 1.65; padding-right: 8px; }
.mode-tag {
  display: inline-block; margin-top: 12px; font-size: 11px; font-weight: 650;
  color: #4338ca; background: #eef2ff; border-radius: 6px; padding: 3px 9px;
}

/* ---------- 表格 / 标签 / 提示 ---------- */
.data-table, .table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.data-table th, .data-table td, .table th, .table td {
  padding: 11px 13px; border-bottom: 1px solid #eef1f6; text-align: left; vertical-align: middle;
}
.data-table thead th, .table thead th {
  background: var(--v6-soft); color: #475569; font-weight: 650; font-size: 12.5px;
  border-bottom: 1px solid var(--v6-line);
}
.data-table tbody tr:hover, .table tbody tr:hover { background: #fafbff; }
.data-table tbody tr:last-child td, .table tbody tr:last-child td { border-bottom: 0; }
.data-table th[scope=row] { color: var(--v6-muted); font-weight: 600; width: 150px; }
.badge, .chip, .domain-status {
  display: inline-block; border-radius: 20px; padding: 3px 10px;
  font-size: 11.5px; font-weight: 650; background: #f1f5f9; color: #475569;
}
.domain-status.on { background: #dcfce7; color: #15803d; }
.domain-status.off { background: #f1f5f9; color: #64748b; }
.notice {
  border: 1px solid #dbe4ff; background: linear-gradient(120deg, #f5f7ff, #fbfcff);
  border-radius: 11px; padding: 13px 16px; color: #3f4a6b; margin-bottom: 18px;
  font-size: 13px; line-height: 1.75;
}
.hint { color: var(--v6-muted); font-size: 12.5px; line-height: 1.75; margin: 10px 0 16px; }
.flash {
  border-radius: 10px; padding: 12px 16px; margin-bottom: 16px;
  border: 1px solid transparent; font-size: 13px; font-weight: 550;
}
.flash.success { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.flash.error   { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.empty { padding: 40px 20px; text-align: center; color: var(--v6-muted); }
.empty-hint { font-size: 12.5px; }

/* ---------- 选项卡 ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--v6-line); margin: -4px 0 18px; padding-bottom: 0; flex-wrap: wrap; }
.tabs a {
  padding: 9px 15px; border-radius: 9px 9px 0 0; font-size: 13px;
  color: var(--v6-muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--v6-primary); text-decoration: none; background: #fafaff; }
.tabs a.active { color: var(--v6-primary); font-weight: 700; border-bottom-color: var(--v6-primary); background: #fafaff; }

/* ---------- 登录页 ---------- */
.auth-body { background: radial-gradient(1000px 600px at 50% -10%, #e8e9ff, #f6f8fc 70%); min-height: 100vh; }
.auth-card { padding: 32px 30px; width: min(420px, calc(100% - 32px)); box-shadow: var(--v6-shadow-lg); }
.auth-card .btn-primary { width: 100%; padding: 11px; margin-top: 8px; }
.auth-link { text-align: center; font-size: 13px; margin-top: 18px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .content { padding: 22px 20px 48px; }
  .topbar { padding: 14px 20px; }
  .storage-modes { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none; height: auto; position: static;
    padding: 14px; box-shadow: none;
  }
  .sidebar .logo { padding: 0 0 12px; }
  .sidebar nav { flex-direction: row; overflow-x: auto; padding-bottom: 6px; }
  .sidebar nav a { flex: 0 0 auto; }
  .sidebar-bottom { display: none; }
  .topbar { position: static; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr !important; }
}
