@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap");

:root {
  color-scheme: dark;
  --bg: #09111e;
  --bg-elevated: #0d1626;
  --panel: #101a2b;
  --panel-2: #142033;
  --panel-3: #18263b;
  --line: #223148;
  --line-strong: #304362;
  --ink: #eef3ff;
  --muted: #8f9db5;
  --accent: #4d8dff;
  --accent-rgb: 77, 141, 255;
  --accent-soft: rgba(77, 141, 255, 0.12);
  --accent-border: rgba(77, 141, 255, 0.24);
  --accent-2: #9bc0ff;
  --good: #2ec98b;
  --warn: #ffb648;
  --bad: #ff7272;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.26);
}

body.light {
  color-scheme: light;
  --bg: #f2f5f7;
  --bg-elevated: #eef3f5;
  --panel: #ffffff;
  --panel-2: #f7fafb;
  --panel-3: #f1f6f7;
  --line: #d4dee5;
  --line-strong: #bfd0db;
  --ink: #162129;
  --muted: #647885;
  --accent: #2f6fe0;
  --accent-rgb: 47, 111, 224;
  --accent-soft: rgba(47, 111, 224, 0.1);
  --accent-border: rgba(47, 111, 224, 0.18);
  --accent-2: #1c59c0;
  --good: #1c9c69;
  --warn: #d68a1d;
  --bad: #d14d4d;
  --shadow: 0 18px 40px rgba(18, 32, 41, 0.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Poppins", "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  background:
    radial-gradient(circle at top right, var(--accent-soft), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-elevated) 100%);
  color: var(--ink);
  font-weight: 400;
}

body.authenticated .topbar {
  display: none;
}

button, input, select, textarea { font: inherit; }

button {
  min-height: 34px;
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  padding: 0 12px;
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 500;
  font-size: 0.84rem;
  cursor: pointer;
}

button:hover { filter: brightness(1.04); }

button:disabled {
  opacity: 0.55;
  cursor: default;
  filter: none;
}

.ghost {
  background: rgba(255, 255, 255, 0.01);
  color: var(--ink);
  border: 1px solid var(--line);
}

.danger {
  color: var(--bad);
  border-color: rgba(255, 114, 114, 0.28);
  background: rgba(255, 114, 114, 0.08);
}

.shell {
  width: calc(100% - 24px);
  margin: 0 auto;
  padding: 12px 0 20px;
}

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

.brand-row,
.top-actions,
.hero-actions,
.queue-header-tools,
.sidebar-nav,
.status-row,
.meta-chip-row,
.flow-actions,
.flow-metrics,
.flow-toolbar,
.flow-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-mark {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 600;
}

.brand-mark span { color: var(--accent); }

.header-context {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.engine-badge,
.meta-chip,
.path-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.82rem;
  font-weight: 600;
}

.login-panel {
  min-height: 70vh;
  display: grid;
  place-items: center;
}

.panel,
.login-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.panel { padding: 16px; }
.login-box { width: min(420px, 100%); padding: 24px; }

.app-shell {
  display: grid;
  grid-template-columns: 174px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  min-height: calc(100vh - 24px);
}

.sidebar {
  position: sticky;
  top: 12px;
  min-height: calc(100vh - 24px);
}

.sidebar-panel {
  min-height: calc(100vh - 24px);
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px;
}

.sidebar-brand {
  display: grid;
  gap: 6px;
  padding-bottom: 6px;
}

.sidebar-nav {
  display: grid;
  grid-template-columns: 1fr;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  gap: 6px;
}

.sidebar-tab {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  justify-content: start;
  gap: 8px;
  width: 100%;
  padding: 0 8px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  min-height: 36px;
  border-radius: 9px;
  font-weight: 500;
  font-size: 0.8rem;
  box-shadow: none;
}

.sidebar-tab.active {
  background: linear-gradient(90deg, var(--accent-soft), rgba(var(--accent-rgb), 0.03));
  color: var(--ink);
  border-color: var(--accent-border);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.08);
}

.tab-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.7rem;
  opacity: 0.9;
}

