:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #17202c;
  --muted: #667180;
  --line: #e2e7ec;
  --primary: #1769e0;
  --primary-soft: #eaf2fd;
  --success: #137a50;
  --warning: #9a5b00;
  --danger: #c63c3c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 0;
  color: var(--text);
  background: var(--bg);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { color: #98a2ae !important; background: #f1f3f5 !important; border-color: #d9dee4 !important; cursor: not-allowed; }
input:disabled, select:disabled, textarea:disabled { color: #46515e; background: #f4f6f8; cursor: default; }
[hidden] { display: none !important; }

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px;
  background: #eef2f6;
}

.login-panel {
  width: 400px;
  padding: 36px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(25, 38, 54, .08);
}

.brand-mark,
.sidebar-brand > span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: #fff;
  background: var(--primary);
  border-radius: 7px;
  font-size: 15px;
  font-weight: 750;
}

.login-panel h1 { margin: 20px 0 4px; font-size: 23px; }
.login-panel > p { margin: 0 0 28px; color: var(--muted); }
.security-note { margin: -14px 0 22px; padding: 10px 12px; color: #36516f; background: #edf5ff; border-left: 3px solid #1769e0; font-size: 12px; }
.login-panel label,
.editor-body > label,
.form-grid label { display: grid; gap: 7px; margin-bottom: 16px; color: #394554; font-weight: 600; }

input, select, textarea {
  width: 100%;
  color: var(--text);
  background: #fff;
  border: 1px solid #cfd6de;
  border-radius: 6px;
  outline: none;
}

input, select { height: 40px; padding: 0 12px; }
select[multiple] { height: auto; min-height: 132px; padding: 7px; }
textarea { resize: vertical; min-height: 74px; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(23, 105, 224, .1); }

.button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 650;
}

.button.primary { color: #fff; background: var(--primary); }
.button.primary:hover { background: #0f5bc8; }
.button.secondary { color: #344252; background: #fff; border-color: #cfd6de; }
.button.secondary:hover { border-color: #aeb8c4; background: #f8fafb; }
.login-panel .button { width: 100%; margin-top: 4px; }
.form-error { min-height: 22px; margin-top: 10px; color: var(--danger); font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 224px 1fr; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  color: #dce4ee;
  background: #202a36;
  border-right: 1px solid #17202a;
}

.sidebar-brand { height: 76px; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid #34404e; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { color: #fff; font-size: 15px; }
.sidebar-brand small { margin-top: 2px; color: #9eabb9; }
.sidebar-brand > span { width: 36px; height: 36px; }
.nav-list { overflow-y: auto; display: grid; gap: 2px; padding: 14px 12px 22px; }
.nav-group-label {
  margin: 14px 12px 4px;
  color: #718094;
  font-size: 11px;
  font-weight: 700;
}
.nav-group-label:first-child { margin-top: 2px; }
.nav-item {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  color: #bdc8d5;
  background: transparent;
  border: 0;
  border-radius: 6px;
  text-align: left;
}
.nav-item:hover { color: #fff; background: #2b3745; }
.nav-item.active { color: #fff; background: #1769e0; }
.nav-count { min-width: 22px; padding: 1px 6px; color: #273343; background: #fff; border-radius: 10px; font-size: 12px; text-align: center; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-top: 1px solid #34404e; color: #aeb9c6; }
.sidebar-foot button { color: #fff; background: transparent; border: 0; }

.workspace { min-width: 0; }
.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar h2 { margin: 0; font-size: 20px; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.sync-state { color: var(--muted); font-size: 13px; }
.sync-state.ready { color: var(--success); }
.environment-banner {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 30px;
  border-bottom: 1px solid;
}
.environment-banner.local { color: #6e4c0d; background: #fff7df; border-color: #ecd69b; }
.environment-banner.production { color: #1c6043; background: #edf8f3; border-color: #b9dfcc; }
.environment-banner strong, .environment-banner span { display: block; }
.environment-banner strong { font-size: 13px; }
.environment-banner span { margin-top: 1px; color: inherit; opacity: .82; font-size: 12px; }
.environment-banner .button { min-height: 34px; display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
.view-section { padding: 26px 30px 48px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  margin-bottom: 22px;
  background: #fff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat-item { min-height: 84px; padding: 15px 18px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat-item:nth-child(5n + 1) { border-left: 0; }
.stat-item:nth-last-child(-n + 5) { border-bottom: 0; }
.stat-item span { display: block; color: var(--muted); font-size: 13px; }
.stat-item strong { display: block; margin-top: 5px; font-size: 24px; line-height: 1.1; }

.release-readiness {
  min-height: 86px;
  padding: 16px 18px;
  display: grid;
  grid-template-columns: 210px minmax(320px, 1fr) 390px;
  align-items: center;
  gap: 24px;
  background: #fff8e8;
  border-top: 1px solid #efd697;
  border-bottom: 1px solid #efd697;
}

.release-readiness.ready {
  background: #edf8f3;
  border-color: #b9dfcc;
}

.release-readiness span,
.release-readiness strong {
  display: block;
}

.release-readiness span {
  color: var(--muted);
  font-size: 12px;
}

.release-readiness strong {
  margin-top: 4px;
  font-size: 18px;
}

.release-readiness p {
  margin: 0;
  color: #70551b;
  line-height: 1.6;
}

.release-readiness.ready p {
  color: #28674a;
}

.release-readiness dl {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-left: 1px solid rgba(91, 72, 30, .18);
}

.release-readiness dl div {
  padding-left: 18px;
}

.release-readiness dt {
  color: var(--muted);
  font-size: 12px;
}

.release-readiness dd {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 700;
}

.section-block { margin-top: 18px; background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-heading { min-height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--line); }
.section-heading h3 { margin: 0; font-size: 16px; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.text-button { color: var(--primary); background: transparent; border: 0; font-weight: 650; }

.toolbar { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.toolbar-group { display: flex; gap: 10px; }
.toolbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.toolbar-summary { color: var(--muted); font-size: 13px; }
.control { width: 150px; background: #fff; }
.search-control { width: 280px; }

.quality-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  margin-bottom: 18px;
  background: #fff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.quality-item {
  min-height: 78px;
  display: block;
  padding: 15px 17px;
  color: var(--text);
  background: #fff;
  border: 0;
  border-left: 1px solid var(--line);
  text-align: left;
}

.quality-item:first-child { border-left: 0; }
.quality-item:not(:disabled):hover { background: #f6f9fd; }
.quality-item.active { box-shadow: inset 0 -3px 0 var(--primary); background: var(--primary-soft); }
.quality-item:disabled { cursor: default; }
.quality-strip span, .quality-strip strong { display: block; }
.quality-strip span { color: var(--muted); font-size: 12px; }
.quality-strip strong { margin-top: 4px; font-size: 21px; }

.content-table { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.listing-table { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.listing-admin-head, .listing-admin-row { min-width: 856px; display: grid; grid-template-columns: minmax(250px, 1.5fr) minmax(110px, .7fr) 90px 72px 96px 164px; align-items: center; column-gap: 10px; padding: 0 12px; }
.listing-admin-head { min-height: 44px; color: var(--muted); background: #f7f9fb; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 650; }
.listing-admin-row { min-height: 78px; border-bottom: 1px solid var(--line); }
.listing-admin-row:last-child { border-bottom: 0; }
.listing-admin-head > *, .listing-admin-row > * { min-width: 0; }
.listing-admin-row > span small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.status.active { color: var(--success); background: #e8f5ef; }
.status.inactive, .status.sold { color: var(--muted); background: #edf0f3; }
.status.account-active { color: var(--success); background: #e8f5ef; }
.status.account-suspended { color: var(--danger); background: #fbecec; }
.table-head, .content-row { display: grid; grid-template-columns: minmax(210px, 1.6fr) 56px minmax(110px, .8fr) 86px 92px 116px; align-items: center; column-gap: 10px; padding: 0 12px; }
.table-head { min-height: 44px; color: var(--muted); background: #f7f9fb; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 650; }
.content-row { min-height: 74px; border-bottom: 1px solid var(--line); }
.content-row:last-child { border-bottom: 0; }
.content-title strong, .content-title small { display: block; }
.content-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.content-title small { margin-top: 4px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content-title small.content-warning { color: var(--danger); font-size: 11px; }
.placement-copy { color: #4b5968; font-size: 12px; }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.row-actions button { min-height: 30px; padding: 0 10px; color: #344252; background: #fff; border: 1px solid #cfd6de; border-radius: 5px; }
.row-actions button.primary-link { color: var(--primary); border-color: #bdd2f2; }
.row-actions button.danger-link { color: var(--danger); border-color: #edc5c5; }

.status { display: inline-flex; width: fit-content; padding: 3px 8px; border-radius: 4px; font-size: 12px; font-weight: 650; }
.status.scheduled { color: #1769e0; background: #eaf2fd; }
.status.expired { color: #667180; background: #edf0f3; }
.status.published { color: var(--success); background: #e8f5ef; }
.status.draft { color: var(--warning); background: #fff3dc; }
.status.archived { color: #687381; background: #edf0f3; }
.status.verification-verified { color: var(--success); background: #e8f5ef; }
.status.verification-announced { color: #755600; background: #fff3cf; }
.status.verification-partial,
.status.verification-draft { color: var(--warning); background: #fff3dc; }

.catalog-table,
.run-table {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.catalog-head,
.catalog-row {
  display: grid;
  grid-template-columns: minmax(250px, 1.5fr) minmax(145px, .8fr) 115px 60px 105px 64px;
  align-items: center;
  column-gap: 10px;
  padding: 0 12px;
}

.catalog-head,
.run-head {
  min-height: 44px;
  color: var(--muted);
  background: #f7f9fb;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 650;
}

.catalog-row {
  min-height: 76px;
  border-bottom: 1px solid var(--line);
}

.catalog-row:last-child,
.run-row:last-child { border-bottom: 0; }

.lab-notice {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  color: #36516f;
  background: #edf5ff;
  border-top: 1px solid #c9dcf7;
  border-bottom: 1px solid #c9dcf7;
}

.lab-notice strong { flex: 0 0 auto; }
.lab-notice span { color: #536b84; }
.surface-row { background: #fff; border: 1px solid var(--line); }
.http-probe { min-height: 78px; display: grid; grid-template-columns: minmax(280px, 1fr) minmax(240px, .8fr) auto; align-items: center; gap: 18px; margin-top: 16px; padding: 14px 18px; }
.http-probe strong, .http-probe span { display: block; }
.http-probe span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.http-probe-result { color: #405064; font-variant-numeric: tabular-nums; }

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.preset-item {
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.preset-item > div strong,
.preset-item > div span { display: block; }
.preset-item > div strong { font-size: 16px; }
.preset-item > div span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.preset-item dl { display: grid; grid-template-columns: 1fr 1fr; margin: 16px 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.preset-item dl div { padding: 8px 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.preset-item dt { color: var(--muted); font-size: 11px; }
.preset-item dd { margin: 2px 0 0; font-weight: 700; }
.preset-item .button { width: 100%; }

.run-head,
.run-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) 120px 100px 120px minmax(220px, 1.2fr) 120px;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 0 16px;
}

.run-row { border-bottom: 1px solid var(--line); }
.run-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }

.review-list { background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.review-item { display: grid; grid-template-columns: 110px minmax(340px, 1fr) 150px 190px; align-items: center; gap: 16px; min-height: 82px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.review-item:last-child { border-bottom: 0; }
.review-type { color: #3e4a58; font-weight: 650; }
.review-copy strong, .review-copy small { display: block; }
.review-copy small { margin-top: 4px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-meta { color: var(--muted); font-size: 13px; }

.user-table,
.audit-table { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.user-head,
.user-row { min-width: 780px; display: grid; grid-template-columns: minmax(170px, 1.15fr) 118px minmax(160px, .95fr) 120px 70px 88px; align-items: center; gap: 10px; padding: 0 12px; }
.user-head,
.audit-head { min-height: 44px; color: var(--muted); background: #f7f9fb; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 650; }
.user-row { min-height: 80px; border-bottom: 1px solid var(--line); }
.user-row:last-child,
.audit-row:last-child { border-bottom: 0; }
.user-row > span small,
.audit-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.audit-head,
.audit-row { min-width: 820px; display: grid; grid-template-columns: 108px minmax(135px, .8fr) 115px minmax(165px, 1fr) 82px 116px; align-items: center; gap: 10px; padding: 0 12px; }
.audit-row { min-height: 70px; border-bottom: 1px solid var(--line); }
.audit-note { overflow: hidden; color: #4b5664; text-overflow: ellipsis; white-space: nowrap; }

.backup-status-strip {
  min-height: 86px;
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
  align-items: stretch;
  margin-bottom: 14px;
  background: #fff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.backup-status-strip > div { padding: 17px 18px; border-right: 1px solid var(--line); }
.backup-status-strip span,
.backup-status-strip strong { display: block; }
.backup-status-strip span { color: var(--muted); font-size: 12px; }
.backup-status-strip strong { margin-top: 5px; font-size: 17px; }
.backup-status-strip .button { align-self: center; margin: 0 18px; white-space: nowrap; }
.backup-notice { min-height: 60px; display: flex; align-items: center; gap: 18px; padding: 0 18px; color: #36516f; background: #edf5ff; border-top: 1px solid #c9dcf7; border-bottom: 1px solid #c9dcf7; }
.backup-notice strong { flex: 0 0 auto; }
.backup-notice span { color: #536b84; }
.backup-toolbar { min-height: 54px; margin: 0; }
.backup-table { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.backup-head,
.backup-row { min-width: 860px; display: grid; grid-template-columns: 150px 118px minmax(240px, 1.2fr) 130px 92px 76px; align-items: center; gap: 12px; padding: 0 14px; }
.backup-head { min-height: 44px; color: var(--muted); background: #f7f9fb; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 650; }
.backup-row { min-height: 76px; border-bottom: 1px solid var(--line); }
.backup-row:last-child { border-bottom: 0; }
.backup-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.status.backup-valid { color: var(--success); background: #e8f5ef; }
.status.backup-invalid { color: var(--danger); background: #fbecec; }
.danger-text { color: var(--danger) !important; }

.segmented { display: flex; padding: 3px; background: #e9edf2; border-radius: 6px; }
.segmented button { min-height: 34px; padding: 0 14px; color: #4b5664; background: transparent; border: 0; border-radius: 5px; }
.segmented button.active { color: var(--text); background: #fff; box-shadow: 0 1px 3px rgba(32, 44, 58, .1); font-weight: 650; }
.empty-row { padding: 40px 18px; color: var(--muted); text-align: center; }

.pager {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}
.pager-actions { display: flex; align-items: center; gap: 8px; }
.pager-actions label { display: flex; align-items: center; gap: 7px; }
.pager-actions select { width: 72px; height: 34px; padding: 0 8px; }
.pager-actions button {
  min-width: 68px;
  height: 34px;
  color: #344252;
  background: #fff;
  border: 1px solid #cfd6de;
  border-radius: 5px;
}
.pager-actions button:disabled { color: #a6afb9; background: #f3f5f7; cursor: default; }
.pager-actions strong { min-width: 56px; color: #4b5664; text-align: center; }

.editor-dialog { width: min(820px, calc(100vw - 80px)); max-height: calc(100vh - 60px); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 24px 64px rgba(24, 35, 48, .22); }
.editor-dialog.compact-dialog { width: min(560px, calc(100vw - 80px)); }
.editor-dialog::backdrop { background: rgba(20, 28, 38, .46); }
.editor-dialog form { display: flex; max-height: calc(100vh - 60px); flex-direction: column; }
.editor-dialog header, .editor-dialog footer { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; background: #fff; border-bottom: 1px solid var(--line); }
.editor-dialog footer { justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); border-bottom: 0; }
.editor-dialog footer .footer-error { min-height: 0; max-width: 460px; margin: 0 auto 0 0; line-height: 1.4; }
.editor-dialog h3 { margin: 0; font-size: 18px; }
.editor-dialog header p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.close-button { width: 34px; height: 34px; color: #657180; background: transparent; border: 0; font-size: 26px; line-height: 1; }
.editor-body { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 22px 22px 36px; }
.form-section { padding: 0; margin: 0 0 22px; border: 0; border-bottom: 1px solid var(--line); }
.form-section:last-of-type { margin-bottom: 0; border-bottom: 0; }
.form-section > label,
.model-picker label,
.source-picker label { display: grid; gap: 7px; margin-bottom: 16px; color: #394554; font-weight: 600; }
.form-section-heading { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.form-section-heading strong { font-size: 15px; }
.form-section-heading span { color: var(--muted); font-size: 12px; }
.model-picker,
.source-picker { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.model-picker .button,
.source-picker .button { margin-bottom: 16px; white-space: nowrap; }
.field-help { color: var(--muted); font-size: 12px; font-weight: 400; }
.field-help.warning { color: var(--warning); }
.field-state { margin: -9px 0 16px; color: var(--muted); font-size: 12px; }
.field-state.valid { color: var(--success); }
.field-state.warning { color: var(--warning); }
.placement-hint { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: -2px; padding: 0 12px; color: #36516f; background: #edf5ff; border-left: 3px solid var(--primary); }
.placement-hint strong, .placement-hint span { font-size: 12px; }
.placement-hint span { font-weight: 650; }
.placement-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 2px 0 18px; padding: 14px; border: 1px solid var(--line); }
.placement-controls legend { padding: 0 6px; color: #394554; font-size: 13px; font-weight: 700; }
.placement-controls .check-label { margin: 0; align-self: center; }
.content-live-preview { margin-top: 18px; padding: 14px; background: #f5f7f9; border: 1px solid var(--line); }
.preview-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.preview-heading strong { font-size: 13px; }
.preview-heading span { color: var(--muted); font-size: 12px; }
.preview-phone-card { min-height: 142px; display: grid; grid-template-columns: 170px minmax(0, 1fr); overflow: hidden; background: #fff; border: 1px solid #dfe4e9; border-radius: 7px; }
.preview-phone-card > img { width: 170px; height: 142px; object-fit: cover; background: #eef1f4; }
.preview-phone-card > div { min-width: 0; padding: 14px; }
.preview-phone-card span { display: inline-flex; padding: 2px 7px; color: var(--primary); background: var(--primary-soft); border-radius: 4px; font-size: 11px; font-weight: 700; }
.preview-phone-card strong { display: block; margin-top: 9px; overflow: hidden; color: #1a2028; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.preview-phone-card p { display: -webkit-box; margin: 7px 0 0; overflow: hidden; color: #687382; font-size: 12px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.preview-phone-card small { display: block; margin-top: 8px; color: #8a94a1; font-size: 11px; }
.moderation-impact { margin-bottom: 18px; padding: 12px 14px; color: #5c4a23; background: #fff8e8; border-left: 3px solid #d6a642; line-height: 1.65; }
.danger-button { color: #fff !important; background: var(--danger) !important; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.check-label { min-height: 40px; display: flex !important; grid-template-columns: 18px 1fr; align-items: center; align-self: end; }
.check-label input { width: 16px; height: 16px; }
.cover-field { display: grid; grid-template-columns: 1fr 190px; align-items: center; gap: 18px; min-height: 92px; margin: 4px 0 18px; padding: 14px; background: #f7f9fb; border: 1px solid var(--line); border-radius: 6px; }
.cover-field span, .cover-field small { display: block; }
.cover-field span { font-weight: 650; }
.cover-field small { margin-top: 4px; color: var(--muted); }
.cover-field img { grid-column: 1 / -1; width: 180px; height: 90px; object-fit: cover; border-radius: 5px; border: 1px solid var(--line); }

.import-dialog { width: min(920px, calc(100vw - 80px)); }
.import-step {
  min-height: 72px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.step-index {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 50%;
  font-weight: 750;
}
.import-step strong, .import-step p { display: block; margin: 0; }
.import-step p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.file-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  color: #344252;
  background: #fff;
  border: 1px solid #cfd6de;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 650;
}
.file-button input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.import-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 18px;
  background: #f7f9fb;
  border: 1px solid var(--line);
}
.import-summary > div { padding: 12px 14px; border-left: 1px solid var(--line); }
.import-summary > div:first-child { border-left: 0; }
.import-summary span, .import-summary strong { display: block; }
.import-summary span { color: var(--muted); font-size: 12px; }
.import-summary strong { margin-top: 2px; font-size: 20px; }
.import-summary .success strong { color: var(--success); }
.import-summary .danger strong { color: var(--danger); }
.import-preview { max-height: 320px; overflow: auto; margin-top: 12px; border: 1px solid var(--line); }
.import-preview:empty { display: none; }
.import-preview-row {
  min-height: 62px;
  display: grid;
  grid-template-columns: 72px minmax(220px, 1fr) 76px minmax(190px, .8fr);
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}
.import-preview-row:last-child { border-bottom: 0; }
.import-preview-row > span, .import-preview-row p { color: var(--muted); font-size: 12px; }
.import-preview-row strong, .import-preview-row small { display: block; }
.import-preview-row small { margin-top: 2px; color: var(--muted); }
.import-preview-row p { margin: 0; }
.import-status { width: fit-content; padding: 3px 7px; border-radius: 4px; font-size: 12px; font-style: normal; font-weight: 650; }
.import-status.ready { color: var(--success); background: #e8f5ef; }
.import-status.duplicate { color: var(--warning); background: #fff3dc; }
.import-status.invalid { color: var(--danger); background: #fbecec; }
.import-more { padding: 12px; color: var(--muted); background: #f7f9fb; text-align: center; font-size: 12px; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; min-width: 220px; max-width: 420px; padding: 12px 16px; color: #fff; background: #253140; border-radius: 6px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 196px minmax(0, 1fr); }
  .topbar, .environment-banner { padding-right: 22px; padding-left: 22px; }
  .view-section { padding: 22px 22px 44px; }
  .stat-grid { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
  .stat-item:nth-child(5n + 1) { border-left: 1px solid var(--line); }
  .stat-item:nth-child(3n + 1) { border-left: 0; }
  .release-readiness { grid-template-columns: 180px minmax(260px, 1fr); }
  .release-readiness dl { grid-column: 1 / -1; border-top: 1px solid rgba(91, 72, 30, .18); border-left: 0; padding-top: 12px; }
  .quality-strip { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
  .quality-item:nth-child(4) { border-left: 0; border-top: 1px solid var(--line); }
  .quality-item:nth-child(n + 5) { border-top: 1px solid var(--line); }
  .preset-grid { grid-template-columns: repeat(2, minmax(250px, 1fr)); }
  .backup-status-strip { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
  .backup-status-strip .button { justify-self: start; margin: 14px 18px; }
}

@media (max-width: 980px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; }
  .sidebar-brand { height: 62px; }
  .nav-list { display: flex; gap: 6px; overflow-x: auto; padding: 9px 12px; }
  .nav-group-label { display: none; }
  .nav-item { min-width: 104px; flex: 0 0 auto; justify-content: center; gap: 8px; padding: 0 14px; }
  .sidebar-foot { margin: 0; padding: 10px 20px; }
  .topbar { position: sticky; top: 0; z-index: 4; }
  .release-readiness { grid-template-columns: minmax(150px, .6fr) minmax(260px, 1.4fr); }
  .content-table { overflow-x: auto; }
  .table-head, .content-row { min-width: 760px; }
  .catalog-head, .catalog-row { min-width: 780px; }
  .http-probe { grid-template-columns: 1fr auto; }
  .http-probe-result { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 680px) {
  .login-view { padding: 20px; }
  .login-panel { width: 100%; padding: 26px 22px; }
  .topbar { min-height: 76px; height: auto; flex-wrap: wrap; gap: 10px; padding-top: 12px; padding-bottom: 12px; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .environment-banner { align-items: flex-start; flex-direction: column; padding-top: 12px; padding-bottom: 12px; }
  .view-section { padding: 18px 14px 38px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-item:nth-child(3n + 1) { border-left: 1px solid var(--line); }
  .stat-item:nth-child(2n + 1) { border-left: 0; }
  .release-readiness { grid-template-columns: 1fr; gap: 12px; }
  .release-readiness dl { grid-column: auto; grid-template-columns: 1fr; gap: 10px; }
  .release-readiness dl div { padding-left: 0; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-group, .toolbar-actions { flex-wrap: wrap; justify-content: flex-start; }
  .control, .search-control { width: 100%; }
  .quality-strip, .backup-status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preset-grid { grid-template-columns: 1fr; }
  .editor-dialog, .editor-dialog.compact-dialog, .import-dialog { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
  .editor-dialog form { max-height: calc(100vh - 20px); }
  .editor-dialog header, .editor-dialog footer { padding: 14px; }
  .editor-dialog footer { flex-wrap: wrap; }
  .editor-dialog footer .footer-error { width: 100%; max-width: none; }
  .editor-body { padding: 16px 14px 30px; }
  .form-grid, .placement-controls, .model-picker, .source-picker, .cover-field { grid-template-columns: 1fr; }
  .model-picker .button, .source-picker .button { margin: -8px 0 16px; }
  .preview-phone-card { grid-template-columns: 116px minmax(0, 1fr); }
  .preview-phone-card > img { width: 116px; height: 142px; }
  .import-summary { grid-template-columns: repeat(2, 1fr); }
  .import-preview-row { min-width: 680px; }
  .http-probe { grid-template-columns: 1fr; }
  .http-probe-result { grid-column: auto; grid-row: auto; }
}
