:root {
  --c-bg: #f1f5f9;
  --c-surface: #ffffff;
  --c-surface-2: #f8fafc;
  --c-primary: #0b2545;
  --c-primary-600: #13315c;
  --c-primary-700: #0a1f3d;
  --c-accent: #ffd166;
  --c-text: #0f172a;
  --c-muted: #64748b;
  --c-border: #e2e8f0;
  --c-success: #16a34a;
  --c-danger: #dc2626;
  --c-info: #2563eb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
  --sidebar-w: 232px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--c-info); text-decoration: none; }

/* ---- Auth ---- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-600) 100%);
  padding: 24px;
}
.auth-card {
  background: var(--c-surface);
  border-radius: 16px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
  padding: 32px;
}
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; color: var(--c-primary); font-weight: 800; font-size: 22px; }
.auth-sub { color: var(--c-muted); margin-bottom: 22px; }
.brand-mark { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; background: var(--c-primary); color: var(--c-accent); border-radius: 9px; }

/* ---- Layout ---- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--c-primary);
  color: #cbd5e1;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 18px; padding: 6px 8px 18px; }
.sidebar .brand .brand-mark { background: rgba(255,255,255,.12); color: var(--c-accent); }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: #cbd5e1; cursor: pointer; user-select: none; font-weight: 500;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--c-accent); color: var(--c-primary); font-weight: 700; }
.nav-item svg { flex: 0 0 auto; }
.sidebar .foot { margin-top: auto; font-size: 12px; color: #64748b; padding: 10px 8px 0; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px; background: var(--c-surface); border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
}
.topbar .title { font-weight: 700; font-size: 16px; color: var(--c-primary); }
.topbar .right { display: flex; align-items: center; gap: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--c-primary); color: #fff; display: grid; place-items: center; font-weight: 700; }
.lang-btn { border: 1px solid var(--c-border); background: var(--c-surface); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-weight: 600; color: var(--c-primary); }

.content { padding: 24px; overflow: auto; }

/* ---- Cards / generic ---- */
.grid { display: grid; gap: 16px; }
.stat-grid { grid-template-columns: repeat(4, 1fr); }
.card-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.stat {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.stat .label { color: var(--c-muted); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 800; color: var(--c-primary); margin-top: 4px; }
.stat .ico { color: var(--c-accent); }

.panel {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.panel h2 { margin: 0 0 14px; font-size: 16px; color: var(--c-primary); }
.panel h3 { margin: 0 0 10px; font-size: 14px; color: var(--c-primary); }

.preview-card {
  height: 130px; border-radius: 12px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: #fff; cursor: pointer;
  box-shadow: var(--shadow); text-align: center; padding: 8px;
}
.preview-card .t { font-weight: 800; font-size: 18px; }
.preview-card .z { font-size: 13px; opacity: .85; margin-top: 4px; }

/* ---- Forms ---- */
label { display: block; font-weight: 600; color: var(--c-primary); margin-bottom: 6px; font-size: 13px; }
input, textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px; color: var(--c-text); background: var(--c-surface);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--c-primary-600); border-color: var(--c-primary-600); }
textarea { resize: vertical; min-height: 90px; }
.field { margin-bottom: 14px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 700; cursor: pointer; font-family: var(--font); font-size: 14px;
}
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-700); }
.btn-accent { background: var(--c-accent); color: var(--c-primary); }
.btn-accent:hover { filter: brightness(1.05); }
.btn-ghost { background: var(--c-surface); border-color: var(--c-border); color: var(--c-primary); }
.btn-ghost:hover { background: var(--c-surface-2); }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 13px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--c-border); font-size: 13px; }
.table th { color: var(--c-muted); font-weight: 700; }
.table tr:hover td { background: var(--c-surface-2); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.tag-year { background: #ecfdf5; color: var(--c-success); }
.tag-once { background: #eff6ff; color: var(--c-info); }
.tag-dev { background: #fef3c7; color: #b45309; }

.notice { background: var(--c-surface-2); border: 1px solid var(--c-border); border-left: 4px solid var(--c-accent); border-radius: 8px; padding: 12px 14px; color: var(--c-text); font-size: 13px; }
.notice.info { border-left-color: var(--c-info); }
.notice.success { border-left-color: var(--c-success); }

.import-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.import-box { border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: 14px; background: var(--c-surface-2); }
.import-box .field { margin-bottom: 10px; }
.import-box textarea { min-height: 110px; width: 100%; }
@media (max-width: 720px) { .import-grid { grid-template-columns: 1fr; } }

.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: grid; place-items: center; padding: 24px; z-index: 50; }
.modal { background: var(--c-surface); border-radius: 14px; width: 100%; max-width: 720px; max-height: 88vh; overflow: auto; box-shadow: var(--shadow); }
.modal-body { padding: 18px; }
.modal iframe { width: 100%; height: 70vh; border: 0; border-radius: 8px; background: #fff; }

.muted { color: var(--c-muted); }
.center-empty { text-align: center; color: var(--c-muted); padding: 40px 0; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--c-primary); color: #fff; padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow); z-index: 100; font-weight: 600; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; }
  .sidebar .foot { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- SEO / no-JS landing (crawlable; hidden once the SPA mounts) ---- */
.seo-landing { background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-600) 100%); color: #fff; min-height: 100vh; display: flex; align-items: center; }
.seo-wrap { max-width: 760px; margin: 0 auto; padding: 48px 24px; }
.seo-top { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.seo-brand { font-weight: 800; font-size: 22px; color: #fff; }
.seo-tag { font-size: 13px; color: var(--c-primary); background: var(--c-accent); padding: 4px 10px; border-radius: 999px; font-weight: 700; }
.seo-landing h1 { font-size: 40px; line-height: 1.1; margin: 0 0 16px; font-weight: 800; }
.seo-lead { font-size: 18px; line-height: 1.6; color: #e2e8f0; margin: 0 0 24px; }
.seo-feats { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 12px; }
.seo-feats li { background: rgba(255,255,255,.08); border-left: 4px solid var(--c-accent); padding: 12px 16px; border-radius: 8px; font-size: 15px; line-height: 1.5; }
.seo-feats strong { color: var(--c-accent); }
.seo-cta { font-size: 15px; color: #cbd5e1; margin: 0; }
.js .seo-landing { display: none !important; }
@media (max-width: 600px) { .seo-landing h1 { font-size: 30px; } }