.sidebar-utility-mount {
  display: grid;
  gap: 8px;
  align-content: end;
}

.sidebar-utility-mount .ghost,
.sidebar-utility-mount .engine-badge {
  width: 100%;
  justify-content: center;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.queue-heading {
  display: grid;
  gap: 6px;
}

.queue-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
}

.queue-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

.queue-title-row #flowCountLabel {
  font-size: 0.84rem;
}

.queue-header-tools {
  margin-left: auto;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.queue-header-tools .filter-select {
  min-width: 92px;
  padding: 0 28px 0 10px;
}

.queue-header-tools #quickImportButton {
  min-width: 88px;
  padding: 0 12px;
}

.compact-heading h2,
.section-heading h2 {
  margin: 0;
  font-size: 0.98rem;
}

.workspace,
.two-column-grid,
.three-col,
.flow-detail-grid,
.queue-layout {
  display: grid;
  gap: 14px;
}

.workspace { gap: 16px; }

.two-column-grid,
.flow-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.queue-layout {
  grid-template-columns: minmax(280px, 0.72fr) minmax(620px, 1.28fr);
  align-items: start;
}

.publishing-toolbar,
.publishing-toolbar-main,
.publishing-toolbar-actions,
.publishing-toolbar-footer,
.publish-card-head,
.publish-card-grid,
.publish-index-row,
.publish-meta-row {
  display: grid;
  gap: 12px;
}

.publishing-toolbar {
  gap: 10px;
  padding: 14px;
}

.publishing-toolbar-main {
  grid-template-columns: 170px minmax(0, 1fr);
  align-items: start;
}

.publishing-toolbar-actions {
  display: grid;
  grid-template-columns: minmax(180px, 1.15fr) repeat(4, minmax(120px, 0.9fr)) minmax(110px, 0.8fr) auto;
  align-items: end;
}

.compact-field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
}

.small-field {
  max-width: 120px;
}

.publishing-toolbar-footer {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.publishing-scope-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.publish-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(430px, 1fr));
  gap: 14px;
  align-items: start;
}

.publish-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border-top: 2px solid var(--accent-border);
}

.publish-card-head {
  grid-template-columns: 1fr;
  align-items: start;
}

.publish-title-block {
  display: grid;
  gap: 6px;
}

.publish-card-head h3 {
  margin: 0;
  font-size: 1.28rem;
  font-weight: 600;
  line-height: 1.24;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.publish-card-grid {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.52fr);
  align-items: start;
}

.publish-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.publish-meta-row {
  grid-template-columns: minmax(220px, 1.1fr) minmax(160px, 0.6fr) minmax(260px, 1fr);
  align-items: start;
}

.publish-card-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.wide-field {
  grid-column: 1 / -1;
}

.meta-field {
  grid-column: 1 / 2;
}

.compact-area {
  min-height: 168px;
}

.content-area {
  min-height: 280px;
}

.publish-dropzone {
  min-height: 172px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  align-content: space-between;
  gap: 10px;
  padding: 14px;
  cursor: pointer;
  grid-column: 2 / 3;
  grid-row: 3 / 4;
}

.publish-dropzone.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.publish-dropzone img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.upload-placeholder {
  color: var(--muted);
  font-size: 0.82rem;
}

.publish-index-row {
  display: flex;
  justify-content: start;
  align-items: center;
  gap: 10px;
}

.publish-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(46, 201, 139, 0.14);
  border: 1px solid rgba(46, 201, 139, 0.28);
  color: var(--good);
  font-size: 0.82rem;
  font-weight: 700;
}

.article-activity {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.02);
}

.article-activity.good {
  color: var(--good);
  border-color: rgba(46, 201, 139, 0.24);
}

.article-activity.warn {
  color: var(--warn);
  border-color: rgba(255, 182, 72, 0.24);
}

.article-activity.bad {
  color: var(--bad);
  border-color: rgba(255, 114, 114, 0.24);
}

.article-activity.idle {
  color: var(--muted);
}

.article-activity.publishing {
  color: var(--accent);
  border-color: var(--accent-border);
}

.publish-empty {
  min-height: 260px;
}

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.workspace-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
}

