:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #242736;
  --border: #2e3247;
  --accent: #e63946;
  --accent2: #457b9d;
  --text: #e8eaf0;
  --text2: #9094a8;
  --green: #2a9d8f;
  --yellow: #e9c46a;
  --radius: 8px;
  --sidebar-w: 240px;
}
/* Світла тема */
body.light {
  --bg: #f2f4f6;
  --surface: #ffffff;
  --surface2: #f0f2f5;
  --border: #dfe3e8;
  --text: #1a1d27;
  --text2: #5f6577;
}
body.light tr:hover td { background: rgba(0,0,0,.03); }
body.light .toast { box-shadow: 0 4px 20px rgba(0,0,0,.12); }
body.light .block-designer-popup,
body.light .img-dialog,
body.light .img-edit-toolbar { box-shadow: 0 12px 40px rgba(0,0,0,.18); }
body.light .modal-overlay { background: rgba(0,0,0,.45); }
body.light .sidebar-logo-img { border: 1px solid var(--border); }

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; font-family: inherit; font-size: 14px; }
input, textarea, select { font-family: inherit; font-size: 14px; }

/* Login */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 40px; width: 360px; }
.login-box h1 { font-size: 22px; margin-bottom: 8px; }
.login-box p { color: var(--text2); font-size: 14px; margin-bottom: 28px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.form-group input { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; color: var(--text); outline: none; transition: border .2s; }
.form-group input:focus { border-color: var(--accent); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: var(--radius); font-weight: 600; transition: opacity .2s, transform .1s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: .9; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--text2); }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: #c1121f; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }
.error-msg { color: var(--accent); font-size: 13px; margin-top: 10px; text-align: center; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; }
.sidebar-logo { padding: 16px 20px 14px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.sidebar-logo-img { max-height: 52px; width: auto; max-width: 180px; object-fit: contain; background: #fff; border-radius: 6px; padding: 4px 8px; }
.sidebar-logo span { font-size: 11px; font-weight: 600; color: var(--text2); letter-spacing: .03em; text-transform: uppercase; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 20px; font-size: 14px; color: var(--text2); cursor: pointer; transition: all .15s; border-left: 3px solid transparent; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(230,57,70,.1); color: var(--accent); border-left-color: var(--accent); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-user { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info { flex: 1; overflow: hidden; }
.user-info strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info span { font-size: 11px; color: var(--text2); }
.logout-btn { background: none; color: var(--text2); font-size: 18px; padding: 4px; border-radius: 4px; }
.logout-btn:hover { color: var(--accent); }

.main { margin-left: var(--sidebar-w); flex: 1; padding: 32px; max-width: calc(100vw - var(--sidebar-w)); min-height: 100vh; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.page-header h1 { font-size: 24px; }

/* Cards / stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-card .num { font-size: 32px; font-weight: 700; }
.stat-card .label { font-size: 13px; color: var(--text2); margin-top: 4px; }

/* Table */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-toolbar { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.search-input { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px; color: var(--text); outline: none; flex: 1; min-width: 200px; }
.search-input:focus { border-color: var(--accent2); }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--surface2); }
th { text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; }
td { padding: 12px 16px; font-size: 14px; border-top: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: rgba(255,255,255,.02); }
.article-title { font-weight: 600; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.article-title a { color: var(--text); }
.article-title a:hover { color: var(--accent); }

/* Badges */
.badge { display: inline-block; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-published { background: rgba(42,157,143,.2); color: #2a9d8f; }
.badge-draft { background: rgba(144,148,168,.15); color: var(--text2); }
.badge-admin { background: rgba(230,57,70,.2); color: var(--accent); }
.badge-editor { background: rgba(69,123,157,.2); color: var(--accent2); }

/* Category dot */
.cat-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.cat-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--dot-color, #888); flex-shrink: 0; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--border); }
.page-btn { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 6px 12px; border-radius: var(--radius); font-size: 13px; }
.page-btn:hover:not(:disabled) { border-color: var(--accent2); }
.page-btn:disabled { opacity: .4; cursor: default; }
.page-info { color: var(--text2); font-size: 13px; margin: 0 auto; }

/* Article editor */
.editor-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }
.editor-main { display: flex; flex-direction: column; gap: 16px; }
.editor-side { display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card h3 { font-size: 14px; color: var(--text2); margin-bottom: 14px; text-transform: uppercase; letter-spacing: .05em; }
.field-group { margin-bottom: 14px; }
.field-group label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.field-input { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; color: var(--text); outline: none; resize: vertical; }
.field-input:focus { border-color: var(--accent2); }
select.field-input option { background: var(--surface2); }
.cover-preview { width: 100%; aspect-ratio: 16/9; background: var(--surface2); border: 2px dashed var(--border); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; margin-bottom: 10px; position: relative; }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-preview span { color: var(--text2); font-size: 13px; text-align: center; padding: 20px; }
.cover-preview:hover { border-color: var(--accent2); }

/* Rich text area */
.rich-editor-toolbar { display: flex; gap: 4px; padding: 10px; background: var(--surface2); border: 1px solid var(--border); border-bottom: none; border-radius: var(--radius) var(--radius) 0 0; flex-wrap: wrap; }
.toolbar-btn { background: transparent; color: var(--text2); border: 1px solid transparent; border-radius: 4px; padding: 5px 8px; font-size: 13px; font-weight: 600; }
.toolbar-btn:hover { background: var(--surface); color: var(--text); border-color: var(--border); }
.toolbar-sep { width: 1px; background: var(--border); margin: 2px 4px; align-self: stretch; }
.toolbar-btn-doc { color: var(--accent2); border-color: rgba(69,123,157,.3); background: rgba(69,123,157,.07); }
.toolbar-btn-doc:hover { background: rgba(69,123,157,.2); color: var(--accent2); border-color: var(--accent2); }
.toolbar-btn-doc:disabled { opacity: .5; cursor: wait; }
.toolbar-btn-design { color: #a855f7; border-color: rgba(168,85,247,.3); background: rgba(168,85,247,.07); }
.toolbar-btn-design:hover, .toolbar-btn-design.active { background: rgba(168,85,247,.18); color: #a855f7; border-color: #a855f7; }

/* ── Block Designer Floating Popup ── */
.block-designer-popup { position: absolute; z-index: 9999; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.45); overflow: hidden; }
.designer-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--surface2); border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 700; color: #a855f7; }
.designer-body { max-height: 360px; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 14px; }
.designer-body::-webkit-scrollbar { width: 4px; }
.designer-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.designer-group-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--text2); margin-bottom: 8px; }
.designer-blocks { display: flex; flex-wrap: wrap; gap: 6px; }
.designer-block { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; min-width: 76px; transition: all .15s; user-select: none; }
.designer-block:hover { border-color: #a855f7; background: rgba(168,85,247,.12); transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,.2); }
.designer-block-icon { font-size: 20px; line-height: 1; }
.designer-block-label { font-size: 10px; color: var(--text2); text-align: center; line-height: 1.2; font-weight: 600; }

/* ── Image Dialog ── */
.img-dialog-wrap { position: absolute; z-index: 9000; }
.img-dialog { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.45); overflow: hidden; }
.img-dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--surface2); border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 700; color: var(--accent2); }
.img-dialog-tabs { display: flex; border-bottom: 2px solid var(--border); }
.img-tab { background: none; border: none; color: var(--text2); font-size: 13px; font-weight: 600; padding: 10px 16px; cursor: pointer; font-family: inherit; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; }
.img-tab:hover { color: var(--text); }
.img-tab.active { color: var(--accent2); border-bottom-color: var(--accent2); }
.img-tab-panel { padding: 16px; }
.img-dropzone { border: 2px dashed var(--border); border-radius: 8px; padding: 32px 20px; text-align: center; cursor: pointer; transition: all .15s; color: var(--text2); font-size: 14px; }
.img-dropzone:hover, .img-dropzone.drag-active { border-color: var(--accent2); background: rgba(69,123,157,.08); color: var(--text); }
.img-media-thumb { cursor: pointer; border-radius: 6px; overflow: hidden; border: 2px solid transparent; transition: border-color .15s; }
.img-media-thumb:hover { border-color: var(--accent2); }

/* Editor drag over highlight */
.rich-area.editor-drag-over { outline: 3px dashed var(--accent2); background: rgba(69,123,157,.06); }

/* Block delete floating button */
.block-delete-btn { position: absolute; z-index: 8000; background: #c1121f; color: #fff; border: none;
  border-radius: 5px; padding: 4px 10px; font-size: 12px; font-weight: 700; cursor: pointer;
  font-family: inherit; box-shadow: 0 2px 8px rgba(0,0,0,.35); transition: background .15s; white-space: nowrap; }
.block-delete-btn:hover { background: #e63946; }
.rich-area { width: 100%; min-height: 400px; background: var(--surface2); border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); padding: 16px; color: var(--text); outline: none; font-size: 15px; line-height: 1.8; }
.rich-area:focus { border-color: var(--accent2); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; z-index: 999; padding: 20px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 18px; }
.modal-close { background: none; color: var(--text2); font-size: 22px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* Media grid */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.media-item { background: var(--surface2); border: 2px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; position: relative; aspect-ratio: 1; }
.media-item:hover { border-color: var(--accent2); }
.media-item.selected { border-color: var(--accent); }
.media-item img { width: 100%; height: 100%; object-fit: cover; }
.media-item-del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.7); border-radius: 4px; padding: 3px 6px; font-size: 11px; color: #fff; opacity: 0; transition: opacity .2s; }
.media-item:hover .media-item-del { opacity: 1; }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 18px; font-size: 14px; min-width: 200px; box-shadow: 0 4px 20px rgba(0,0,0,.3); animation: toastIn .2s ease; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--accent); }
.toast.info { border-left: 3px solid var(--accent2); }
@keyframes toastIn { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:none; } }

