/* Overseas Marketing Hub — mature content-workspace layer.
   Kept separate from legacy styles so behavior-specific selectors remain intact. */
:root {
  --bg: #f7f7f5;
  --canvas: #f7f7f5;
  --surface: #ffffff;
  --sidebar: #f7f7f5;
  --surface-subtle: #f1f1ef;
  --surface-hover: #ececea;
  --text: #1f1f1d;
  --ink: #1f1f1d;
  --text-muted: #5f5e5a;
  --ink-secondary: #5f5e5a;
  --text-light: #8b8a86;
  --ink-muted: #8b8a86;
  --border: #e4e4e1;
  --border-light: #ecece9;
  --hairline: #e4e4e1;
  --hairline-strong: #d4d4d0;
  --accent: #496f95;
  --accent-hover: #3c5f80;
  --accent-light: #eaf0f5;
  --brand-navy: #1d3043;
  --brand-blue: #6684a3;
  --green: #16835f;
  --green-bg: #e9f7f1;
  --orange: #a15c12;
  --orange-bg: #fff4e5;
  --red: #c9362b;
  --red-bg: #fff0ee;
  --purple: #6658c8;
  --purple-bg: #f0effd;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(24,24,22,.04);
  --shadow-lg: 0 12px 32px rgba(24,24,22,.12), 0 2px 8px rgba(24,24,22,.06);
  --font: 'Inter','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
}

[data-theme="dark"] {
  --bg: #171716;
  --canvas: #171716;
  --surface: #222220;
  --sidebar: #1b1b1a;
  --surface-subtle: #2b2b29;
  --surface-hover: #333330;
  --text: #efefec;
  --ink: #efefec;
  --text-muted: #b1b0aa;
  --ink-secondary: #b1b0aa;
  --text-light: #7d7c76;
  --ink-muted: #7d7c76;
  --border: #363633;
  --border-light: #2d2d2a;
  --hairline: #363633;
  --hairline-strong: #484843;
  --accent: #668db3;
  --accent-hover: #769cc0;
  --accent-light: #26394a;
  --brand-navy: #dce8f2;
  --brand-blue: #86a8c8;
}

html { background: var(--canvas); }
body {
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -.005em;
}

button, input, textarea, select { font: inherit; }
button, .nav-item, .tab, .version-tab, .kanban-card { -webkit-tap-highlight-color: transparent; }

/* App shell */
#app { min-height: 100vh; }
.sidebar {
  width: 232px;
  background: var(--sidebar);
  border-right-color: var(--hairline);
  z-index: 120;
}
.brand {
  min-height: 58px;
  padding: 13px 14px 9px;
  gap: 10px;
}
.brand-mark { overflow: hidden; flex: 0 0 auto; border: 1px solid color-mix(in srgb, var(--brand-blue) 24%, var(--hairline)); background: #faf7f0; }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: cover; transform: scale(1.78); }
.brand-mark-app { width: 30px; height: 30px; border-radius: 8px; }
.brand-title { font-size: 13px; font-weight: 650; line-height: 18px; }
.brand-sub { font-size: 10.5px; line-height: 14px; color: var(--ink-muted); }
.nav { padding: 8px 10px 16px; }
.nav-group { margin: 10px 0 16px; }
.nav-group:first-child { margin-top: 2px; }
.nav-group-label {
  padding: 0 9px 6px;
  color: var(--ink-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.nav-item {
  position: relative;
  min-height: 34px;
  margin: 1px 0;
  padding: 6px 9px;
  gap: 9px;
  border-radius: 6px;
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 450;
  transition: background-color .14s ease, color .14s ease;
}
.nav-item:hover { background: var(--surface-hover); color: var(--ink); }
.nav-item.active { background: var(--surface-subtle); color: var(--ink); font-weight: 550; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 1px;
  width: 2px;
  height: 16px;
  border-radius: 2px;
  background: var(--accent);
}
.nav-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  color: var(--ink-muted);
  font-size: 0;
}
.nav-icon svg { width: 16px; height: 16px; stroke-width: 1.7; }
.nav-item.active .nav-icon { color: var(--accent); }
.sidebar-footer {
  min-height: 62px;
  padding: 8px 10px;
  border-top-color: var(--hairline);
  display: block;
}
.sidebar-account-wrap { position: relative; width: 100%; }
.sidebar-account {
  width: 100%;
  min-height: 44px;
  padding: 5px 7px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 7px;
  text-align: left;
  cursor: pointer;
  transition: background-color .14s ease;
}
.sidebar-account:hover,
.sidebar-account[aria-expanded="true"] { background: var(--surface-hover); }
.sidebar-account:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
.account-avatar { width: 30px; height: 30px; border-radius: 8px; }
.account-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.account-copy strong { overflow: hidden; color: var(--ink); font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.account-copy small { margin-top: 2px; color: var(--ink-muted); font-size: 10.5px; }
.account-more { padding: 0 3px 4px; color: var(--ink-muted); font-size: 15px; letter-spacing: 1px; }
.account-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 7px);
  z-index: 260;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 9px;
  box-shadow: var(--shadow-lg);
}
.account-menu[hidden] { display: none; }
.account-menu button {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-secondary);
  background: transparent;
  border: 0;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
}
.account-menu button:hover,
.account-menu button:focus-visible { color: var(--ink); background: var(--surface-hover); outline: none; }
.account-menu button > span:first-child { width: 16px; color: var(--ink-muted); text-align: center; }
.account-menu-separator { height: 1px; margin: 4px 6px; background: var(--hairline); }
.account-menu .account-menu-danger:hover { color: var(--red); }

.main { margin-left: 232px; min-height: 100vh; background: var(--canvas); }
.workspace-topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  height: 52px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--canvas) 92%, transparent);
  backdrop-filter: blur(10px);
}
.workspace-context { display: flex; align-items: center; gap: 8px; color: var(--ink-secondary); font-size: 12px; font-weight: 500; }
.workspace-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.workspace-command {
  margin-left: auto;
  width: 220px;
  height: 30px;
  padding: 0 8px 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-muted);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--surface);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
.workspace-command:hover,
.workspace-command:focus-visible { color: var(--ink-secondary); border-color: var(--line-strong); background: var(--surface-hover); outline: none; }
.workspace-command kbd { padding: 1px 5px; border: 1px solid var(--hairline); border-radius: 4px; background: var(--surface-subtle); font: inherit; font-size: 10px; }