.hero-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

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

.compact-copy,
.panel-label,
.muted,
.detail-label {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0;
}

.website-list,
.folder-list,
.flow-list,
.flow-log-list {
  display: grid;
  gap: 10px;
}

.website-list {
  align-content: start;
  overflow: auto;
}

.website-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
  text-align: left;
}

.website-nav-item:hover {
  background: var(--accent-soft);
  border-color: rgba(var(--accent-rgb), 0.1);
}

.website-nav-item.active {
  background: linear-gradient(90deg, var(--accent-soft), rgba(var(--accent-rgb), 0.03));
  border-color: var(--accent-border);
}

.website-nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--website-accent, var(--accent));
  flex: 0 0 auto;
  opacity: 0.72;
}

.website-nav-item.active .website-nav-dot {
  background: var(--website-accent, var(--accent));
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--website-accent, var(--accent)) 18%, transparent);
  opacity: 1;
}

.website-nav-label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.72rem;
  font-weight: 500;
}

.stack-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--ink);
  padding: 9px 11px;
}

textarea {
  min-height: 120px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.source-summary,
.folder-item,
.queue-row,
.flow-shell,
.flow-list-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
}

.source-summary,
.folder-item,
.queue-row {
  padding: 12px;
}

.flow-list-item {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  text-align: left;
  color: var(--ink);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
}

.flow-list-item.active {
  border-color: var(--accent-border);
  box-shadow: inset 0 0 0 1px var(--accent-soft);
  background: linear-gradient(180deg, var(--accent-soft), rgba(var(--accent-rgb), 0.03));
}

.flow-list-row {
  display: block;
  min-width: 0;
}

.flow-card-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
  width: 100%;
}

.flow-card-line h3 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  flex: 0 0 auto;
}

.flow-head-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.flow-title-block,
.flow-name-row,
.flow-path {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.compact-flow-head,
.compact-flow-meta,
.flow-head-line,
.compact-pills,
.compact-actions,
.compact-settings {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-flow-head,
.compact-flow-meta {
  justify-content: space-between;
  flex-wrap: nowrap;
}

.flow-head-line {
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: nowrap;
}

.flow-head-line h2 {
  flex: 0 0 auto;
}

.compact-pills {
  min-width: 0;
  flex-wrap: nowrap;
  overflow: hidden;
}

.compact-flow-meta .compact-pills {
  gap: 10px;
}

.flow-card-pills {
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  overflow: hidden;
}

.compact-actions {
  flex-wrap: nowrap;
  flex: 0 0 auto;
}

.compact-flow-head .progress-battery {
  min-width: 52px;
}

.queue-stat {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 1px 5px;
  border: 1px solid var(--line);
  font-size: 0.62rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}

.queue-stat.good { color: var(--good); }
.queue-stat.warn { color: var(--warn); }
.queue-stat.bad { color: var(--bad); }

.flow-body {
  padding: 14px 16px 16px;
  display: grid;
  gap: 14px;
}

.flow-detail-panel {
  min-height: calc(100vh - 148px);
  position: sticky;
  top: 12px;
  align-self: start;
}

.detail-empty {
  min-height: calc(100vh - 180px);
  display: grid;
  place-items: center;
  text-align: center;
}

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

.detail-head h2 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
}

.flow-topline {
  justify-content: space-between;
}

.flow-settings-bar {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  justify-content: space-between;
}

.compact-flow-head,
.compact-flow-meta {
  margin-bottom: 8px;
}

.compact-flow-head .path-pill,
.compact-flow-head .meta-chip,
.compact-flow-meta .meta-chip {
  padding: 3px 8px;
  font-size: 0.66rem;
  min-height: 24px;
}

.compact-flow-head .status-pill,
.compact-flow-meta .status-pill {
  padding: 3px 8px;
  font-size: 0.66rem;
  min-height: 24px;
}

.compact-actions button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.76rem;
  white-space: nowrap;
}

.compact-settings {
  justify-content: flex-start;
  gap: 12px;
}

.compact-inline-field {
  min-width: 72px;
  gap: 4px;
}

