*{box-sizing:border-box}body{margin:0;background:#f1f5f4;color:#142726;font:1rem system-ui,sans-serif}
header{background:#123a38;color:#fff;padding:1.6rem max(1rem,calc((100vw - 72rem)/2))}
header h1{margin:0;font-size:1.5rem}header p{margin:.4rem 0 0;color:#d0e9e5}
main{width:min(72rem,calc(100% - 2rem));margin:2rem auto;display:grid;grid-template-columns:16rem minmax(0,1fr);gap:1.25rem}
section,main aside{background:white;border:1px solid #d5e0dc;border-radius:1rem;padding:1.25rem;align-self:start}
h2,h3{margin-top:0}form{display:grid;gap:.8rem}label{display:grid;gap:.3rem;font-size:.95rem}
input,textarea,select,button{font:inherit;padding:.6rem;border:1px solid #aebfba;border-radius:.45rem;width:100%}
button{background:#126358;color:white;border:0;cursor:pointer;width:max-content;max-width:100%}
nav{display:grid;gap:.3rem;margin-bottom:1rem}nav a{color:#145c53;padding:.5rem;border-radius:.4rem;overflow-wrap:anywhere}
nav a[aria-current]{background:#e2f2ed;font-weight:700}
.grid{display:grid;grid-template-columns:1fr 1fr;gap:.75rem}.message{background:#e2f2ed;padding:.7rem;border-radius:.45rem}
details{border-top:1px solid #dae4df;padding:.7rem 0}summary{cursor:pointer;overflow-wrap:anywhere}details form{margin-top:1rem}
@media(max-width:680px){main,.grid{grid-template-columns:1fr}}


body{--sidebar-width:15rem;padding-left:var(--sidebar-width)}
.sidebar{position:fixed;top:0;left:0;width:var(--sidebar-width);height:100vh;height:100dvh;overflow:auto;
  padding:1.55rem 1rem;background:#123a38;color:#fff;border:0;border-radius:0}
.brand{display:inline-block;margin:0 .65rem 1.65rem;color:#fff;font-size:1.35rem;
  font-weight:750;text-decoration:none}
.sidebar nav{display:grid;gap:.45rem;margin:0}
.sidebar nav a{color:inherit;text-decoration:none}
.sidebar-group{margin:0;padding:0;border:0}
.sidebar-group summary,.sidebar-link,.sidebar-links a{display:block;padding:.65rem .75rem;border-radius:.45rem}
.sidebar-group summary{display:list-item;list-style-position:inside;font-weight:650}
.sidebar-links{list-style:none;padding:0 0 0 1.15rem;margin:.25rem 0 0;display:grid;gap:.15rem}
.sidebar nav [aria-current="page"]{background:#d6f1e9;color:#123a38;font-weight:700}
.sidebar nav a:hover:not([aria-current]),.sidebar-group summary:hover{background:#20524e}
.sidebar a:focus-visible,.sidebar summary:focus-visible{outline:2px solid #a6e7d4;outline-offset:2px}
@media(max-width:760px){
  body{--sidebar-width:clamp(7.5rem,29vw,12rem)}
  .sidebar{padding:.95rem .45rem}
  .brand{margin:0 .4rem 1rem;font-size:1.15rem}
  .sidebar-group summary,.sidebar-link,.sidebar-links a{padding:.55rem .4rem;overflow-wrap:anywhere}
  .sidebar-links{padding-left:.6rem}
  main,.grid{grid-template-columns:minmax(0,1fr)}
  main{margin:1rem auto}
  main section,main aside{min-width:0;padding:.85rem}
}

.catalog-row{display:flex;align-items:center;justify-content:space-between;gap:.35rem}
.catalog-row a{flex:1;min-width:0}
.catalog-delete{display:grid;place-items:center;flex:none;width:2.5rem;height:2.5rem;
  padding:0;background:transparent;color:#9e3434}
.catalog-delete:hover,.catalog-delete:focus-visible{background:#fbe9e9}
.delete-dialog{width:min(27rem,calc(100% - 2rem));padding:1.4rem;border:1px solid #d5e0dc;
  border-radius:1rem;color:#142726;overflow-wrap:anywhere}
.delete-dialog::backdrop{background:rgb(10 29 28 / .52)}
.dialog-actions{display:flex;justify-content:flex-end;gap:.5rem;flex-wrap:wrap}
.cancel-delete{background:#e8efed;color:#142726}
.confirm-delete{background:#9e3434}

.created-catalogs{list-style:none;padding:0;margin:0}
.created-catalogs li{border-top:1px solid #d5e0dc;overflow-wrap:anywhere}
.inline-catalog{border:0;padding:0}
.inline-catalog>summary{display:flex;align-items:center;justify-content:space-between;
  flex-wrap:wrap;gap:.65rem;padding:.7rem 0;list-style:none}
.inline-catalog>summary::-webkit-details-marker{display:none}
.inline-catalog>summary>div>span{display:block;color:#465c59;font-size:.875rem}
.inline-edit-label{padding:.45rem .7rem;border:1px solid #aebfba;border-radius:.45rem;color:#145c53}
.inline-catalog>summary:hover .inline-edit-label{background:#e8f4ef}
.inline-catalog[open] .when-closed,.inline-catalog:not([open]) .when-open{display:none}
.inline-catalog-editor{padding:.4rem 0 1rem}

.inline-catalog>summary>div>.default-cards-status{color:#ae2929;font-weight:650}
.inline-catalog>summary>div>.custom-cards-status{color:#126358;font-weight:650}
.inline-edit-label .when-open,.inline-edit-label .when-closed{display:inline}
.manual-product-form{margin-bottom:1rem}
.manual-product{display:grid;min-width:0;gap:.75rem;border:1px solid #d5e0dc;
  border-radius:.6rem;padding:.75rem;margin:0 0 .75rem}
.manual-product legend{font-weight:650;padding:0 .25rem}

.replacement-loading{display:flex;align-items:center;gap:.8rem}
.replacement-loading p{margin:0}
.replacement-spinner{flex:none;width:1.55rem;height:1.55rem;border:.19rem solid #d5e0dc;
  border-top-color:#126358;border-radius:50%;animation:replacement-spin .85s linear infinite}
@keyframes replacement-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.replacement-spinner{animation:none}}

.catalog-toggle{display:grid;place-items:center}
.inline-catalog[open]>summary .catalog-toggle svg{transform:rotate(180deg)}
.catalog-actions{display:grid;gap:.75rem}
.catalog-replace-editor>summary{width:max-content;max-width:100%;padding:.45rem .7rem;
  color:#145c53;border:1px solid #aebfba;border-radius:.45rem}
.catalog-replace-editor>summary:hover{background:#e8f4ef}

.catalog-status-button{margin-bottom:.75rem}
.status-dialog{width:min(48rem,calc(100% - 2rem));max-height:calc(100dvh - 2rem);overflow:auto}
.status-dialog-header{display:flex;justify-content:space-between;align-items:flex-start;
  flex-wrap:wrap;gap:.45rem;background:none;color:inherit;padding:0}
.status-dialog-header h2{margin-bottom:.7rem}
.status-count{font-size:.875rem;margin:0 0 .45rem;color:#465c59}
.status-items{list-style:none;padding:0;margin:0 0 .8rem;border-top:1px solid #d5e0dc}
.status-item{display:grid;grid-template-columns:3ch minmax(0,1fr) max-content;align-items:center;
  gap:.55rem;border-bottom:1px solid #d5e0dc;padding:.28rem .2rem;font-size:.875rem}
.status-row-number{color:#465c59;font-variant-numeric:tabular-nums;text-align:right}
.status-item-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.status-value{display:inline-block;border-radius:.35rem;padding:.1rem .35rem;background:#edf1f0}
.status-approved,.status-fetched,.status-direct_upload{color:#145c53;background:#e1f3eb}
.status-rejected,.status-fetch_failed{color:#902525;background:#fbe9e9}
.status-pending,.status-outdated,.status-partial_fetch{color:#754814;background:#fff2d6}
.status-badges{display:flex;align-items:center;gap:.35rem .55rem;min-width:0}
.status-badges .status-value{white-space:nowrap}
@media(max-width:620px){
  .status-item{grid-template-columns:3ch minmax(0,1fr)}
  .status-badges{grid-column:2;flex-wrap:wrap}
}

.accounts-page{display:block;max-width:54rem}
.accounts-page h1{margin-top:0}
.account-portfolio{margin-bottom:1rem}
.account-portfolio h2{margin-bottom:.2rem;font-size:1.15rem;overflow-wrap:anywhere}
.account-portfolio-id{color:#465c59;font-size:.875rem;margin:0 0 .75rem;overflow-wrap:anywhere}
.account-table-wrap{overflow-x:auto}
.account-table{width:100%;border-collapse:collapse;min-width:24rem;font-variant-numeric:tabular-nums}
.account-table th,.account-table td{padding:.55rem .65rem;text-align:left;vertical-align:top;border-bottom:1px solid #d5e0dc}
.account-table thead th{font-size:.875rem;color:#465c59}
.account-table small{display:block;color:#465c59;line-height:1.35;margin-top:.15rem}
.account-badge{display:inline-block;padding:.12rem .45rem;border-radius:.35rem;background:#edf1f0;font-weight:650;font-size:.875rem}
.account-badge-active{background:#e1f3eb;color:#145c53}
.account-badge-banned{background:#fbe9e9;color:#902525}
.account-badge-payment{background:#fff1b8;color:#654609}

/* Shared panel surfaces, controls and interaction states. */
:root {
  --ink: #172a26;
  --muted: #506661;
  --line: #dce6e1;
  --canvas: #f3f6f4;
  --accent: #13644e;
  --accent-hover: #0c513f;
  --surface: #fff;
  --radius: 16px;
}
body { background: var(--canvas); color: var(--ink); line-height: 1.5; }
main { width: min(76rem, calc(100% - 4rem)); margin-block: 2rem; }
main section, main aside { border-color: var(--line); border-radius: var(--radius); padding: 1.4rem; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.025em; }
h1 { margin: 0 0 1.25rem; font-size: clamp(1.55rem, 3vw, 2.25rem); }
h2 { font-size: 1.35rem; }
p { margin-block: .65rem; }
.sidebar { background: #102f2a; padding: 1.4rem 1rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; }
.brand::before {
  content: "Z"; display: grid; place-items: center; width: 2rem; height: 2rem;
  border-radius: .6rem; background: #b7efcf; color: #173a2d; font-size: 1.05rem;
}
.sidebar nav [aria-current="page"] { background: #c9efda; color: #173a2d; }
input, textarea, select {
  min-height: 2.65rem; padding: .6rem .75rem; border-color: #bfcec8;
  border-radius: .55rem; background: var(--surface); color: var(--ink);
}
label { gap: .4rem; font-weight: 600; }
textarea { resize: vertical; }
button {
  background: var(--accent); min-height: 2.55rem; padding: .55rem .9rem;
  border-radius: .6rem; font-weight: 650;
  transition: background-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
button:hover { background: var(--accent-hover); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .58; cursor: not-allowed; }
.cancel-delete { background: #edf3ef; color: var(--ink); }
.cancel-delete:hover { background: #dfece4; }
.confirm-delete { background: #a42e38; }
.confirm-delete:hover { background: #84222c; }
:where(button, input, textarea, select, summary, a):focus-visible {
  outline: 2px solid #228567; outline-offset: 3px;
}
.catalog-page, .accounts-page { display: block; max-width: 67rem; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: .8rem 1.5rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.page-heading h1 { margin: 0; }
.create-catalog-button span { margin-right: .25rem; font-size: 1.15em; }
main .catalog-list { padding: .25rem 1.25rem; }
.created-catalogs > li:first-child { border-top: 0; }
.inline-catalog > summary { padding: .95rem .3rem; border-radius: .6rem; transition: background-color .16s ease; }
.inline-catalog > summary:hover { background: #f3f8f5; }
.inline-catalog > summary strong { display: block; margin-bottom: .15rem; }
.inline-catalog > summary > div > :is(.default-cards-status, .custom-cards-status) {
  display: inline-block; margin-top: .35rem; padding: .15rem .55rem; border-radius: 2rem;
  font-size: .75rem; line-height: 1.4;
}
.inline-catalog > summary > div > .default-cards-status { background: #fff0ef; color: #992d33; }
.inline-catalog > summary > div > .custom-cards-status { background: #e2f4e9; color: #15583f; }
.inline-edit-label { border-color: var(--line); background: white; }
.catalog-toggle svg { transition: transform .18s ease; }
.inline-catalog[open] > .inline-catalog-editor { animation: panel-enter .18s ease both; }
.feed-progress { display: flex; align-items: center; gap: .65rem; color: var(--muted); }
.feed-progress .replacement-spinner { width: 1rem; height: 1rem; border-width: 2px; }
.empty-state { text-align: center; padding: 2.5rem 1rem; }
.empty-state p { margin-bottom: 0; color: var(--muted); }
.delete-dialog {
  width: min(32rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem);
  border: 1px solid var(--line); padding: 1.5rem; border-radius: 1.2rem;
  box-shadow: 0 24px 80px rgb(15 42 32 / .2);
}
.delete-dialog[open] { animation: panel-enter .22s ease both; }
.delete-dialog::backdrop { background: rgb(14 35 29 / .45); }
.delete-dialog h2 { margin: 0 0 .85rem; }
.status-dialog { width: min(61rem, calc(100% - 2rem)); }
.status-dialog-header { align-items: center; flex-wrap: nowrap; gap: .8rem; margin-bottom: 1rem; }
.status-dialog-header h2 { margin: 0; }
.status-loading { min-height: 5rem; }
.result-enter { animation: panel-enter .22s ease both; }
.status-item { padding: .5rem .3rem; }
.status-value, .account-badge { border-radius: 2rem; padding-inline: .5rem; }
.status-value { animation: badge-enter .2s ease both; }
.account-table tbody tr:hover { background: #f5f9f6; }
.feedback-list { list-style: none; padding: 0; display: grid; gap: .55rem; margin: 0 0 1.15rem; }
.feedback-entry { border-radius: .6rem; padding: .7rem .85rem; background: #edf3ef; }
.feedback-replace_success { background: #e2f4e9; color: #15583f; }
.feedback-replace_error { background: #fff0ef; color: #992d33; }
.feedback-replace_warning { background: #fff3d9; color: #744411; }

@keyframes panel-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes badge-enter { from { opacity: .45; } to { opacity: 1; } }
.menu-toggle { display: none; }
@media (max-width: 900px) {
  body { padding-left: 0; }
  .sidebar { position: static; width: 100%; height: auto; padding: .85rem 1rem; overflow: visible; }
  .sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
  .sidebar .brand { margin: 0; }
  .sidebar nav { display: grid; gap: .25rem; margin-top: .65rem; }
  .sidebar.menu-ready:not(.menu-open) nav { display: none; }
  .sidebar.menu-ready .menu-toggle {
    display: grid; place-items: center; flex: none; width: 2.75rem; min-height: 2.75rem;
    padding: 0; color: #fff; background: #20524e;
  }
  .sidebar .menu-toggle:hover { background: #29665e; }
  .menu-toggle[aria-expanded="false"] .close-icon,
  .menu-toggle[aria-expanded="true"] .menu-icon { display: none; }
  .sidebar.menu-open nav { animation: panel-enter .18s ease both; }
  .sidebar-group summary, .sidebar-link, .sidebar-links a { padding: .4rem .55rem; }
  main { width: calc(100% - 1.5rem); margin-block: 1rem; }
  .delete-dialog { padding: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .replacement-spinner { animation: none; }
}

.catalog-list-entry { position: relative; }
.catalog-list-entry > .inline-catalog > summary { padding-right: 3.2rem; }
.catalog-list-entry > .catalog-delete { position: absolute; top: .95rem; right: .3rem; }

.ads-account-link { color: var(--accent); text-underline-offset: .2em; }
.ads-campaign-heading { margin-top: 1rem; }
.ads-campaign-heading p { margin-bottom: 0; }
.ads-campaign-table { min-width: 32rem; }
.ads-campaign-table td:last-child { width: 10rem; }
.ads-campaign-table td:last-child button { min-height: 2rem; padding: .3rem .6rem; }

.campaign-job-panel{position:fixed;right:1rem;bottom:1rem;z-index:21;width:min(22rem,calc(100vw - 2rem));
  background:white;border:1px solid var(--line);border-radius:.75rem;box-shadow:0 .4rem 1.4rem #10342824;
  padding:.55rem .75rem;font-size:.875rem;overflow-wrap:anywhere}
.campaign-job-panel[hidden]{display:none}
.campaign-job-panel details{border:0;padding:0}
.campaign-job-panel summary{font-weight:650}
.campaign-job-panel [data-job-count]{margin-left:.5rem;color:var(--muted)}
.campaign-job-panel ul{display:grid;gap:.45rem;list-style:none;padding:0;margin:.45rem 0 0;
  max-height:min(15rem,45vh);overflow:auto}
.campaign-job-panel li{display:flex;align-items:flex-start;gap:.5rem;border-top:1px solid var(--line);padding-top:.45rem}
.campaign-job-panel li strong,.campaign-job-panel li small{display:block}
.campaign-job-panel li small{margin-top:.15rem}
.campaign-job-panel .replacement-spinner{width:1rem;height:1rem;border-width:2px;margin-top:.18rem}
.campaign-job-panel .campaign-job-error{color:#992d33}