/* Responsive */
@media (max-width: 900px) {
  .editor-layout { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; padding: 20px; }
}

/* ── Lang tabs in editor ── */
.lang-tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 2px solid var(--border); }
.lang-tab { background: none; border: none; color: var(--text2); font-size: 13px; font-weight: 600; padding: 10px 20px; cursor: pointer; font-family: inherit; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; }
.lang-tab:hover { color: var(--text); }
.lang-tab.active { color: var(--accent2); border-bottom-color: var(--accent2); }

/* ── Analytics ── */
.analytics-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; color: var(--text); }
.no-data { color: var(--text2); text-align: center; padding: 20px 0; font-size: 14px; }
.bar-row { margin-bottom: 10px; }
.bar-label { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; color: var(--text); margin-bottom: 2px; }
.bar-value { font-size: 12px; color: var(--accent2); font-weight: 700; float: right; margin-top: -18px; }
.bar-track { height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; margin-top: 2px; }
.bar-fill { height: 100%; border-radius: 3px; }
.bar-fill-blue { background: var(--accent2); }
.bar-fill-red  { background: var(--accent); }
.month-chart { display: flex; align-items: flex-end; gap: 10px; height: 130px; padding-top: 12px; }
.month-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.month-count { font-size: 11px; color: var(--text2); }
.month-bar-track { flex: 1; display: flex; align-items: flex-end; width: 100%; }
.month-bar { width: 100%; background: var(--accent2); border-radius: 3px 3px 0 0; min-height: 4px; }
.month-label { font-size: 10px; color: var(--text2); white-space: nowrap; }
.rating-wrap { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; }
.rating-score { text-align: center; min-width: 90px; }
@media (max-width: 800px) { .analytics-two-col { grid-template-columns: 1fr; } }