.compact-inline-field span {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.compact-settings .inline-field {
  min-width: 96px;
}

.compact-inline-field .batch-input,
.compact-inline-field .compact-select {
  min-width: 76px;
  height: 30px;
  padding: 4px 8px;
  border-radius: 9px;
}

.inline-field {
  display: inline-grid;
  gap: 6px;
  min-width: 120px;
}

.batch-input,
.compact-select {
  min-width: 96px;
  padding: 9px 10px;
}

.progress-battery {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.progress-battery-cap {
  width: 2px;
  height: 9px;
  border-radius: 0 3px 3px 0;
  background: #1f6f3d;
}

.progress-battery-body {
  position: relative;
  width: 48px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid #1f6f3d;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.progress-battery-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, #1f6f3d, #2ea85f);
}

.progress-battery-label {
  position: relative;
  z-index: 1;
  font-size: 0.58rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.flow-menu {
  position: relative;
}

.flow-menu summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.01);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
}

.flow-menu summary::-webkit-details-marker {
  display: none;
}

.icon-only {
  min-width: 30px;
  padding: 0 8px;
}

.flow-menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  display: grid;
  gap: 6px;
  min-width: 156px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.flow-menu-pop button {
  width: 100%;
  justify-content: center;
}

.inline-confirm {
  display: grid;
  gap: 6px;
}

.queue-row {
  display: grid;
  gap: 6px;
  background: var(--panel-3);
}

.queue-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.queue-row strong {
  font-size: 0.82rem;
  line-height: 1.4;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.71rem;
  font-weight: 600;
  border: 1px solid transparent;
  text-transform: capitalize;
  background: rgba(255, 255, 255, 0.04);
}

.status-icon {
  width: 14px;
  height: 14px;
  display: inline-grid;
  place-items: center;
  font-size: 0.72rem;
}

.status-pill.published {
  color: #ffffff;
  background: #34c759;
  border-color: #34c759;
}

.status-pill.scheduled {
  color: #1f2024;
  background: #ffd60a;
  border-color: #ffd60a;
}

.status-pill.failed {
  color: #ffffff;
  background: #ff3b30;
  border-color: #ff3b30;
}

.status-pill.draft,
.status-pill.draft-remote {
  color: #ffffff;
  background: #ff9500;
  border-color: #ff9500;
}

.status-pill.running {
  color: #ffffff;
  background: #0a84ff;
  border-color: #0a84ff;
}

.status-pill.neutral {
  color: #ffffff;
  background: #6e6e73;
  border-color: #6e6e73;
}

.empty-state {
  min-height: 320px;
  display: grid;
  place-items: center;
  text-align: center;
}

.website-link {
  color: var(--accent-2);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.website-link:hover { text-decoration: underline; }

.website-title-link {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.96rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.website-title-link:hover {
  color: var(--accent-2);
}

.outbound-icon {
  opacity: 0.72;
}

.hero-summary {
  font-size: 0.74rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.publication-grid,
.publication-columns,
.publication-list {
  display: grid;
  gap: 14px;
}

.publication-grid,
.publication-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.publication-count {
  display: block;
  font-size: 1.8rem;
  line-height: 1;
  font-weight: 600;
  margin: 4px 0 8px;
}

.publication-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
}

.publication-item-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.split-actions {
  justify-content: space-between;
}

.error {
  color: var(--bad);
  min-height: 18px;
}

.publishing-toolbar-main,
.publication-toolbar-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.publishing-toolbar-actions,
.publication-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  justify-content: flex-end;
}

.publishing-toolbar-actions .compact-field,
.publication-filter-bar .compact-field {
  min-width: 120px;
}

.search-field {
  min-width: 220px !important;
}

.publish-grid.row-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

.article-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  overflow: hidden;
}

.article-row summary {
  list-style: none;
}

.article-row summary::-webkit-details-marker {
  display: none;
}

.article-row-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
}

