.catalog-toolbar { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:8px; }
#catalogStatus { min-height:1.5em; color:var(--muted); margin-bottom:8px; }
#catalogScreen [hidden] { display:none !important; }
.catalog-editor { display:grid; grid-template-columns:minmax(105px, .42fr) minmax(0, 1fr) minmax(0, 1.22fr); gap:16px; align-items:start; }
.catalog-editor h3 { margin:0 0 10px; font-size:1rem; }
.catalog-controls { display:grid; gap:8px; }
.catalog-controls label { display:grid; gap:4px; margin:0; font-size:.82rem; }
.catalog-controls :is(input,textarea,select) { margin:0; min-width:0; width:100%; }
.catalog-controls textarea { resize:vertical; }
.catalog-controls input[type=color] { padding:2px; min-height:38px; cursor:pointer; }
#catalogPages input { width:auto; min-height:0; margin:0; }
.catalog-preview .catalog-price-toggle {
    display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; padding:12px;
    margin:12px 0 0; border:2px solid #849bb5; border-radius:12px; color:#17273d; background:#eff5fc; cursor:pointer;
}
.catalog-preview .catalog-price-toggle + .catalog-price-toggle { margin-top:8px; }
.catalog-price-toggle:has(input:focus-visible) { outline:2px solid #174a78; outline-offset:3px; }
.catalog-price-toggle:has(input:checked) { background:#e9f7ee; border-color:#50856a; }
.catalog-preview .catalog-price-toggle input {
    flex:none; width:22px; height:22px; min-height:0; margin:0; accent-color:#17654b; cursor:pointer;
}
.catalog-price-copy { flex:1 1 120px; display:grid; gap:3px; }
.catalog-price-copy strong { font-size:1rem; }
.catalog-price-copy small { color:#415671; font-size:.8rem; }
.catalog-price-hidden, .catalog-price-visible {
    padding:4px 9px; border-radius:20px; background:#d9e5f3; color:#203755; font-weight:750;
}
.catalog-price-visible { display:none; background:#ccebd8; color:#174c34; }
.catalog-price-toggle input:checked ~ .catalog-price-visible { display:inline; }
.catalog-price-toggle input:checked ~ .catalog-price-hidden { display:none; }
.catalog-style-row { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
#catalogScreen .catalog-page-rail { position:sticky; top:90px; padding:10px; }
#catalogAddPage { width:100%; margin-bottom:8px; }
#catalogPages { display:grid; gap:5px; max-height:55vh; overflow:auto; }
.catalog-page-row { display:flex; align-items:center; gap:8px; }
.catalog-page-row button { flex:1; min-width:0; display:grid; gap:2px; text-align:left; background:#f2f5f8; color:#17273d; padding:7px 9px; border:1px solid #dbe2ea; border-radius:7px; cursor:pointer; }
.catalog-page-row button[aria-current=true] { background:#d9e8fb; border-color:#6d8eb4; }
.catalog-photo-row { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:7px 0; border-bottom:1px solid var(--border); font-size:.82rem; overflow-wrap:anywhere; }
.catalog-photo-row span { flex:1; }
.catalog-photo-row button { flex:none; }
.catalog-preview { padding:clamp(8px,2vw,18px); background:#e8edf1; border:1px solid #d9e1e7; border-radius:12px; }
#catalogCanvas { display:block; width:100%; height:auto; box-shadow:0 8px 22px #18283a24; }
@media (max-width:780px) {
    .catalog-editor { grid-template-columns:1fr; }
    #catalogScreen .catalog-page-rail { position:static; }
    #catalogAddPage { width:auto; }
    #catalogPages { display:flex; max-height:none; overflow-x:auto; }
    .catalog-page-row { flex:0 0 80px; }
    .catalog-preview { grid-row:2; max-width:500px; width:100%; margin:auto; }
}
.catalog-heading { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; padding:22px; margin-bottom:12px; border-radius:14px; color:#fff; background:linear-gradient(125deg,#152539,#243f56); }
.catalog-heading span { font-size:.7rem; font-weight:750; letter-spacing:.17em; color:#e9c397; }
.catalog-heading h2 { margin:4px 0 0; font-size:clamp(1.45rem,5vw,2.25rem); line-height:1.08; }
#catalogArchive { display:grid; gap:8px; margin:8px 0; max-height:460px; overflow:auto; }
#catalogArchive .catalog-archive-card { display:flex; align-items:center; gap:12px; width:100%; }
.catalog-archive-preview { flex:0 0 82px; display:grid; gap:4px; text-align:center; }
.catalog-archive-preview img { display:block; width:100%; aspect-ratio:210/297; background:#e5ecf3; border:1px solid #d4dfea; object-fit:contain; }
.catalog-archive-preview small, .catalog-archive-title small, .catalog-page-row small { color:#43576c; font-size:.72rem; }
.catalog-archive-title { display:grid; gap:4px; min-width:0; overflow-wrap:anywhere; }
#catalogAddDialog { margin:auto; width:min(520px, calc(100vw - 24px)); max-height:88vh; overflow:auto;
    border:1px solid #dbe2ea; border-radius:14px; padding:18px; color:#17273d; }
#catalogAddDialog::backdrop { background:#17263c80; }
#catalogAddForm { display:grid; gap:10px; }
#catalogAddForm label { margin:0; }
#catalogAddForm :is(input,select) { margin:4px 0 0; }
#catalogAddProducts { display:grid; gap:4px; min-height:48px; max-height:32vh; overflow:auto; }
#catalogAddProducts button { text-align:left; padding:8px; border:1px solid #dbe2ea; border-radius:6px; color:#17273d; background:#f3f6f9; }
#catalogAddProducts .catalog-picker-product { display:flex; align-items:center; gap:10px; min-height:44px;
    padding:6px 9px; border:1px solid #dbe2ea; border-radius:8px; background:#f7f9fc; cursor:pointer; }
#catalogAddProducts .catalog-picker-product:has(:checked) { background:#e7f4ef; border-color:#77a695; }
#catalogAddProducts .catalog-picker-product:has(:focus-visible) { outline:2px solid #286860; outline-offset:-2px; }
#catalogAddProducts .catalog-picker-product:has(:disabled) { color:#59677b; cursor:default; }
#catalogAddProducts .catalog-picker-product input { flex:0 0 18px; width:18px; height:18px;
    margin:0; accent-color:#286860; }
#catalogAddProducts .catalog-picker-product span { min-width:0; }
#catalogAddProducts .catalog-picker-product strong { display:block; font-size:.9rem; line-height:1.25; overflow-wrap:anywhere; }
#catalogAddProducts .catalog-picker-product small { display:block; color:#46586c; font-size:.72rem; }
.catalog-product-search label { display:block; color:#203b48; font-weight:700; }
.catalog-product-search-row { display:flex; align-items:stretch; gap:6px; margin-top:5px; padding:4px;
    border:1px solid #9cbab3; border-radius:14px; background:#f5faf8; }
.catalog-product-search-row:focus-within { outline:2px solid #286860; outline-offset:2px; }
#catalogAddForm .catalog-product-search-row input { flex:1; min-width:0; min-height:48px; width:100%;
    margin:0; padding:8px 9px; border:0; border-radius:9px; box-shadow:none;
    outline:none; background:transparent; color:#17263c; font-size:1rem; }
.catalog-product-search-row input::placeholder { color:#52676e; }
.catalog-product-search-row .camera-scan-btn { box-shadow:none; }
.catalog-product-search-row .camera-scan-btn:focus-visible { outline:2px solid #284963; outline-offset:2px; }
#catalogAddCount { font-size:.82rem; }
#catalogArchive button { text-align:left; background:#f3f6f9; border:1px solid #dbe2ea; border-radius:8px; padding:9px 12px; color:#17273d; cursor:pointer; }
#catalogPhotoDialog { margin:auto; width:min(calc(100% - 28px),490px); max-height:85dvh; padding:20px; border:1px solid #d7dfe8; border-radius:14px; }
#catalogPhotoDialog::backdrop { background:#17263c80; }
#catalogPhotoDialog h3, #catalogPhotoStatus { margin:9px 0; }
#catalogPhotoDialog textarea { display:block; width:100%; margin:4px 0 8px; }
#catalogPhotoResult { display:block; width:100%; max-height:280px; object-fit:contain; margin:8px auto; }
.catalog-preview .catalog-photo-fit {
    display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px;
    padding:12px; margin:12px 0 0; border:1px solid #849bb5; border-radius:12px;
    color:#17273d; background:#eff5fc;
}
.catalog-photo-fit strong { flex:1 1 125px; }
.catalog-preview .catalog-photo-fit select { flex:1 1 185px; min-width:0; width:auto; margin:0; }
.catalog-controls .catalog-layout-field {
    padding:10px; border:1px solid #849bb5; border-radius:10px; background:#eff5fc;
    color:#17273d; font-weight:700;
}
.container:has(#catalogScreen.active) { max-width:1160px; }
.catalog-entry-actions { display:flex; flex-wrap:wrap; gap:8px; }
.catalog-sidebar, .catalog-preview { min-width:0; }
.catalog-page-row button strong { font-size:.95rem; }
#stockPhotosSlots { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; }
.catalog-stock-photo { display:grid; align-content:start; gap:5px; min-width:0; }
.catalog-stock-photo img { width:100%; aspect-ratio:1; object-fit:contain; background:#f2f5f8; border-radius:7px; }
.catalog-stock-photo button { width:100%; }
.catalog-photo-row { flex-wrap:wrap; }
.catalog-stock-choices { flex:0 0 100%; display:flex; flex-wrap:wrap; gap:6px; }
.catalog-stock-choices button { padding:2px; border:2px solid #a6b5c4; border-radius:7px; background:#fff; cursor:pointer; }
.catalog-stock-choices button[aria-pressed=true] { border-color:#17654b; background:#daf2e4; }
.catalog-stock-choices img { display:block; width:48px; height:44px; object-fit:contain; }
@media print {
    #printArea .print-table td:has(> .print-stock-photo) {
        position:relative; width:20mm; min-width:20mm; height:17mm; padding:0;
    }
    .print-stock-photo { display:block; position:absolute; inset:0; width:100%; height:100%;
        object-fit:contain; object-position:center; }
    .print-table tr:has(.print-stock-photo) { break-inside:avoid; }
}
#catalogScreen {
    --catalog-ink:#162b40;
    --catalog-accent:#0b634e;
    --catalog-line:#d7e2ea;
}
#catalogScreen .catalog-heading {
    border-radius:18px; padding:clamp(16px, 3vw, 28px);
    background:linear-gradient(122deg, #182b41, #224c52);
}
#catalogScreen .card { border-color:var(--catalog-line); box-shadow:0 4px 16px #17283d0b; }
#catalogScreen .btn {
    border-radius:9px; min-height:40px; padding:8px 12px; font-weight:700;
}
#catalogScreen :is(.btn, .catalog-page-row button, .catalog-archive-card, #catalogAddProducts button):focus-visible {
    outline:2px solid #1e6996; outline-offset:2px;
}
#catalogScreen :is(#catalogStart,#catalogAddPage,#catalogAddSubmit,#catalogPrepare) {
    color:#fff; background:var(--catalog-accent); border:1px solid transparent;
}
#catalogScreen #catalogStart { background:#fff; color:#152a40; }
#catalogScreen #catalogLibrary { background:#ffffff12; border:1px solid #ffffff65; color:#fff; }
#catalogScreen :is(#catalogSave,#catalogNewDesign) {
    color:var(--catalog-ink); background:#edf3f8; border:1px solid var(--catalog-line);
}
#catalogScreen .catalog-page-row button[aria-current=true] {
    color:#144b3e; background:#e2f3eb; border-color:#6ca790;
}
#catalogScreen .catalog-archive-card:hover { border-color:#7697aa; background:#edf4f8; }
#catalogScreen .catalog-entry-actions { align-items:center; }
@media (max-width:520px) {
    #catalogScreen .catalog-entry-actions { width:100%; }
    #catalogScreen .catalog-entry-actions button { flex:1 1 auto; }
}

#catalogAddPresets h4 { margin:0 0 8px; color:#17263c; font-size:.95rem; }
.catalog-preset-options { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
@media (max-width:430px) {
    .catalog-preset-options { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
.catalog-preset-options button { display:flex; flex-direction:column; align-items:center; gap:5px;
    padding:8px 4px; margin:0; border:1px solid #cbd5e1; border-radius:12px;
    color:#17263c; background:#fff; text-align:center; font:inherit; cursor:pointer; }
.catalog-preset-options button:hover { border-color:#286860; background:#f5faf9; }
.catalog-preset-options button:focus-visible { outline:2px solid #286860; outline-offset:2px; }
.catalog-preset-options button[aria-pressed="true"] { border-color:#286860; background:#e7f4ef;
    box-shadow:inset 0 0 0 1px #286860; }
.catalog-preset-options canvas { display:block; width:min(100%, 72px); height:auto; aspect-ratio:auto;
    border:1px solid #d2d8e0; border-radius:3px; }
.catalog-preset-options strong { font-size:.8rem; line-height:1.15; }
.catalog-preset-options small { color:#46586c; font-size:.7rem; line-height:1.25; }

.catalog-bulk-selection { display:flex; flex-wrap:wrap; gap:6px; }
.catalog-bulk-selection button { min-height:40px; padding:7px 10px; border:1px solid #98b2ac;
    border-radius:8px; color:#153f39; background:#e7f4ef; text-align:left; font:inherit; font-size:.85rem; cursor:pointer; }
.catalog-bulk-selection button:disabled { opacity:.6; cursor:default; }
.catalog-bulk-selection button:focus-visible { outline:2px solid #286860; outline-offset:2px; }
#catalogSelectedFilter { display:flex; align-items:center; gap:7px; font-size:.85rem; }
#catalogSelectedFilter input { width:17px; height:17px; margin:0; accent-color:#286860; }
#catalogPageJump { margin:8px 0; }
#catalogPageJump label { display:block; margin:0 0 4px; font-size:.8rem; }
#catalogPageJump div { display:flex; gap:4px; }
#catalogPageJump input { flex:1; min-width:0; width:100%; margin:0; padding:4px 6px; }
#catalogPageJump button { margin:0; padding:5px 8px; }
.catalog-bulk-selection[hidden], .catalog-bulk-selection button[hidden], #catalogSelectedFilter[hidden], #catalogPageJump[hidden] { display:none; }

#catalogSelectedOrder { padding:10px; border:1px solid #dbe2ea; border-radius:12px; background:#f7f9fc; }
#catalogSelectedOrder h4 { margin:0 0 6px; color:#17263c; font-size:.95rem; }
#catalogSelectedOrder p { margin:4px 0; color:#46586c; font-size:.82rem; }
#catalogSelectedProducts { max-height:29vh; overflow:auto; margin:8px 0 0; padding:0 5px 0 2rem; }
#catalogSelectedProducts li { padding:5px 0; border-bottom:1px solid #dbe2ea; }
#catalogSelectedProducts li::marker { color:#46586c; font-weight:700; font-variant-numeric:tabular-nums; }
.catalog-selected-product { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:5px 8px; }
.catalog-selected-product span { flex:1 1 135px; min-width:0; }
.catalog-selected-product strong { display:block; font-size:.86rem; line-height:1.3; overflow-wrap:anywhere; }
.catalog-selected-product small { color:#46586c; font-size:.76rem; }
.catalog-product-move { display:flex; gap:4px; align-items:center; }
#catalogSelectedProducts .catalog-product-move input { width:4.2rem; min-height:36px; margin:0; padding:3px 6px; }
.catalog-product-move button { min-height:36px; padding:4px 8px; border:1px solid #98b2ac; border-radius:8px;
    color:#153f39; background:#e7f4ef; font:inherit; font-size:.82rem; cursor:pointer; }
.catalog-product-move button:focus-visible { outline:2px solid #286860; outline-offset:2px; }
#catalogSelectedOrder [hidden] { display:none; }

#catalogSelectedProducts { list-style:decimal outside; }

.catalog-editor-presets summary { color:#193e42; font-weight:700; cursor:pointer; }
.catalog-editor-presets .catalog-preset-options { margin-top:10px; grid-template-columns:repeat(2,minmax(0,1fr)); }
#catalogRamazanFields { min-width:0; border:1px solid #dbe4ee; border-radius:10px; padding:8px; }
#catalogRamazanFields legend { color:#193e42; font-weight:700; }
.catalog-photo-position { flex-basis:100%; border:1px solid #cbd8e5; border-radius:8px; padding:7px; }
.catalog-photo-position summary { cursor:pointer; color:#14584b; font-weight:700; }
.catalog-photo-position label { display:grid; grid-template-columns:minmax(92px,1fr) 2fr; align-items:center; gap:8px; }
.catalog-photo-position input { width:100%; margin:0; accent-color:#176b5b; }
.catalog-photo-position button { border:1px solid #a5b9b7; background:#edf7f2; color:#174d43; padding:5px 9px; border-radius:7px; cursor:pointer; }
#catalogAddDialog [hidden], #catalogRamazanFields[hidden], .catalog-controls label[hidden] { display:none; }

.catalog-preview-hint { margin:7px 0; color:#4a6271; font-size:.8rem; }
#catalogAddDialog #catalogSelectedOrder[hidden] { display:none; }

.catalog-slot-dialog {
    width:min(94vw, 460px);
    max-height:80vh;
    padding:18px;
    border:1px solid #c9d7e4;
    border-radius:12px;
    color:#172335;
}
.catalog-slot-dialog:not([open]) { display:none; }
.catalog-slot-dialog::backdrop { background:#14223588; }
.catalog-slot-dialog h3 { margin:0 0 6px; }
.catalog-slot-dialog p { margin:0 0 12px; }
.catalog-slot-choices { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.catalog-slot-choices button { padding:4px; border:1px solid #aabed3; border-radius:8px; background:#f1f6fa; cursor:pointer; }
.catalog-slot-choices img { display:block; width:100%; height:78px; object-fit:contain; }
.catalog-slot-choices span { display:block; font-size:.76rem; padding:4px 0; }
.catalog-text-position { border:1px solid #c7d6e2; border-radius:8px; padding:8px 10px; margin:0 0 8px; }
.catalog-text-position summary { color:#193e42; font-weight:700; cursor:pointer; }
.catalog-text-position label { margin-top:7px; }
.catalog-text-position label[hidden] { display:none; }
