/* ════════════════════════════════════════════════════
   PhotoPrint — Main Stylesheet
   ════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue:    #2563eb;
    --blue-lt: #eff6ff;
    --blue-md: #bfdbfe;
    --green:   #16a34a;
    --red:     #dc2626;
    --gray-50: #f8fafc;
    --gray-100:#f1f5f9;
    --gray-200:#e2e8f0;
    --gray-300:#cbd5e1;
    --gray-400:#94a3b8;
    --gray-600:#475569;
    --gray-800:#1e293b;
    --shadow:  0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1);
    --radius:  8px;
    --radius-sm: 4px;
}

body { font-family: 'Inter', system-ui, sans-serif; font-size: 14px; color: var(--gray-800); background: var(--gray-50); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: inherit; font-size: 14px; }
img { display: block; max-width: 100%; }

/* ── Navbar ── */
.navbar {
    display: flex; align-items: center; gap: 24px;
    padding: 0 24px; height: 56px;
    background: #fff; border-bottom: 1px solid var(--gray-200);
    position: sticky; top: 0; z-index: 100;
    box-shadow: var(--shadow);
}
.navbar-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.navbar-menu  { display: flex; gap: 4px; flex: 1; }
.navbar-menu a {
    padding: 6px 12px; border-radius: var(--radius-sm);
    color: var(--gray-600); font-weight: 500; transition: background .15s;
}
.navbar-menu a:hover, .navbar-menu a.active { background: var(--blue-lt); color: var(--blue); text-decoration: none; }
.navbar-user  { display: flex; align-items: center; gap: 10px; }
.user-name    { font-weight: 500; }
.user-role    { padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.user-role.admin    { background: #fef9c3; color: #854d0e; }
.user-role.operator { background: var(--blue-lt); color: var(--blue); }
.btn-logout   { padding: 5px 12px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); background: #fff; cursor: pointer; color: var(--gray-600); }
.btn-logout:hover { background: var(--gray-100); }

.main-content { padding: 24px; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border: none; border-radius: var(--radius);
    font-weight: 500; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--blue);  color: #fff; }
.btn-primary:hover:not(:disabled)  { background: #1d4ed8; }
.btn-success  { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled)  { background: #15803d; }
.btn-secondary { background: var(--gray-100); color: var(--gray-800); border: 1px solid var(--gray-200); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-200); }
.btn-danger   { background: #fee2e2; color: var(--red); border: 1px solid #fecaca; }
.btn-danger:hover:not(:disabled) { background: #fecaca; }
.btn-sm       { padding: 4px 10px; font-size: 12px; }
.w-full       { width: 100%; justify-content: center; }

/* ── Forms ── */
.form-group   { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.form-group label { font-weight: 500; color: var(--gray-600); font-size: 13px; }
.form-group input, .form-group select, .form-group textarea {
    padding: 8px 10px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
    background: #fff; transition: border .15s;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-select  { padding: 8px 10px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); background: #fff; width: 100%; }
.form-select:focus { outline: none; border-color: var(--blue); }
.form-grid    { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; align-items: end; }
.form-actions { display: flex; align-items: flex-end; }
.inline-form  { display: inline; }
.form-check   { flex-direction: row; align-items: center; gap: 8px; }
.form-check input { width: 16px; height: 16px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; margin-bottom: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Login ── */
.login-box { background: #fff; border-radius: 12px; padding: 40px; width: 400px; box-shadow: var(--shadow-md); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 24px; font-weight: 700; margin-top: 12px; }
.login-logo p  { color: var(--gray-400); font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 4px; }

/* ── Operator Layout ── */
.operator-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    height: calc(100vh - 56px - 48px);
    margin: -24px;
}

/* ── Settings Panel ── */
.settings-panel {
    background: #fff;
    border-right: 1px solid var(--gray-200);
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.panel-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--gray-100); }
.settings-section { margin-bottom: 16px; }
.settings-label { display: block; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-400); margin-bottom: 6px; }

/* Orientation toggle */
.orientation-toggle { display: flex; gap: 4px; }
.orient-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 7px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
    background: #fff; cursor: pointer; font-size: 12px; font-weight: 500;
    transition: all .15s; color: var(--gray-600);
}
.orient-btn.active { background: var(--blue-lt); color: var(--blue); border-color: var(--blue-md); }
.orient-btn:hover:not(.active) { background: var(--gray-50); }

/* Toggle switch */
.toggle-row {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 0; cursor: pointer; font-size: 13px;
}
.toggle-row small { color: var(--gray-400); font-size: 11px; }
.toggle-row input[type=checkbox] { display: none; }
.toggle-switch {
    width: 36px; height: 20px; background: var(--gray-300); border-radius: 10px;
    position: relative; transition: background .2s; flex-shrink: 0;
}
.toggle-switch::after {
    content: ''; position: absolute; left: 2px; top: 2px;
    width: 16px; height: 16px; background: #fff; border-radius: 50%;
    transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-row input:checked + .toggle-switch { background: var(--blue); }
.toggle-row input:checked + .toggle-switch::after { transform: translateX(16px); }

/* Copies */
.copies-control { display: flex; align-items: center; gap: 0; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); width: fit-content; }
.copies-btn { width: 32px; height: 34px; border: none; background: var(--gray-100); cursor: pointer; font-size: 16px; font-weight: 500; }
.copies-btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.copies-btn:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.copies-btn:hover { background: var(--gray-200); }
.copies-control input { width: 48px; text-align: center; border: none; border-left: 1px solid var(--gray-200); border-right: 1px solid var(--gray-200); height: 34px; }
.copies-control input:focus { outline: none; background: var(--blue-lt); }

/* Layout info */
.layout-info  { display: flex; gap: 8px; margin-bottom: 12px; }
.layout-stat  { flex: 1; background: var(--blue-lt); border-radius: var(--radius-sm); padding: 8px; text-align: center; }
.layout-num   { display: block; font-size: 22px; font-weight: 700; color: var(--blue); }
.layout-desc  { font-size: 11px; color: var(--gray-600); }

/* Sheet preview */
.sheet-preview-wrap { display: flex; justify-content: center; padding: 8px; background: var(--gray-100); border-radius: var(--radius-sm); }
.sheet-preview-wrap canvas { max-width: 100%; display: block; box-shadow: var(--shadow); }

/* Custom sizes */
.custom-sizes { margin-top: 8px; }
.custom-sizes.hidden { display: none; }
.size-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ── Photos Panel ── */
.photos-panel {
    display: flex; flex-direction: column; gap: 0;
    overflow: hidden; background: var(--gray-50);
}

/* Dropzone */
.dropzone {
    margin: 16px; border: 2px dashed var(--gray-300); border-radius: var(--radius);
    background: #fff; cursor: pointer; transition: all .2s; flex-shrink: 0;
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--blue); background: var(--blue-lt); }
.dropzone-inner { padding: 24px; text-align: center; pointer-events: none; }
.dropzone-inner svg { margin: 0 auto 12px; }
.dropzone-inner p { color: var(--gray-600); }
.dropzone-inner strong { color: var(--gray-800); }
.dropzone-hint { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

/* Photo Grid */
.photo-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px; padding: 0 16px; overflow-y: auto; flex: 1;
}
.photo-card {
    background: #fff; border-radius: var(--radius); border: 1px solid var(--gray-200);
    overflow: hidden; box-shadow: var(--shadow); transition: box-shadow .15s;
}
.photo-card:hover { box-shadow: var(--shadow-md); }
.photo-card.loading { opacity: .7; }

.photo-thumb-wrap { position: relative; aspect-ratio: 1; background: var(--gray-100); overflow: hidden; }
.photo-thumb { width: 100%; height: 100%; object-fit: cover; }
.photo-loading-spinner {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
}
.photo-loading-spinner::after {
    content: ''; width: 28px; height: 28px; border: 3px solid var(--gray-300);
    border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.rotation-badge {
    position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6);
    color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 3px;
}
.photo-info   { padding: 6px 8px; display: flex; align-items: center; gap: 6px; }
.photo-name   { font-size: 11px; color: var(--gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.fit-badge    { font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 3px; flex-shrink: 0; }
.badge-fill   { background: #dbeafe; color: #1d4ed8; }
.badge-contain { background: #d1fae5; color: #065f46; }
.photo-actions { display: flex; justify-content: space-between; padding: 4px 6px; background: var(--gray-50); border-top: 1px solid var(--gray-100); }
.icon-btn     { background: none; border: none; cursor: pointer; padding: 4px 6px; border-radius: var(--radius-sm); font-size: 14px; }
.icon-btn:hover { background: var(--gray-100); }
.icon-btn.danger:hover { background: #fee2e2; }

/* Action Bar */
.action-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: #fff; border-top: 1px solid var(--gray-200);
    box-shadow: 0 -2px 8px rgba(0,0,0,.05); gap: 12px; flex-shrink: 0;
}
.action-bar-right { display: flex; gap: 8px; }
.photo-count-badge {
    background: var(--blue); color: #fff; padding: 4px 12px;
    border-radius: 12px; font-size: 13px; font-weight: 600;
}

/* ── Crop Modal ── */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.modal-dialog  { position: relative; z-index: 1; background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.2); width: 600px; max-width: 95vw; max-height: 90vh; display: flex; flex-direction: column; }
.crop-dialog   { width: 620px; }
.modal-header  { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--gray-200); }
.modal-header h3 { font-weight: 700; font-size: 16px; }
.modal-close   { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--gray-400); line-height: 1; }
.modal-close:hover { color: var(--gray-800); }
.modal-body    { padding: 16px 20px; flex: 1; overflow-y: auto; }
.modal-footer  { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--gray-200); }

.crop-toolbar  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.fit-mode-btns { display: flex; gap: 4px; }
.fit-btn { padding: 6px 14px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); background: #fff; cursor: pointer; font-weight: 500; transition: all .15s; }
.fit-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.fit-btn:hover:not(.active) { background: var(--gray-100); }
.rotation-btns { display: flex; gap: 4px; }
.crop-canvas-wrap { display: flex; justify-content: center; background: var(--gray-800); border-radius: var(--radius); overflow: hidden; }
.crop-canvas-wrap canvas { max-width: 100%; cursor: move; }
.crop-hint { font-size: 12px; color: var(--gray-400); margin-top: 8px; text-align: center; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--gray-200); background: #fff; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 10px 14px; background: var(--gray-50); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-600); border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }
.actions { display: flex; gap: 6px; }

/* ── Status badges ── */
.status-badge  { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.status-pending    { background: #fef9c3; color: #854d0e; }
.status-processing { background: #dbeafe; color: #1d4ed8; }
.status-ready      { background: #d1fae5; color: #065f46; }
.status-printing   { background: #ede9fe; color: #5b21b6; }
.status-done       { background: #d1fae5; color: #065f46; }
.status-cancelled  { background: var(--gray-100); color: var(--gray-600); }
.status-error      { background: #fee2e2; color: #991b1b; }

.role-badge  { padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.role-admin  { background: #fef9c3; color: #854d0e; }
.role-operator { background: var(--blue-lt); color: var(--blue); }

/* ── Admin pages ── */
.page-container { max-width: 1200px; }
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 20px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-size: 16px; font-weight: 700; margin: 24px 0 12px; }

.card { background: #fff; border-radius: var(--radius); border: 1px solid var(--gray-200); padding: 20px; box-shadow: var(--shadow); }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card  { background: #fff; border-radius: var(--radius); padding: 16px 20px; border: 1px solid var(--gray-200); box-shadow: var(--shadow); }
.stat-card.stat-warning { border-color: #fecaca; background: #fff5f5; }
.stat-num   { font-size: 28px; font-weight: 700; color: var(--blue); }
.stat-label { font-size: 12px; color: var(--gray-600); margin-top: 4px; }

.quick-links { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.quick-link {
    display: flex; align-items: center; gap: 8px; padding: 10px 16px;
    background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
    font-weight: 500; color: var(--gray-800); box-shadow: var(--shadow);
    transition: all .15s; text-decoration: none;
}
.quick-link:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; box-shadow: var(--shadow-md); }
.quick-link-icon { font-size: 18px; }

.system-printers { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* ── Toast ── */
.toast {
    position: fixed; bottom: 24px; right: 24px; z-index: 999;
    padding: 12px 20px; border-radius: var(--radius); font-weight: 500;
    box-shadow: var(--shadow-md); animation: fadeIn .2s;
    max-width: 360px;
}
.toast.hidden { display: none; }
.toast-success { background: #16a34a; color: #fff; }
.toast-error   { background: #dc2626; color: #fff; }
.toast-info    { background: #2563eb; color: #fff; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Pagination ── */
.pagination { display: flex; gap: 4px; margin-top: 16px; }
.pagination .page-link { padding: 6px 12px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); color: var(--gray-600); text-decoration: none; }
.pagination .page-link:hover { background: var(--gray-100); }
.pagination .page-item.active .page-link { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ── Misc ── */
.text-center  { text-align: center; }
.text-gray-400 { color: var(--gray-400); }
.py-8         { padding-top: 32px; padding-bottom: 32px; }
code { background: var(--gray-100); padding: 1px 5px; border-radius: 3px; font-size: 12px; }

/* ═══════════════════════════════════════════════════
   НОВЫЙ ИНТЕРФЕЙС ОПЕРАТОРА (v2)
═══════════════════════════════════════════════════ */

/* Верхняя панель настроек */
.operator-wrap { display:flex; flex-direction:column; height:calc(100vh - 56px); overflow:hidden; }

.top-bar {
    display:flex; flex-wrap:wrap; gap:8px; align-items:flex-end;
    padding:8px 16px; background:#f8fafc; border-bottom:1px solid #e2e8f0;
    flex-shrink:0;
}
.top-bar-section { display:flex; flex-direction:column; gap:4px; min-width:120px; }
.top-label { font-size:11px; color:#64748b; font-weight:500; text-transform:uppercase; letter-spacing:.3px; }
.form-select-sm { padding:4px 8px; font-size:13px; border:1px solid #cbd5e1; border-radius:6px; background:#fff; }

.orient-toggle { display:flex; gap:4px; }
.orient-btn { padding:4px 10px; font-size:12px; border:1px solid #cbd5e1; border-radius:6px;
    background:#fff; cursor:pointer; transition:all .15s; }
.orient-btn.active { background:#6366f1; color:#fff; border-color:#6366f1; }

.toggle-row { display:flex; align-items:center; gap:6px; font-size:12px; cursor:pointer; }
.toggle-switch { width:28px; height:16px; background:#cbd5e1; border-radius:8px; position:relative; flex-shrink:0; transition:background .2s; }
.toggle-row input[type=checkbox] { display:none; }
.toggle-row input:checked + .toggle-switch { background:#6366f1; }
.toggle-switch::after { content:''; position:absolute; width:12px; height:12px; background:#fff; border-radius:50%; top:2px; left:2px; transition:left .2s; }
.toggle-row input:checked + .toggle-switch::after { left:14px; }

/* Основной контент */
.main-content { display:flex; flex:1; overflow:hidden; }

/* Левая колонка */
.photos-col { width:300px; flex-shrink:0; display:flex; flex-direction:column; border-right:1px solid #e2e8f0; overflow:hidden; }

.dropzone { border:2px dashed #bfdbfe; border-radius:10px; margin:10px; padding:16px; text-align:center;
    cursor:pointer; transition:all .2s; background:#f0f9ff; flex-shrink:0; }
.dropzone:hover, .dropzone.drag-over { border-color:#6366f1; background:#ede9fe; }
.dropzone p { font-size:12px; color:#475569; margin:4px 0; }
.dropzone .hint { color:#94a3b8; font-size:11px; }

.photo-list { flex:1; overflow-y:auto; padding:0 8px 8px; display:flex; flex-direction:column; gap:6px; }

.photo-item { display:flex; gap:8px; align-items:center; padding:6px; border-radius:8px;
    border:1px solid #e2e8f0; background:#fff; transition:all .15s; }
.photo-item:hover { border-color:#a5b4fc; background:#f5f3ff; }
.photo-item.loading { opacity:.6; }

.photo-thumb-wrap { position:relative; width:52px; height:52px; flex-shrink:0; border-radius:6px; overflow:hidden; background:#f1f5f9; }
.photo-thumb { width:100%; height:100%; object-fit:cover; display:block; }
.skeleton { width:100%; height:100%; background:linear-gradient(90deg,#f1f5f9 25%,#e2e8f0 50%,#f1f5f9 75%); background-size:200% 100%; animation:shimmer 1.2s infinite; }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

.photo-overlay { position:absolute; inset:0; background:rgba(0,0,0,.45); opacity:0; transition:opacity .15s;
    display:flex; align-items:center; justify-content:center; gap:2px; border-radius:6px; }
.photo-thumb-wrap:hover .photo-overlay { opacity:1; }
.ov-btn { width:20px; height:20px; border:none; border-radius:4px; background:rgba(255,255,255,.9);
    color:#1e293b; font-size:11px; cursor:pointer; padding:0; line-height:1; }
.ov-btn:hover { background:#fff; }
.ov-del { color:#ef4444; }

.photo-info { flex:1; min-width:0; display:flex; flex-direction:column; gap:3px; }
.photo-name { font-size:11px; color:#475569; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.photo-fmt-btn { font-size:11px; padding:2px 7px; border:1px solid #c7d2fe; border-radius:5px;
    background:#ede9fe; color:#4338ca; cursor:pointer; text-align:left; transition:all .15s; }
.photo-fmt-btn:hover { background:#ddd6fe; }

.action-bar { padding:8px 10px; border-top:1px solid #e2e8f0; flex-direction:column; gap:8px; flex-shrink:0; }
.action-stats { display:flex; gap:6px; }
.badge { font-size:11px; padding:2px 8px; border-radius:10px; background:#6366f1; color:#fff; }
.badge-light { background:#e2e8f0; color:#475569; }
.action-btns { display:flex; gap:6px; flex-wrap:wrap; }
.action-btns .btn { font-size:12px; padding:6px 12px; flex:1; min-width:80px; }

/* Правая колонка — предпросмотр */
.preview-col { flex:1; display:flex; flex-direction:column; overflow:hidden; }

.preview-header { display:flex; align-items:center; justify-content:space-between;
    padding:8px 16px; border-bottom:1px solid #e2e8f0; flex-shrink:0; }
.preview-title { font-size:13px; font-weight:600; color:#1e293b; }
.preview-nav { display:flex; align-items:center; gap:8px; font-size:13px; color:#475569; }
.nav-btn { width:28px; height:28px; border:1px solid #e2e8f0; border-radius:6px; background:#fff;
    cursor:pointer; font-size:16px; line-height:1; }
.nav-btn:hover { background:#f1f5f9; }

.preview-area { flex:1; display:flex; align-items:center; justify-content:center;
    overflow:hidden; padding:16px; position:relative; background:#f8fafc; }

#previewCanvas { box-shadow:0 4px 24px rgba(0,0,0,.12); border-radius:2px; }

.preview-empty { position:absolute; inset:0; display:flex; flex-direction:column;
    align-items:center; justify-content:center; color:#94a3b8; gap:4px; }
.preview-empty p { font-size:14px; margin:0; }
.preview-empty .hint { font-size:12px; }

.preview-ruler { padding:4px 16px 8px; font-size:11px; color:#94a3b8; text-align:center; flex-shrink:0; }

/* Модальное окно формата */
.modal { position:fixed; inset:0; z-index:1000; display:flex; align-items:center; justify-content:center; }
.modal.hidden { display:none; }
.modal-overlay { position:absolute; inset:0; background:rgba(0,0,0,.5); }
.modal-dialog { position:relative; background:#fff; border-radius:12px; padding:0; width:420px;
    max-height:80vh; display:flex; flex-direction:column; box-shadow:0 20px 60px rgba(0,0,0,.2); }
.modal-header { display:flex; align-items:center; justify-content:space-between;
    padding:16px 20px; border-bottom:1px solid #e2e8f0; }
.modal-header h3 { font-size:16px; font-weight:600; margin:0; }
.modal-close { width:28px; height:28px; border:none; background:none; font-size:20px; cursor:pointer; color:#94a3b8; }
.modal-body { padding:16px 20px; overflow-y:auto; }

.format-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.format-btn { display:flex; flex-direction:column; align-items:center; padding:10px 8px;
    border:2px solid #e2e8f0; border-radius:8px; background:#fff; cursor:pointer; transition:all .15s; gap:2px; }
.format-btn:hover { border-color:#a5b4fc; background:#f5f3ff; }
.format-btn.active { border-color:#6366f1; background:#ede9fe; }
.format-name { font-size:14px; font-weight:600; color:#1e293b; }
.format-size { font-size:10px; color:#64748b; }

/* Toast */
.toast { position:fixed; bottom:24px; right:24px; padding:10px 18px; border-radius:10px;
    font-size:13px; font-weight:500; z-index:9999; box-shadow:0 4px 20px rgba(0,0,0,.15); transition:opacity .3s; }
.toast.hidden { display:none; }
.toast-success { background:#10b981; color:#fff; }
.toast-error   { background:#ef4444; color:#fff; }
.toast-warning { background:#f59e0b; color:#fff; }
.toast-info    { background:#6366f1; color:#fff; }

/* Кнопки */
.btn-success { background:#10b981; color:#fff; border:none; }
.btn-success:hover:not(:disabled) { background:#059669; }

/* Кастомные размеры бумаги */
.custom-sizes { display:flex; align-items:center; gap:4px; margin-top:4px; }
.custom-sizes input { width:60px; padding:3px 6px; border:1px solid #cbd5e1; border-radius:6px; font-size:12px; }

/* Кастомный формат в модалке */
.custom-format-inputs {
    margin-top: 12px; padding: 12px; background: #f8fafc;
    border-radius: 8px; border: 1px solid #e2e8f0;
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.custom-format-inputs label { font-size: 12px; color: #64748b; width: 100%; margin-bottom: -4px; }
.custom-format-inputs input { width: 80px; padding: 4px 8px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; }
.custom-format-inputs .btn-sm { padding: 5px 14px; font-size: 12px; }
.format-btn-custom { border-style: dashed !important; }
.photo-meta { font-size: 10px; color: #94a3b8; }

/* Счётчик количества копий фото */
.qty-control {
    display: flex; align-items: center; gap: 4px; margin-top: 4px;
}
.qty-btn {
    width: 22px; height: 22px; border: 1px solid #c7d2fe; border-radius: 5px;
    background: #ede9fe; color: #4338ca; font-size: 14px; font-weight: 600;
    cursor: pointer; line-height: 1; padding: 0; display: flex;
    align-items: center; justify-content: center; transition: all .15s;
}
.qty-btn:hover { background: #ddd6fe; }
.qty-value {
    font-size: 11px; font-weight: 600; color: #4338ca;
    min-width: 34px; text-align: center;
}