.article-row-primary,
.article-row-meta,
.article-row-actions,
.publication-row,
.publication-row-main,
.publication-row-side,
.history-row,
.history-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.article-title-stack {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.article-title-stack strong {
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.25;
}

.article-row-meta {
  justify-content: flex-end;
}

.article-row .meta-chip,
.article-row .status-pill,
.publication-row .meta-chip,
.publication-row .status-pill,
.small-metric {
  font-size: 0.68rem;
  padding: 4px 7px;
}

.publish-index {
  min-width: 90px;
  height: 24px;
  padding: 0 9px;
  font-size: 0.66rem;
  font-weight: 600;
}

.article-row-body {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  display: grid;
  gap: 10px;
}

.article-row-actions {
  justify-content: flex-end;
}

.article-row-actions button,
.article-row-actions .website-link {
  font-size: 0.76rem;
}

.article-detail-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(160px, 0.8fr) minmax(150px, 0.7fr) minmax(220px, 0.9fr) minmax(220px, 1fr);
  align-items: start;
}

.article-field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.article-field-wide {
  grid-column: 1 / -1;
}

.article-field-meta {
  grid-column: 1 / span 3;
}

.article-row .compact-area {
  min-height: 120px;
}

.article-row .content-area {
  min-height: 220px;
}

.article-row .publish-dropzone {
  min-height: 120px;
  grid-column: 4 / 5;
  grid-row: 2 / 3;
}

.pinterest-list {
  display: grid;
  gap: 10px;
}

.pin-workbench {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(0, 2.6fr) minmax(150px, 0.9fr);
  gap: 10px;
  align-items: stretch;
}

.pin-controls-stack {
  display: grid;
  gap: 8px;
  min-width: 0;
  align-self: stretch;
}

.pin-batch-tools {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(52px, auto);
  align-items: stretch;
}

.pin-tool-group {
  display: grid;
  gap: 8px;
  align-content: start;
}

.pin-keyword-inline {
  grid-column: 1 / -1;
}

.pin-count-field select {
  max-width: 84px;
}

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

.pin-card-mini {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.pin-card-topline,
.pin-card-actions,
.pin-slot-summary,
.slot-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pin-card-topline {
  justify-content: space-between;
}

.pin-card-actions {
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: nowrap;
}

.pin-card-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) 160px;
  gap: 10px;
  align-items: start;
}

.pin-card-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.pin-card-grid {
  display: grid;
  gap: 5px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pin-card-grid .article-field-wide {
  grid-column: 1 / -1;
}

.pin-card-mini .compact-area {
  min-height: 46px;
}

.compact-textarea {
  resize: none;
}

.compact-left .article-field {
  gap: 2px;
  font-size: 0.64rem;
}

.compact-left input,
.compact-left textarea {
  min-height: 26px;
  padding: 4px 7px;
  font-size: 0.7rem;
}

.pin-card-preview {
  min-height: 172px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.pin-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pin-preview-empty {
  color: var(--muted);
  font-size: 0.72rem;
  padding: 10px;
  text-align: center;
}

.pin-slot-toolbar {
  display: grid;
  gap: 10px;
}

.slot-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.02);
}

.slot-chip button {
  min-height: 24px;
  padding: 0 7px;
  font-size: 0.68rem;
}

.pinterest-csv-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(230, 0, 35, 0.28);
  background: rgba(230, 0, 35, 0.12);
  color: #e60023;
  font-size: 0.7rem;
  font-weight: 600;
}

.pin-badge {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: #e60023;
  color: #ffffff;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;
}

.pin-article-actions {
  justify-content: flex-end;
  gap: 6px;
}

.pin-actions-bottom {
  justify-content: flex-start;
  padding-top: 2px;
}