.inspiration-search-row { margin-bottom: 14px; }
.inspiration-search { width: min(680px, 100%); display: flex; align-items: center; gap: 8px; }
.inspiration-search > span { margin-right: -34px; position: relative; z-index: 1; color: var(--ink-muted); font-size: 18px; pointer-events: none; }
.inspiration-search .input { min-width: 0; flex: 1; padding-left: 34px; }
.discovery-panel { margin: 0 0 22px; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); background: color-mix(in srgb,var(--surface) 70%,transparent); }
.discovery-head { padding: 16px 4px; display: flex; align-items: center; gap: 18px; }
.discovery-head > div:first-child { min-width: 0; flex: 1; }
.discovery-head strong { font-size: 14px; color: var(--ink); }
.discovery-head p { margin: 4px 0 0; color: var(--ink-muted); font-size: 12px; }
.discovery-actions { display: flex; align-items: center; gap: 8px; }
.discovery-context { width: 150px; height: 32px; font-size: 12px; }
.discovery-hint,
.discovery-loading,
.discovery-error,
.discovery-notice { margin: 0 4px 14px; padding: 10px 12px; border-radius: 7px; color: var(--ink-secondary); background: var(--surface-subtle); font-size: 12px; }
.discovery-error { color: var(--red); background: var(--red-bg); }
.discovery-notice { color: var(--green); background: var(--green-bg); }
.discovery-list { border-top: 1px solid var(--hairline); }
.discovery-item { padding: 14px 4px; display: grid; grid-template-columns: 24px minmax(0,1fr) auto; gap: 10px; border-bottom: 1px solid var(--hairline); }
.discovery-item:last-child { border-bottom: 0; }
.discovery-item.is-existing { opacity: .72; }
.discovery-select { padding-top: 2px; }
.discovery-select input { width: 16px; height: 16px; accent-color: var(--accent); }
.discovery-done { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-bg); font-size: 11px; font-weight: 700; }
.discovery-title { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 7px; font-size: 14px; font-weight: 650; line-height: 1.45; }
.discovery-title a { color: var(--ink); text-decoration: none; }
.discovery-title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.discovery-copy p { margin: 7px 0 5px; color: var(--ink-secondary); font-size: 12px; line-height: 1.55; }
.discovery-copy small { color: var(--ink-muted); font-size: 11px; }
.discovery-footer { padding: 12px 4px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--hairline); color: var(--ink-muted); font-size: 12px; }
.workspace-avatar { width: 28px; height: 28px; flex: 0 0 auto; overflow: hidden; border: 1px solid color-mix(in srgb, var(--brand-blue) 24%, var(--hairline)); border-radius: 50%; background: #faf7f0; }
.workspace-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; transform: scale(1.78); }
#content { min-height: calc(100vh - 52px); }
.page { max-width: 1320px; margin: 0 auto; padding: 38px 48px 64px; }
.page.page-wide { max-width: 1480px; }
.page-header { margin-bottom: 28px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-heading { min-width: 0; }
.page-eyebrow { margin-bottom: 5px; color: var(--accent); font-size: 10px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.brand-eyebrow { display: flex; align-items: center; gap: 6px; }
.brand-signal { width: 5px; height: 5px; flex: 0 0 auto; border-radius: 50%; background: var(--brand-blue); box-shadow: 0 0 0 3px var(--accent-light); }
.page-title { color: var(--ink); font-size: 28px; font-weight: 650; line-height: 36px; letter-spacing: -.6px; }
.page-desc { max-width: 640px; margin-top: 4px; color: var(--ink-secondary); font-size: 13px; line-height: 20px; }
.page-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }

/* Controls */
.toolbar { gap: 8px; margin-bottom: 18px; }
.btn {
  min-height: 34px;
  padding: 6px 11px;
  gap: 6px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 1px rgba(24,24,22,.02);
  font-size: 13px;
  font-weight: 520;
  line-height: 18px;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease, transform .08s ease;
}
.btn:hover { background: var(--surface-hover); border-color: var(--hairline-strong); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .nav-item:focus-visible, .tab:focus-visible, .version-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn:disabled { opacity: .45; transform: none; }
.btn-primary { color: #fff; background: var(--accent); border-color: var(--accent); box-shadow: none; }
.btn-primary:hover { color: #fff; background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-sm { min-height: 30px; padding: 4px 9px; font-size: 12px; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-secondary); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--ink); }
.btn-green { color: #fff; background: var(--green); border-color: var(--green); }
.btn-danger { color: var(--danger); background: transparent; border-color: transparent; box-shadow: none; }
.btn-danger:hover { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-soft); }

.input, .textarea, select, .tag-select, .score-input input {
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px transparent;
  font-size: 13px;
  transition: border-color .14s ease, box-shadow .14s ease, background-color .14s ease;
}
.input:hover, .textarea:hover, select:hover, .tag-select:hover { border-color: var(--hairline-strong); }
.input:focus, .textarea:focus, select:focus, .tag-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.textarea { line-height: 1.65; }
.field { margin-bottom: 18px; }
.field-label { margin-bottom: 7px; color: var(--ink-secondary); font-size: 12px; font-weight: 550; }
.field-help { margin-top: 6px; color: var(--ink-muted); font-size: 11px; line-height: 17px; }
.search-box { max-width: 360px; }

.tabs {
  min-height: 38px;
  gap: 18px;
  margin-bottom: 20px;
  align-items: center;
  border-bottom-color: var(--hairline);
}
.tab { padding: 9px 1px 8px; border-bottom-width: 1.5px; color: var(--ink-muted); font-size: 12.5px; font-weight: 500; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: var(--surface-subtle);
}
.segmented .tab { min-height: 28px; padding: 5px 10px; border: 0; border-radius: 6px; }
.segmented .tab.active { background: var(--surface); box-shadow: 0 1px 2px rgba(24,24,22,.08); }

/* Content surfaces */
.card {
  padding: 22px;
  margin-bottom: 20px;
  border-color: var(--hairline);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: none;
}
.card:hover { box-shadow: none; }
.card-title { margin-bottom: 8px; color: var(--ink); font-size: 15px; font-weight: 600; letter-spacing: -.1px; }
.card-meta { margin-bottom: 8px; color: var(--ink-muted); font-size: 11.5px; line-height: 18px; }
.card-summary { max-width: 78ch; margin-bottom: 12px; color: var(--ink-secondary); font-size: 13.5px; line-height: 22px; }
.card-section { margin-top: 16px; padding-top: 14px; border-top-color: var(--border-light); }
.card-section-label, .section-label { margin-bottom: 8px; color: var(--ink-muted); font-size: 10px; font-weight: 650; letter-spacing: .06em; }
.analysis-box { padding: 14px 16px; border: 0; border-radius: 8px; background: var(--surface-subtle); }
.analysis-row { gap: 16px; margin-bottom: 6px; font-size: 12.5px; }
.analysis-label { min-width: 84px; color: var(--ink-muted); }
.analysis-val { line-height: 20px; }

.badge { min-height: 20px; padding: 2px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 550; line-height: 16px; }
.badge-gray { color: var(--ink-secondary); background: var(--surface-subtle); }
.badge-blue { color: #4338ca; background: #efefff; }
.badge-green { color: var(--green); background: var(--green-bg); }
.badge-orange { color: var(--orange); background: var(--orange-bg); }
.badge-purple { color: #6254b8; background: #f0effd; }
.badge-red { color: var(--danger); background: var(--danger-soft); }

.empty { padding: 56px 24px; color: var(--ink-muted); }
.empty-icon { width: 38px; height: 38px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-subtle); font-size: 16px; opacity: 1; }
.empty-text { color: var(--ink-secondary); font-size: 13px; }
.empty-brandmark { width: 38px; height: 38px; margin: 0 auto 12px; border-radius: 10px; }
.empty-title { margin-bottom: 4px; color: var(--ink); font-size: 14px; font-weight: 600; }
.loading { min-height: 180px; padding: 48px; color: var(--ink-muted); }
.loading::before { content: ""; width: 220px; height: 68px; border-radius: 8px; background: linear-gradient(90deg,var(--surface-subtle),var(--surface),var(--surface-subtle)); background-size: 240% 100%; animation: skeleton 1.3s ease infinite; }
.loading .spinner { display: none; }
@keyframes skeleton { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.spinner { width: 14px; height: 14px; border-width: 1.5px; }
.alert-card { padding: 11px 13px; border-color: #f0dfc9; border-radius: 8px; background: var(--warning-soft); }

/* Dashboard */
.dashboard-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.dashboard-hero-copy { max-width: 680px; }
.dashboard-kicker { margin-bottom: 8px; color: var(--accent); font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.dashboard-title { margin: 0; font-size: 32px; font-weight: 650; line-height: 40px; letter-spacing: -1px; }
.dashboard-subtitle { margin-top: 8px; color: var(--ink-secondary); font-size: 14px; line-height: 22px; }
.stat-grid { display: flex; gap: 0; margin: 0 0 34px; padding: 16px 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.stat-card { min-width: 140px; padding: 2px 30px 2px 0; margin-right: 30px; border: 0; border-right: 1px solid var(--hairline); border-radius: 0; background: transparent; }
.stat-card:last-child { border-right: 0; }
.stat-num { font-size: 24px; font-weight: 620; line-height: 30px; }
.stat-label { margin-top: 2px; color: var(--ink-muted); font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(320px,.7fr); gap: 28px; align-items: start; }
.dashboard-section { min-width: 0; }
.dashboard-section-head { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.dashboard-section-title { font-size: 16px; font-weight: 600; }
.dashboard-list { border-top: 1px solid var(--hairline); }

/* Inspiration and reusable rows */
.filter-bar {
  position: sticky;
  top: 52px;
  z-index: 50;
  margin: 0 -8px 22px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--canvas) 94%, transparent);
  backdrop-filter: blur(10px);
}
.filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-label { color: var(--ink-muted); font-size: 11px; }
.filter-pills { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.filter-pill { min-height: 28px; padding: 5px 9px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-secondary); font-size: 11.5px; cursor: pointer; }
.filter-pill:hover { background: var(--surface-hover); color: var(--ink); }
.filter-pill.active { background: var(--surface-subtle); color: var(--ink); font-weight: 550; }
.content-list { border-top: 1px solid var(--hairline); }
.content-row { position: relative; padding: 19px 4px 18px; border-bottom: 1px solid var(--hairline); }
.content-row:hover { background: color-mix(in srgb, var(--surface-subtle) 55%, transparent); }
.content-row-main { padding-right: 180px; }
.content-row-title { margin-bottom: 6px; color: var(--ink); font-size: 15px; font-weight: 600; line-height: 23px; letter-spacing: -.12px; }
.content-row-meta { margin-bottom: 7px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; color: var(--ink-muted); font-size: 11.5px; }
.content-row-summary { max-width: 82ch; color: var(--ink-secondary); font-size: 13px; line-height: 21px; }
.content-row-score { position: absolute; top: 20px; right: 4px; display: flex; align-items: center; gap: 6px; color: var(--ink-muted); font-size: 11px; }
.content-row-actions { margin-top: 14px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; opacity: .62; transition: opacity .14s ease; }
.content-row:hover .content-row-actions, .content-row:focus-within .content-row-actions { opacity: 1; }
.content-row-actions .tag-select { width: auto; min-height: 30px; padding: 4px 24px 4px 8px; font-size: 11px; }
.content-row .analysis-box { margin-top: 14px; max-width: 920px; }
.notes-input { max-width: 340px; }
.score-input input { width: 44px; }
.trend-grid { grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); gap: 8px; }
.trend-card { padding: 14px; border-color: transparent; background: var(--surface-subtle); }
.trend-card:hover { border-color: var(--hairline-strong); box-shadow: none; }

/* Drafts and publishing table */
.data-table { width: 100%; border-collapse: collapse; border-top: 1px solid var(--hairline); }
.data-table th { height: 38px; padding: 0 12px; color: var(--ink-muted); font-size: 10px; font-weight: 600; letter-spacing: .04em; text-align: left; text-transform: uppercase; border-bottom: 1px solid var(--hairline); }
.data-table td { height: 54px; padding: 8px 12px; color: var(--ink-secondary); font-size: 12px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.data-table tbody tr { cursor: pointer; transition: background-color .12s ease; }
.data-table tbody tr:hover { background: var(--surface-subtle); }
.data-table .table-title { max-width: 460px; color: var(--ink); font-size: 13px; font-weight: 550; }
.table-actions { display: flex; justify-content: flex-end; gap: 4px; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--ink-muted); }
.status-dot.writing { background: var(--accent); }
.status-dot.done { background: var(--green); }
.status-dot.favorited { background: var(--orange); }
.kanban { gap: 12px; }
.kanban-col { padding: 10px; border: 1px solid var(--hairline); background: transparent; }
.kanban-card { padding: 11px; border-color: transparent; background: var(--surface-subtle); }

/* Article editor */
.editor-page { max-width: 1520px; padding: 0; }
.editor-topbar {
  position: sticky;
  top: 52px;
  z-index: 60;
  min-height: 56px;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--canvas) 94%, transparent);
  backdrop-filter: blur(10px);
}
.editor-topbar-title { min-width: 0; flex: 1; overflow: hidden; color: var(--ink-secondary); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.editor-topbar .btn { white-space: nowrap; }
.editor-shell { display: grid; grid-template-columns: 230px minmax(560px,760px) minmax(270px,320px); justify-content: center; align-items: start; }
.editor-context > summary { cursor: pointer; font-size: 12px; color: var(--ink-secondary); margin-bottom: 16px; }
.editor-save-state { white-space: nowrap; color: var(--ink-muted); font-size: 11px; }
.editor-save-state.is-dirty { color: var(--orange); }
.editor-tool-tabs { display: flex; gap: 4px; margin: 0 0 20px; padding-bottom: 8px; border-bottom: 1px solid var(--hairline); }
.editor-tool-tabs .tab { flex: 1; justify-content: center; border: 0; border-radius: 5px; background: transparent; }
.editor-tool-tabs .tab.active { background: var(--surface-subtle); color: var(--ink); }
.editor-tool-tabs .tab:hover { background: var(--surface-hover); }
.editor-advanced { margin-top: 20px; }
.editor-advanced > summary { cursor: pointer; color: var(--ink-secondary); font-size: 12px; }
.editor-stream { margin: 20px 0; padding: 24px; background: var(--surface); border-left: 2px solid var(--accent); }
.stream-error { color: var(--red); font-size: 12px; }
.edit-decision-copy { color: var(--ink-secondary); font-size: 14px; line-height: 1.8; margin: 16px 0 28px; }
.editor-rail, .editor-inspector { position: sticky; top: 108px; max-height: calc(100vh - 108px); overflow-y: auto; padding: 24px 18px; }
.editor-rail { border-right: 1px solid var(--hairline); }
.editor-inspector { border-left: 1px solid var(--hairline); }
.editor-canvas-wrap { min-width: 0; padding: 34px 42px 80px; }
.editor-canvas { min-height: 720px; padding: 54px 62px 72px; border: 1px solid var(--hairline); border-radius: 10px; background: var(--surface); box-shadow: 0 1px 2px rgba(24,24,22,.03); overflow-wrap: anywhere; }
.editor-meta { margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--border-light); color: var(--ink-muted); font-size: 11px; }
.editor-brandline { display: inline-flex; align-items: center; gap: 6px; margin-right: 6px; color: var(--ink-secondary); font-weight: 550; }
.editor-brandline .brand-mark { width: 18px; height: 18px; border-radius: 5px; }
.editor-brandline-separator { color: var(--hairline-strong); }
.editor-rail-section, .inspector-section { margin-bottom: 24px; }
.editor-context-title { margin: 6px 0 9px; font-size: 13px; font-weight: 600; line-height: 20px; }
.editor-context-copy { color: var(--ink-secondary); font-size: 11.5px; line-height: 18px; }
.version-tabs { display: grid; gap: 4px; margin: 0; }
.version-tab { min-height: 32px; padding: 6px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-secondary); text-align: left; }
.version-tab:hover { border: 0; background: var(--surface-hover); }
.version-tab.active { color: var(--ink); background: var(--surface-subtle); }
.editor-tool-list { display: grid; gap: 3px; }
.editor-tool-list .btn { width: 100%; justify-content: flex-start; background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-secondary); }
.editor-tool-list .btn:hover { color: var(--ink); background: var(--surface-hover); }
.generate-panel { padding: 14px; border-radius: 8px; background: var(--surface-subtle); }
.generate-panel .field { margin-bottom: 12px; }
.ai-composer { padding: 14px; border: 1px solid var(--hairline); border-radius: 8px; background: var(--surface); }
.ai-composer .textarea { min-height: 112px; border: 0; padding: 2px; box-shadow: none; background: transparent; }
.ai-composer-actions { margin-top: 10px; display: flex; justify-content: flex-end; gap: 6px; }
.md-content { color: var(--ink); font-size: 15.5px; line-height: 1.9; }
.md-content.preview-phone { max-width: 72ch; margin: 0 auto; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.editor-canvas:has(.final-publish-preview) { background: #fff; color: #222; }
.editor-canvas:has(.final-publish-preview) .editor-meta { color: #777; border-bottom-color: #e4e4e1; }
.editor-canvas:has(.final-publish-preview) .editor-brandline { color: #5f5e5a; }
.md-content.preview-phone.final-publish-preview, .md-content.preview-phone.final-publish-preview h1 { color: #222; }
.md-content.preview-phone h1 { margin: 0 0 28px; font-size: 29px; line-height: 1.35; letter-spacing: -.5px; }
.md-content.preview-phone h2 { margin: 36px 0 14px; font-size: 20px; line-height: 1.45; letter-spacing: -.2px; }
.md-content.preview-phone h3 { margin: 28px 0 10px; font-size: 16px; line-height: 1.55; }
.md-content.preview-phone p, .md-content.preview-phone li { margin-bottom: 16px; font-size: 15.5px; line-height: 1.95; }
.md-content.preview-phone blockquote { margin: 24px 0; padding: 10px 18px; border-left: 2px solid var(--accent); border-radius: 0 6px 6px 0; background: var(--accent-light); color: var(--ink-secondary); }
.raw-editor { min-height: 680px !important; border: 0; padding: 0; box-shadow: none !important; font-family: ui-monospace,SFMono-Regular,Consolas,monospace; font-size: 13px; line-height: 1.7; }

/* Media gallery */
.media-workspace {
  position: fixed !important;
  top: 52px;
  right: 0;
  bottom: 0;
  z-index: 110;
  width: min(560px,calc(100vw - 232px));
  margin: 0;
  border: 0;
  border-left: 1px solid var(--hairline);
  border-radius: 0;
  background: var(--surface);
  box-shadow: -18px 0 42px rgba(24,24,22,.10);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.media-header { position: sticky; top: 0; z-index: 3; background: color-mix(in srgb,var(--surface) 95%,transparent); backdrop-filter: blur(10px); }
.media-header { min-height: 58px; padding: 12px 16px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--hairline); }
.media-title { font-size: 14px; font-weight: 600; }
.media-subtitle { color: var(--ink-muted); font-size: 11px; }
.media-grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 0; }
.media-slot-nav { display: flex; gap: 8px; padding: 12px 16px; overflow-x: auto; border-bottom: 1px solid var(--hairline); }
.media-slot-tab { flex: 0 0 84px; display: grid; gap: 5px; padding: 5px; border-radius: 7px; border: 1px solid transparent; background: transparent; font-size: 11px; color: var(--ink-secondary); }
.media-slot-tab.active { border-color: var(--accent); background: var(--accent-light); color: var(--ink); }
.media-slot-tab img, .media-slot-placeholder { width: 72px; height: 44px; object-fit: cover; border-radius: 4px; background: var(--surface-subtle); }
.media-slot-placeholder { display: grid; place-items: center; }
.media-source-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.media-current-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--ink-secondary); font-size: 12px; }
.media-advanced { margin-top: 16px; color: var(--ink-secondary); }
.media-advanced > summary { margin-bottom: 14px; cursor: pointer; font-size: 12px; }
.media-inline-picker { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--hairline); }
.media-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; font-size: 13px; }
.media-inline-picker .asset-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.media-cover-select { margin-top: 18px; }
.media-item { min-width: 0; padding: 16px; border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.media-item:nth-child(2n) { border-right: 0; }
.media-item-head { margin-bottom: 10px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.media-slot { color: var(--ink); font-size: 12px; font-weight: 600; }
.media-caption { margin-top: 2px; color: var(--ink-muted); font-size: 11px; line-height: 17px; }
.media-preview { aspect-ratio: 16/9; margin-bottom: 12px; display: grid; place-items: center; overflow: hidden; border-radius: 8px; background: var(--surface-subtle); color: var(--ink-muted); }
.media-preview img { width: 100%; height: 100%; max-width: none !important; object-fit: cover; border-radius: 0 !important; }
.media-item .tag-select { width: 100%; }
.media-item-actions { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.media-search { margin-top: 10px; display: flex; gap: 6px; }
.media-candidates { margin-top: 10px; }
.media-footer { position: sticky; bottom: 0; z-index: 4; min-height: 58px; padding: 11px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface-subtle); }
.media-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }

/* XHS split workbench */
.xhs-page { max-width: 1480px; padding-top: 24px; }
.xhs-topbar { position: sticky; top: 52px; z-index: 55; margin: -24px -48px 24px; padding: 10px 48px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--hairline); background: color-mix(in srgb,var(--canvas) 94%,transparent); backdrop-filter: blur(10px); }
.xhs-topbar .spacer { flex: 1; }
.xhs-shell { display: grid; grid-template-columns: minmax(440px,1fr) minmax(420px,.9fr); gap: 40px; align-items: start; }
.xhs-form { min-width: 0; }
.xhs-section { padding: 22px 0; border-bottom: 1px solid var(--hairline); }
.xhs-section:first-child { padding-top: 0; }
.xhs-section-title { margin-bottom: 12px; font-size: 14px; font-weight: 600; }
.xhs-title-row { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.xhs-title-row .btn { flex-shrink: 0; white-space: nowrap; }
.xhs-preview-pane { position: sticky; top: 126px; min-width: 0; }
.xhs-card-stage { padding: 22px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--surface); }
.xhs-stage-head { margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.xhs-stage-title { font-size: 13px; font-weight: 600; }
.xhs-stage-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.xhs-template-select { width: auto; min-width: 130px; }
.xhs-current { display: grid; grid-template-columns: minmax(170px,43%) minmax(0,1fr); gap: 18px; align-items: start; }
.xhs-current > div { min-width: 0; }
.xhs-current canvas { width: 100% !important; height: auto !important; border: 1px solid var(--hairline); border-radius: 10px !important; box-shadow: none !important; }
.xhs-thumbs { margin-top: 14px; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; }
.xhs-thumb { padding: 7px; border: 1px solid var(--hairline); border-radius: 7px; background: var(--surface); color: var(--ink-secondary); font-size: 10px; cursor: pointer; text-align: left; }
.xhs-thumb:hover { background: var(--surface-hover); }
.xhs-thumb.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); color: var(--ink); }
.xhs-thumb[draggable="true"] { cursor: grab; }
.xhs-thumb[draggable="true"]:active { cursor: grabbing; }
.xhs-thumb span { margin-left: 5px; color: var(--ink-muted); font-size: 9px; }
.xhs-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* Publishing and fact checking */
.publish-workspace { width: min(680px,calc(100vw - 232px)); }
.publish-body { padding: 22px; }
.publish-status-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--hairline); }
.publish-current { margin-top: 7px; }
.publish-id { display: block; max-width: 260px; margin-top: 7px; overflow: hidden; color: var(--ink-secondary); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.publish-error { margin-top: 18px; color: var(--danger); }
.publish-body .alert-card { display: block; line-height: 1.7; overflow-wrap: anywhere; }
.publish-body .alert-card code { padding: 1px 4px; border-radius: 4px; background: var(--surface-subtle); font-size: 11px; }
.publish-checklist { margin: 22px 0; display: grid; gap: 0; }
.publish-checklist > div { min-height: 66px; display: flex; align-items: flex-start; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--hairline); }
.publish-checklist > div > span { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-subtle); color: var(--ink-secondary); font-size: 10px; }
.publish-checklist strong, .publish-checklist small { display: block; }
.publish-checklist small { margin-top: 3px; color: var(--ink-muted); line-height: 17px; }
.publish-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.facts-summary { display: flex; align-items: center; gap: 8px; padding-bottom: 18px; border-bottom: 1px solid var(--hairline); }
.facts-summary strong { font-size: 22px; }
.facts-summary span { color: var(--ink-muted); }
.facts-summary .btn { margin-left: auto; }
.fact-row { padding: 20px 0; border-bottom: 1px solid var(--hairline); }
.fact-head { display: flex; gap: 6px; }
.fact-row p { margin: 10px 0 12px; color: var(--ink); font-size: 13px; line-height: 1.7; }
.fact-fields { display: grid; grid-template-columns: minmax(0,1fr) 100px auto; gap: 7px; }
.connection-card { min-height: 64px; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--hairline); }
.publish-inline-action { margin-left: 5px; }
.publish-channel-list { margin-bottom: 20px; border-top: 1px solid var(--hairline); }
.publish-channel { min-height: 74px; display: flex; align-items: center; gap: 12px; padding: 14px 2px; border-bottom: 1px solid var(--hairline); cursor: pointer; }
.publish-channel > input { width: 16px; height: 16px; accent-color: var(--accent); }
.publish-channel-main { min-width: 0; flex: 1; }
.publish-channel-main strong, .publish-channel-main small { display: block; }
.publish-channel-main strong { font-size: 13px; }
.publish-channel-main small { margin-top: 3px; color: var(--ink-muted); font-size: 11px; line-height: 17px; }
.publish-option { margin: 4px 0 18px; display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-radius: 8px; background: var(--surface-subtle); cursor: pointer; }
.publish-option input { margin-top: 2px; accent-color: var(--accent); }
.publish-option strong, .publish-option small { display: block; }
.publish-option small { margin-top: 2px; color: var(--ink-muted); }
.publish-run-summary { display: flex; align-items: center; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--hairline); }
.publish-run-title { margin-top: 7px; }
.publish-run-summary code { color: var(--ink-muted); font-size: 11px; }
.publish-result-list { margin-bottom: 18px; }
.publish-result { padding: 16px 0; border-bottom: 1px solid var(--hairline); }
.publish-result > div { display: flex; align-items: center; gap: 8px; }
.publish-result p { margin: 7px 0 0; color: var(--ink-secondary); font-size: 12px; line-height: 18px; }
.package-intro { display: flex; align-items: center; gap: 10px; padding-bottom: 18px; border-bottom: 1px solid var(--hairline); }
.package-intro p { margin: 0; color: var(--ink-secondary); font-size: 12px; }
.publication-package { margin-top: 4px; }
.package-row { min-height: 64px; display: grid; grid-template-columns: 92px minmax(0,1fr) auto; align-items: center; gap: 16px; padding: 13px 2px; border-bottom: 1px solid var(--hairline); }
.package-label { color: var(--ink-muted); font-size: 12px; }
.package-value { min-width: 0; color: var(--ink); font-size: 13px; font-weight: 520; line-height: 1.65; overflow-wrap: anywhere; }
.package-row-multiline .package-value { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.package-action { justify-self: end; }
.mobile-copy-callout { margin: 12px 0; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 12px; padding: 13px 14px; border-radius: 8px; background: var(--accent-light); }
.mobile-copy-callout strong, .mobile-copy-callout span { display: block; }
.mobile-copy-callout strong { font-size: 12px; }
.mobile-copy-callout span { color: var(--ink-secondary); font-size: 11px; line-height: 17px; }
.mobile-copy-callout .btn { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.package-footer { display: flex; align-items: center; gap: 12px; padding-top: 20px; }
.package-footer span { color: var(--ink-muted); font-size: 11px; }
.wechat-preview { margin: 22px -2px 0; padding: 28px 16px; border-top: 1px solid var(--hairline); background: var(--surface-subtle); }
.wechat-preview[hidden] { display: none; }
.wechat-preview-phone { width: min(100%,390px); margin: 0 auto; padding: 30px 24px 50px; background: #fff; color: #222; box-shadow: 0 8px 28px rgba(24,24,22,.08); }
.wechat-preview-account { margin-bottom: 12px; color: #576b95; font-size: 12px; }
.wechat-preview-phone h1 { margin: 0 0 10px; color: #1a1a1a; font-size: 23px; line-height: 1.4; }
.wechat-preview-meta { margin-bottom: 22px; color: #999; font-size: 12px; }
.wechat-preview-cover { width: 100%; max-height: 210px; margin-bottom: 22px; object-fit: cover; }
.wechat-preview-body { overflow-wrap: anywhere; }
.xhs-package-workspace { width: min(720px,calc(100vw - 232px)); }
.package-row-control { grid-template-columns: 92px minmax(0,1fr) auto; }
.package-title-select { width: 100%; min-width: 0; }
.package-actions-inline { display: flex; justify-content: flex-end; gap: 5px; }
.xhs-publish-primary { margin-top: 18px; display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 9px; background: var(--surface-subtle); }
.xhs-publish-primary span { color: var(--ink-muted); font-size: 11px; line-height: 17px; }
.xhs-publish-checklist { margin-top: 12px; }
.xhs-publish-preview { margin: 22px -2px 0; padding: 28px 16px; border-top: 1px solid var(--hairline); background: var(--surface-subtle); }
.xhs-publish-preview[hidden] { display: none; }
.xhs-post-mock { width: min(100%,360px); margin: 0 auto; overflow: hidden; border-radius: 10px; background: #fff; color: #202020; box-shadow: 0 8px 28px rgba(24,24,22,.08); }
.xhs-post-mock > img { display: block; width: 100%; aspect-ratio: 3/4; object-fit: cover; }
.xhs-post-content { padding: 16px 17px 20px; }
.xhs-post-content strong { display: block; font-size: 16px; line-height: 1.45; }
.xhs-post-content p { margin: 10px 0; color: #333; font-size: 13px; line-height: 1.72; white-space: pre-wrap; }
.xhs-post-content div { color: #385898; font-size: 12px; line-height: 1.7; }

/* Settings */
.settings-shell { display: grid; grid-template-columns: 190px minmax(0,760px); gap: 54px; align-items: start; }
.settings-nav { position: sticky; top: 82px; display: grid; gap: 3px; }
.settings-nav-item { min-height: 34px; padding: 7px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-secondary); font-size: 12px; text-align: left; cursor: pointer; }
.settings-nav-item:hover { background: var(--surface-hover); color: var(--ink); }
.settings-nav-item.active { background: var(--surface-subtle); color: var(--ink); font-weight: 550; }
.settings-panel { min-width: 0; }
.brand-about-panel { max-width: 680px; }
.brand-about-head { display: flex; align-items: center; gap: 16px; padding-bottom: 24px; border-bottom: 1px solid var(--hairline); }
.brand-mark-about { width: 54px; height: 54px; border-radius: 14px; }
.brand-about-title { color: var(--ink); font-size: 19px; font-weight: 650; letter-spacing: -.02em; }
.brand-about-tagline { margin-top: 3px; color: var(--ink-muted); font-size: 12px; }
.brand-about-copy { max-width: 540px; margin: 22px 0 0; color: var(--ink-secondary); font-size: 14px; line-height: 1.8; }
.brand-about-meta { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.brand-about-meta span { padding: 5px 8px; border-radius: 6px; background: var(--surface-subtle); color: var(--ink-muted); font-size: 11px; }
.settings-section-head { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--hairline); }
.settings-section-title { font-size: 18px; font-weight: 600; letter-spacing: -.2px; }
.settings-section-desc { margin-top: 4px; color: var(--ink-secondary); font-size: 12px; }
.settings-group { padding: 0 0 28px; margin-bottom: 28px; border-bottom: 1px solid var(--hairline); }
.settings-prompt { min-height: 150px; }
.model-row { padding: 14px 0; display: grid; grid-template-columns: 230px minmax(260px,1fr); gap: 20px; align-items: center; border-bottom: 1px solid var(--hairline); }
.model-row-title { color: var(--ink); font-size: 12.5px; font-weight: 550; }
.model-row-desc { margin-top: 2px; color: var(--ink-muted); font-size: 10.5px; }
.source-row { min-height: 54px; padding: 9px 0; border-bottom-color: var(--hairline); }
.source-cat { color: var(--ink-muted); font-size: 10px; }
.settings-savebar { position: sticky; bottom: 0; margin-top: 24px; padding: 12px 0; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--hairline); background: color-mix(in srgb,var(--canvas) 94%,transparent); backdrop-filter: blur(10px); }

/* Overlays and notifications */
.modal-overlay { background: rgba(24,24,22,.34); backdrop-filter: blur(2px); }
.modal { max-width: 600px; padding: 24px; border: 1px solid var(--hairline); border-radius: 12px; box-shadow: var(--shadow-lg); }
.modal-title { font-size: 18px; font-weight: 620; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.draft-compare-open { margin-top: 12px; }
#modal[data-draft-compare="open"] .modal { max-width: 960px; }
.draft-compare-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.draft-compare-header .modal-title { margin: 0; }
.draft-compare-selectors { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; margin: 18px 0 12px; }
.draft-compare-selectors label { min-width: 0; }
.draft-compare-selectors select { width: 100%; margin-top: 6px; }
.draft-compare-summary { color: var(--ink-secondary); font-size: 12px; line-height: 1.6; margin-bottom: 12px; }
.draft-compare-result { max-height: 48vh; overflow: auto; border: 1px solid var(--hairline); border-radius: 8px; }
.draft-compare-empty { padding: 24px 16px; margin: 0; color: var(--ink-secondary); }
.draft-diff-row { display: grid; grid-template-columns: 32px 32px 22px minmax(0,1fr); font: 12px/1.8 ui-monospace,monospace; }
.draft-diff-number { color: var(--ink-muted); text-align: right; padding: 4px 3px; user-select: none; }
.draft-diff-mark { text-align: center; padding-top: 4px; font-weight: 700; }
.draft-diff-text { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; padding: 4px 10px 4px 0; }
.draft-diff-row.is-add { background: color-mix(in srgb,#2d9560 12%,var(--surface)); }
.draft-diff-row.is-remove { background: color-mix(in srgb,#c74a42 12%,var(--surface)); }
.draft-diff-row.is-omit { color: var(--ink-muted); background: var(--canvas); }
.import-url-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.import-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.import-body { min-height: 260px; line-height: 1.7; }
.draft-status-select { width: auto; min-width: 108px; flex: 0 0 auto; min-height: 32px; padding: 0 28px 0 9px; border: 1px solid var(--hairline); border-radius: 7px; background: var(--surface); color: var(--ink-secondary); font: inherit; font-size: 12px; }
.draft-edit-fields { display: grid; gap: 10px; }
.draft-title-input { font-size: 22px; font-weight: 650; }
.image-position-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 4px; color: var(--ink-secondary); font-size: 12px; }
.image-position-input { display: inline-block; width: 62px; min-height: 30px; padding: 4px 7px; }
.job-progress { position: fixed; z-index: 180; color: var(--ink); font-family: var(--font); }
.job-progress button { font: inherit; }
.job-progress.mode-peek { right: 20px; bottom: 20px; width: min(304px,calc(100vw - 40px)); }
.job-task-peek,.job-task-panel,.job-task-sheet,.job-mobile-bar { border: 1px solid color-mix(in srgb,var(--hairline) 84%,transparent); background: color-mix(in srgb,var(--surface) 94%,transparent); box-shadow: 0 12px 34px rgba(24,24,22,.11),0 2px 8px rgba(24,24,22,.05); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.job-task-peek { overflow: hidden; padding: 13px 14px 11px; border-radius: 12px; }
.job-task-peek-head,.job-task-peek-current,.job-task-panel-head,.job-task-summary > div,.job-mobile-bar { display: flex; align-items: center; }
.job-task-peek-head { gap: 8px; }
.job-task-peek-head strong,.job-task-panel-head strong { font-size: 13px; font-weight: 640; }
.job-task-peek-head > span:last-of-type,.job-task-panel-head span { color: var(--ink-muted); font-size: 11px; }
.job-state-dot { flex: 0 0 auto; color: var(--accent); font-size: 11px; line-height: 1; }
.status-completed .job-state-dot { color: var(--green); }
.status-failed .job-state-dot { color: var(--red); }
.job-task-peek-head .job-task-icon-btn { margin-left: auto; }
.job-task-peek-current,.job-task-summary > div { justify-content: space-between; gap: 12px; margin-top: 10px; color: var(--ink-secondary); font-size: 12px; }
.job-task-peek-current b,.job-task-summary b { color: var(--ink-muted); font-size: 11px; font-weight: 550; }
.job-task-meter { height: 3px; margin-top: 9px; overflow: hidden; border-radius: 99px; background: var(--surface-hover); }
.job-task-meter span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .25s ease; }
.status-completed .job-task-meter span { background: var(--green); }
.status-failed .job-task-meter span { background: var(--red); }
.job-task-peek-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 9px; }
.job-task-peek-actions button { min-height: 28px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-secondary); font-size: 11px; cursor: pointer; }
.job-task-peek-actions button:hover { background: var(--surface-hover); color: var(--ink); }
.job-task-peek-actions button:last-child { color: var(--accent); }
.job-progress.mode-docked { width: 46px; }
.job-task-pill { width: 46px; min-height: 108px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px 5px; border: 1px solid color-mix(in srgb,var(--hairline) 74%,transparent); border-left-width: 0; border-radius: 0 11px 11px 0; background: color-mix(in srgb,var(--surface) 82%,transparent); color: var(--ink-secondary); box-shadow: 0 8px 24px rgba(24,24,22,.09); backdrop-filter: blur(13px); -webkit-backdrop-filter: blur(13px); cursor: grab; touch-action: none; transition: background .16s ease,box-shadow .16s ease,transform .16s ease; }
.job-progress.mode-docked.dock-right .job-task-pill { border-right-width: 0; border-left-width: 1px; border-radius: 11px 0 0 11px; }
.job-task-pill:hover { background: color-mix(in srgb,var(--surface) 94%,transparent); box-shadow: 0 10px 28px rgba(24,24,22,.13); }
.job-task-pill:active,.job-progress.is-dragging .job-task-pill { cursor: grabbing; }
.job-task-pill strong { font-size: 11px; font-weight: 650; }
.job-task-pill small { max-height: 38px; overflow: hidden; color: var(--ink-muted); font-size: 10px; line-height: 13px; writing-mode: vertical-rl; }
.job-task-pill > span:last-child { color: var(--ink-muted); font-size: 13px; }
.job-progress.mode-panel { top: 52px; right: 0; bottom: 0; width: 336px; }
.job-task-panel { height: 100%; overflow-y: auto; padding: 18px 18px 24px; border-width: 0 0 0 1px; border-radius: 0; box-shadow: -8px 0 28px rgba(24,24,22,.05); }
.job-task-panel-head { justify-content: space-between; gap: 12px; }
.job-task-panel-head > div { display: flex; align-items: center; gap: 8px; }
.job-task-icon-btn { width: 28px; height: 28px; display: inline-grid; place-items: center; flex: 0 0 auto; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--ink-muted); cursor: pointer; }
.job-task-icon-btn:hover { background: var(--surface-hover); color: var(--ink); }
.job-task-summary { margin: 18px 0 12px; padding-bottom: 16px; border-bottom: 1px solid var(--hairline); }
.job-task-result { margin: -2px 0 10px; padding: 9px 10px; border-radius: 7px; background: var(--surface-subtle); color: var(--ink-secondary); font-size: 11.5px; line-height: 17px; }
.job-task-summary > div { margin-top: 0; }
.job-task-steps { padding: 1px 0; }
.job-step { display: grid; grid-template-columns: 12px 1fr; gap: 10px; padding: 10px 1px; }
.job-step > span { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--border); }
.job-step.completed > span { background: var(--green); }
.job-step.running > span { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb,var(--accent) 12%,transparent); }
.job-step.failed > span { background: var(--red); }
.job-step strong,.job-step small { display: block; }
.job-step strong { font-size: 12px; font-weight: 560; }
.job-step small { margin-top: 2px; color: var(--ink-muted); font-size: 10.5px; line-height: 1.45; overflow-wrap: anywhere; }
.job-task-footer { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--hairline); }
.job-sheet-backdrop { position: fixed; inset: 0; z-index: 175; border: 0; background: rgba(18,18,16,.28); backdrop-filter: blur(1px); }
.job-sheet-backdrop[hidden] { display: none; }
body.job-panel-open .main { margin-right: 336px; transition: margin-right .18s ease; }
body.job-panel-open .media-workspace { right: 336px; width: min(720px,calc(100vw - 568px)); }
.has-job-progress:not(.has-job-taskbar) .toast { bottom: 132px; }
.source-link { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; }
.event-source-list { display: grid; gap: 2px; }
.event-source-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--hairline); color: inherit; text-decoration: none; }
.event-source-row p { margin: 4px 0 0; color: var(--ink-secondary); font-size: 12px; line-height: 1.55; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: 14px; }
.asset-grid.picker { max-height: 62vh; overflow-y: auto; }
.asset-card { overflow: hidden; border: 1px solid var(--hairline); border-radius: 10px; background: var(--surface); }
.asset-card > img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--surface-subtle); }
.asset-card-body { display: grid; gap: 5px; padding: 11px; }
.asset-card-body strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.asset-card-body span { color: var(--ink-muted); font-size: 11px; }
.media-guidance { margin: 10px 0; padding: 10px 12px; border-radius: 8px; background: var(--surface-subtle); color: var(--ink-secondary); font-size: 12px; line-height: 1.55; }
.image-type-badge { margin-right: 6px; }
.toast { bottom: 20px; right: 20px; }
.toast-msg { padding: 10px 13px; border: 1px solid rgba(255,255,255,.12); border-radius: 7px; background: #262624; box-shadow: var(--shadow-lg); }
.loadbar { height: 2px; background: var(--accent); animation: none; }
.warmbar { border-radius: 8px; background: #262624; }

@media (max-width: 1360px) {
  .page { padding-left: 32px; padding-right: 32px; }
  .xhs-topbar { margin-left: -32px; margin-right: -32px; padding-left: 32px; padding-right: 32px; }
  .editor-shell { grid-template-columns: 190px minmax(0,760px); }
  .editor-inspector { position: static; grid-column: 2; max-height: none; padding: 0 42px 60px; border-left: 0; }
  .editor-tool-list { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .xhs-shell { grid-template-columns: 1fr; }
  .xhs-preview-pane { position: static; }
}

@media (min-width: 769px) and (max-width: 1199px) {
  .job-progress.mode-panel { top: auto; right: 16px; bottom: 16px; width: min(336px,calc(100vw - 32px)); max-height: min(620px,calc(100dvh - 84px)); }
  .job-task-panel { height: auto; max-height: inherit; border: 1px solid var(--hairline); border-radius: 12px; box-shadow: var(--shadow-lg); }
  body.job-panel-open .main { margin-right: 0; }
  body.job-panel-open .media-workspace { right: 0; width: min(720px,calc(100vw - 232px)); }
}

@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .settings-shell { grid-template-columns: 1fr; gap: 24px; }
  .asset-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .settings-nav { position: static; display: flex; overflow-x: auto; padding-bottom: 4px; }
  .settings-nav-item { white-space: nowrap; }
  .media-grid { grid-template-columns: 1fr; }
  .media-item { border-right: 0; }
  .xhs-current { grid-template-columns: minmax(220px,300px) 1fr; }
}

@media (max-width: 768px) {
  .mobile-topbar { height: 50px; padding: 0 8px 0 16px; background: var(--canvas); border-bottom-color: var(--hairline); }
  .mobile-brand { display: inline-flex; align-items: center; gap: 8px; }
  .brand-mark-mobile { width: 23px; height: 23px; border-radius: 6px; }
  .mobile-menu { display: block !important; }
  .sidebar { top: 50px; width: min(84vw,300px); box-shadow: var(--shadow-lg); }
  .sidebar.open { z-index: 220; }
  .main { margin: 50px 0 0; }
  .workspace-topbar { display: none; }
  #content { min-height: calc(100vh - 50px); }
  .page { padding: 24px 16px 48px; }
  .page-header { margin-bottom: 22px; align-items: flex-start; flex-direction: column; gap: 12px; }
  .page-title { font-size: 24px; line-height: 32px; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .stat-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 0; }
  .stat-card { min-width: 0; margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--hairline); }
  .stat-card:nth-child(2n) { border-right: 0; }
  .dashboard-hero { flex-direction: column; }
  .dashboard-title { font-size: 27px; line-height: 35px; }
  .filter-bar { top: 50px; margin-left: -4px; margin-right: -4px; }
  .inspiration-search { width: 100%; flex-wrap: wrap; }
  .inspiration-search > span { margin-right: -34px; }
  .inspiration-search .input { flex-basis: calc(100% - 78px); }
  .discovery-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .discovery-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .discovery-context { width: 100%; }
  .discovery-item { grid-template-columns: 22px minmax(0,1fr); }
  .discovery-item-action { grid-column: 2; }
  .discovery-footer { align-items: stretch; flex-direction: column; }
  .discovery-footer .btn { width: 100%; justify-content: center; }
  .content-row-main { padding-right: 0; }
  .content-row-score { position: static; margin-top: 9px; justify-content: flex-start; }
  .content-row-actions { opacity: 1; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table thead { display: none; }
  .data-table tr { padding: 14px 2px; border-bottom: 1px solid var(--hairline); }
  .data-table td { height: auto; padding: 3px 0; border: 0; }
  .table-actions { justify-content: flex-start; margin-top: 6px; }
  .editor-page { padding: 0; }
  .editor-topbar { top: 50px; padding: 9px 12px; flex-wrap: wrap; }
  .editor-topbar-title { flex-basis: calc(100% - 48px); }
  .editor-shell { display: block; }
  .editor-rail, .editor-inspector { position: static; max-height: none; padding: 18px 16px; border: 0; border-bottom: 1px solid var(--hairline); }
  .editor-canvas-wrap { padding: 16px 10px 30px; }
  .editor-canvas { min-height: 0; padding: 34px 22px 48px; border-left: 0; border-right: 0; border-radius: 0; }
  .editor-tool-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .media-workspace { top: 50px; left: 0; right: 0; width: auto; border-left: 0; }
  .media-footer { align-items: flex-start; flex-direction: column; }
  .xhs-page { padding-top: 16px; }
  .xhs-topbar { top: 50px; margin: -16px -16px 20px; padding: 9px 12px; flex-wrap: wrap; }
  .xhs-shell { gap: 24px; }
  .xhs-current { grid-template-columns: 1fr; }
  .xhs-current canvas { max-width: 290px; margin: 0 auto; }
  .xhs-thumbs { grid-template-columns: repeat(2,1fr); }
  .xhs-stage-actions { justify-content: flex-start; }
  .xhs-template-select { width: 100%; }
  .publish-workspace { width: auto; }
  .publish-body { padding: 18px 15px; }
  .publish-status-row { flex-direction: column; }
  .package-intro { align-items: flex-start; flex-direction: column; }
  .package-row { grid-template-columns: 74px minmax(0,1fr) auto; gap: 10px; }
  .package-value { font-size: 12px; }
  .mobile-copy-callout { grid-template-columns: 1fr; }
  .mobile-copy-callout .btn { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 6px; }
  .package-footer { align-items: flex-start; flex-direction: column; }
  .wechat-preview { margin-left: -15px; margin-right: -15px; padding: 18px 10px; }
  .wechat-preview-phone { padding: 26px 20px 42px; box-shadow: none; }
  .xhs-package-workspace { width: auto; }
  .package-row-control { grid-template-columns: 74px minmax(0,1fr) auto; }
  .package-actions-inline { flex-direction: column; }
  .xhs-publish-primary { align-items: flex-start; flex-direction: column; }
  .xhs-publish-preview { margin-left: -15px; margin-right: -15px; padding: 18px 12px; }
  .fact-fields { grid-template-columns: 1fr; }
  .model-row { grid-template-columns: 1fr; gap: 8px; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { max-width: none; max-height: 90vh; border-radius: 14px 14px 0 0; }
  .import-url-row, .import-meta-grid { grid-template-columns: 1fr; }
  .draft-compare-selectors { grid-template-columns: minmax(0,1fr); gap: 10px; margin-top: 12px; }
  .draft-compare-result { max-height: 42vh; }
  .draft-diff-row { grid-template-columns: 25px 25px 18px minmax(0,1fr); }
  .toast { left: 12px; right: 12px; bottom: 12px; }
  .job-progress { left: 0; right: 0; top: auto; width: auto; }
  .job-progress.mode-bar { bottom: max(8px,env(safe-area-inset-bottom)); padding: 0 10px; pointer-events: none; }
  .job-mobile-bar { min-height: 48px; justify-content: space-between; gap: 4px; overflow: hidden; border-radius: 12px; pointer-events: auto; }
  .job-mobile-bar-main { min-width: 0; min-height: 48px; display: flex; align-items: center; gap: 5px; flex: 1; padding: 0 4px 0 13px; overflow: hidden; border: 0; background: transparent; color: var(--ink-secondary); text-align: left; cursor: pointer; }
  .job-mobile-bar-main strong { flex: 0 0 auto; color: var(--ink); font-size: 12px; font-weight: 620; }
  .job-mobile-bar-main > span:nth-of-type(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
  .job-mobile-bar-main b { margin-left: auto; color: var(--ink-muted); font-size: 10.5px; font-weight: 550; }
  .job-mobile-bar-main > span:last-child { color: var(--ink-muted); font-size: 12px; }
  .job-mobile-bar > .job-task-icon-btn { margin-right: 8px; pointer-events: auto; }
  .job-progress.mode-sheet { bottom: 0; max-height: 76dvh; }
  .job-task-sheet { max-height: 76dvh; overflow-y: auto; padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); border-width: 1px 0 0; border-radius: 18px 18px 0 0; box-shadow: 0 -14px 38px rgba(24,24,22,.15); }
  .job-sheet-handle { width: 36px; height: 5px; display: block; margin: 0 auto 10px; padding: 0; border: 0; border-radius: 99px; background: var(--hairline-strong); cursor: pointer; }
  .job-task-sheet .job-task-panel-head { position: sticky; top: -8px; z-index: 1; margin: 0 -4px; padding: 7px 4px 9px; background: color-mix(in srgb,var(--surface) 94%,transparent); backdrop-filter: blur(12px); }
  .job-task-sheet .job-task-summary { margin-top: 10px; }
  body.has-job-taskbar #content { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  body.has-job-taskbar .settings-savebar { bottom: calc(58px + env(safe-area-inset-bottom)); }
  body.has-job-taskbar .media-workspace { bottom: calc(64px + env(safe-area-inset-bottom)); }
  body.has-job-taskbar .toast { bottom: calc(68px + env(safe-area-inset-bottom)); }
  body.job-sheet-open { overflow: hidden; }
  /* Keep the toast container content-sized while the task sheet is open.
     The extra specificity overrides the desktop progress offset; otherwise
     an empty toast stretches between top and bottom and intercepts taps. */
  body.has-job-progress.job-sheet-open .toast { bottom: auto; top: 62px; pointer-events: none; }
  body.has-job-progress.job-sheet-open .toast-msg { pointer-events: auto; }
  /* Save completion can arrive while the bottom edit-decision sheet is open. */
  body:has(#modal[data-edit-decision="open"]) .toast { bottom: auto; top: calc(62px + env(safe-area-inset-top)); pointer-events: none; }
  .editor-brandline { width: 100%; margin: 0 0 5px; }
  .brand-about-head { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
/* Authentication gate */
.auth-gate{position:fixed;inset:0;z-index:10000;place-items:center;padding:24px;background:var(--bg,#f7f7f5)}
.auth-panel{width:min(100%,420px);padding:40px;background:var(--surface,#fff);border:1px solid var(--hairline,#e7e7e4);border-radius:14px;box-shadow:0 24px 70px rgba(15,23,42,.10)}
.auth-mark{display:block;width:46px;height:46px;margin-bottom:26px;border-radius:12px}
.auth-panel h1{margin:7px 0 10px;font-size:28px;line-height:1.2;letter-spacing:-.03em;color:var(--text,#191919)}
.auth-panel p{margin:0 0 28px;color:var(--text-muted,#6b6b67);font-size:14px;line-height:1.7}
.auth-panel .input{width:100%;margin-top:8px}
.auth-error{min-height:22px;margin:8px 0 4px;color:var(--danger,#c0392b);font-size:13px}
.auth-submit{width:100%;justify-content:center;margin-top:6px}
.auth-divider{display:flex;align-items:center;gap:12px;margin:18px 0;color:var(--text-light);font-size:12px}
.auth-divider:before,.auth-divider:after{content:"";height:1px;background:var(--hairline);flex:1}
.auth-passkey{width:100%;justify-content:center;background:var(--surface);border:1px solid var(--border);font-weight:600}
.auth-passkey:hover{background:var(--bg);border-color:var(--text-light)}
.passkey-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 0;border-bottom:1px solid var(--hairline)}
.passkey-row:last-child{border-bottom:0}
.empty-note{padding:18px 0;color:var(--text-muted);font-size:13px;line-height:1.65}
.list-result-meta { min-height: 24px; padding: 0 4px; color: var(--ink-muted); font-size: 12px; }
.content-list[aria-busy="true"] { opacity: .65; }
.content-row-summary { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.analysis-details > summary { cursor: pointer; display: flex; align-items: center; gap: 14px; color: var(--ink-secondary); font-size: 12px; margin-top: 10px; }
.analysis-details > summary span { color: var(--ink-muted); }
.analysis-details .analysis-box { margin-top: 12px; }
.recap-intro { padding-top: 12px; color: var(--ink-secondary); font-size: 14px; line-height: 1.8; }
.recap-intro strong { color: var(--ink); font-size: 16px; }
.recap-details > summary { cursor: pointer; margin: 16px 0; color: var(--accent); font-size: 13px; }
.draft-list-row { padding: 18px 4px; display: flex; gap: 20px; align-items: start; border-bottom: 1px solid var(--hairline); }
.draft-open { flex: 1; min-width: 0; text-align: left; padding: 0; background: transparent; border: 0; color: var(--ink); }
.draft-open strong { display: block; font-size: 15px; line-height: 1.65; margin-bottom: 6px; }
.draft-open:hover { color: var(--accent); background: transparent; }
.draft-versions { flex: 0 0 auto; min-width: 90px; color: var(--ink-secondary); font-size: 12px; }
.draft-versions > summary { cursor: pointer; padding: 4px 0; }
.draft-version-list { display: grid; gap: 4px; margin-top: 8px; }
.draft-version-open { display: flex; gap: 12px; justify-content: space-between; padding: 8px 10px; text-align: left; background: var(--surface-subtle); border: 0; font-size: 11px; color: var(--ink-secondary); }
.xhs-canvas-preview { min-width: 0; }
.xhs-card-audit { margin: 10px 0; padding: 9px 12px; color: var(--orange); background: var(--orange-bg); font-size: 12px; line-height: 1.7; border-radius: 6px; }
[hidden] { display: none !important; }
@media(min-width:769px) and (max-width:1500px) {
  .editor-shell { grid-template-columns: minmax(0,1fr) 270px; }
  .editor-rail { grid-column: 1 / -1; position: static; max-height: none; padding: 10px 18px; }
  .editor-context > summary { margin-bottom: 0; }
  .editor-context[open] > summary { margin-bottom: 16px; }
  .editor-context[open] { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px; }
  .editor-context[open] > summary { grid-column: 1 / -1; }
  .editor-canvas-wrap { grid-column: 1; grid-row: 2; padding: 18px 20px 60px; }
  .editor-canvas { padding: 30px 28px 50px; }
  .editor-inspector { grid-column: 2; grid-row: 2; position: sticky; top: 108px; max-height: calc(100vh - 108px); padding: 18px 14px; border-left: 1px solid var(--hairline); }
  .editor-tool-list { grid-template-columns: 1fr; }
}
@media(max-width:768px) {
  .editor-shell { display: flex; flex-direction: column; }
  .editor-shell > * { width: 100%; }
  .editor-rail { order: 1; }
  .editor-inspector { order: 2; padding: 10px 16px; }
  .editor-canvas-wrap { order: 3; }
  .editor-topbar { gap: 6px; }
  .editor-topbar > .btn:first-child { width: 72px; justify-content: flex-start; padding: 5px; }
  .editor-topbar-title { flex-basis: calc(100% - 88px); }
  .editor-topbar > .btn:not(:first-child) { padding: 6px 8px; font-size: 12px; }
  .editor-topbar .draft-status-select { width: 80px; min-width: 0; }
  .editor-topbar .segmented .tab { padding: 5px 8px; font-size: 12px; }
  .editor-context > summary { margin: 0; min-height: 40px; display: flex; align-items: center; }
  .editor-context[open] > summary { margin-bottom: 16px; }
  .editor-rail { padding: 0 16px; }
  .editor-inspector { padding: 10px 16px; }
  .editor-inspector .editor-tool-tabs { margin-bottom: 0; }
  .editor-inspector:has(.tab.active) .editor-tool-tabs { margin-bottom: 16px; }
  .editor-tool-tabs { position: sticky; top: 50px; background: var(--canvas); z-index: 2; }
  .editor-canvas-wrap { padding-top: 10px; }
  .editor-canvas { padding-top: 22px; }
  .editor-save-state { margin-right: auto; }
  .media-header { flex-wrap: wrap; gap: 8px; }
  .media-header > div:first-child { flex: 1; min-width: 110px; }
  .media-header > .spacer { display: none; }
  .media-header .btn { padding: 6px; font-size: 11px; }
  .media-header .media-check { font-size: 11px; gap: 4px; }
  .media-header .media-subtitle { max-width: 220px; }
  .media-slot-nav { padding: 10px 12px; }
  .media-footer { position: sticky; bottom: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom,0px)); z-index: 4; }
  .draft-list-row { flex-wrap: wrap; gap: 10px; }
  .draft-open { flex-basis: 100%; }
  .draft-versions { width: 100%; }
  .draft-version-open { min-height: 40px; flex-wrap: wrap; }
  .xhs-canvas-preview canvas { display: block; width: 100%; max-width: 290px; }
}
.auth-logout{margin-left:auto}
@media(max-width:520px){.auth-gate{padding:16px}.auth-panel{padding:30px 24px;border-radius:12px}.auth-panel h1{font-size:24px}}
