/* Goweco CMS Admin - Modern commercial design */

* { box-sizing: border-box; }

:root {
  --brand: #0a7a8a;
  --brand-dark: #0a1a3a;
  --brand-light: #e6f4f1;
  --accent: #fbbf24;
  --text: #1f2328;
  --text-light: #57606a;
  --text-mute: #8b949e;
  --border: #e1e4e8;
  --bg: #f5f7fa;
  --bg-card: #ffffff;
  --success: #1a7f37;
  --success-bg: #dafbe1;
  --warning: #d29922;
  --warning-bg: #fff8c5;
  --danger: #cf222e;
  --danger-bg: #ffebe9;
  --info: #0969da;
  --info-bg: #ddf4ff;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 10px 24px rgba(15, 23, 42, .12);
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  display: flex;
  min-height: 100vh;
}

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  background: var(--brand-light);
  padding: .1em .4em;
  border-radius: 4px;
  font-size: .9em;
  color: var(--brand-dark);
}

h1 { font-size: 1.65rem; margin: 0 0 .6rem; font-weight: 600; }
h2 { font-size: 1.25rem; margin: 1.6rem 0 .8rem; font-weight: 600; }
h3 { font-size: 1.05rem; margin: 0 0 .8rem; font-weight: 600; }

.muted { color: var(--text-light); }
.small { font-size: .85em; }
.danger { color: var(--danger); }

/* === Sidebar === */
.sidebar {
  width: 240px;
  background: var(--brand-dark);
  color: rgba(255,255,255,.85);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-brand {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand a {
  color: #fff;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-brand a:hover { text-decoration: none; }
.sidebar-brand strong { font-weight: 700; letter-spacing: .5px; }
.sidebar-brand em { font-style: normal; color: var(--accent); font-weight: 600; font-size: .85em; }
.logo-dot {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--brand), #2dd4bf);
  display: inline-block;
  box-shadow: 0 0 0 1px rgba(255,255,255,.1);
}
.sidebar-nav { padding: 14px 0; flex: 1; }
.nav-section { padding: 8px 0; }
.nav-title {
  font-size: .68rem;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 8px 20px 4px;
  font-weight: 700;
}
.nav-link {
  display: flex;
  align-items: center;
  padding: 9px 20px;
  color: rgba(255,255,255,.78);
  font-size: 13.5px;
  border-left: 3px solid transparent;
  transition: all .15s;
}
.nav-link:hover {
  background: rgba(255,255,255,.05);
  color: #fff;
  text-decoration: none;
}
.nav-link.active {
  background: rgba(13, 148, 136, .18);
  border-left-color: var(--brand);
  color: #fff;
}
.nav-link .badge-red { margin-left: auto; }
.sidebar-foot {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-foot a {
  color: var(--text-mute);
  font-size: 12px;
}
.sidebar-foot a:hover { color: #fff; text-decoration: none; }

/* === Main + topbar === */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 16px; }
.hamburger {
  background: transparent;
  border: 1px solid var(--border);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-light);
}
.breadcrumb { color: var(--text-light); font-size: 13px; }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-light);
  color: var(--brand-dark);
  padding: 4px 12px 4px 4px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}
.user-chip .avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.user-chip .role {
  background: var(--brand-dark);
  color: var(--accent);
  padding: 0 6px;
  border-radius: 8px;
  font-size: 10px;
  text-transform: uppercase;
  font-style: normal;
}
.topbar-right a, .topbar-right .btn-link {
  color: var(--text-light);
  font-size: 13px;
  background: transparent;
  border: none;
  cursor: pointer;
}
.topbar-right a:hover, .topbar-right .btn-link:hover { color: var(--text); }

