* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: #f7f8fb; color: #111827; }
.app-topbar { background: #0f172a; border-bottom: 1px solid #1f2937; }
.app-topbar-inner { width: 100%; max-width: none; margin: 0; padding: 10px 16px; display: flex; gap: 10px; }
.app-nav-link { color: #cbd5e1; text-decoration: none; font-size: 13px; padding: 6px 10px; border-radius: 6px; }
.app-nav-link:hover { background: #1e293b; color: #fff; }
.app-nav-link.is-active { background: #2563eb; color: #fff; }
.app-nav-link.is-secondary { display: inline-block; background: #334155; }
.app-nav-link.is-dark { display: inline-block; background: #0f172a; }
.app-live-stamp { margin-left: auto; color: #93c5fd; font-size: 12px; padding: 7px 2px; white-space: nowrap; }
.app-nav-link.logout { margin-left: 6px; }

.app-nav-item { position: relative; display: inline-flex; align-items: center; }
/* Bridge hover from "Items" link to submenu: abs. submenu doesn't expand parent height,
   so a gap/margin loses :hover. Padding + overlap fixes the dead zone. */
.app-nav-item-dropdown {
  position: relative;
  padding-bottom: 10px;
  margin-bottom: -10px;
}
.app-nav-item-dropdown .app-nav-submenu {
  display: flex;
  visibility: hidden;
  pointer-events: none;
  position: absolute;
  top: calc(100% - 6px);
  left: 0;
  margin-top: 0;
  min-width: 200px;
  padding: 6px 0;
  background: #0f172a;
  border: 1px solid #1f2937;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 200;
  flex-direction: column;
  /* 200ms delay before hiding so mouse can travel to submenu items */
  transition: visibility 0s 200ms;
}
.app-nav-item-dropdown:hover .app-nav-submenu {
  visibility: visible;
  pointer-events: auto;
  transition: none;
}
.app-nav-sublink {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 13px;
  padding: 8px 14px;
  white-space: nowrap;
}
.app-nav-sublink:hover { background: #1e293b; color: #fff; }
.app-nav-sublink.is-active { background: #1e3a5f; color: #fff; }
.app-page { width: 100%; max-width: none; margin: 0; padding: 20px 16px 32px; }
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px; margin-bottom: 12px; }
h1 { margin: 0 0 12px; font-size: 24px; }
.small { color: #64748b; font-size: 12px; }
.ok { color: #15803d; }
.error { color: #b91c1c; }
input[type="text"], input[type="password"], input[type="number"], textarea, select {
    width: 100%;
    max-width: 480px;
    padding: 7px 9px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
}
textarea { min-height: 90px; max-width: 640px; font-family: inherit; }
textarea.textarea-short {
    min-height: 42px;
    height: auto;
    max-height: none;
    resize: vertical;
}
button {
    border: 0;
    border-radius: 4px;
    background: #2563eb;
    color: #fff;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.form-stack { display: grid; grid-template-columns: 1fr; gap: 12px; max-width: 760px; }
.field-row { display: grid; grid-template-columns: 180px minmax(240px, 420px) minmax(220px, 1fr) minmax(180px, 1fr); gap: 8px 12px; align-items: start; }
.field-row label { display: block; font-weight: 400; font-size: 12px; color: #475467; padding-top: 8px; }
.field-row .field-control { max-width: 100%; }
.field-row .field-control select[multiple] { width: 100%; max-width: 100%; min-width: 0; }
.field-row .field-help { color: #64748b; font-size: 12px; margin: 8px 0 0; }
.field-row .field-example { color: #475569; font-size: 12px; margin: 8px 0 0; }
.field-link { display: inline; font-size: 12px; margin-right: 3px; }
.checkbox-list {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px;
    max-width: 480px;
    max-height: 154px;
    overflow: auto;
    background: #fff;
}
.checkbox-list.checkbox-list-plain {
    border: none;
    border-radius: 0;
    padding: 0;
    max-width: none;
    max-height: none;
    overflow: visible;
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.checkbox-list-item {
    display: block;
    margin: 0 0 6px;
    font-size: 13px;
    color: #111827;
}
.checkbox-list-item:last-child { margin-bottom: 0; }
.checkbox-list-item input { margin-right: 6px; }
.checkbox-list-plain .checkbox-list-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    cursor: pointer;
    width: fit-content;
}
.checkbox-list-plain .checkbox-list-item input { margin: 0; }
.checkbox-list-filter-wrap {
    position: sticky;
    top: -8px;
    z-index: 2;
    background: #fff;
    margin: -8px -8px 6px -8px;
    padding: 8px 8px 6px;
    border-bottom: 1px solid #eef2f7;
}
.checkbox-list .checkbox-list-filter {
    max-width: none;
    width: 100%;
}
.checkbox-filter-input-wrap { display: flex; align-items: center; gap: 4px; }
.checkbox-filter-input-wrap .checkbox-list-filter { flex: 1; min-width: 0; }
.checkbox-list-empty {
    font-size: 12px;
    color: #64748b;
    margin-top: 6px;
}
.radio-group { display: flex; flex-direction: column; gap: 4px; }
.radio-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #111827;
    width: fit-content;
}
.radio-option input { margin: 0; }
.inline-check { display: inline-flex; align-items: center; gap: 6px; }
.small-block { display: block; }
.small-block-muted { display: block; color: #64748b; }
.mt-12 { margin-top: 12px; }
.field-help code,
.field-example code,
td code {
    font-family: inherit;
    font-size: inherit;
    background: transparent;
}
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.inline-form { display: inline; }

.cms-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.cms-toolbar label { font-size: 12px; color: #64748b; }
.cms-table-wrap { overflow: auto; border-radius: 6px; }
.cms-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}
.cms-table th,
.cms-table td {
    border-bottom: 1px solid #f0f1f4;
    padding: 8px;
    text-align: left;
    vertical-align: top;
    font-size: 13px;
}
.cms-table th {
    background: #fafbfc;
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
}
.cms-table th a.sort-link,
.deals-table th a.sort-link {
    color: inherit;
    text-decoration: none;
}
.cms-table th a.sort-link:hover,
.deals-table th a.sort-link:hover {
    color: inherit;
    text-decoration: none;
}
.cms-table th a.sort-link::after,
.deals-table th a.sort-link::after {
    content: " ↕";
    color: #94a3b8;
    font-weight: 400;
    font-size: 11px;
}
.cms-table th a.sort-link.is-sort-asc::after,
.deals-table th a.sort-link.is-sort-asc::after { content: " ↑"; color: #2563eb; }
.cms-table th a.sort-link.is-sort-desc::after,
.deals-table th a.sort-link.is-sort-desc::after { content: " ↓"; color: #2563eb; }
.cms-table tbody tr:nth-child(even) { background: #fcfdff; }
.cms-table-compact th,
.cms-table-compact td {
    padding: 6px 8px;
    font-size: 12px;
}

.status-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.status-todo { color: #92400e; background: #fef3c7; border: 1px solid #fcd34d; }
.status-active { color: #065f46; background: #d1fae5; border: 1px solid #a7f3d0; }
.status-text-todo { color: #dc2626; font-weight: 600; }
.status-text-active { color: #16a34a; font-weight: 600; }
#items_table th:nth-child(3), #items_table td:nth-child(3),
#items_table th:nth-child(4), #items_table td:nth-child(4),
#items_table th:nth-child(6), #items_table td:nth-child(6),
#items_table th:nth-child(7), #items_table td:nth-child(7),
#items_table th:nth-child(13), #items_table td:nth-child(13),
#items_table th:nth-child(14), #items_table td:nth-child(14),
#items_table th:nth-child(15), #items_table td:nth-child(15),
#items_table th:nth-child(17), #items_table td:nth-child(17) { width: 1%; white-space: nowrap; padding: 4px 2px; }
.active-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: #065f46;
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    vertical-align: middle;
}
.gate-hint {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 6px;
}
.gate-hint-lenient { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.gate-hint-balanced { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.gate-hint-strict { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.gate-check-pass { color: #166534; font-weight: 600; }
.gate-check-fail { color: #991b1b; font-weight: 600; }
.gate-check-manual { color: #1d4ed8; font-weight: 600; }
.run-focus { outline: 2px solid #2563eb; outline-offset: -2px; background: #eff6ff !important; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 8px; }
.summary-item { border: 1px solid #e4e7ec; border-radius: 8px; padding: 8px 10px; background: #fff; }
.summary-item .k { font-size: 11px; color: #64748b; display: block; }
.summary-item .v { font-size: 18px; font-weight: 700; color: #0f172a; }
.source-item-strong { margin-top: 0; font-weight: 500; }
.index-table-wide { width: 100%; min-width: 920px; border-collapse: collapse; }
.index-table-wider { width: 100%; min-width: 1460px; border-collapse: collapse; }
.index-th { text-align: left; border-bottom: 1px solid #e5e7eb; padding: 6px; }
.index-cell { border-bottom: 1px solid #f1f5f9; padding: 6px; }
.index-col-action { min-width: 260px; }

.table-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.table-tools .small { margin: 0; }
.table-tools button {
    font-size: 11px;
    padding: 3px 6px;
}
.table-tools button.secondary {
    background: #1d4ed8;
    color: #ffffff;
}
.table-tools button.secondary:hover {
    background: #1e40af;
}
.table-tools-inline { margin: 0; flex-wrap: nowrap; }
.list-meta-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 6px 0 8px 0;
}
.list-meta-row .small,
.list-meta-row .pager {
    margin: 0;
}
.list-meta-row .pager {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.list-meta-row .table-tools {
    margin: 0;
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable::after { content: " ↕"; color: #94a3b8; font-weight: 400; font-size: 11px; }
th.sortable.is-sort-asc::after { content: " ↑"; color: #2563eb; }
th.sortable.is-sort-desc::after { content: " ↓"; color: #2563eb; }
thead tr.column-filter-row th { background: #f8fafc; top: 34px; }
thead tr.column-filter-row input { max-width: 220px; width: 100%; font-size: 12px; padding: 5px 7px; }
tbody tr.row-selected { background: #eff6ff !important; }
.col-filter-input-wrap { display: flex; align-items: center; gap: 4px; }
.col-filter-not { display: inline-flex; align-items: center; font-size: 11px; color: #667085; gap: 2px; }
.col-filter-not input { margin: 0; }
.col-filter-clear {
    border: 1px solid #d0d5dd;
    background: #fff;
    color: #667085;
    border-radius: 3px;
    padding: 0 4px;
    line-height: 16px;
    height: 18px;
    font-size: 11px;
    cursor: pointer;
    display: none;
}
.col-filter-clear.is-visible { display: inline-block; }

/* Unified page styles (single stylesheet) */
.table-wrap { overflow: auto; border-radius: 6px; }
.pager { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pager-item { display: inline-block; min-width: 34px; padding: 3px 5px; }
.pager-item.is-disabled { color: #111827; text-decoration: none; cursor: default; }

/* Sources-style form layout as default */
.field-row,
.form-rows {
    display: grid;
    grid-template-columns: 160px minmax(260px, 320px) minmax(220px, 1fr) minmax(180px, 1fr);
    gap: 8px 12px;
    align-items: start;
}
.field-row label,
.form-rows label {
    display: block;
    font-weight: 400;
    font-size: 12px;
    color: #475467;
    padding-top: 8px;
    white-space: nowrap;
}
.field-row .field-control,
.form-rows .field-control { max-width: 320px; }
.field-row .field-help,
.form-rows .field-help { color: #64748b; font-size: 12px; margin: 8px 0 0; line-height: 1.35; }
.field-row .field-example,
.form-rows .field-example { color: #94a3b8; font-size: 12px; margin: 8px 0 0; line-height: 1.35; }
.form-stack { max-width: 100%; }
.settings-meta-grid { width: fit-content; max-width: 100%; }
.general-rows { grid-template-columns: 160px minmax(170px, 310px) minmax(220px, 1fr) minmax(180px, 1fr); }
.general-rows .field-control { width: 300px; max-width: 300px; }
.general-rows .field-control > input[type="text"],
.general-rows .field-control > input[type="number"],
.general-rows .field-control > select,
.general-rows .field-control > textarea { max-width: 100%; }
.general-rows > label { white-space: normal; }
.form-rows .field-control > label {
    display: block;
    font-family: inherit;
    font-size: 12px;
    font-weight: 400;
    color: #475467;
    white-space: normal;
    line-height: 1.35;
    padding-top: 0;
}
.form-rows .field-control > label > input[type="checkbox"] {
    vertical-align: top;
    margin-top: 1px;
}

/* Shared source/deals/support/login helpers */
.run-form { max-width: 100%; }
.source-list { display: block; max-width: 700px; }
.source-item { display: block; margin: 4px 0; }
.run-log { background: #ffffff; color: #344054; border: 1px solid #e4e7ec; border-radius: 8px; padding: 10px; font-family: Menlo, Consolas, monospace; font-size: 12px; white-space: pre-wrap; min-height: 120px; max-height: 280px; overflow-y: auto; overflow-x: auto; }
.status-icon { display:inline-flex; align-items:center; justify-content:center; font-size:14px; line-height:1; margin-left:6px; min-width:16px; color:#16a34a; }
.status-icon.pulse { animation: statusPulse 700ms ease-out 1; }
@keyframes statusPulse {
    0% { transform: scale(0.85); opacity: 0.65; }
    55% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
.source-actions { display:flex; gap:8px; margin:6px 0 8px; flex-wrap:wrap; }
.source-action-link { color: #475467; font-size: 12px; text-decoration: none; cursor: pointer; }
.source-action-link:hover { text-decoration: underline; }
.run-settings-grid { display:grid; grid-template-columns: 160px 300px 260px 220px; align-items:start; width:fit-content; max-width:100%; gap:8px 10px; }
.run-settings-grid > label { white-space: nowrap; font-weight: 600; }
.run-settings-grid .field-control { max-width: 300px; }
.run-mode-options { display:block; margin-top:4px; }
.run-mode-option { display:block; margin:4px 0; border:0; padding:0; background:transparent; }
.run-warning { margin-top:8px; padding:8px 10px; border:1px solid #facc15; background:#fffbeb; color:#854d0e; border-radius:8px; font-size:12px; display:none; }
.run-submit-row { margin-top: 10px; }
.run-status-meta { margin-top: -2px; }
.run-status-meta.live { color: #0b7a27; font-weight: 600; }
.index-compact p,
.index-compact label,
.index-compact td,
.index-compact th { font-size: 12px; }
.index-compact .field-help,
.index-compact .field-example { font-size: 12px; line-height: 1.35; }
.table-scroll { width: 100%; overflow-x: auto; overflow-y: hidden; }
.index-table th,
.index-table td { vertical-align: top; }
.num-col { text-align: right !important; }
.attention-pill { display: inline-block; padding: 2px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; border: 1px solid transparent; }
.attention-none { color: #166534; background: #dcfce7; border-color: #86efac; }
.attention-has { color: #991b1b; background: #fee2e2; border-color: #fca5a5; }
.quick-links { display: inline-flex; gap: 8px; align-items: center; margin-left: 6px; }
.quick-link { color: #475467; font-size: 12px; text-decoration: none; border-bottom: 1px dashed #94a3b8; }
.quick-link:hover { color: #111827; border-bottom-color: #111827; }
.gate-pass { color: #166534; font-weight: 600; }
.gate-fail { color: #991b1b; font-weight: 600; }
.gate-manual { color: #1d4ed8; font-weight: 600; }
.small-mono { font-family: Menlo, Consolas, monospace; font-size: 11px; color: #475467; }
.doc { white-space: pre-wrap; font-family: Menlo, Consolas, monospace; font-size: 12px; background: #fff; border: 1px solid #e6e7eb; border-radius: 8px; padding: 10px; }
.login-page { max-width: 560px; padding-top: 60px; }
.login-password-label { display: block; margin-top: 8px; }
.login-actions { margin-top: 10px; }

/* Source management tables/forms */
.field-grid { display: grid; grid-template-columns: 1fr; gap: 10px 0; align-items: end; max-width: 820px; }
.two-col { display: grid; grid-template-columns: 1fr; gap: 10px 0; max-width: 820px; }
.wide { max-width: 820px; }
.wide textarea { max-width: 700px; width: 100%; min-height: 90px; }
.wide input[type="text"] { max-width: 560px; }
.crawl-table { width: 100%; border-collapse: collapse; }
.crawl-table th,
.crawl-table td { border-bottom: 1px solid #e5e7eb; padding: 6px; vertical-align: top; text-align: left; font-size: 12px; }
.crawl-table tbody tr:last-child td,
.crawl-table.no-row-dividers tbody td { border-bottom: 0; }
.crawl-table th { background: #f8fafc; }
.crawl-table th.col-action,
.crawl-table td.col-action { min-width: 170px; width: 170px; }
.source-element-actions { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.source-element-actions form { margin: 0; }
.crawl-form input[type="text"],
.crawl-form input[type="number"],
.crawl-form textarea,
.crawl-form select { width: 100%; }
.crawl-form input[type="text"] { max-width: 420px; }
.crawl-form input[type="number"] { max-width: 120px; }
.crawl-form select { max-width: 180px; }
.crawl-form textarea { max-width: 560px; min-height: 68px; }
.crawl-table td textarea { min-height: 30px; height: 30px; max-width: 420px; overflow: auto; }
.section-title-row { grid-column: 1 / -1; margin-top: 6px; font-weight: 700; color: #111827; }
.section-note-row { grid-column: 1 / -1; margin-top: -4px; margin-bottom: 4px; color: #64748b; font-size: 12px; }
.section-divider { border: 0; border-top: 1px solid #cbd5e1; margin: 12px 0 10px; }
.transform-table tbody tr.dragging { opacity: 0.55; }
.drag-handle { cursor: move; color: #64748b; font-size: 13px; user-select: none; }
.transform-op-select,
.transform-from-select { max-width: 135px; }
.transform-actions { display: flex; gap: 6px; white-space: nowrap; align-items: center; }
.transform-actions button { padding: 6px 8px; font-size: 12px; }
.mb-8 { margin-bottom: 8px; }
.sources-country-checkbox-label { display: block; margin-bottom: 4px; }
.sources-section-title-spaced { margin: 12px 0 8px 0; }
.sources-hidden-block { display: none; }
.sources-section-title { margin: 0 0 8px 0; }
.sources-overflow-auto { overflow: auto; }
.sources-inline-map-form { display: flex; gap: 4px; align-items: center; margin-top: 4px; }
.sources-map-target-select { max-width: 170px; }
.sources-op-guide { margin: 8px 0 12px 0; border: 1px solid #e4e7ec; border-radius: 8px; padding: 8px; }
.sources-transform-copy-panel { display: none; margin-top: 12px; }
.mt-10 { margin-top: 10px; }

/* Deals table (reference list behavior) */
.deals-table { width: max-content; min-width: 100%; border-collapse: collapse; table-layout: auto; }
.deals-table th,
.deals-table td { border-bottom: 1px solid #f0f1f4; padding: 4px 6px; text-align: left; vertical-align: top; line-height: 1.25; font-size: 12px; }
.deals-table th { background: #fafbfc; position: sticky; top: 0; z-index: 1; }
.deals-table.has-source-groups thead tr.deals-group-row th { top: 0; z-index: 5; font-weight: 600; }
.deals-table.has-source-groups thead tr.deals-col-row th { top: 24px; z-index: 4; }
.deals-table.has-source-groups thead tr.col-filter-row th { top: 50px; z-index: 3; }
.deals-table.has-source-groups thead tr.deals-col-row th.sticky-col {
    position: sticky;
    z-index: 9;
    background: #fafbfc;
}
.deals-table.has-source-groups thead tr.col-filter-row th.sticky-col {
    position: sticky;
    z-index: 10;
    background: #ffffff;
}
.deals-table .deals-group-header { text-align: left; font-size: 11px; letter-spacing: 0.01em; padding-left: 8px; }
.deals-table .deals-group-base { background: #f3f4f6; color: #374151; }
.deals-table .deals-group-ce-custom { background: #eef2ff; color: #3730a3; }
.deals-table .deals-group-ce-fixed { background: #effaf6; color: #065f46; }
.deals-table .deals-group-sticky-1,
.deals-table .deals-group-sticky-2,
.deals-table .deals-group-sticky-3,
.deals-table .deals-group-sticky-4 {
    position: sticky;
    z-index: 7;
}
.deals-table .deals-group-sticky-1 { left: 0; box-shadow: 2px 0 0 #dbe0e8; }
.deals-table .deals-group-sticky-2 { left: 388px; }
.deals-table .deals-group-sticky-3 { left: 428px; }
.deals-table .deals-group-sticky-4 {
    left: 580px;
    box-shadow: 2px 0 0 #dbe0e8;
}
.deals-table.has-source-groups thead tr.deals-group-row th.deals-group-sticky-1,
.deals-table.has-source-groups thead tr.deals-group-row th.deals-group-sticky-2,
.deals-table.has-source-groups thead tr.deals-group-row th.deals-group-sticky-3,
.deals-table.has-source-groups thead tr.deals-group-row th.deals-group-sticky-4 {
    z-index: 11;
}
.deals-table th.ce-custom,
.deals-table td.ce-custom { background: #f7f9ff; }
.deals-table th.ce-fixed,
.deals-table td.ce-fixed { background: #f3fbf7; }
.deals-table tbody tr:nth-child(even) { background: #fcfdff; }
.deals-table tbody tr.row-active { background: #eff6ff !important; }
.deals-table .sticky-col { position: sticky; z-index: 2; background: #fff; }
.deals-table thead .sticky-col { background: #fafbfc; z-index: 4; }
.deals-table tbody tr:nth-child(even) td.sticky-col { background: #fcfdff; }
.deals-table tbody tr.row-active td.sticky-col { background: #eff6ff !important; }
.deals-table tbody tr.row-active td.ce-custom { background: #e7ecff !important; }
.deals-table tbody tr.row-active td.ce-fixed { background: #e5f7ee !important; }
.deals-table .sticky-last { box-shadow: 2px 0 0 #dbe0e8; }
.sticky-sel { left: 0; min-width: 26px; width: 26px; }
.sticky-action { left: 26px; min-width: 162px; width: 162px; }
.sticky-source { left: 188px; min-width: 120px; width: 120px; }
.sticky-deal-status { left: 308px; min-width: 40px; width: 40px; }
.sticky-candidate { left: 348px; min-width: 40px; width: 40px; }
.sticky-url-status { left: 388px; min-width: 40px; width: 40px; }
.sticky-updated { left: 428px; min-width: 40px; width: 40px; }
.sticky-brand { left: 468px; min-width: 112px; width: 112px; }
.sticky-deal-url { left: 580px; min-width: 112px; width: 112px; }
.col-http { width: 60px; min-width: 60px; max-width: 60px; }
.col-action { width: 162px; max-width: 162px; white-space: nowrap; }
.col-select { width: 26px; max-width: 26px; }
.deals-table .url-cell { min-width: 280px; width: 280px; white-space: nowrap; }
.deals-table .url-cell a { display: block; white-space: nowrap; color: #344054; text-decoration: none; }
.deals-table .url-cell a:hover { color: #c2410c; text-decoration: none; }
.deals-table td.sticky-deal-url.url-cell { min-width: 112px; width: 112px; max-width: 112px; }
.deals-table td.sticky-deal-url.url-cell a { overflow: hidden; text-overflow: ellipsis; }
.brand-cell { min-width: 112px; width: 112px; white-space: nowrap; }
.title-cell { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desc-cell { max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.terms-cell { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crawl-cell { max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.date-cell { white-space: nowrap; color: #475467; }
.num-cell { text-align: right; }
.nowrap { white-space: nowrap; }
.link-btn {
    background: none;
    border: 0;
    color: #1d4ed8;
    cursor: pointer;
    padding: 0;
    font-size: 12px;
    line-height: 1;
    text-decoration: none;
}
.link-btn:hover { text-decoration: none; color: #1e40af; }
.scope-switch { display: inline-flex; gap: 6px; align-items: center; margin-left: 6px; }
.scope-btn { display: inline-block; border: 1px solid #1d4ed8; border-radius: 6px; padding: 2px 8px; font-size: 12px; text-decoration: none; color: #1d4ed8; background: #ffffff; }
.scope-btn.is-active { color: #ffffff; background: #1d4ed8; }
.scope-btn:hover { background: #eff6ff; }
.scope-btn.is-active:hover { background: #1e40af; }
.status-inline { display: inline-flex; align-items: center; margin-left: 2px; color: #475467; font-size: 12px; line-height: 1; white-space: nowrap; min-width: 10px; }
.action-inline { display: inline-flex; align-items: center; gap: 4px; line-height: 1; justify-content: flex-start; }
.bulk-progress { display: none; align-items: center; gap: 8px; }
.bulk-progress.active { display: inline-flex; }
.bulk-progress progress { width: 220px; height: 12px; }
.bulk-progress.done #bulk-progress-meta { color: #0b7a27; font-weight: 700; }
.filters-grid { display: grid; grid-template-columns: repeat(4, minmax(140px, 180px)); gap: 8px 10px; align-items: start; justify-content: start; width: fit-content; max-width: 100%; }
.filter-block { min-width: 140px; }
.filter-links { display: flex; gap: 8px; margin: 2px 0 4px 0; }
.editorial-filter { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.editorial-filter label { font-weight: 500; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.filter-link { color: #475467; font-size: 12px; text-decoration: none; cursor: pointer; }
.filter-link:hover { text-decoration: underline; }
.info-tip { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border: 1px solid #cbd5e1; border-radius: 999px; color: #64748b; font-size: 10px; line-height: 1; margin-left: 4px; cursor: help; user-select: none; }
.col-filter-row th { background: #ffffff; top: 26px; z-index: 2; }
.col-filter-row th.sticky-col { z-index: 6; }
.col-filter-input { width: 100%; min-width: 88px; box-sizing: border-box; padding: 3px 4px; font-size: 11px; }
.deals-filters-grid {
    grid-template-columns: 300px repeat(3, 150px) minmax(560px, 2.6fr);
    column-gap: 8px;
    row-gap: 6px;
    align-items: stretch;
}
.deals-filter-list { min-width: 180px; max-width: 100%; }
.deals-multiselect-block {
    height: 210px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.deals-multiselect-block > label { line-height: 1.2; min-height: 16px; }
.deals-multiselect-block .filter-links { margin: 2px 0 6px 0; }
.deals-multiselect-block .deals-filter-list {
    flex: 1;
    min-height: 0;
    overflow: auto;
}
.deals-filter-source { min-width: 300px; max-width: 300px; }
.deals-filter-compact { min-width: 150px; max-width: 150px; }
.deals-filter-compact > label { white-space: nowrap; }
.deals-filter-compact .deals-filter-list { min-width: 0; }
.deals-quick-block { min-width: 560px; }
.deals-quick-fields { gap: 8px; max-width: 100%; }
.deals-quick-fields .field-row { grid-template-columns: 120px minmax(150px, 200px) minmax(170px, 1fr) minmax(140px, 1fr); }
.deals-quick-fields .field-row label { padding-top: 6px; }
.deals-quick-fields .field-control input,
.deals-quick-fields .field-control select { max-width: 200px; }
.deals-quick-fields .field-help,
.deals-quick-fields .field-example { margin-top: 6px; }

/* Playbook and source_data specific small additions */
.step { border: 1px solid #e4e7ec; border-radius: 8px; padding: 10px; background: #fff; margin-bottom: 10px; }
.step h3 { margin: 0 0 6px; font-size: 14px; }
.step p { margin: 0 0 6px; font-size: 12px; color: #475467; }
.links { display:flex; gap:8px; flex-wrap:wrap; }
.small-list { margin: 6px 0 0 18px; color: #334155; font-size: 12px; }
.small-list li { margin: 2px 0; }
.source-data-table .url-cell { min-width: 440px; max-width: 760px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; word-break: normal; }
.source-data-table .dyn-cell { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-data-table .json-cell { max-width: 640px; word-break: break-word; font-family: Menlo, Consolas, monospace; }

.card-narrow { max-width: 870px; }
.card-mapping-spacer { padding-bottom: 400px; }
/* Deal category mapping: let dropdown extend past table (avoid clipping by overflow:auto) */
.card-mapping-spacer .cms-table-wrap { overflow: visible; }
#category_mapping_table td:nth-child(3) {
    overflow: visible;
    vertical-align: top;
}
/* Deal category mapping */
.mapping-filter-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.mapping-filter-input { width: 130px; }
.mapping-bulk-wrap { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.mapping-bulk-select { min-width: 130px; }
#mapping_bulk_status { color: #16a34a; }
.mapping-check-col { width: 28px; text-align: center; }
.mapping-filter-label { white-space: nowrap; }
#category_mapping_table { table-layout: fixed; width: 830px; }
#category_mapping_table th:nth-child(1),
#category_mapping_table td:nth-child(1) { width: 28px; text-align: center; padding: 4px 2px; }
#category_mapping_table th:nth-child(2),
#category_mapping_table td:nth-child(2) { width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#category_mapping_table th:nth-child(3),
#category_mapping_table td:nth-child(3) { width: 250px; }
#category_mapping_table th:nth-child(4),
#category_mapping_table td:nth-child(4) { width: 100px; text-align: right; }
#category_mapping_table th:nth-child(5),
#category_mapping_table td:nth-child(5) { width: 100px; text-align: center; }
.mapping-multi-select { position: relative; }
.mapping-summary { cursor: pointer; font-size: 13px; padding: 4px 6px; border: 1px solid #d1d5db; border-radius: 4px; background: #fff; min-height: 26px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; list-style: none; }
.mapping-summary::-webkit-details-marker { display: none; }
.mapping-summary::after { content: '\25BC'; font-size: 9px; color: #94a3b8; float: right; margin-left: 6px; }
details[open] > .mapping-summary::after { content: '\25B2'; }
.mapping-none { color: #94a3b8; }
.mapping-opts {
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 200;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    padding: 6px 0;
    min-width: 280px;
    max-width: min(96vw, 420px);
    /* Tall panel: use viewport so few table rows don't shrink the list */
    max-height: min(75vh, calc(100vh - 10rem));
    overflow-y: auto;
    margin-top: 2px;
}
.mapping-opt-label { display: block; padding: 3px 10px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.mapping-opt-label:hover { background: #f0f4ff; }
.mapping-opt-label input { margin-right: 6px; vertical-align: middle; }
.mapping-status-col { text-align: center; }
.mapping-status { font-size: 11px; color: #94a3b8; }
.mapping-status.is-ok { color: #16a34a; font-weight: 600; }
.deals-group-mapped { background: #eff6ff; color: #000; }

/* Quick alias block */
.quick-alias-row { display: flex; align-items: center; gap: 8px; }
.quick-alias-row input[type="text"] { width: 240px; }
.quick-alias-row select { width: 280px; }
.quick-alias-row button { white-space: nowrap; }

/* Item image fields */
.image-field-section { border-top: 1px solid #e2e8f0; padding: 12px 0; }
.image-field-heading { margin: 0 0 8px 0; font-size: 13px; font-weight: 600; color: #334155; }
.image-open-link { font-size: 11px; font-weight: 400; color: #6366f1; margin-left: 8px; }
.image-open-link:hover { text-decoration: underline; }
.image-field-block { display: flex; gap: 16px; align-items: flex-start; }
.image-preview-wrap.preview-image { flex-shrink: 0; width: 500px; }
.image-preview-wrap.preview-logo { flex-shrink: 0; width: 200px; }
.preview-image .image-preview { width: 500px; min-height: 80px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 4px; position: relative; overflow: hidden; }
.preview-logo .image-preview {
    width: 200px;
    min-height: 200px;
    box-sizing: border-box;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.preview-logo .image-preview img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}
.image-preview img { display: block; max-width: 100%; height: auto; }
.preview-logo .image-preview .image-placeholder { padding: 0; height: 100%; }
.image-preview .image-placeholder { display: flex; align-items: center; justify-content: center; width: 100%; color: #94a3b8; font-size: 12px; padding: 24px 0; }
.image-loading-bar { height: 3px; background: #e2e8f0; border-radius: 2px; margin-top: 4px; overflow: hidden; display: none; }
.image-loading-bar.is-active { display: block; }
.image-loading-bar-fill { height: 100%; background: #6366f1; border-radius: 2px; width: 0; transition: width 0.3s ease; }
.image-loading-bar-fill.is-indeterminate { animation: image-load-pulse 1.5s ease-in-out infinite; }
@keyframes image-load-pulse { 0% { width: 15%; } 50% { width: 85%; } 100% { width: 15%; } }
.image-size-warning { margin-top: 4px; font-size: 11px; color: #dc2626; min-height: 16px; }
.image-inputs-stack { flex: 1; min-width: 150px; max-width: 280px; display: flex; flex-direction: column; gap: 6px; }
.image-control-row { display: flex; align-items: center; gap: 6px; }
.image-control-row .image-field-label { width: 60px; flex-shrink: 0; font-size: 12px; color: #475569; }
.image-control-row input[type="text"] { flex: 1; min-width: 0; }
.image-upload-btn { display: inline-block; padding: 4px 10px; font-size: 12px; border: 0; border-radius: 4px; background: #2563eb; color: #fff; cursor: pointer; white-space: nowrap; }
.image-upload-btn:hover { background: #1d4ed8; }
.image-control-or { font-size: 11px; color: #94a3b8; }
.image-url-input { font-size: 12px; }
.image-url-load { font-size: 12px; padding: 4px 10px; }
.image-remove-link { font-size: 11px; color: #dc2626; text-decoration: none; cursor: pointer; }
.image-remove-link:hover { text-decoration: underline; }
.image-preview .cropper-container { max-width: 100% !important; }
