:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #17181c;
  --muted: #667085;
  --line: #dfe3ea;
  --accent: #d71920;
  --accent-strong: #b51218;
  --danger: #d92d20;
  --ok: #108548;
  --warn: #b54708;
  --shadow: 0 16px 40px rgba(15, 23, 42, .07);
}

/* Legacy PHP admin parity layer. Keep these class names aligned with admin/views/*.php. */
.nav-group { border-bottom: 0; padding: 10px 0 22px; }
.nav-group h3 { display: none; }
nav button { min-height: auto; padding: 9px 10px; font-size: .92rem; }
.nav-icon { width: 18px; height: 18px; background: transparent; border: 0; border-radius: 0; font-size: 14px; }
.nav-menu {
  list-style: none;
  padding: 10px 0 22px;
  margin: 0;
}
.nav-menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  color: #343841;
  text-decoration: none;
  border-radius: 6px;
  font-size: .92rem;
  font-weight: 700;
  transition: .15s ease;
  border-left: 3px solid transparent;
}
.nav-menu li a:hover,
.nav-menu li a.active {
  color: var(--accent);
  background: #fff5f5;
  border-left-color: var(--accent);
}
.nav-menu li a.nav-logout {
  color: var(--danger);
}
.nav-menu li a.nav-logout i {
  color: var(--danger);
}
.nav-menu li a i {
  width: 18px;
  text-align: center;
  font-size: 15px;
  color: #8a9099;
}
.nav-menu li a:hover i,
.nav-menu li a.active i {
  color: var(--accent);
}
.brand { padding: 18px 8px; margin-bottom: 0; }
.brand strong { font-weight: 900; letter-spacing: .02em; line-height: 1.1; }
.brand small { display: inline-block; margin-top: 4px; padding: 1px 6px; border: 1px solid #f1b9bc; background: #fff5f5; font-size: 10px; line-height: 1.4; letter-spacing: .08em; text-transform: uppercase; }
.shell { padding: 0 24px 34px; }
.topbar { min-height: 56px; margin-bottom: 20px; }
.topbar h1 { font-size: 0; width: 0; height: 0; overflow: hidden; }
#pageSub, .legacy-shell-meta { display: none; }
.content { max-width: none; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header h2 { font-size: clamp(1.45rem, 1.1vw + 1rem, 1.9rem); line-height: 1.25; font-weight: 800; letter-spacing: 0; margin: 0; }
.page-subtitle { color: var(--muted); font-size: .95rem; margin-top: 6px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: clamp(18px, 1.4vw, 24px); margin-bottom: 22px; box-shadow: var(--shadow); overflow-x: auto; }
.card-title { font-size: 1.02rem; font-weight: 900; color: var(--ink); margin-bottom: 14px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head strong { font-size: 1.08rem; }
.card-head p { color: var(--muted); font-size: .9rem; margin-top: 4px; margin-bottom: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.stat-card .value { font-size: 28px; line-height: 1; font-weight: 800; color: var(--accent); }
.stat-card .label { font-size: .95rem; color: var(--muted); margin-top: 8px; }
.data-table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; }
.data-table th { text-align: left; padding: 13px 15px; font-size: .86rem; color: #475569; border-bottom: 1px solid var(--line); font-weight: 800; background: #f8fafc; white-space: nowrap; }
.data-table td { padding: 13px 15px; border-bottom: 1px solid var(--line); font-size: .94rem; vertical-align: middle; }
.data-table tr:hover td { background: #f8fafc; }

/* Final admin UI normalization. */
.shell, .content, #content { min-width: 0; }
.content { overflow-x: hidden; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.page-header h2 { margin: 0; letter-spacing: 0; }
.card, .panel, .filter-card { border-radius: 8px; overflow: visible; box-shadow: 0 10px 26px rgba(15, 23, 42, .06); }
.table-scroll, .card > table, .panel-body > table { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card > table, .panel-body > table { display: block; }
.data-table, .table-scroll table, .card > table, .panel-body > table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; }
.data-table th, .card > table th, .panel-body > table th { position: sticky; top: 0; z-index: 1; background: #f8fafc; color: #334155; white-space: nowrap; }
.data-table th, .data-table td, .card > table th, .card > table td, .panel-body > table th, .panel-body > table td { max-width: 360px; vertical-align: middle; }
.actions-col { min-width: 210px; }
.actions-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-bar { align-items: flex-end; gap: 10px 12px; padding: 12px; border-radius: 8px; box-shadow: 0 8px 22px rgba(15, 23, 42, .05); }
.filter-bar .form-item, .legacy-filter .form-item { min-width: 160px; flex: 1 1 180px; }
.filter-bar .form-item.compact { flex: 0 1 170px; }
.filter-bar input, .filter-bar select, .filter-bar button { min-height: 38px; }
.btn, button, .ghost, .danger { border-radius: 8px; letter-spacing: 0; }
.time-cell, .nowrap, .mono { white-space: nowrap; font-variant-numeric: tabular-nums; }
.url-cell, .code-cell, .ellipsis-cell { display: inline-block; max-width: min(42vw, 520px); overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; white-space: nowrap; }
.code-cell { padding: 2px 6px; border-radius: 6px; background: #f1f5f9; color: #334155; }
.code-block { margin: 12px 0 0; padding: 12px; border: 1px solid #e5e7eb; border-radius: 8px; background: #0f172a; color: #e5e7eb; overflow: auto; font-size: 13px; line-height: 1.55; }
.system-item b, .token-box, .cache-group-name, .cache-group-key { min-width: 0; }

@media (max-width: 900px) {
  .card, .panel, .filter-card { padding: 14px; }
  .page-header { align-items: stretch; }
  .filter-bar, .actions-inline { width: 100%; }
  .filter-bar .form-item, .filter-bar .form-item.compact, .filter-bar button { flex: 1 1 100%; width: 100%; }
  .data-table, .table-scroll table, .card > table, .panel-body > table { min-width: 680px; }
  .url-cell, .code-cell, .ellipsis-cell { max-width: 56vw; }
}

/* Admin polish and layout guards. Keep this last so legacy pages share one stable surface. */
:root {
  --admin-bg: #f6f8fb;
  --admin-card: #ffffff;
  --admin-line: #e5e7eb;
  --admin-muted: #64748b;
  --admin-text: #0f172a;
}

body {
  background: var(--admin-bg);
  color: var(--admin-text);
}

.shell,
.content,
#content {
  min-width: 0;
}

.content {
  overflow-x: hidden;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.page-header h2 {
  margin: 0;
  letter-spacing: 0;
}

.page-subtitle {
  margin: 4px 0 0;
  color: var(--admin-muted);
}

.card,
.panel,
.filter-card {
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: var(--admin-card);
  box-shadow: 0 10px 26px rgba(15, 23, 42, .06);
}

.card {
  overflow: visible;
}

.table-scroll,
.card > table,
.panel-body > table {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.card > table,
.panel-body > table {
  display: block;
}

.data-table,
.table-scroll table,
.card > table,
.panel-body > table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th,
.data-table td,
.card > table th,
.card > table td,
.panel-body > table th,
.panel-body > table td {
  max-width: 360px;
  vertical-align: middle;
}

.data-table th,
.card > table th,
.panel-body > table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #334155;
  white-space: nowrap;
}

.actions-col {
  min-width: 210px;
}

.actions-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-bar {
  align-items: flex-end;
  gap: 10px 12px;
  padding: 12px;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .05);
}

.filter-bar .form-item,
.legacy-filter .form-item {
  min-width: 160px;
  flex: 1 1 180px;
}

.filter-bar .form-item.compact {
  flex: 0 1 170px;
}

.filter-bar input,
.filter-bar select,
.filter-bar button {
  min-height: 38px;
}

.btn,
button,
.ghost,
.danger {
  border-radius: 8px;
  letter-spacing: 0;
}

.time-cell,
.nowrap,
.mono {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.url-cell,
.code-cell,
.ellipsis-cell {
  display: inline-block;
  max-width: min(42vw, 520px);
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.code-cell {
  padding: 2px 6px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
}

.system-item b,
.token-box,
.cache-group-name,
.cache-group-key {
  min-width: 0;
}

@media (max-width: 900px) {
  .card,
  .panel,
  .filter-card {
    padding: 14px;
  }

  .page-header {
    align-items: stretch;
  }

  .filter-bar,
  .actions-inline {
    width: 100%;
  }

  .filter-bar .form-item,
  .filter-bar .form-item.compact,
  .filter-bar button {
    flex: 1 1 100%;
    width: 100%;
  }

  .data-table,
  .table-scroll table,
  .card > table,
  .panel-body > table {
    min-width: 680px;
  }

  .url-cell,
  .code-cell,
  .ellipsis-cell {
    max-width: 56vw;
  }
}
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 15px; min-height: 38px; border-radius: 11px; font-size: .93rem; cursor: pointer; border: 1px solid transparent; font-weight: 700; transition: .18s ease; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--ok); color: #fff; }
.btn-outline { background: #fff; border-color: var(--line); color: #334155; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: #fff5f5; }
.btn-sm { padding: 6px 11px; min-height: 32px; font-size: .84rem; }
.success-text { color: var(--ok) !important; }
.danger-text { color: var(--danger) !important; }
.border-l-4 { border-left-width: 4px; }
.border-l-blue-600 { border-left-color: #2563eb; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.filter-bar .form-item { margin-bottom: 0; }
.table-scroll { width: 100%; overflow-x: auto; }
.pager { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 16px; color: var(--muted); font-size: 13px; }
.pager a, .pager button { min-width: 34px; min-height: 32px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #334155; font-weight: 700; text-decoration: none; cursor: pointer; }
.pager a.active, .pager button.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.pager button:disabled { cursor: default; opacity: .55; }
.pager span { padding: 0 3px; }
.empty-cell { text-align: center; color: var(--muted); padding: 40px !important; }
.tag { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.spider-stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.spider-note-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; font-size: 13px; color: var(--muted); }
.spider-note-grid strong { color: var(--ink); }
.switch { position: relative; display: inline-block; width: 46px; height: 24px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: #475569; transition: .3s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; transition: .3s; border-radius: 50%; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(22px); }
.spider-logo-cell { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.spider-logo-img { width: 42px; height: 42px; border-radius: 12px; object-fit: contain; background: #fff; border: 1px solid #e2e8f0; padding: 5px; box-shadow: 0 4px 12px rgba(15,23,42,.06); }
.spider-logo-mark { font-family: Consolas, "SFMono-Regular", monospace; font-size: 12px; font-weight: 800; color: #334155; line-height: 1.15; word-break: break-all; }
.profile-name { font-weight: 800; color: var(--ink); }
.profile-notes { color: var(--muted); font-size: 12px; margin-top: 3px; }
.ua-cell { max-width: 460px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-family: Consolas, "SFMono-Regular", monospace; font-size: 12px; }
.spider-profile-table td { height: 68px; }
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; margin-left: 6px; }
.badge-on { background: #dcfce7; color: var(--ok); }
.badge-off { background: #fee2e2; color: var(--danger); }
.badge.neutral { background: rgba(148, 163, 184, .2); color: #64748b; }
.badge.model { background: rgba(99, 102, 241, .15); color: var(--accent); }
.badge.lang { background: rgba(52, 211, 153, .15); color: var(--ok); }
.badge.warn { background: rgba(251, 191, 36, .15); color: #b54708; }
.form-row { display: flex; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.split-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.form-item { flex: 1 1 180px; min-width: 0; display: block; color: var(--muted); font-weight: 700; }
.form-item input, .form-item select, .form-item textarea, .legacy-filter input, .legacy-filter select, .ai-generate-row input, .ai-generate-row select { width: 100%; padding: 11px 13px; background: #fff; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); font-size: 1rem; outline: none; }
.form-item textarea { min-height: 110px; resize: vertical; font-family: Consolas, "SFMono-Regular", monospace; }
.article-editor-card .rich-toolbar { background: #fff; border: 1px solid var(--line); border-radius: 6px 6px 0 0; padding: 6px 8px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.article-editor-card .rich-toolbar button { background: #fff; border: 1px solid #e5e7eb; color: #222; padding: 5px 10px; border-radius: 4px; cursor: pointer; font-size: 13px; line-height: 1.4; min-height: 30px; }
.article-editor-card .rich-toolbar button:hover { background: #f3f4f6; border-color: #9ca3af; }
.article-editor-card .rich-toolbar .sep { display: inline-block; width: 1px; height: 18px; background: #e5e7eb; margin: 0 4px; }
.article-editor-card .rich-editor { background: #fff; color: #222; min-height: 400px; max-height: 600px; overflow: auto; padding: 18px 22px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 6px 6px; font-size: 15px; line-height: 1.9; outline: none; font-weight: 400; }
.article-editor-card .rich-editor h2 { font-size: 22px; margin: 14px 0 10px; color: #111; font-weight: 700; }
.article-editor-card .rich-editor h3 { font-size: 18px; margin: 12px 0 8px; color: #222; font-weight: 600; }
.article-editor-card .rich-editor p { margin-bottom: 12px; }
.article-editor-card .rich-editor blockquote { margin: 10px 0; padding: 8px 14px; border-left: 3px solid #6366f1; background: #f3f4ff; color: #444; }
.article-editor-card .rich-editor ul, .article-editor-card .rich-editor ol { margin: 8px 0 12px 24px; }
.article-editor-card .rich-editor img { max-width: 100%; display: block; margin: 10px 0; }
.article-editor-card .rich-editor a { color: #2563eb; text-decoration: underline; }
.article-editor-card .rich-source { width: 100%; min-height: 400px; font-family: Consolas, "SFMono-Regular", monospace; font-size: 13px; border-radius: 0 0 6px 6px; }
#articleViewModal { padding: 16px; overflow: hidden; }
#articleViewModal .article-view-modal { width: min(920px, 100%); max-width: 100%; height: min(850px, calc(100dvh - 32px)); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; overflow: hidden; min-height: 0; margin: 0; }
#articleViewModal .card-head { display: flex; flex: 0 0 auto; align-items: flex-start; gap: 12px; }
#articleViewModal .card-head h3 { min-width: 0; flex: 1; overflow-wrap: anywhere; max-height: 100px; overflow-y: auto; font-size: 17px; }
#articleViewModal .card-head button { flex-shrink: 0; }
#articleViewMeta { flex: 0 0 auto; overflow-wrap: anywhere; }
#articleViewContent { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; overflow-wrap: anywhere; }
.keyword-trends-panel .data-table { min-width: 620px; }
.article-view-content { margin-top: 14px; padding: 18px 20px; background: #fff; border: 1px solid var(--line); border-radius: 6px; color: #222; font-size: 15px; line-height: 1.9; }
.article-view-content p { margin: 0 0 12px; }
.article-view-content img { max-width: 100%; height: auto; }
.legacy-filter { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.legacy-filter label { display: block; font-size: 12px; font-weight: 800; color: #64748b; }
.legacy-grid-main { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, .65fr); gap: 20px; margin-top: 20px; }
.legacy-grid-bottom { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; margin-top: 20px; }
.legacy-side-stack { display: grid; gap: 20px; align-content: start; }
.spider-category { margin-bottom: 20px; }
.spider-category-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; border-radius: 12px; padding: 8px 12px; background: #fff5f5; color: var(--accent); }
.spider-category-head span { color: #64748b; font-size: 12px; font-weight: 700; }
.spider-type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.spider-type-card { display: flex; gap: 12px; align-items: center; border: 1px solid #e2e8f0; border-radius: 16px; background: #fff; padding: 12px; transition: .16s ease; text-align: left; cursor: pointer; }
.spider-type-card:hover { border-color: #94a3b8; }
.spider-logo { width: 38px; height: 38px; border-radius: 12px; background: #fff; border: 1px solid #e2e8f0; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; color: var(--accent); flex: none; }
.spider-type-logo-img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.spider-type-body { display: block; min-width: 0; flex: 1; }
.spider-type-title { display: block; font-weight: 800; color: #0f172a; font-size: 14px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spider-type-mark { display: block; max-width: 100%; margin-top: 3px; overflow: hidden; color: #334155; font-family: Consolas, "SFMono-Regular", monospace; font-size: 11px; font-weight: 800; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.spider-type-badge { display: inline-flex; align-items: center; margin-left: 6px; padding: 1px 6px; border-radius: 999px; font-size: 11px; font-style: normal; font-weight: 800; vertical-align: 1px; }
.spider-type-badge.blocked { background: #fee2e2; color: var(--danger); }
.spider-type-badge.static { background: #fff7ed; color: #b54708; }
.spider-type-meta { display: block; font-size: 12px; color: #64748b; margin-top: 3px; }
.mini-progress { display: block; height: 5px; background: #eef2f7; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.mini-progress span { display: block; height: 100%; border-radius: 999px; }
.spider-chart { height: 230px; position: relative; }
.spider-chart-sm { height: 210px; position: relative; }
.legacy-tabs-card { padding: 14px 20px; margin-bottom: 16px; }
.legacy-tabs { display: flex; gap: 10px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.legacy-tabs button { border: 0; background: transparent; padding: 10px 20px; color: var(--muted); font-weight: 700; cursor: pointer; border-bottom: 2px solid transparent; }
.legacy-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.ai-generate-card { border: 1px dashed var(--accent); }
.ai-generate-card > strong { color: var(--accent); }
.ai-generate-row { display: grid; grid-template-columns: 150px 170px minmax(320px, 2fr) 120px 140px 120px minmax(150px, 1fr) 120px auto; gap: 12px; align-items: start; margin-top: 14px; }
.ai-generate-row label { font-size: 13px; font-weight: 800; color: var(--muted); }
.ai-generate-row .wide { min-width: 320px; }
.ai-generate-row small { display: block; min-height: 18px; margin-top: 5px; line-height: 1.4; color: var(--muted); }
.prompt-card { border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; background: rgba(255, 255, 255, .02); }
.prompt-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.prompt-meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.prompt-card pre { background: rgba(0, 0, 0, .72); padding: 10px; border-radius: 6px; font-size: 11px; color: #d1d5db; max-height: 140px; overflow: auto; white-space: pre-wrap; }
.legacy-modal { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .7); z-index: 9999; align-items: center; justify-content: center; overflow-y: auto; padding: 30px 0; }
.legacy-modal.active { display: flex; }
.legacy-modal-card { width: min(680px, calc(100vw - 24px)); max-height: 90vh; overflow-y: auto; }
.legacy-modal-card h3 { margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.legacy-note { background: rgba(99, 102, 241, .08); }
.legacy-note strong { color: var(--accent); }
.legacy-note p { color: var(--muted); font-size: 13px; line-height: 1.8; margin: 6px 0 0; }
.legacy-log { height: 280px; overflow: auto; margin: 0; background: #020617; color: #d1fae5; border-radius: 12px; padding: 14px; font: 13px/1.7 Consolas, Monaco, monospace; white-space: pre-wrap; }
.task-progress { height: 4px; background: rgba(99,102,241,.15); border-radius: 2px; margin-top: 3px; overflow: hidden; }
.task-progress span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.task-actions { white-space: nowrap; font-size: 12px; }
.task-error { margin-top: 6px; color: var(--danger); font-size: 12px; }
.text-ok { color: var(--ok); }
.text-danger { color: var(--danger); }
.empty { padding: 30px; text-align: center; color: var(--muted); }

@media(max-width: 1280px) {
  .ai-generate-row { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
  .legacy-grid-main, .legacy-grid-bottom { grid-template-columns: 1fr; }
}

@media(max-width: 768px) {
  .page-header { display: block; }
  .legacy-filter { margin-top: 12px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-generate-row { grid-template-columns: 1fr; }
  .split-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  background: #fff;
  color: var(--ink);
  padding: 0 8px 0;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  box-shadow: 4px 0 18px rgba(17, 24, 39, .04);
  z-index: 40;
}

.sidebar-backdrop { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid #f1b9bc;
  background: #fff;
  object-fit: cover;
  flex: none;
}

.brand strong { display: block; font-size: 16px; }
.brand small { color: var(--accent); font-weight: 800; }

.nav-group {
  padding: 6px 0 8px;
  border-bottom: 1px solid #f0f2f5;
}

.nav-group:last-child { border-bottom: 0; }

.nav-group h3 {
  margin: 6px 10px;
  color: #98a2b3;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
}

nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #343841;
  text-align: left;
  padding: 0 10px;
  cursor: pointer;
  margin: 2px 0;
  border-left: 3px solid transparent;
  font-weight: 700;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: #f2f4f7;
  color: #8a9099;
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
  flex: none;
}

nav button.active,
nav button:hover {
  background: #fff5f5;
  color: var(--accent);
  border-left-color: var(--accent);
}

nav button.active .nav-icon,
nav button:hover .nav-icon {
  background: #fff;
  color: var(--accent);
  border: 1px solid #f1b9bc;
}

.sidebar-foot { display: none; }

.sidebar-logout {
  width: 100%;
  background: transparent;
  color: var(--danger);
  border: 1px solid #fecaca;
  font-weight: 800;
}

.sidebar-logout:hover {
  background: #fff1f0;
  color: var(--danger);
}

.shell {
  margin-left: 260px;
  min-height: 100vh;
  padding: 0 24px 34px;
}

body.login-active .sidebar,
body.login-active .topbar {
  display: none;
}

body.login-active .shell {
  margin-left: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

body.login-active #alerts {
  position: fixed;
  top: 16px;
  left: 50%;
  width: min(720px, calc(100vw - 32px));
  transform: translateX(-50%);
  z-index: 10;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: 56px;
  margin: 0 -24px 24px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(12px);
}

.topbar-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-brand-text {
  color: #667085;
  font-size: 14px;
  font-weight: 500;
}

.menu-toggle {
  display: none;
  background: #fff;
  color: #344054;
  border: 1px solid var(--line);
}

.menu-toggle:hover {
  color: var(--accent);
  background: #fff5f5;
  border-color: #f1b9bc;
}

.legacy-shell-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.legacy-shell-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #475467;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 800;
}

h1 { margin: 0; font-size: 24px; letter-spacing: 0; }
p { margin: 4px 0 0; color: var(--muted); }

.token-box {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 360px;
}

.token-box input { min-width: 210px; }

.token-box span {
  color: #667085;
  font-size: 14px;
  font-weight: 500;
}

.token-box .ghost {
  height: 36px;
  border: 1px solid #e5e7eb;
  border-radius: 0;
  background: #fff;
  color: #374151;
  font-weight: 700;
}

.token-box .ghost:hover {
  border-color: var(--accent);
  background: #fff;
  color: var(--accent);
}

.login-panel {
  display: none;
  width: min(960px, 100%);
  place-items: center;
}

.login-panel.active { display: grid; }

.login-shell {
  width: min(960px, 100%);
  min-height: 520px;
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(17, 24, 39, .10);
}

.login-brand-pane {
  padding: 48px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #fff;
}

.login-brand-logo {
  width: min(430px, 100%);
  display: block;
}

.login-brand-meta { margin-top: 28px; }
.login-brand-meta h2 {
  margin: 0;
  color: var(--ink);
  font-size: 28px;
  line-height: 1.2;
  font-weight: 900;
}
.login-brand-meta p {
  margin: 10px 0 0;
  color: var(--muted);
}
.login-brand-meta span {
  display: inline-flex;
  margin-top: 18px;
  padding: 5px 10px;
  border: 1px solid #f1b9bc;
  background: #fff5f5;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.login-brand-foot {
  color: #8a9099;
  font-size: 12px;
}

.login-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  background: var(--panel);
  padding: 54px 48px;
}

.login-card h2 { margin: 0 0 6px; font-size: 24px; line-height: 1.25; font-weight: 900; }
.login-card p { margin: 0 0 30px; color: var(--muted); font-size: 14px; }
.login-card label { display: grid; gap: 7px; margin-bottom: 18px; color: #30343b; font-size: 13px; font-weight: 800; }
.login-card input {
  height: 44px;
  border-color: #cfd5df;
  border-radius: 0;
  font-size: 15px;
  padding: 0 12px;
}
.login-card button[type="submit"] {
  width: 100%;
  height: 44px;
  margin-top: 8px;
  border: 0;
  border-radius: 0;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
}
.login-card button[type="submit"]:hover { background: var(--accent-strong); }
.login-mobile-mark {
  display: none;
  width: 74px;
  height: 74px;
  object-fit: cover;
  margin-bottom: 18px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-height: 36px;
  padding: 8px 10px;
  outline: none;
}

textarea { min-height: 78px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(22,119,255,.12); }

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  height: 36px;
  padding: 0 14px;
  cursor: pointer;
  white-space: nowrap;
}
button:hover { background: var(--accent-strong); }
button.ghost { background: #eef3fa; color: #28364f; }
button.ghost:hover { background: #e1e9f5; }
button.danger { background: var(--danger); }

.content { display: grid; gap: 14px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { margin: 0; font-size: 16px; }
.panel-body { padding: 16px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.stat {
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.stat strong { display: block; font-size: 24px; }
.stat span { color: var(--muted); }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 9px 11px;
  text-align: left;
  vertical-align: top;
}
th {
  background: #f7f9fc;
  color: #41506a;
  font-size: 12px;
  font-weight: 700;
}
td code {
  display: inline-block;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.form-grid label { display: grid; gap: 6px; color: #3b4b66; font-weight: 600; }
.form-grid .wide { grid-column: span 3; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.actions-inline { display: flex; gap: 8px; align-items: center; }
.actions-inline input { width: 86px; }
.flush-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.flush-grid button {
  height: auto;
  min-height: 42px;
  white-space: normal;
  text-align: left;
}

.cache-group-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cache-config-section {
  border-top: 1px dashed var(--line);
  margin-top: 14px;
  padding-top: 14px;
}

.cache-state-line {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.cache-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 6px;
}

.security-danger {
  border-color: #ef4444;
  background: #fff7f7;
}

.security-preview {
  margin-top: 14px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  border-radius: 14px;
  padding: 14px;
}

.security-preview strong {
  display: block;
  color: #1d4ed8;
  margin-bottom: 8px;
}

.security-preview code {
  display: block;
  background: #fff;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #dbeafe;
  word-break: break-all;
}

.settings-tabs-static {
  display: grid;
  gap: 14px;
}

.settings-tab-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.settings-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 20px;
}

.settings-tab:hover,
.settings-tab.active {
  background: transparent;
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: block;
}

.code-field textarea,
.code-textarea {
  font-family: Consolas, "SFMono-Regular", monospace;
  min-height: 150px;
}

.group-help-card {
  padding: 14px 20px;
  margin-bottom: 16px;
}

.group-help-card p {
  color: var(--muted);
  font-size: 13px;
}

.domain-group-card {
  margin-bottom: 16px;
}

.domain-group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.domain-group-title {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.domain-group-title > strong {
  font-size: 16px;
  margin-right: 2px;
}

.group-description {
  margin-left: 4px;
  color: var(--muted);
  font-size: 12px;
}

.img-count {
  background: rgba(245,158,11,.15);
  color: #b54708;
}

.link-count {
  background: rgba(168,85,247,.15);
  color: #7c3aed;
}

.empty-inline {
  color: var(--muted);
  text-align: center;
  padding: 14px 0;
  font-size: 13px;
}

.filter-card {
  padding: 14px 20px;
  margin-bottom: 16px;
}

.site-filter-keyword {
  flex: 2 1 240px;
}

.muted-cell {
  color: var(--muted);
  font-size: 12px;
}

.page-count {
  font-size: 14px;
  color: var(--muted);
}

.cache-group-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(420px, 1.4fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.cache-group-title strong {
  display: block;
  font-size: 15px;
  color: var(--ink);
}

.cache-group-title span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.cache-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.cache-metric {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px 10px;
  min-width: 0;
}

.cache-metric b {
  display: block;
  font-size: 14px;
  line-height: 1.3;
  word-break: break-all;
}

.cache-metric span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.alert {
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: #eef6ff;
  border: 1px solid #b9d7ff;
  color: #164a8b;
}
.alert.error { background: #fff1f0; border-color: #ffc9c4; color: #9f1f16; }
.badge {
  display: inline-block;
  min-width: 46px;
  text-align: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  background: #eef3fa;
  color: #42526d;
}
.badge.ok { color: var(--ok); background: #eaf7ef; }
.badge.off { color: var(--warn); background: #fff4e5; }

.compat-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #f1b9bc;
  border-radius: 8px;
  background: #fffafa;
  color: #4b5563;
}

.compat-banner strong {
  display: block;
  color: var(--accent);
  font-size: 14px;
}

.compat-banner span {
  display: block;
  margin-top: 3px;
}

.compat-banner code {
  color: #172033;
  background: #fff;
  border: 1px solid #f4d3d5;
  border-radius: 4px;
  padding: 1px 5px;
}

.compat-pill {
  flex: none;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 26px;
  margin: 0 !important;
  border-radius: 999px;
  background: #fff5f5;
  color: var(--accent) !important;
  font-weight: 900;
  font-size: 12px;
}

.local-lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.local-lang-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 14px;
  padding: 13px 14px;
  cursor: pointer;
  transition: .18s ease;
}

.local-lang-card:hover { border-color: var(--accent); background: #eff6ff; }
.local-lang-card input { width: 18px; height: 18px; accent-color: var(--accent); }
.local-lang-card span { display: flex; flex-direction: column; line-height: 1.3; }
.local-lang-card em { margin-top: 3px; color: var(--muted); font-size: 12px; font-style: normal; }

.local-result-box {
  margin: 0;
  background: #0f172a;
  color: #cbd5e1;
  border-radius: 14px;
  padding: 14px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 13px;
  line-height: 1.75;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
}

.local-result-box .ok { color: #34d399; }

.template-progress-track {
  position: relative;
  height: 18px;
  margin-bottom: 14px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(99, 102, 241, .12);
}

.template-progress-bar {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--accent), #a855f7);
  transition: width .5s ease;
}

.template-progress-track #progressLabel {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
}

.progress-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.redirect-help-card {
  margin-bottom: 16px;
  background: rgba(99, 102, 241, .08);
}

.redirect-help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.group-check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px 0;
}

.group-check-grid label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 14px;
  background: rgba(99, 102, 241, .1);
  cursor: pointer;
}

.schedule-table input[type="number"] { width: 80px; }
.nowrap { white-space: nowrap; }
.mono { font-family: Consolas, "SFMono-Regular", monospace; font-size: 12px; }
.ellipsis-cell { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.template-filter {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(140px, .7fr) minmax(130px, .55fr) auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.template-filter label {
  display: block;
  margin-bottom: 5px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.template-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.template-tools .left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: #64748b;
  font-size: 13px;
}

.tpl-check-cell { width: 42px; text-align: center; }
.tpl-name { min-width: 180px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-dir { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.template-preview-card {
  width: min(1180px, 94vw);
  height: 90vh;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.template-preview-toolbar {
  display: grid;
  grid-template-columns: auto auto auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

#templatePreviewFrame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}

.legacy-info-card {
  padding: 14px 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.legacy-info-card p + p { margin-top: 4px; }

.url-fallback-box {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(99, 102, 241, .08);
  color: #334155;
}

.url-fallback-box label,
.inline-check,
.select-line label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legacy-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, .58);
}

.legacy-modal-card {
  width: min(560px, 96vw);
  max-height: 90vh;
  overflow: auto;
}

.legacy-modal-card h3 {
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.legacy-inline-panel {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.legacy-filter-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-top: 12px;
}

.legacy-filter-row .form-item,
.compact-row .form-item {
  margin-bottom: 0;
}

.form-item.wide {
  flex: 2;
  min-width: 260px;
}

.compact-row {
  align-items: flex-end;
  margin-top: 12px;
}

.select-line {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.image-asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.image-asset-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.image-asset-thumb {
  position: relative;
  height: 120px;
  background: #0f172a;
}

.image-asset-thumb input {
  position: absolute;
  z-index: 2;
  top: 6px;
  left: 6px;
}

.image-asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-asset-meta {
  position: relative;
  padding: 8px 38px 8px 10px;
  color: var(--muted);
  font-size: 12px;
}

.image-asset-meta div {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-asset-meta span {
  display: block;
  margin-top: 4px;
}

.image-asset-meta button {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-height: 24px;
  width: 26px;
  padding: 0;
}

.stat-grid.four-cols { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-grid.five-cols { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.tag-help {
  background: rgba(99, 102, 241, .08);
}

.tag-help strong {
  color: var(--accent);
}

.tag-help p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.tag-table-card {
  padding: 0;
  overflow: hidden;
}

.tags-table {
  min-width: 980px;
  table-layout: fixed;
}

.tag-name-code {
  display: inline-block;
  max-width: 142px;
  padding: 3px 8px;
  overflow: hidden;
  color: var(--accent);
  font-weight: 700;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
  border-radius: 4px;
  background: rgba(99, 102, 241, .1);
}

.tag-system-badge {
  margin-left: 4px;
  color: #06b6d4;
  font-size: 10px;
  background: rgba(6, 182, 212, .15);
}

.tag-actions {
  flex-wrap: wrap;
}

.tag-value-cell {
  white-space: normal;
}

.tag-handler-value {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tag-desc {
  margin-top: 3px;
  overflow: hidden;
  color: #888;
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.wide-modal {
  width: min(860px, 96vw);
  max-height: 92vh;
}

.tag-edit-modal {
  width: min(640px, 96vw);
}

.legacy-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
  vertical-align: middle;
}

.legacy-switch input {
  width: 0;
  height: 0;
  opacity: 0;
}

.legacy-switch span {
  position: absolute;
  inset: 0;
  cursor: pointer;
  border-radius: 22px;
  background: #475569;
  transition: .2s;
}

.legacy-switch span::before {
  position: absolute;
  bottom: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  content: "";
  transition: .2s;
}

.legacy-switch input:checked + span {
  background: var(--accent);
}

.legacy-switch input:checked + span::before {
  transform: translateX(20px);
}

.code-textarea {
  font-family: Consolas, "SFMono-Regular", monospace;
  line-height: 1.55;
}

.actions.right {
  justify-content: flex-end;
}

.dashed-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.scope-box {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.scope-box label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.domain-scope-box {
  max-height: 240px;
  overflow: auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.domain-scope-box label {
  align-items: flex-start;
  font-size: 12px;
}

.domain-scope-box small,
.subtle {
  color: var(--muted);
  font-size: 12px;
}

.backup-table-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

.backup-table-checks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filter-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  align-self: center;
}

.board-filter {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .05);
}

.board-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.board-label {
  display: block;
  margin-bottom: 5px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.board-input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}

.board-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.board-metric {
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .055);
}

.board-metric b {
  display: block;
  color: #0f172a;
  font-size: 26px;
  line-height: 1.05;
  font-weight: 800;
}

.board-metric span {
  display: block;
  margin-top: 7px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.board-metric small {
  display: block;
  margin-top: 2px;
  color: #94a3b8;
  font-size: 11px;
}

.board-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 16px;
}

.board-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.board-chart {
  min-height: 250px;
}

.board-chart .canvas-wrap {
  height: 185px;
}

.system-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.system-item {
  min-width: 0;
  padding-bottom: 9px;
  border-bottom: 1px solid #eef2f7;
}

.system-item span {
  display: block;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.system-item b {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.resource-strip-page { margin-top: 0; }
.resource-unavailable { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); }
.resource-meter { min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.resource-meter-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.resource-meter-head strong { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.resource-meter-track { height: 6px; margin: 9px 0 7px; overflow: hidden; border-radius: 3px; background: #e8edf3; }
.resource-meter-track i { display: block; height: 100%; border-radius: inherit; background: #2563eb; }
.resource-meter.is-warning .resource-meter-track i { background: #d97706; }
.resource-meter small { display: block; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.cleanup-check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    width: 260px;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(15, 23, 42, .48);
  }
  body.nav-open .sidebar-backdrop { display: block; }
  .shell { margin-left: 0; padding: 0 14px 14px; }
  .topbar { display: grid; }
  .topbar { margin: 0 -14px 14px; padding: 10px 14px; }
  .menu-toggle { display: inline-flex; }
  .topbar-brand-text { display: none; }
  .token-box { min-width: 0; flex-wrap: wrap; }
  .stats-grid, .form-grid, .flush-grid, .cache-group-row, .cache-metrics { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .compat-banner { display: grid; }
  .redirect-help-grid, .stat-grid.four-cols, .stat-grid.five-cols, .domain-scope-box,
  .board-filter-grid, .board-metrics, .board-grid, .board-chart-grid, .system-list, .resource-strip { grid-template-columns: 1fr; }
  .template-filter { grid-template-columns: 1fr 1fr; }
  .template-preview-toolbar { grid-template-columns: 1fr 1fr; }
  .login-shell { display: block; min-height: 0; }
  .login-brand-pane { display: none; }
  .login-card { padding: 34px 26px; }
  .login-mobile-mark { display: block; }
}

/* Final legacy overrides after the original v2 rules. */
html { font-size: clamp(15px, .88vw + 11px, 17px); }
body { font-size: 1rem; line-height: 1.65; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
.nav-group { border-bottom: 0; padding: 10px 0 22px; }
.nav-group h3 { display: none; }
nav button { min-height: auto; padding: 9px 10px; font-size: .92rem; border-radius: 6px; border-left: 3px solid transparent; }
.nav-icon { width: 18px; height: 18px; background: transparent; border: 0; border-radius: 0; font-size: 14px; }
.topbar h1, #pageSub, .legacy-shell-meta { display: none; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: clamp(18px, 1.4vw, 24px); margin-bottom: 22px; box-shadow: var(--shadow); overflow-x: auto; }
.card > .data-table { margin-left: calc(clamp(18px, 1.4vw, 24px) * -1); margin-right: calc(clamp(18px, 1.4vw, 24px) * -1); width: calc(100% + (clamp(18px, 1.4vw, 24px) * 2)); }
.filter-bar { display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px; box-shadow: 0 10px 30px rgba(15, 23, 42, .06); flex-wrap: wrap; }
.form-item input:focus, .form-item select:focus, .form-item textarea:focus, .filter-bar input:focus, .filter-bar select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 15px; min-height: 38px; border-radius: 11px; font-size: .93rem; cursor: pointer; border: 1px solid transparent; font-weight: 700; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); transform: translateY(-1px); color: #fff; }
.btn-outline { background: #fff; border-color: var(--line); color: #334155; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: #fff5f5; }
.btn-danger { background: var(--danger); color: #fff; }
.data-table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; }
.data-table th { text-align: left; padding: 13px 15px; font-size: .86rem; color: #475569; border-bottom: 1px solid var(--line); font-weight: 800; background: #f8fafc; white-space: nowrap; }
.data-table td { padding: 13px 15px; border-bottom: 1px solid var(--line); font-size: .94rem; vertical-align: middle; }
.data-table tr:hover td { background: #f8fafc; }

/* Final admin UI normalization after all legacy overrides. */
.license-status-page { font-size: 15px; letter-spacing: 0; }
.license-status-page h2 { font-size: 24px; }
.license-status-line { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; min-height: 36px; margin-bottom: 16px; }
.license-state { display: inline-flex; align-items: center; font-weight: 700; gap: 8px; }
.license-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #667085; }
.license-state[data-tone="success"]::before { background: #16803c; }
.license-state[data-tone="danger"]::before { background: #c62828; }
.license-state[data-tone="warning"]::before { background: #a26405; }
#licenseRequestState { color: #667085; font-size: 13px; }
.license-status-page .license-refresh { width: 40px; height: 40px; flex: 0 0 40px; padding: 0; border-radius: 6px; }
.license-refresh:disabled { opacity: .55; cursor: wait; }
.license-section { padding: 18px 0; border-top: 1px solid var(--line); }
.license-section h3 { margin: 0 0 14px; font-size: 17px; font-weight: 700; }
.license-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; margin: 0; }
.license-facts > div { display: grid; grid-template-columns: 124px minmax(0, 1fr); align-content: start; min-height: 54px; padding: 10px 0; border-bottom: 1px solid #e7e9ee; gap: 8px; }
.license-facts dt { color: #667085; }
.license-facts dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .license-facts { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 400px) { .license-facts > div { grid-template-columns: 102px minmax(0, 1fr); } }

/* Compact admin typography after the oversized legacy rules. */
html { font-size: 14px; }
body { font-size: 14px; line-height: 1.5; font-weight: 400; }
nav button { font-size: 14px; font-weight: 500; }
.brand strong { font-size: 16px; font-weight: 650; }
.page-header h2, .license-status-page h2 { font-size: 22px; line-height: 1.3; font-weight: 600; }
.page-subtitle, .card-head p { font-size: 13px; line-height: 1.55; }
.card-title, .card-head strong, .panel-head h2, .license-section h3 { font-size: 16px; font-weight: 600; }
.stat-card .value, .stat strong { font-size: 24px; font-weight: 600; }
.stat-card .label { font-size: 13px; }
.btn, button, .ghost, .danger { font-size: 14px; font-weight: 500; }
.btn-sm { font-size: 13px; }
.form-item { font-weight: 400; }
.form-item label, .form-grid label, .legacy-filter label, .ai-generate-row label, .login-card label { font-size: 13px; font-weight: 500; }
.form-item input, .form-item select, .form-item textarea,
.legacy-filter input, .legacy-filter select,
.ai-generate-row input, .ai-generate-row select { font-size: 14px; }
.data-table th, .card > table th, .panel-body > table th { font-size: 13px; font-weight: 600; }
.data-table td, .card > table td, .panel-body > table td { font-size: 14px; font-weight: 400; }
.data-table td strong, .profile-name, .spider-type-title { font-weight: 600; }
.badge, .tag, .pager a, .pager button { font-weight: 600; }
.login-card h2 { font-size: 22px; font-weight: 600; }
.license-status-page { font-size: 14px; }
.form-item .page-subtitle { white-space: normal; overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .form-row > .form-item { flex: 0 1 auto; width: 100%; }
}

.shell, .content, #content { min-width: 0; }
.content { overflow-x: hidden; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.page-header h2 { margin: 0; letter-spacing: 0; }
.card, .panel, .filter-card { border-radius: 8px; overflow: visible; box-shadow: 0 10px 26px rgba(15, 23, 42, .06); }
.table-scroll, .card > table, .panel-body > table { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card > table, .panel-body > table { display: block; }
.data-table, .table-scroll table, .card > table, .panel-body > table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; }
.data-table th, .card > table th, .panel-body > table th { position: sticky; top: 0; z-index: 1; background: #f8fafc; color: #334155; white-space: nowrap; }
.data-table th, .data-table td, .card > table th, .card > table td, .panel-body > table th, .panel-body > table td { max-width: 360px; vertical-align: middle; }
.actions-col { min-width: 210px; }
.actions-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-bar { align-items: flex-end; gap: 10px 12px; padding: 12px; border-radius: 8px; box-shadow: 0 8px 22px rgba(15, 23, 42, .05); }
.filter-bar .form-item, .legacy-filter .form-item { min-width: 160px; flex: 1 1 180px; }
.filter-bar .form-item.compact { flex: 0 1 170px; }
.filter-bar input, .filter-bar select, .filter-bar button { min-height: 38px; }
.btn, button, .ghost, .danger { border-radius: 8px; letter-spacing: 0; }
.time-cell, .nowrap, .mono { white-space: nowrap; font-variant-numeric: tabular-nums; }
.url-cell, .code-cell, .ellipsis-cell { display: inline-block; max-width: min(42vw, 520px); overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; white-space: nowrap; }
.code-cell { padding: 2px 6px; border-radius: 6px; background: #f1f5f9; color: #334155; }
.system-item b, .token-box, .cache-group-name, .cache-group-key { min-width: 0; }

@media (max-width: 900px) {
  .card, .panel, .filter-card { padding: 14px; }
  .page-header { align-items: stretch; }
  .filter-bar, .actions-inline { width: 100%; }
  .filter-bar .form-item, .filter-bar .form-item.compact, .filter-bar button { flex: 1 1 100%; width: 100%; }
  .data-table, .table-scroll table, .card > table, .panel-body > table { min-width: 680px; }
  .url-cell, .code-cell, .ellipsis-cell { max-width: 56vw; }
}

/* Dense operations UI baseline. Keep this final so legacy rules cannot enlarge
   form controls, cards, or typography again. */
html, body { max-width: 100%; overflow-x: hidden; }
.shell { padding-right: 20px; padding-bottom: 24px; padding-left: 20px; }
.content { width: 100%; max-width: 1920px; margin: 0 auto; gap: 12px; }
.page-header { margin-bottom: 12px; }
.page-header h2, .license-status-page h2 { font-size: 20px; font-weight: 650; }
.page-subtitle, .card-head p { margin-top: 3px; font-size: 12px; line-height: 1.45; }
.card, .panel, .filter-card { padding: 14px 16px; margin-bottom: 14px; }
.card-title, .card-head strong, .panel-head h2, .license-section h3 { font-size: 14px; }
.stat-grid { gap: 10px; }
.stat-card { min-height: 72px; padding: 13px 14px; border-radius: 8px; }
.stat-card .value, .stat strong { font-size: 21px; line-height: 1.15; }
.stat-card .label { margin-top: 4px; font-size: 12px; }
.stat-card .hint { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 16px 0 8px; }
.section-heading h3 { margin: 0; font-size: 14px; font-weight: 650; }
.identity-section { min-width: 0; }
.identity-card { border-left: 3px solid #94a3b8; }
.identity-card.is-verified { border-left-color: #16a34a; }
.identity-card.is-unverified { border-left-color: #d97706; }
.identity-card.is-failed { border-left-color: #dc2626; }
.data-table th, .card > table th, .panel-body > table th { padding: 9px 11px; font-size: 12px; }
.data-table td, .card > table td, .panel-body > table td { padding: 9px 11px; font-size: 13px; }
input, select, textarea { font-size: 13px; }
input:not([type="checkbox"]):not([type="radio"]), select { min-height: 34px; padding: 6px 9px; }
textarea { padding: 8px 9px; }
input[type="checkbox"], input[type="radio"] {
  box-sizing: border-box;
  width: 16px;
  min-width: 16px;
  max-width: 16px;
  height: 16px;
  min-height: 16px;
  max-height: 16px;
  flex: 0 0 16px;
  margin: 0;
  padding: 0;
  border-radius: 3px;
  box-shadow: none;
  accent-color: var(--accent);
  vertical-align: middle;
}
input[type="radio"] { border-radius: 50%; }
.group-check-grid { grid-template-columns: repeat(auto-fill, minmax(150px, max-content)); gap: 6px 8px; }
.group-check-grid label { min-height: 30px; gap: 7px; padding: 5px 9px; border-radius: 6px; font-size: 12px; line-height: 1.35; white-space: normal; }
.schedule-table input[type="number"] { width: 68px; min-height: 32px; }
.filter-bar { gap: 8px 10px; padding: 10px; }
.filter-bar input, .filter-bar select, .filter-bar button { min-height: 34px; }
.btn, button:not(.spider-type-card), .ghost, .danger { min-height: 34px; height: 34px; padding: 0 12px; font-size: 13px; }
.btn-sm { min-height: 30px; height: 30px; padding: 0 10px; font-size: 12px; }
.legacy-grid-main { gap: 12px; align-items: start; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.legacy-grid-main > * { min-width: 0; }
.spider-type-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 10px; }
button.spider-type-card {
  display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px;
  width: 100%; height: auto; min-height: 104px; padding: 12px;
  border-radius: 6px; background: #fff; color: #17212f;
  white-space: normal; line-height: 1.45; box-shadow: none;
}
button.spider-type-card:hover { background: #f6f8fb; transform: none; box-shadow: none; }
button.spider-type-card:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.spider-type-title { line-height: 1.4; }
.spider-type-mark { font-weight: 400; }
.spider-type-meta { font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.image-asset-thumb { background: #f1f3f5; }
.image-asset-thumb.is-missing::after { content: "本地文件缺失"; color: #667085; font-size: 12px; }
.image-asset-thumb.is-missing { display: flex; align-items: center; justify-content: center; }
.image-asset-thumb.is-missing img { display: none; }
.certificate-section { min-width: 0; padding: 16px 0; border-top: 1px solid var(--line); }
.certificate-section h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.certificate-section [hidden] { display: none; }
.dns-section [hidden], .dns-section[hidden] { display: none; }
.dns-section { margin-bottom: 24px; }
.dns-section .data-table { min-width: 760px; }
.google-section { padding: 16px 0; border-top: 1px solid var(--line); min-width: 0; }
.google-section h3 { font-size: 15px; font-weight: 500; margin: 0 0 16px; }
.google-section .form-item { max-width: 720px; margin-bottom: 16px; }
.google-actions { margin: 16px 0 0; }
.google-section .google-jobs-table { display: table; width: 100%; min-width: 760px; overflow: visible; }
.google-api-status { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; margin: 12px 0; }
.google-api-status > span { display: inline-flex; align-items: center; gap: 6px; }
.google-jobs-table td { vertical-align: top; }
.google-jobs-table .profile-notes { max-width: 260px; white-space: normal; overflow-wrap: anywhere; }
.google-jobs-table input[type="checkbox"] { width: 16px; height: 16px; min-width: 16px; min-height: 16px; padding: 0; margin: 4px 0; }
.google-job-result { color: var(--danger, #b91c1c); margin-bottom: 8px; overflow-wrap: anywhere; }
.google-more { margin-top: 12px; }
.google-more[hidden] { display: none !important; }
#googleResult { font-size: 13px; overflow-wrap: anywhere; margin-top: 12px; }
.domain-dns-fields { min-width: 0; border: 0; border-top: 1px solid var(--line); padding: 12px 0; margin-top: 12px; }
.domain-dns-fields legend { font-size: 14px; font-weight: 500; padding-right: 10px; }
.domain-dns-fields [hidden] { display: none; }
.domain-dns-fields .actions-inline { margin: 12px 0; }
.domain-dns-fields .actions-inline label { display: inline-flex; align-items: center; gap: 6px; }
.domain-dns-fields .form-error { font-size: 12px; overflow-wrap: anywhere; }
#domainLegacyModal .legacy-modal-card, #groupDomainModal .legacy-modal-card {
  max-height: calc(100dvh - 36px); max-width: 100%; overflow: auto; margin: 0;
  overscroll-behavior: contain;
}
#keywordTrendsPanel [hidden] { display: none; }
#keywordTrendsPanel .data-table { min-width: 960px; }
#keywordTrendsPanel .data-table th,
#keywordTrendsPanel .data-table td { white-space: nowrap; }
#keywordTrendsPanel .data-table td:last-child { min-width: 160px; max-width: 360px; white-space: normal; overflow-wrap: anywhere; }
.certificate-check { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 13px; }
.certificate-warning { font-size: 12px; color: #85540c; }
.spider-chart, .spider-chart-sm { min-height: 220px; }
.board-grid .card > .data-table,
.legacy-grid-bottom .card > .data-table { min-width: 0; table-layout: auto; }

@media (max-width: 900px) {
  .shell { padding-right: 12px; padding-bottom: 18px; padding-left: 12px; }
  .legacy-grid-main { grid-template-columns: minmax(0, 1fr); }
  .content > *, .card, .panel, .filter-card, form { min-width: 0; max-width: 100%; }
  .card, .panel, .filter-card { padding: 12px; }
  .stat-grid, .identity-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-table, .table-scroll table, .card > table, .panel-body > table {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
  }
}

@media (max-width: 560px) {
  .page-header h2, .license-status-page h2 { font-size: 18px; }
  .stat-grid, .stat-grid[style], .identity-stat-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .stat-card { min-height: 66px; }
  .group-check-grid { grid-template-columns: minmax(0, 1fr); }
}