/* === Content === */
.content {
  padding: 24px 28px 60px;
  flex: 1;
  max-width: 100%;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.page-head h1 { margin: 0; }
.page-head p.muted { margin: 4px 0 0; }
.page-head-actions { display: flex; gap: 8px; align-items: center; }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  box-shadow: var(--shadow-sm);
}
.btn:hover {
  background: #f6f8fa;
  text-decoration: none;
  border-color: #c9d1d9;
}
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}
.btn-secondary { background: #f6f8fa; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a40e26; border-color: #a40e26; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-link {
  background: transparent;
  border: none;
  color: var(--info);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  padding: 0;
}

/* === Form === */
.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}
.form-row input[type=text], .form-row input[type=number],
.form-row input[type=email], .form-row input[type=password],
.form-row input[type=url], .form-row input[type=date],
.form-row select, .form-row textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(10, 122, 138, .15);
}
.form-row textarea { font-family: inherit; resize: vertical; }
.form-row small.muted { display: block; margin-top: 4px; }
.form-row-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  cursor: pointer;
}

/* === Cards === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card > form, .card > .editor-layout, .card > .card-body, .card > p, .card > table {
  padding: 18px;
}
.card > .card-head + * { padding-top: 18px; }

.editor-layout { display: grid; grid-template-columns: 1fr 360px; gap: 18px; }
.editor-aside { display: flex; flex-direction: column; gap: 14px; }

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
  background: #fafbfc;
}
.tab {
  padding: 11px 18px;
  font-size: 13px;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}

/* === Tables === */
table.t {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 13px;
}
table.t th, table.t td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table.t th {
  background: #fafbfc;
  font-weight: 600;
  color: var(--text-light);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
table.t tbody tr:hover { background: #f6f8fa; }
table.t tbody tr:last-child td { border-bottom: none; }

/* === Stat cards (dashboard) === */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.cards .card {
  display: block;
  padding: 18px;
  text-align: left;
  color: var(--text);
  transition: all .2s;
}
.cards .card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
  border-color: var(--brand);
}
.cards .num {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 4px;
}
.cards .label { font-size: 13px; color: var(--text-light); margin-bottom: 2px; }
.cards small { font-size: 11px; color: var(--text-mute); }

/* === Tags === */
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.tag.draft { background: var(--warning-bg); color: var(--warning); }
.tag.published { background: var(--success-bg); color: var(--success); }
.tag.archived { background: #eaeef2; color: var(--text-mute); }

/* .badge is the same chip as .tag under a second name. The list templates were
   written against .tag; the newer screens (heroes, SEO, footer, cases,
   inquiries) against .badge -- and only .tag was ever defined, so every
   已启用 / 已停用 / 收录 / 不收录 chip and every inquiry status word came out as
   plain text with no pill at all. One rule now serves both names.
   Variants cover both vocabularies the templates use: semantic colours
   (green / blue / grey / red) and the raw status words passed straight through
   from the database (published / draft for cases and articles, new / contacted
   / qualified / closed for inquiries). */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  white-space: nowrap;
  background: #eef1f5;
  color: var(--text-mute);
}
.badge.green, .badge.published, .badge.qualified {
  background: var(--success-bg); color: var(--success);
}
.badge.blue, .badge.contacted {
  background: var(--info-bg); color: var(--info);
}
.badge.grey, .badge.draft, .badge.archived, .badge.closed {
  background: #eaeef2; color: var(--text-mute);
}
.badge.new { background: var(--warning-bg); color: var(--warning); }
.badge.red { background: var(--danger-bg); color: var(--danger); }
.badge-red {
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

/* === Flash === */
.flash {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 13px;
}
.flash.ok { background: var(--success-bg); color: var(--success); border: 1px solid #aff5b4; }
.flash.err { background: var(--danger-bg); color: var(--danger); border: 1px solid #ffcecb; }
.flash.warn { background: var(--warning-bg); color: #7a5b00; border: 1px solid #f2e08a; }

/* === Empty state === */
.empty {
  padding: 40px;
  text-align: center;
  color: var(--text-light);
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* === Login === */
.login-card {
  background: #fff;
  padding: 2.5rem 2.5rem 2rem;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 380px;
  border: 1px solid var(--border);
}
.login-card h1 { margin: 0 0 .4rem; font-size: 1.5rem; }
.login-card label { display: block; margin: 1rem 0 .3rem; font-size: 13px; font-weight: 600; }
.login-card label input { width: 100%; margin-top: 4px; }
.login-card .btn { width: 100%; padding: .8rem; margin-top: 1.2rem; }

/* === Login page background === */
body.login {
  background: linear-gradient(135deg, var(--brand-dark) 0%, #062c5a 100%);
  align-items: center;
  justify-content: center;
}

/* === Responsive === */
@media (max-width: 900px) {
  .editor-layout { grid-template-columns: 1fr; }
  .form-row-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   secform.css -- appended to admin.css
   Styles for the schema-driven page-section editor (admin/_secform.html +
   secform.js). Everything is namespaced under .fld / .rep / .imgpick / .mp so
   it cannot leak into the existing admin pages.
   ========================================================================== */

/* --- shared bits ------------------------------------------------------- */
.btn-mini {
  display: inline-flex; align-items: center; gap: .3em;
  padding: .3em .7em; border: 1px solid var(--border);
  background: #fff; color: var(--text); border-radius: 6px;
  font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn-mini:hover { border-color: var(--brand); color: var(--brand); }
.btn-mini.ghost { background: transparent; color: var(--text-light); }
.btn-mini.add { background: var(--brand-light); border-color: #bfe3dd; color: var(--brand-dark); }
.btn-mini.add:hover { background: var(--brand); color: #fff; border-color: var(--brand); }

html { scroll-behavior: smooth; }

/* --- section shell ----------------------------------------------------- */
.sec-typebar {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .7rem .9rem; margin-bottom: 1rem;
  background: linear-gradient(180deg, #fff, #fafbfc);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.sec-typebar select { width: auto; min-width: 230px; font-weight: 600; }
.sec-typebar .sep { width: 1px; height: 22px; background: var(--border); }

.sechead-note {
  background: var(--info-bg); border: 1px solid #b6e3ff;
  color: #05507a; padding: .55rem .8rem; border-radius: 6px;
  font-size: 12.5px; margin: 0 0 1rem; line-height: 1.6;
}
.sechead-note b { color: #032f4d; }

/* --- fields ------------------------------------------------------------ */
.fld { margin-bottom: 1.15rem; }
.fld-label {
  display: block; font-weight: 600; font-size: 13px;
  margin-bottom: .35rem; color: var(--text);
}
.fld-hint {
  display: block; font-style: normal; font-weight: 400;
  font-size: 11.5px; color: var(--text-mute); margin-top: .25rem;
}
.fld > input[type=text], .fld > textarea, .fld > select { width: 100%; }
.fld textarea.html-area { font-size: 12px; line-height: 1.6; min-height: 120px; }
.fld textarea.md-area { min-height: 90px; }

/* bilingual / quadrilingual pair -- EN 中 RU AR */
.bi { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.bi-4 { grid-template-columns: repeat(4, 1fr); }
.bi-gap { margin-top: .55rem; }
.bi-col { position: relative; display: block; }
.bi-col input, .bi-col textarea, .bi-col select { width: 100%; padding-left: 2.1rem; }
.bi-tag {
  position: absolute; left: 8px; top: 8px; z-index: 2;
  font-size: 9.5px; font-weight: 800; letter-spacing: .06em;
  color: var(--text-mute); background: #eef1f5;
  border-radius: 3px; padding: 1px 4px; pointer-events: none;
}
.bi-tag.zh { color: #fff; background: var(--brand); }
.bi-tag.ru { color: #fff; background: #2f6f9f; }
.bi-tag.ar { color: #fff; background: #7a5aa8; }
.bi-col .imgpick-bar input[type=text] { padding-left: .5rem; }
@media (max-width: 1180px) { .bi-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .bi, .bi-4 { grid-template-columns: 1fr; } }

/* toggle switch */
.sw { display: inline-flex; align-items: center; cursor: pointer; }
.sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw span {
  width: 40px; height: 22px; border-radius: 11px;
  background: #cfd6de; position: relative; transition: background .15s;
  display: block;
}
.sw span::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s;
}
.sw input:checked + span { background: var(--brand); }
.sw input:checked + span::after { transform: translateX(18px); }
.sw input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* colour picker */
.colorpick { display: flex; gap: .5rem; align-items: center; }
.colorpick input[type=color] { width: 44px; height: 34px; padding: 2px; border-radius: 6px; border: 1px solid var(--border); background: #fff; }
.colorpick input[type=text] { flex: 1; }

/* --- image picker ------------------------------------------------------ */
.imgpick { display: flex; gap: .7rem; align-items: flex-start; }
.imgpick-prev {
  width: 104px; height: 72px; flex: none;
  border: 1px solid var(--border); border-radius: 6px;
  background: #f3f5f8 repeating-linear-gradient(45deg, #eceff3 0 6px, #f6f8fa 6px 12px);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.imgpick-prev img { width: 100%; height: 100%; object-fit: cover; }
.imgpick-none { font-size: 10.5px; color: var(--text-mute); text-align: center; padding: 0 .4rem; }
.imgpick-bar { flex: 1; display: flex; gap: .4rem; flex-wrap: wrap; }
.imgpick-bar input[type=text] { flex: 1; min-width: 180px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

/* --- repeatable blocks ------------------------------------------------- */
.rep {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: #fbfcfd; overflow: hidden;
}
.rep-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem .7rem; border-bottom: 1px solid var(--border);
  background: #f2f5f8; font-weight: 600; font-size: 12.5px;
}
.rep-count {
  display: inline-block; min-width: 20px; text-align: center;
  background: var(--brand); color: #fff; border-radius: 10px;
  font-size: 11px; padding: 1px 6px; margin-left: .3rem;
}
.rep-list { padding: .5rem; display: flex; flex-direction: column; gap: .5rem; }
.rep-empty { padding: 1.1rem .7rem; text-align: center; color: var(--text-mute); font-size: 12.5px; }

.rep-row {
  display: grid; grid-template-columns: 22px 1fr auto;
  gap: .5rem; align-items: start;
  background: #fff; border: 1px solid var(--border);
  border-radius: 6px; padding: .6rem .6rem .6rem .3rem;
}
.rep-row.flash-new { animation: repFlash 900ms ease; }
@keyframes repFlash {
  0%   { box-shadow: 0 0 0 3px rgba(10,122,138,.35); }
  100% { box-shadow: 0 0 0 0 rgba(10,122,138,0); }
}
.rep-grip { color: var(--text-mute); text-align: center; cursor: grab; user-select: none; font-size: 13px; line-height: 1.1; padding-top: 2px; }
.rep-body { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.rep-field { display: block; }
.rep-label {
  display: block; font-size: 11.5px; font-weight: 600;
  color: var(--text-light); margin-bottom: .2rem;
}
.rep-field input[type=text], .rep-field textarea, .rep-field select { width: 100%; font-size: 13px; }
.rep-ops { display: flex; flex-direction: column; gap: .25rem; }
.rep-btn {
  width: 26px; height: 26px; border: 1px solid var(--border);
  background: #fff; border-radius: 5px; cursor: pointer;
  color: var(--text-light); font-size: 12px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.rep-btn:hover { border-color: var(--brand); color: var(--brand); }
.rep-btn.del:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }
.rep-row.is-dragover { border-color: var(--brand); box-shadow: 0 -2px 0 var(--brand) inset; }

/* --- media drawer ------------------------------------------------------ */
.mp { position: fixed; inset: 0; z-index: 9000; }
.mp[hidden] { display: none; }
.mp-scrim { position: absolute; inset: 0; background: rgba(9,16,29,.55); }
.mp-panel {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(760px, 94vw);
  background: #fff; display: flex; flex-direction: column;
  box-shadow: -8px 0 30px rgba(0,0,0,.2); animation: mpIn .16s ease;
}
@keyframes mpIn { from { transform: translateX(22px); opacity: .4; } to { transform: none; opacity: 1; } }
.mp-head {
  display: flex; align-items: center; gap: .6rem;
  padding: .8rem 1rem; border-bottom: 1px solid var(--border);
}
.mp-head input[type=search] { flex: 1; }
.mp-grid {
  flex: 1; overflow: auto; padding: .8rem 1rem;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem;
  align-content: start;
}
.mp-cell {
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
  display: flex; flex-direction: column; text-decoration: none; color: inherit; background: #fff;
}
.mp-cell:hover { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-light); }
.mp-cell img { width: 100%; height: 92px; object-fit: cover; background: #eef1f5; }
.mp-cell span {
  font-size: 10.5px; padding: .3rem .4rem; color: var(--text-light);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mp-none { grid-column: 1 / -1; color: var(--text-mute); text-align: center; padding: 2.5rem 1rem; }
.mp-foot {
  display: flex; gap: .5rem; padding: .7rem 1rem;
  border-top: 1px solid var(--border); background: #fafbfc;
}
.mp-foot input { flex: 1; }

/* --- json escape hatch ------------------------------------------------- */
.jsonbox { margin-top: 1.4rem; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.jsonbox > summary {
  padding: .6rem .9rem; background: #f2f5f8; cursor: pointer;
  font-weight: 600; font-size: 13px; list-style: none; display: flex; align-items: center; gap: .5rem;
}
.jsonbox > summary::-webkit-details-marker { display: none; }
.jsonbox > summary::before { content: '▸'; color: var(--text-mute); transition: transform .15s; }
.jsonbox[open] > summary::before { transform: rotate(90deg); }
.jsonbox .jsonbody { padding: .8rem .9rem; border-top: 1px solid var(--border); background: #fbfcfd; }
.jsonbox textarea { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 12px; line-height: 1.55; }
.jsonbox .rowbtns { display: flex; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }

/* --- dirty state ------------------------------------------------------- */
body.sec-dirty .page-head-actions .btn-primary,
body.sec-dirty .savebar .btn-primary {
  box-shadow: 0 0 0 3px rgba(251,191,36,.45);
}
.dirtybar {
  position: sticky; bottom: 0; z-index: 50;
  background: #fff7e0; border-top: 2px solid var(--accent);
  padding: .5rem .9rem; font-size: 12.5px; color: #7a5300;
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
}
.dirtybar[hidden] { display: none; }
.dirtybar .grow { flex: 1; }

/* --- section list page: type badges ----------------------------------- */
.type-badge {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
  padding: .12em .5em; border-radius: 4px;
  background: #eef1f5; color: var(--text-light); white-space: nowrap;
}
.type-badge[data-t=card-grid]   { background: #e6f0ff; color: #0b4a9e; }
.type-badge[data-t=industry-strip]{ background: #e6f7f2; color: #07624a; }
.type-badge[data-t=caption-strip] { background: #f3e8ff; color: #5b21b6; }
.type-badge[data-t=cta]         { background: #fde8ef; color: #a01553; }
.type-badge[data-t=stat-strip]  { background: #fff2d6; color: #8a5a00; }
.type-badge[data-t=signpost]    { background: #fae0ee; color: #a01063; }
.type-badge[data-t=image-text]  { background: #e8f4ff; color: #0a5a8a; }
.type-badge[data-t=features]    { background: #e9f8e5; color: #1f6b28; }
.type-badge[data-t=faq]         { background: #f2f0e6; color: #6b5b1f; }
.type-badge[data-t=spec-table]  { background: #e6f4f1; color: #0a5a55; }
.type-badge[data-t=logos]       { background: #eeeaf6; color: #4a2f86; }
.type-badge[data-t=downloads]   { background: #fdeee0; color: #8a4b12; }
.type-badge[data-t=html]        { background: #eceef1; color: #444c56; }

/* --- validation problems ----------------------------------------------- */
.problems {
  background: var(--danger-bg); border: 1px solid #ffcecb;
  color: #a40e26; border-radius: 6px; padding: .7rem .9rem; margin-bottom: 1rem;
}
.problems ul { margin: .35rem 0 0; padding-left: 1.2rem; }
.problems li { font-size: 12.5px; line-height: 1.7; }

/* ==========================================================================
   admin_mobile.css -- appended to admin.css

   Narrow-screen support for the CMS admin.

   Measured at a 390px viewport against the live site: 6 of 7 admin pages
   overflowed horizontally (documentElement.scrollWidth 572..2188 against
   clientWidth 390). Three independent causes, all of them desktop-only CSS:

     1. body is `display:flex` with a fixed 240px sidebar, so .main was
        squeezed to 150px and .topbar-right -- a fixed 572px flex row of
        user chip + links + logout form -- forced the whole page wide. It
        was the top offender on 5 of the 6 pages.

     2. The hamburger has always toggled `body.sb-collapsed`, but no rule
        anywhere used that class, so the sidebar could not be dismissed
        at all on a phone.

     3. .card is `overflow:hidden` for its rounded corners, which CLIPS
        the wide .data-table instead of scrolling it. The row action
        buttons (edit / move up / move down / toggle / duplicate) exist in
        the DOM but are unreachable below ~880px. This is worse than a
        scrollbar: it is silently missing functionality.

   Also reflows .media-grid (was unstyled, so 99 cards laid out at a
   2188px intrinsic width), the tabs, the type cards and the media
   library form, and raises tap targets to a 40px minimum.

   Scoped to `body:not(.login)` because body.login is a centred flex box.
   ========================================================================== */

@media (max-width: 880px) {

  /* ---- 1. shell: sidebar becomes an off-canvas drawer ------------------ */
  body:not(.login) { display: block; }

  body:not(.login) .sidebar {
    position: fixed !important;
    top: 0; left: 0; bottom: 0;
    width: 78vw; max-width: 300px;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 0 0 44px rgba(0, 0, 0, .4);
  }

  body:not(.login).sb-collapsed .sidebar { transform: translateX(0); }

  /* CSS-generated scrim: no template change needed. admin.js clears
     sb-collapsed on any outside tap. */
  body:not(.login).sb-collapsed::after {
    content: '';
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(15, 23, 42, .5);
    z-index: 80;
  }

  body:not(.login) .main { width: 100%; }

  /* ---- 2. topbar: wrap instead of forcing 572px ------------------------ */
  body:not(.login) .topbar {
    height: auto;
    min-height: 56px;
    padding: 8px 14px;
    flex-wrap: wrap;
    gap: 8px 12px;
  }
  body:not(.login) .topbar-left  { min-width: 0; flex: 1 1 auto; }
  body:not(.login) .topbar-right { flex-wrap: wrap; gap: 10px; margin-left: auto; }

  /* The "admin" pill is redundant next to the Administrator label and was
     ~50px of the overflow. */
  body:not(.login) .user-chip .role { display: none; }
  body:not(.login) .user-chip { font-size: 12px; padding: 3px 10px 3px 3px; }
  body:not(.login) .user-chip .avatar { width: 24px; height: 24px; }

  body:not(.login) .breadcrumb {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ---- 3. touch targets ------------------------------------------------ */
  body:not(.login) .hamburger { width: 44px; height: 44px; font-size: 19px; }

  body:not(.login) .topbar a,
  body:not(.login) .topbar .btn-link,
  body:not(.login) .nav-link,
  body:not(.login) .sidebar-foot a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
  body:not(.login) .nav-link { padding: 10px 20px; }

  body:not(.login) .btn,
  body:not(.login) .btn-sm,
  body:not(.login) .btn-mini,
  body:not(.login) button,
  body:not(.login) input[type=submit] { min-height: 40px; }

  body:not(.login) input[type=text],
  body:not(.login) input[type=email],
  body:not(.login) input[type=number],
  body:not(.login) input[type=url],
  body:not(.login) input[type=password],
  body:not(.login) input[type=search],
  body:not(.login) select { min-height: 40px; max-width: 100%; }

  body:not(.login) textarea { min-height: 120px; max-width: 100%; }

  /* Long slugs and JSON must break rather than push the page wide. */
  body:not(.login) pre,
  body:not(.login) code,
  body:not(.login) .mono { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }

  body:not(.login) iframe { max-width: 100%; }

  /* ---- 4. content ------------------------------------------------------ */
  body:not(.login) .content { padding: 16px 14px 56px; }

  body:not(.login) .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
  body:not(.login) .page-head-actions { flex-wrap: wrap; }
  body:not(.login) .card-head { flex-wrap: wrap; }

  /* ---- 5. THE functional fix: scroll the table, don't clip it ---------- */
  body:not(.login) .card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* the section editor card must keep its sticky dirty bar, so it must not
     become a scroll container (a sticky element inside one sticks to that
     container, not the viewport) */
  body:not(.login) .card:has(.editor-layout) { overflow: visible; }

  body:not(.login) .data-table { width: max-content; min-width: 100%; }
  body:not(.login) .data-table th,
  body:not(.login) .data-table td { vertical-align: top; }
  body:not(.login) .data-table td.ops { white-space: nowrap; }
  body:not(.login) .data-table .ops .btn { margin: 0 4px 4px 0; }

  body:not(.login) .tabs {
    overflow-x: auto;
    white-space: nowrap;
    padding: 0 12px;
    -webkit-overflow-scrolling: touch;
  }

  /* two different filter bars exist -- .filters on the section/page lists and
     .filter-bar on cases -- each list page invents its own class */
  body:not(.login) :is(.filters, .filter-bar),
  body:not(.login) :is(.filters, .filter-bar) input,
  body:not(.login) :is(.filters, .filter-bar) select,
  body:not(.login) .upload-form,
  body:not(.login) .bar { flex-wrap: wrap; }

  body:not(.login) :is(.filters, .filter-bar) input,
  body:not(.login) :is(.filters, .filter-bar) select { flex: 1 1 140px; min-width: 0; }
  /* "Reset" is a bare <a class="link"> next to the filter button */
  body:not(.login) :is(.filters, .filter-bar) :is(a, button) {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
  }

  body:not(.login) .upload-form { display: grid; grid-template-columns: 1fr; gap: 10px; }
  body:not(.login) .upload-form label { display: block; margin: 0 0 8px; }
  body:not(.login) .upload-form input { width: 100%; }

  body:not(.login) .typecards { display: grid; grid-template-columns: 1fr; gap: 10px; }

  /* ---- 6. bare tables ---------------------------------------------------
     Several list pages put their table straight into .content, outside any
     .card, so the card scroll rule in section 5 never reached them and they
     kept pushing the document wide: dashboard 410px, pages 542px,
     inquiries 548px. They are three DIFFERENT classes -- table.t, table.data,
     table.data-table -- so match on `> table` rather than a class name.
     Scoped with :has() to those list pages only, and excluded when an editor
     layout is present, so the section editor keeps its sticky dirty bar (a
     sticky element inside a scroll container sticks to that container, not
     to the viewport). */
  body:not(.login) .content:not(:has(.editor-layout)):has(> table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  body:not(.login) .content > table { width: max-content; min-width: 100%; }
  body:not(.login) .content > table th,
  body:not(.login) .content > table td { vertical-align: top; }
  body:not(.login) .content > table td:last-child { white-space: nowrap; }

  /* links inside a table cell were 17-19px tall -- on a phone that is the
     only route to a page's row actions */
  body:not(.login) .content > table :is(a, button),
  body:not(.login) .card > table :is(a, button) {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
  }

  body:not(.login) .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  body:not(.login) .bar-actions { flex-wrap: wrap; }

  /* two different page-switcher widgets exist -- .tabs > .tab on the section
     list and .status-tabs > a.active on inquiries -- both 19px tall */
  body:not(.login) .tabs .tab,
  body:not(.login) .status-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
  body:not(.login) .status-tabs {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  /* 9.5px EN/中 tags and 10.5px type badges are unreadable on a phone */
  body:not(.login) :is(.bi-tag, .type-badge, .badge, .tag,
                        .fld-hint, .rep-label, .imgpick-none, .sechead-note) {
    font-size: 12px;
  }
  body:not(.login) .small { font-size: 13px; }

  /* ---- 7. media library ------------------------------------------------ */
  body:not(.login) .media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }
  body:not(.login) .media-card { min-width: 0; }
  body:not(.login) .media-card .thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #eef1f5;
    border-radius: 6px;
  }
  body:not(.login) .media-card .thumb img,
  body:not(.login) .media-card .thumb .file-ico {
    width: 100%; height: 100%; object-fit: cover; display: block;
  }
  body:not(.login) .media-card .meta { overflow-wrap: anywhere; }
  body:not(.login) .media-card .meta strong { display: block; }
  body:not(.login) .media-card form.inline { display: grid; grid-template-columns: 1fr; gap: 6px; }
  body:not(.login) .media-card form.inline input,
  body:not(.login) .media-card form.inline button { width: 100%; min-height: 40px; }

  /* ---- 8. section editor internals ------------------------------------ */
  body:not(.login) .sec-typebar { gap: .5rem; }
  body:not(.login) .sec-typebar select { min-width: 0; width: 100%; }

  body:not(.login) .form-row,
  body:not(.login) .form-row-grid { min-width: 0; }

  body:not(.login) .imgpick { flex-direction: column; align-items: stretch; }
  body:not(.login) .imgpick-prev { width: 100%; height: 150px; }
  body:not(.login) .imgpick-bar { flex-direction: column; align-items: stretch; }
  body:not(.login) .imgpick-bar input[type=text] { min-width: 0; width: 100%; }

  body:not(.login) .colorpick { flex-wrap: wrap; }
  body:not(.login) .colorpick input[type=text] { min-width: 120px; }

  /* the row's own buttons are an `auto` third column; give them their own
     full-width line instead of letting them crush the fields */
  body:not(.login) .rep-row { grid-template-columns: 22px 1fr; }
  body:not(.login) .rep-ops { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; }

  body:not(.login) .dirtybar { flex-wrap: wrap; row-gap: .4rem; }
  body:not(.login) .dirtybar .grow { flex: 1 1 100%; }
  body:not(.login) .form-actions { flex-wrap: wrap; }
}

/* ---- very small phones ------------------------------------------------ */
@media (max-width: 480px) {
  body:not(.login) .content { padding: 12px 10px 48px; }
  body:not(.login) .media-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  body:not(.login) .h1, body:not(.login) h1 { font-size: 1.35rem; }
  body:not(.login) .page-head-actions .btn,
  body:not(.login) .page-head-actions a { flex: 1 1 auto; justify-content: center; }
}

/* ---- login page -------------------------------------------------------- */
@media (max-width: 480px) {
  body.login { padding: 0; }
  .login-card { width: auto; max-width: 100%; margin: 0 12px; padding: 1.8rem 1.4rem 1.4rem; }
}