/* ── SMM ── */
.smm-grid { display: grid; grid-template-columns: 360px 1fr; gap: 20px; }
.smm-channel-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; text-decoration: none; transition: opacity .15s; }
.smm-channel-btn:hover { opacity: .85; }
.smm-tg { background: #0088cc; color: #fff; }
.smm-fb { background: #1877f2; color: #fff; }
.smm-yt { background: #ff0000; color: #fff; }
.smm-share-action { font-size: 13px; padding: 8px 14px; }
.smm-tg-btn { background: #0088cc; color: #fff; }
.smm-fb-btn { background: #1877f2; color: #fff; }
.smm-tw-btn { background: #1da1f2; color: #fff; }
.smm-article-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); }
.smm-article-row:first-child { border-top: none; }
.smm-article-info { flex: 1; min-width: 0; }
.smm-article-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smm-article-meta { font-size: 11px; color: var(--text2); margin-top: 2px; }
.smm-article-btns { display: flex; gap: 4px; flex-shrink: 0; }
.smm-icon-btn { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: 14px; color: var(--text); cursor: pointer; text-decoration: none; transition: background .15s; display: inline-flex; align-items: center; }
.smm-icon-btn:hover { background: var(--border); }
@media (max-width: 900px) { .smm-grid { grid-template-columns: 1fr; } }

/* SMM Tabs */
.smm-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.smm-tab { background: none; border: none; color: var(--text2); font-size: 13px; font-weight: 600; padding: 10px 16px; cursor: pointer; font-family: inherit; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; white-space: nowrap; }
.smm-tab:hover { color: var(--text); }
.smm-tab.active { color: var(--accent2); border-bottom-color: var(--accent2); }
.smm-tab-mini { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; color: var(--text2); font-size: 12px; font-weight: 600; padding: 6px 12px; cursor: pointer; font-family: inherit; transition: all .15s; }
.smm-tab-mini.active { background: var(--accent2); color: #fff; border-color: var(--accent2); }

/* Hashtag cloud */
.ht-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.ht-chip { background: var(--surface2); border: 1px solid var(--border); border-radius: 20px; padding: 4px 12px; font-size: 12px; color: var(--text2); cursor: pointer; transition: all .15s; user-select: none; }
.ht-chip:hover { border-color: var(--accent2); color: var(--accent2); }
.ht-chip-active { background: rgba(69,123,157,.15); border-color: var(--accent2); color: var(--accent2); }

/* Content calendar */
.cal-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.cal-day { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px; min-height: 90px; }
.cal-today { border-color: var(--accent2); background: rgba(69,123,157,.1); }
.cal-past { opacity: .6; }
.cal-day-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cal-weekday { font-size: 10px; color: var(--text2); text-transform: uppercase; }
.cal-date { font-size: 13px; font-weight: 700; }
.cal-today .cal-date { color: var(--accent2); }
.cal-arts { display: flex; flex-direction: column; gap: 3px; }
.cal-art { display: flex; align-items: center; gap: 4px; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.cal-art:hover { background: var(--border); }
.cal-art-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.cal-art-title { font-size: 10px; color: var(--text); line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cal-empty { font-size: 10px; color: var(--text2); font-style: italic; padding: 2px 4px; }
.smm-gen-wrap { display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 700px) { .cal-grid { grid-template-columns: repeat(3, 1fr); } }

/* ── Image editor toolbar ─────────────────────────────────────────────── */
.img-edit-toolbar {
  position: absolute;
  z-index: 9500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
  flex-wrap: wrap;
}
.img-edit-toolbar button {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  padding: 4px 8px;
  font-size: 12px;
  min-width: 28px;
  transition: all .15s;
}
.img-edit-toolbar button:hover { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.img-tb-sep { width: 1px; height: 22px; background: var(--border); margin: 0 3px; }
.img-tb-group { display: flex; gap: 2px; }
.img-tb-crop { background: rgba(69,123,157,.2) !important; border-color: var(--accent2) !important; color: var(--accent2) !important; }
.img-tb-crop:hover { background: var(--accent2) !important; color: #fff !important; }
.img-tb-del { background: rgba(198,40,40,.15) !important; border-color: #c62828 !important; color: #ef5350 !important; }
.img-tb-del:hover { background: #c62828 !important; color: #fff !important; }

/* Resize handles */
.img-handle {
  position: absolute;
  z-index: 9400;
  width: 10px;
  height: 10px;
  background: #52A9FF;
  border: 2px solid #fff;
  border-radius: 2px;
  cursor: ew-resize;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.img-handle[data-pos="n"], .img-handle[data-pos="s"] { cursor: ns-resize; }
.img-handle[data-pos="nw"], .img-handle[data-pos="se"] { cursor: nwse-resize; }
.img-handle[data-pos="ne"], .img-handle[data-pos="sw"] { cursor: nesw-resize; }

/* ── Crop modal ───────────────────────────────────────────────────────── */
.crop-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.crop-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-width: 820px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
}
.crop-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
}
.crop-modal-body {
  flex: 1;
  overflow: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.crop-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  gap: 12px;
}

/* Placeholder images in designer blocks */
.rich-area img[src*="via.placeholder"],
.rich-area img[src*="placeholder"] {
  cursor: pointer;
  opacity: .85;
  border: 2px dashed #52A9FF !important;
  transition: opacity .15s, transform .15s;
  position: relative;
}
.rich-area img[src*="via.placeholder"]:hover,
.rich-area img[src*="placeholder"]:hover {
  opacity: 1;
  transform: scale(1.01);
  box-shadow: 0 0 0 3px rgba(82,169,255,.3);
}

/* ── Pages editor ─────────────────────────────────────────────────────── */
.page-tab-btn {
  width: 100%;
  text-align: left;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text2);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.page-tab-btn:hover { color: var(--text); border-color: var(--accent2); }
.page-tab-btn.active { background: rgba(69,123,157,.15); border-color: var(--accent2); color: var(--accent2); }