.pin-dropzone-large {
  display: grid;
  gap: 4px;
  min-height: 120px;
  height: 100%;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  align-content: center;
  text-align: center;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.pin-dropzone-large strong {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
}

.pin-dropzone-large:hover,
.pin-dropzone-large.dragging {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

.pin-dropzone-images {
  justify-self: stretch;
  align-self: stretch;
}

.pin-dropzone-csv {
  justify-self: stretch;
  align-self: stretch;
}

.pin-article-actions button,
.pin-article-actions .website-link {
  min-height: 26px;
  font-size: 0.7rem;
  padding: 0 9px;
}

.pin-batch-tools .article-field {
  gap: 3px;
  font-size: 0.66rem;
  align-content: start;
}

.pin-batch-tools input,
.pin-batch-tools select,
.pin-batch-tools textarea {
  min-height: 28px;
  padding: 5px 8px;
}

.pin-empty {
  grid-column: 1 / -1;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
  font-size: 0.76rem;
}

.pin-card-actions .danger {
  min-height: 26px;
  padding: 0 8px;
}

@media (max-width: 1400px) {
  .pin-workbench {
    grid-template-columns: 1fr;
  }

  .pin-batch-tools {
    grid-template-columns: 1fr;
  }

  .pin-card-layout {
    grid-template-columns: 1fr;
  }

  .pin-card-preview {
    min-height: 220px;
  }
}

.publication-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.small-metric strong {
  margin-right: 5px;
  color: var(--ink);
}

.publication-columns {
  gap: 12px;
}

.publication-list {
  gap: 8px;
}

.publication-row {
  justify-content: space-between;
  padding: 10px 12px;
}

.publication-row-main {
  min-width: 0;
  flex: 1;
}

.publication-row-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.publication-row-copy strong {
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.25;
}

.publication-row-side {
  justify-content: flex-end;
}

.flow-history-block {
  margin-top: 14px;
}

.history-toggle {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.history-toggle summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

.history-toggle summary span:first-child::before {
  content: "▸";
  margin-right: 8px;
  color: var(--muted);
}

.history-toggle[open] summary span:first-child::before {
  content: "▾";
}

.history-toggle summary::-webkit-details-marker {
  display: none;
}

.history-list {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.history-batch {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.history-batch:first-child {
  border-top: 0;
  padding-top: 0;
}

.history-batch > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  cursor: pointer;
}

.history-batch > summary::-webkit-details-marker {
  display: none;
}

.history-batch-main,
.history-batch-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.history-inline {
  font-size: 0.72rem;
  color: var(--muted);
}

.history-inline.good {
  color: #34c759;
}

.history-row {
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.history-main {
  min-width: 0;
}

.compact-row {
  padding: 10px;
}

.last-run-text {
  font-size: 0.74rem;
  color: var(--accent-2);
  font-weight: 500;
  white-space: nowrap;
}

/* Final operator-density overrides */
:root {
  --bg: #161618;
  --bg-elevated: #1c1c1e;
  --panel: #1f2024;
  --panel-2: #24262b;
  --panel-3: #2a2d33;
  --line: #343741;
  --line-strong: #454a57;
  --ink: #f5f5f7;
  --muted: #a7acb8;
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
}

body.light {
  --bg: #f4f5f7;
  --bg-elevated: #eeeff2;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --panel-3: #f0f2f5;
  --line: #d8dce4;
  --line-strong: #c7ccd8;
  --ink: #181a1f;
  --muted: #69707d;
}

.hero-main {
  gap: 10px;
}

.hero-title-row {
  align-items: flex-start;
}

.meta-chip-row {
  gap: 10px;
}

.website-stat {
  min-width: 92px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  gap: 2px;
}

.website-stat-line {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.website-stat strong {
  font-size: 0.92rem;
  line-height: 1;
}

.website-stat span {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.website-stat small {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.25;
}

.hero-summary:empty {
  display: none;
}

.publishing-toolbar-main {
  grid-template-columns: 1fr;
  gap: 10px;
}

.publishing-header-band {
  display: grid;
  gap: 0;
}

.publishing-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.publishing-title-row h2 {
  margin: 0;
  font-size: 1rem;
}

.publishing-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: end;
}

.publishing-toolbar-actions .compact-field {
  min-width: 96px;
  flex: 0 0 auto;
}

.publishing-toolbar-actions .search-field {
  min-width: 148px !important;
  flex: 1 1 170px;
}

.publishing-toolbar-actions input,
.publishing-toolbar-actions select {
  min-height: 32px;
  padding: 7px 10px;
}

#applyGlobalSchedule {
  min-height: 32px;
  padding: 0 12px;
  white-space: nowrap;
}

#publishToolbarMeta:empty {
  display: none;
}

.publishing-toolbar-footer {
  grid-template-columns: 1fr;
  justify-content: start;
}

#publishDateSummary {
  font-size: 0.74rem;
}

.publishing-title-row .meta-chip,
.publishing-title-row .ghost {
  min-height: 30px;
}

#publishScopeChip,
#publishCountLabel {
  font-size: 0.74rem;
}

#clearPublishScope {
  font-size: 0.76rem;
  padding: 0 10px;
}

.article-title-stack .muted,
.publication-row-copy .muted,
.history-main .muted {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.article-title-stack .muted {
  color: var(--muted);
}

.article-title-stack .muted::before,
.publication-row-copy .muted::before,
.history-main .muted::before {
  content: "";
}

.article-title-stack .muted,
.publication-row-copy .muted,
.history-main .muted {
  font-size: 0.72rem;
}

.article-title-stack .muted {
  color: var(--muted);
}

.article-title-stack .muted .tone-good,
.publication-row-copy .tone-good,
.history-main .tone-good {
  color: #34c759;
}

.article-title-stack .muted .tone-warn,
.publication-row-copy .tone-warn,
.history-main .tone-warn {
  color: #ffd60a;
}

.article-title-stack .muted .tone-bad,
.publication-row-copy .tone-bad,
.history-main .tone-bad {
  color: #ff3b30;
}

.article-title-stack .muted .tone-accent,
.publication-row-copy .tone-accent,
.history-main .tone-accent {
  color: #0a84ff;
}

.sidebar-brand .brand-mark {
  font-size: 1.35rem;
}

.sidebar-brand .header-context {
  font-size: 0.72rem;
  padding: 4px 8px;
}

.sidebar-tab {
  min-height: 34px;
  font-size: 0.76rem;
}

.tab-icon {
  width: 16px;
  height: 16px;
  font-size: 0.66rem;
}

.sidebar-utility-mount button,
.sidebar-utility-mount .engine-badge {
  min-height: 32px;
  font-size: 0.76rem;
}

.queue-header-tools {
  gap: 8px;
  flex-wrap: nowrap;
}

.queue-header-tools .filter-select {
  min-width: 118px;
}

.queue-header-tools #quickImportButton {
  min-width: 96px;
}

.article-row-summary {
  padding: 9px 12px;
}

.article-row-meta {
  gap: 6px;
}

.article-title-stack .muted {
  font-size: 0.72rem;
}

.article-row .meta-chip:empty {
  display: none;
}

@media (max-width: 1180px) {
  .app-shell,
  .two-column-grid,
  .flow-detail-grid,
  .three-col,
  .flow-head-grid,
  .queue-layout,
  .publishing-toolbar-main,
  .publishing-toolbar-actions,
  .publishing-toolbar-footer,
  .publication-toolbar-main,
  .publication-columns {
    grid-template-columns: 1fr;
  }

  .flow-topline,
  .flow-settings-bar,
  .workspace-hero,
  .detail-head {
    align-items: stretch;
  }

  .compact-flow-head,
  .compact-flow-meta,
  .flow-head-line,
  .compact-pills,
  .compact-actions,
  .compact-settings {
    flex-wrap: wrap;
  }

  .flow-detail-panel {
    position: static;
    min-height: auto;
  }

  .article-row-summary,
  .article-detail-grid,
  .publication-row {
    grid-template-columns: 1fr;
  }

  .article-row-meta,
  .publication-row-side,
  .article-row-actions {
    justify-content: flex-start;
  }

  .article-row .publish-dropzone,
  .article-field-meta {
    grid-column: auto;
    grid-row: auto;
  }

  .detail-empty {
    min-height: 320px;
  }
}

  @media (max-width: 860px) {
    .app-shell {
      grid-template-columns: 1fr;
    }

  .sidebar {
    position: static;
    min-height: auto;
  }

  .sidebar-panel {
    min-height: auto;
  }

  .publishing-toolbar-actions,
  .publication-filter-bar {
    grid-template-columns: 1fr;
  }
  }
