:root {
  color-scheme: light;
  font-family: Inter, Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f6f8fb;
  font-synthesis: none;
  --blue: #1a56db;
  --blue-dark: #123fa7;
  --blue-soft: #eaf1ff;
  --muted: #64748b;
  --line: #dfe6ef;
  --surface: #fff;
  --green: #059669;
  --green-soft: #dff7eb;
  --red: #dc2626;
  --red-soft: #fff0f1;
  --orange: #d97706;
  --orange-soft: #fff5e6;
  --shadow: 0 8px 28px rgb(15 23 42 / 8%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; background: #f6f8fb; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  color: #fff;
  background: linear-gradient(112deg, var(--blue-dark), var(--blue) 58%, #2876e9);
  box-shadow: 0 2px 12px rgb(15 23 42 / 18%);
}
.header-inner {
  display: grid;
  grid-template-columns: minmax(230px, auto) 1fr auto;
  align-items: center;
  width: min(1920px, 100%);
  min-height: 76px;
  margin: auto;
  padding: 12px 28px;
  gap: 24px;
}
.header-inner > * { min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: 11px; width: fit-content; color: #fff; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid rgb(255 255 255 / 55%); border-radius: 11px; background: rgb(255 255 255 / 14%); font-size: 22px; font-weight: 900; }
.brand > span:last-child { display: grid; line-height: 1.1; }
.brand strong { font-size: 17px; }
.brand small { margin-top: 4px; color: rgb(255 255 255 / 76%); font-size: 11px; font-weight: 600; }
.header-stats { display: flex; justify-content: flex-end; align-items: center; gap: 15px; font-size: 12px; white-space: nowrap; }
.header-stats > span + span { padding-left: 15px; border-left: 1px solid rgb(255 255 255 / 30%); }
.max-connection { padding: 6px 10px; border-radius: 999px; font-weight: 800; }
.max-connection.is-checking { background: rgb(255 255 255 / 14%); }
.max-connection.is-ready { background: rgb(5 150 105 / 48%); }
.max-connection.is-error { background: rgb(220 38 38 / 46%); }
.account { display: flex; align-items: center; gap: 10px; font-size: 12px; }

main { width: min(1920px, 100%); margin: auto; padding: 24px 28px 56px; }
.login-card { width: min(430px, 100%); margin: 7vh auto; padding: 30px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.login-card h1, .content-heading h1, .settings-heading h1 { margin: 0; color: #0f172a; }
.eyebrow { margin: 0 0 6px; color: var(--blue); font-size: 11px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.notice { padding: 11px 13px; border-radius: 9px; color: #174ea6; background: #eef5ff; line-height: 1.45; }
.notice.error { color: #991b1b; background: #fff0f1; }

.form-grid { display: grid; gap: 12px; }
.form-grid label, .filter-panel label, .confirm-dialog label { display: grid; gap: 5px; color: #526173; font-size: 12px; font-weight: 700; }
input, select, textarea { width: 100%; padding: 10px 11px; border: 1px solid #cfd9e6; border-radius: 9px; color: #172033; background: #fff; outline: none; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: #78a2ff; box-shadow: 0 0 0 3px rgb(59 130 246 / 13%); }

.button { min-height: 40px; padding: 9px 14px; border: 1px solid transparent; border-radius: 9px; font-weight: 780; transition: filter .15s ease, transform .15s ease, opacity .15s ease; }
.button:hover:not(:disabled) { filter: brightness(.96); transform: translateY(-1px); }
.button:focus-visible, .menu-bar button:focus-visible, .category-button:focus-visible, .caption-toggle:focus-visible { outline: 3px solid rgb(59 130 246 / 32%); outline-offset: 2px; }
.button:disabled { cursor: not-allowed; opacity: .58; }
.button[aria-busy="true"] { cursor: wait; }
.button.primary { color: #fff; background: var(--blue); }
.button.secondary { color: var(--blue-dark); border-color: #b9cffb; background: #edf4ff; }
.button.light { color: #334155; border-color: #cfd9e6; background: #fff; }
.button.success { color: #fff; background: var(--green); }
.button.warning { color: #fff; background: var(--orange); }
.button.danger { color: #b42318; border-color: #f4b4b4; background: var(--red-soft); }
.button.compact { min-height: 32px; padding: 6px 10px; font-size: 11px; }

.menu-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 16px; padding: 7px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 2px 8px rgb(15 23 42 / 4%); }
.menu-bar button { padding: 9px 13px; border: 0; border-radius: 8px; color: #526173; background: transparent; font-weight: 750; }
.menu-bar button.active { color: #fff; background: var(--blue); }
.menu-bar span { margin-left: auto; padding-right: 8px; color: var(--muted); font-size: 11px; }
.safety-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; padding: 12px 14px; border: 1px solid #f2c16b; border-radius: 11px; color: #7a4203; background: #fff8e8; }
.safety-banner.critical { color: #991b1b; border-color: #f3a6a6; background: #fff0f1; }
.safety-banner div { display: grid; gap: 3px; }
.safety-banner span { font-size: 12px; line-height: 1.4; }
.filter-panel { display: flex; align-items: end; flex-wrap: wrap; gap: 11px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.filter-panel label { min-width: 175px; }
.filter-panel .search-field { flex: 1 1 270px; }
.filter-panel .button { margin-left: auto; }
.filter-panel.settings-mode { justify-content: flex-start; }
.filter-panel .price-filter { flex: 0 1 155px; min-width: 130px; }
.bulk-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 12px; }
.bulk-actions label, .listing-select { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.bulk-actions input, .listing-select input { width: 17px; height: 17px; flex: none; }
.bulk-actions > span { color: var(--muted); margin-right: auto; }
.listing-select { padding: 8px 10px; font-size: 11px; color: #526173; background: #f8faff; }
.ad-card.bulk-selected { border-color: #2863ed; box-shadow: 0 0 0 2px #b7d0ff; }

.kpis { display: grid; grid-template-columns: repeat(7, minmax(125px, 1fr)); gap: 10px; margin: 16px 0; }
.kpi { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: 0 2px 8px rgb(15 23 42 / 4%); }
.kpi { text-align: left; }
.kpi:hover { border-color: #7aa8f3; background: #f6f9ff; }
.kpi:focus-visible { outline: 3px solid #93bafa; outline-offset: 2px; }
.edit-caption { margin-top: 8px; }
.caption-editor { width: 100%; min-height: 240px; resize: vertical; line-height: 1.5; }
.profile-preview { padding: 12px; background: #f4f8ff; border-radius: 9px; white-space: pre-wrap; }
.photo-review-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; }
.photo-review-toolbar label { display: flex; align-items: center; flex: 1 1 250px; }
.photo-review-toolbar input[type="checkbox"] { width: auto; flex: none; }
.kpi::before { content: ""; flex: 0 0 7px; width: 7px; height: 31px; border-radius: 3px; background: var(--blue); }
.kpi:nth-child(2)::before { background: var(--orange); }
.kpi:nth-child(3)::before { background: var(--green); }
.kpi:nth-child(4)::before { background: #8b5cf6; }
.kpi:nth-child(5)::before { background: #0f9a82; }
.kpi:nth-child(6)::before { background: var(--red); }
.kpi strong { display: block; overflow: hidden; color: #142033; font-size: 22px; line-height: 1; text-overflow: ellipsis; }
.kpi span { display: block; margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.feed-layout { display: grid; grid-template-columns: 225px minmax(0, 1fr); align-items: start; gap: 18px; }
.feed-main { min-width: 0; }
.category-section { position: sticky; top: 78px; z-index: 20; margin-top: 18px; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: rgb(255 255 255 / 96%); box-shadow: 0 2px 8px rgb(15 23 42 / 4%); backdrop-filter: blur(9px); }
.category-bar { display: grid; gap: 6px; max-height: calc(100vh - 110px); overflow-y: auto; scrollbar-width: thin; }
.category-button { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; width: 100%; padding: 9px 10px; border: 1px solid #d4deea; border-radius: 9px; color: #526173; background: #fff; font-size: 11px; font-weight: 720; text-align: left; }
.category-button:hover { border-color: #94b5f8; color: var(--blue); }
.category-button.active { color: #fff; border-color: var(--blue); background: var(--blue); }
.category-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 6px; padding: 0 5px; border-radius: 999px; background: rgb(148 163 184 / 18%); font-size: 10px; }
.category-button.active .category-count { background: rgb(255 255 255 / 22%); }
.content-heading, .settings-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 25px 0 16px; }
.visible-count, .settings-heading > p { color: var(--muted); font-size: 13px; }

.ads-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start; gap: 12px; }
.pagination { display: flex; justify-content: center; margin-top: 22px; }
.pagination .button { min-width: 190px; }
.ad-card { overflow: hidden; min-width: 0; border: 1px solid #e0e7f0; border-radius: 16px; background: #fff; box-shadow: 0 3px 12px rgb(15 23 42 / 7%); animation: rise .28s ease both; transition: box-shadow .18s ease, transform .18s ease; }
.ad-card:hover { box-shadow: 0 12px 30px rgb(15 23 42 / 11%); transform: translateY(-1px); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.video-wrapper { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: linear-gradient(145deg, #172554, #1e3a8a 55%, #2563eb); }
.video-wrapper video { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; object-fit: contain; background: #0f172a; opacity: 0; transition: opacity .18s ease; }
.video-wrapper.loaded video { opacity: 1; }
.video-placeholder { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 9px; color: #fff; }
.play-icon { display: grid; place-items: center; width: 54px; height: 54px; padding-left: 3px; border: 1px solid rgb(255 255 255 / 46%); border-radius: 50%; background: rgb(255 255 255 / 14%); font-size: 21px; }
.video-placeholder small { color: rgb(255 255 255 / 72%); }
.video-placeholder small { max-width: 100%; padding: 0 12px; overflow-wrap: anywhere; text-align: center; }
.card-photo-preview { display: block; width: 100%; height: 100%; object-fit: contain; background: #0f172a; }
.has-photo-preview { aspect-ratio: auto; background: #0f172a; }
.has-photo-preview .card-photo-preview { height: auto; aspect-ratio: 16 / 9; }
.has-photo-preview .video-placeholder { position: static; padding: 7px 4px; background: #0f172a; }
.has-photo-preview .play-icon { display: none; }
.review-guidance { margin-top: 10px; padding: 9px 10px; border-radius: 8px; color: #855417; background: #fff7e8; font-size: 12px; }
.review-guidance summary { cursor: pointer; font-weight: 700; }
.review-guidance p { margin: 8px 0 0; line-height: 1.45; }
.card-body { padding: 18px; }
.card-topline { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 9px; }
.category-label { overflow: hidden; color: var(--blue); font-size: 10px; font-weight: 850; letter-spacing: .06em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.price-block { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.price { color: #0f172a; font-size: 16px; font-weight: 850; text-align: right; }
.price-markup-wrap { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border: 1px solid #cbd5e1; border-radius: 6px; background: #f8fafc; font-size: 11px; }
.price-markup-wrap:focus-within { border-color: var(--blue); box-shadow: 0 0 0 2px rgb(26 86 219 / 15%); }
.price-markup-plus { font-weight: 800; color: #475569; font-size: 13px; line-height: 1; }
.price-markup-input { width: 90px; padding: 2px 4px; border: none; background: transparent; font-size: 11px; font-weight: 700; color: #0f172a; outline: none; }
.price-markup-input::placeholder { color: #94a3b8; font-weight: 400; font-size: 10px; }
.price-markup-total { font-size: 10px; font-weight: 750; color: #08764f; text-align: right; }
.ad-card h2 { margin: 0 0 5px; color: #0f172a; font-size: 20px; line-height: 1.25; }
.ad-card h2, .card-meta { overflow-wrap: anywhere; }
.card-meta { margin: 0 0 13px; color: var(--muted); font-size: 12px; }
.card-meta-link { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 13px; color: var(--muted); font-size: 12px; text-decoration: none; transition: color .15s; }
.card-meta-link:hover { color: var(--blue); text-decoration: underline; }
.card-meta-link .external-icon { font-size: 11px; opacity: 0.75; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin-bottom: 13px; }
.fact { min-width: 0; padding: 8px; border: 1px solid #e5ebf2; border-radius: 8px; background: #fafbfd; }
.fact span { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.fact strong { display: block; margin-top: 3px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; color: #526173; background: #eef2f6; font-size: 10px; font-weight: 750; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ready, .badge.active, .badge.published, .badge.channel-published { color: #08764f; background: var(--green-soft); }
.badge.review, .badge.ready_review, .badge.queued, .badge.reserved, .badge.pending_max, .badge.error { color: #a15b05; background: var(--orange-soft); }
.badge.excluded { color: #526173; background: #eef2f6; }
.badge.sold, .badge.declined, .badge.publish_error { color: #b42318; background: var(--red-soft); }
.caption-toggle { width: 100%; padding: 9px 11px; border: 1px solid #d8e4f8; border-radius: 9px; color: #184c9e; background: #f4f8ff; text-align: left; font-size: 11px; font-weight: 800; }
.caption { max-height: 270px; margin-top: 8px; padding: 12px; overflow: auto; border: 1px solid #dbeafe; border-radius: 9px; color: #334155; background: #f7faff; font-size: 12px; line-height: 1.55; white-space: pre-wrap; }
.caption a { color: var(--blue); font-weight: 750; text-decoration: none; }
.caption a:hover { text-decoration: underline; }
.discount-note { margin: 10px 0 0; color: var(--muted); font-size: 11px; }
.publication-error { margin: 10px 0 0; padding: 9px 10px; border-radius: 8px; color: #9f1d17; background: var(--red-soft); font-size: 11px; line-height: 1.45; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.card-actions .button { flex: 1 1 130px; }
.empty-state { grid-column: 1 / -1; padding: 65px 22px; border: 1px dashed #c7d2df; border-radius: 15px; color: var(--muted); background: #fff; text-align: center; }
.empty-state strong { display: block; margin-bottom: 6px; color: #334155; font-size: 16px; }

.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.settings-card { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 3px 12px rgb(15 23 42 / 5%); }
.settings-card.wide { grid-column: span 2; }
.settings-card h2 { margin: 0 0 14px; font-size: 17px; }
.channel-statuses { display: flex; flex-wrap: wrap; gap: 5px; margin: -4px 0 12px; }
.channel-status { padding: 4px 8px; border-radius: 999px; color: #526173; background: #eef2f6; font-size: 10px; font-weight: 800; }
.channel-status.published { color: #08764f; background: var(--green-soft); }
.channel-status.error, .channel-status.paused { color: #b42318; background: var(--red-soft); }
.channel-status.pending, .channel-status.preview, .channel-status.not_configured { color: #a15b05; background: var(--orange-soft); }
.journal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.channel-health { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.health-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.health-card.paused { border-color: #f3a6a6; background: #fff7f7; }
.health-card strong, .health-card span { display: block; }
.health-card span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.journal-panel { margin-top: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.journal-panel h2 { margin: 0 0 13px; font-size: 17px; }
.notification-list { display: grid; gap: 8px; }
.notification { padding: 10px 12px; border-left: 4px solid var(--orange); border-radius: 8px; color: #7a4203; background: #fff8e8; font-size: 12px; }
.notification.critical { color: #991b1b; border-color: var(--red); background: var(--red-soft); }
.notification time { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.journal-table-wrap { overflow-x: auto; }
.journal-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.journal-table th, .journal-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.journal-table th { color: #526173; background: #f8fafc; white-space: nowrap; }
.journal-result.failed, .journal-result.blocked { color: #b42318; font-weight: 800; }
.journal-result.succeeded { color: #08764f; font-weight: 800; }
.form-grid.two-columns, .rule-grid { grid-template-columns: repeat(2, 1fr); }
.rule-grid { grid-template-columns: repeat(4, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toggle-row { display: flex !important; align-items: center; gap: 8px !important; min-height: 40px; padding: 8px 10px; border: 1px solid #dfe6ef; border-radius: 9px; color: #334155 !important; background: #fafbfd; }
.toggle-row input { width: auto; margin: 0; }
.compact-list { display: grid; gap: 6px; margin-top: 5px; }
.compact-item { padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 8px; color: #526173; background: #fafbfd; font-size: 11px; }
.company-access { min-width: 0; margin: 0; padding: 10px 12px 12px; border: 1px solid #dfe6ef; border-radius: 10px; }
.company-access legend { padding: 0 5px; color: #526173; font-size: 11px; font-weight: 750; }
.company-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.company-check { display: inline-flex !important; align-items: center; gap: 6px !important; padding: 7px 9px; border: 1px solid #dfe6ef; border-radius: 8px; color: #334155 !important; background: #fff; font-size: 11px !important; font-weight: 650 !important; }
.company-check input { width: auto; margin: 0; }
.user-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(180px, 1.2fr) minmax(180px, 1.2fr) auto; align-items: center; gap: 9px; }
.user-row strong { display: block; color: #172033; font-size: 12px; }
.user-row small { color: var(--muted); }
.user-publication-limit { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 9px; padding-top: 8px; border-top: 1px solid #e2e8f0; }
.user-publication-limit label { display: grid; gap: 4px; min-width: 150px; }
.user-publication-limit input { max-width: 180px; }
.user-publication-limit small { flex-basis: 100%; }

.confirm-dialog { width: min(760px, calc(100% - 30px)); max-height: calc(100vh - 30px); padding: 0; overflow-y: auto; border: 0; border-radius: 17px; color: #1e293b; background: #fff; box-shadow: 0 25px 75px rgb(15 23 42 / 30%); }
.confirm-dialog::backdrop { background: rgb(15 23 42 / 58%); backdrop-filter: blur(3px); }
.confirm-dialog form { padding: 28px; }
.confirm-dialog h2 { margin: 0; font-size: 24px; }
.confirm-dialog p:not(.eyebrow) { color: var(--muted); line-height: 1.5; }
.dialog-icon { display: grid; place-items: center; width: 45px; height: 45px; margin-bottom: 16px; border-radius: 50%; font-size: 22px; font-weight: 900; }
.dialog-icon.good { color: #067647; background: var(--green-soft); }
.dialog-icon.warning { color: #9a5a07; background: var(--orange-soft); }
.check-list { display: grid; gap: 8px; margin: 15px 0; padding: 14px 16px 14px 36px; border: 1px solid var(--line); border-radius: 10px; color: #334155; background: #fafbfd; font-size: 12px; }
.publish-preview-loading { padding: 20px; border: 1px dashed #b9cffb; border-radius: 10px; color: var(--blue-dark); background: #f4f8ff; text-align: center; }
.publish-preview { display: grid; grid-template-columns: minmax(260px, .9fr) minmax(280px, 1.1fr); gap: 13px; }
.publish-preview video { width: 100%; max-height: 270px; border-radius: 10px; background: #0f172a; }
.publish-targets { display: grid; align-content: start; gap: 8px; }
.publish-target { display: grid !important; grid-template-columns: auto 1fr !important; align-items: start; gap: 9px !important; padding: 11px; border: 1px solid var(--line); border-radius: 9px; color: #334155 !important; background: #fafbfd; }
.publish-target input { width: auto; margin-top: 3px; }
.publish-target strong, .publish-target small { display: block; }
.publish-target small { margin-top: 3px; color: var(--muted); font-weight: 500; overflow-wrap: anywhere; }
.publish-target.unavailable { opacity: .65; }
.max-target-list { display: grid; gap: 7px; padding: 0; margin: 9px 0 0; list-style: none; }
.max-target-list li { padding: 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; overflow-wrap: anywhere; }
.max-target-list strong, .max-target-list small { display: block; }
.max-target-list small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.max-target-list .target-error { border-color: #f4c896; background: #fffbf3; }
.max-target-statuses { margin: 9px 0; font-size: 11px; color: #526173; }
.max-target-statuses summary { cursor: pointer; }
.category-groups { display: grid; gap: 10px; }
.category-group-row { display: grid; gap: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #f8faff; }
.category-group-number { font-size: 12px; color: var(--blue-dark); }
.category-group-row > button { justify-self: end; }
.category-group-actions { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.publish-caption-block { grid-column: 1 / -1; }
.publish-caption-block > strong { display: block; margin-bottom: 7px; font-size: 12px; }
.publish-caption { max-height: 220px; padding: 12px; overflow: auto; border: 1px solid #dbeafe; border-radius: 9px; color: #334155; background: #f7faff; font-size: 12px; line-height: 1.5; white-space: pre-wrap; }
.publish-ack { display: flex !important; grid-template-columns: none !important; align-items: center; gap: 8px !important; padding: 10px 12px; border: 1px solid #b9cffb; border-radius: 9px; color: #184c9e !important; background: #f4f8ff; }
.publish-ack input { width: auto; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 18px; }
.reason-groups { display: grid; gap: 13px; margin-top: 16px; }
.reason-group { padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.reason-group h3 { margin: 0 0 8px; font-size: 13px; }
.reason-option { display: flex !important; grid-template-columns: none !important; align-items: start; gap: 8px !important; padding: 6px; color: #334155 !important; font-weight: 600 !important; }
.reason-option input { width: auto; margin-top: 2px; }
.photo-dialog { width: min(1040px, calc(100% - 30px)); }
.photo-selection { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.photo-end-card { margin-top: 18px; padding: 14px; border: 1px solid #d8e1ec; border-radius: 11px; background: #f8fafc; }
.photo-end-card-toggle { display: flex !important; align-items: center; gap: 9px; }
.photo-end-card-toggle input[type="checkbox"] { width: auto; flex: none; }
.photo-end-card p, .photo-end-card figcaption { color: #64748b; font-size: 12px; line-height: 1.5; }
.photo-end-card figure { margin: 10px 0 0; max-width: 220px; }
.photo-end-card img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 8px; background: #0f172a; }
.photo-item { position: relative; overflow: hidden; border: 2px solid #d8e1ec; border-radius: 11px; background: #f8fafc; }
.photo-item.is-removed { opacity: .42; filter: grayscale(.7); }
.photo-item img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #0f172a; }
.photo-item-controls { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 5px; padding: 7px; }
.photo-item-controls label { display: flex; grid-template-columns: none; align-items: center; gap: 6px; color: #334155; }
.photo-item-controls input { width: auto; }
.photo-order-button { min-width: 30px; min-height: 30px; padding: 4px; border: 1px solid #cfd9e6; border-radius: 7px; color: #334155; background: #fff; }
.photo-item.needs-review { opacity: 1; filter: none; border-color: #e4ad53; }
.photo-item.review-marked { border-color: #199764; }
.photo-item.review-marked .photo-review-label { color: #176040; background: #eaf9f1; }
.photo-item-controls .photo-no-blur-check { grid-column: 1 / -1; align-items: flex-start; padding: 7px; border: 1px solid #d5e4da; border-radius: 7px; background: #fff; font-size: 12px; line-height: 1.4; cursor: pointer; }
.photo-no-blur-check input { flex: none; margin-top: 2px; accent-color: #199764; }
.photo-review-help { flex-basis: 100%; margin: 0; color: #526779; font-size: 12px; }
.photo-review-label { margin: 0; padding: 7px; color: #855417; background: #fff7e8; font-size: 12px; }
.photo-edit-button { width: calc(100% - 14px); margin: 0 7px 7px; }
.photo-editor-dialog { width: min(1200px, calc(100% - 24px)); }
.photo-editor-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin: 14px 0; }
.photo-editor-toolbar label { flex: 1; min-width: 230px; }
.photo-adjustments { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.photo-adjustments label { flex: 1 1 180px; }
.photo-adjustments input[type="range"] { padding: 6px 0; }
.photo-adjustments output { color: var(--blue-dark); }
.photo-editor-canvas { padding: 8px; border-radius: 9px; background: #102033; }
#photoEditorCanvas { display: block; width: auto; height: auto; max-width: 100%; max-height: 62vh; margin: auto; touch-action: none; cursor: crosshair; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; width: min(380px, calc(100% - 36px)); gap: 8px; pointer-events: none; }
.toast { padding: 12px 15px; border-left: 4px solid #60a5fa; border-radius: 9px; color: #fff; background: #183142; box-shadow: 0 10px 30px rgb(15 23 42 / 24%); animation: toastIn .2s ease both; font-size: 13px; }
.toast.success { border-color: #63d59a; }
.toast.error { border-color: #ff8088; }
.dialog-notices { position: sticky; top: 8px; margin: 8px 16px; z-index: 10; display: grid; gap: 8px; }
.dialog-notices:empty { display: none; }
.photo-drag-handle { width: 100%; padding: 8px; border: 0; background: #e7eef9; color: #244e8f; cursor: grab; touch-action: none; font: inherit; }
.photo-drag-handle:active { cursor: grabbing; }
.photo-item.drag-target { outline: 3px solid #1955d0; outline-offset: -3px; }
.confirm-dialog .publication-blocker { padding: 12px; border: 1px solid #e7b76a; border-radius: 8px; color: #703d08; background: #fff4df; }
.publication-photo-fixes { padding: 12px; border: 1px solid #d8e1ec; border-radius: 8px; margin-bottom: 14px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 1120px) {
  .header-inner { grid-template-columns: minmax(210px, auto) 1fr; }
  .account { grid-column: 1 / -1; justify-content: flex-end; margin-top: -5px; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .ads-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .settings-grid { grid-template-columns: repeat(2, 1fr); }
  .feed-layout { grid-template-columns: 190px minmax(0, 1fr); gap: 12px; }
  .category-section { position: static; }
  .photo-selection { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .header-inner { grid-template-columns: 1fr; gap: 9px; padding-inline: 18px; }
  .header-stats { justify-content: flex-start; overflow-x: auto; }
  .account { grid-column: auto; justify-content: space-between; flex-wrap: wrap; }
  main { padding: 16px 18px 42px; }
  .menu-bar { overflow-x: auto; }
  .menu-bar span { display: none; }
  .ads-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-card.wide { grid-column: auto; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .publish-preview, .channel-health { grid-template-columns: 1fr; }
  .feed-layout { display: block; }
  .category-section { margin-top: 14px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .category-bar { display: flex; gap: 7px; max-height: none; padding-bottom: 8px; overflow-x: auto; overflow-y: hidden; }
  .category-button { width: auto; border-radius: 999px; white-space: nowrap; }
  .photo-selection { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .header-stats > span + span { padding-left: 8px; }
  .header-stats { gap: 8px; font-size: 10px; }
  .filter-panel label, .filter-panel .button { width: 100%; margin-left: 0; }
  .kpis { display: flex; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 4px; }
  .kpi { flex: 0 0 145px; scroll-snap-align: start; }
  .content-heading, .settings-heading { align-items: start; flex-direction: column; gap: 7px; }
  .form-grid.two-columns, .rule-grid, .dialog-actions { grid-template-columns: 1fr; }
  .user-row { grid-template-columns: 1fr; }
  .fact strong, .badge, .category-label { font-size: 11px; }
  .fact span { font-size: 10px; }
  .confirm-dialog form { padding: 23px 18px; }
}
.card-photo-gallery, .photo-post-preview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; }
.card-photo-gallery img, .photo-post-preview img { display: block; width: 100%; height: auto; border-radius: 7px; }
.photo-post-preview { max-height: 55vh; overflow-y: auto; }
.photo-post-preview figure { margin: 0; }
.photo-post-preview figcaption { text-align: center; font-size: 12px; color: var(--muted); }
.card-photo-gallery.hidden, .photo-post-preview.hidden { display: none; }
.card-photo-gallery figure { margin: 0; min-width: 0; }
.card-photo-gallery figcaption, .photo-pack-summary, .photo-dimensions { font-size: 12px; color: var(--muted); }
.photo-pack-summary { margin: 6px 18px; }
.gallery-review { padding: 4px; border: 1px solid #e7bd6f; border-radius: 8px; background: #fff8eb; }
.gallery-review figcaption { color: #81500d; }
.photo-dimensions { display: block; padding: 5px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
