:root {
  --bg:      #0e1117;
  --bg2:     #161b22;
  --bg3:     #1c2333;
  --bg4:     #21262d;
  --border:  #30363d;
  --text:    #e6edf3;
  --text2:   #8b949e;
  --text3:   #6e7681;
  --accent:  #2f81f7;
  --accenth: #388bfd;
  --green:   #3fb950;
  --red:     #f85149;
  --r:       8px;
  --font:    'Manrope', sans-serif;
  --mono:    'Space Mono', monospace;
  --sidebar-w: 260px;
  --mobile-h:  52px;
  --fs-base:   14px;
  --fs-sm:     12px;
  --fs-xs:     11px;
  --fs-lg:     16px;
  --fs-xl:     20px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); height: 100vh; overflow: hidden; font-size: var(--fs-base); }

/* ══════════════════════════════════════
   LOGIN
══════════════════════════════════════ */
.login-screen { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 16px; }
.login-box    { width: 100%; max-width: 420px; background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 40px 36px; }
.login-logo   { font-size: 44px; text-align: center; margin-bottom: 10px; }
.login-title  { font-size: 24px; font-weight: 600; text-align: center; margin-bottom: 4px; }
.login-sub    { font-size: var(--fs-base); color: var(--text3); text-align: center; margin-bottom: 24px; }
.login-tabs   { display: flex; background: var(--bg3); border-radius: var(--r); padding: 3px; margin-bottom: 20px; }
.login-tab    { flex: 1; background: none; border: none; color: var(--text2); padding: 8px; font-family: var(--font); font-size: var(--fs-base); font-weight: 500; cursor: pointer; border-radius: calc(var(--r) - 2px); transition: all .15s; }
.login-tab.active { background: var(--bg4); color: var(--text); }
.auth-error   { background: rgba(248,81,73,.1); border: 1px solid rgba(248,81,73,.3); color: var(--red); padding: 10px 12px; border-radius: var(--r); font-size: var(--fs-base); margin-bottom: 14px; }
.btn-full     { width: 100%; justify-content: center; margin-top: 6px; }

/* ══════════════════════════════════════
   ADMIN PANEL
══════════════════════════════════════ */
.admin-panel { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.admin-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 28px; background: var(--bg2); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.admin-header-left { display: flex; align-items: center; gap: 12px; }
.admin-logo  { font-weight: 600; font-size: 16px; }
.admin-badge { font-size: 10px; padding: 3px 8px; background: rgba(47,129,247,.2); color: var(--accent); border-radius: 20px; font-weight: 600; letter-spacing: .5px; font-family: var(--mono); }

.admin-body {
  flex: 1; overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  gap: 0;
}

/* When drawer is open — split into two columns */
.admin-body.drawer-open {
  grid-template-columns: 1fr 360px;
  grid-template-rows: auto 1fr;
}

.admin-sections {
  grid-column: 1;
  grid-row: 1 / 3;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-body.drawer-open .admin-sections {
  grid-column: 1;
}

.admin-section { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; flex-shrink: 0; }
.admin-section-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 10px; }
.admin-section-title  { font-size: 15px; font-weight: 600; }
.admin-sub-title      { font-size: 12px; color: var(--text3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; padding: 0 20px; }

.period-tabs { display: flex; background: var(--bg3); border-radius: var(--r); padding: 3px; gap: 2px; }
.period-tab  { background: none; border: none; color: var(--text2); padding: 5px 12px; font-family: var(--font); font-size: 13px; cursor: pointer; border-radius: calc(var(--r)-2px); transition: all .15s; }
.period-tab:hover  { color: var(--text); }
.period-tab.active { background: var(--accent); color: #fff; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; padding: 16px 20px; }
.stat-card  { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; }
.stat-card.accent { border-color: rgba(47,129,247,.4); background: rgba(47,129,247,.08); }
.stat-card-val   { font-size: 24px; font-weight: 600; font-family: var(--mono); margin-bottom: 4px; }
.stat-card.accent .stat-card-val { color: var(--accent); }
.stat-card-label { font-size: 12px; color: var(--text3); }

/* Daily chart */
.daily-chart-wrap { padding: 4px 0 16px; }
.daily-chart { display: flex; align-items: flex-end; gap: 3px; height: 80px; padding: 0 20px; overflow-x: auto; }
.daily-bar-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 32px; cursor: default; }
.daily-bar  { width: 28px; background: rgba(47,129,247,.5); border-radius: 3px 3px 0 0; transition: background .15s; min-height: 2px; }
.daily-bar:hover { background: var(--accent); }
.daily-date { font-size: 9px; color: var(--text3); font-family: var(--mono); white-space: nowrap; }

/* Users table */
.admin-table-wrap { overflow-x: auto; max-height: 400px; overflow-y: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table thead tr { position: sticky; top: 0; background: var(--bg2); z-index: 1; }
.admin-table th { padding: 10px 16px; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text3); border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table td { padding: 11px 16px; border-bottom: 1px solid var(--border); color: var(--text2); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg3); }
.admin-table td.email { color: var(--text); font-weight: 500; }
.admin-table td.cost  { font-family: var(--mono); font-size: 12px; }
.status-badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 500; }
.status-active   { background: rgba(63,185,80,.15); color: var(--green); }
.status-inactive { background: rgba(248,81,73,.1);  color: var(--red); }
.admin-table .btn-sm { font-size: 11px; padding: 3px 10px; }

/* User drawer — side panel */
.user-drawer {
  grid-column: 2;
  grid-row: 1 / 3;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.user-drawer.hidden { display: none; }
.user-drawer-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.drawer-email { font-size: 14px; font-weight: 600; word-break: break-all; }
.drawer-log   { display: flex; flex-direction: column; gap: 6px; }
.drawer-log-row { display: grid; grid-template-columns: 90px 1fr 1fr 1fr; gap: 6px; align-items: center; padding: 7px 10px; background: var(--bg3); border-radius: 6px; font-size: 12px; }
.drawer-log-date { font-family: var(--mono); font-size: 11px; color: var(--text3); }
.drawer-log-val  { font-family: var(--mono); font-size: 11px; }

/* ══════════════════════════════════════
   APP ROOT
══════════════════════════════════════ */
.app-root { height: 100vh; display: flex; flex-direction: column; }
.app { display: flex; flex: 1; overflow: hidden; }

/* ── Mobile header ── */
.mobile-header { display: none; height: var(--mobile-h); min-height: var(--mobile-h); background: var(--bg2); border-bottom: 1px solid var(--border); padding: 0 12px; align-items: center; justify-content: space-between; gap: 10px; }
.mobile-title  { font-size: 15px; font-weight: 600; flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn      { background: none; border: 1px solid var(--border); color: var(--text2); width: 36px; height: 36px; border-radius: var(--r); font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.icon-btn:hover, .icon-btn.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 49; }

/* ── Sidebar ── */
.sidebar { width: var(--sidebar-w); min-width: var(--sidebar-w); background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; transition: transform .25s ease; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.logo { font-weight: 600; font-size: var(--fs-base); }
.sidebar-count { padding: 7px 16px; font-size: var(--fs-sm); color: var(--text3); }
.sidebar-list  { flex: 1; overflow-y: auto; padding: 6px 8px; }

.tpl-item  { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r); cursor: pointer; transition: background .15s; }
.tpl-item:hover  { background: var(--bg3); }
.tpl-item.active { background: var(--bg4); }
.tpl-emoji { font-size: 18px; flex-shrink: 0; }
.tpl-info  { flex: 1; min-width: 0; }
.tpl-name  { font-size: var(--fs-base); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-sub   { font-size: var(--fs-xs); color: var(--text3); margin-top: 1px; }

/* ── Stats panel ── */
.stats-panel   { border-top: 1px solid var(--border); padding: 12px 14px; }
.stats-title   { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text3); margin-bottom: 8px; }
.stats-row     { display: flex; justify-content: space-between; padding: 3px 0; font-size: var(--fs-sm); }
.stats-label   { color: var(--text3); }
.stats-val     { font-family: var(--mono); font-size: var(--fs-xs); color: var(--text2); }
.stats-val.green { color: var(--green); }
.stats-divider { border-top: 1px solid var(--border); margin: 7px 0; }
.stats-reset   { margin-top: 8px; width: 100%; justify-content: center; font-size: var(--fs-sm); }

/* ── Main ── */
.main { flex: 1; overflow-y: auto; min-width: 0; }
.empty-main { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 12px; color: var(--text2); text-align: center; padding: 40px; }
.empty-main-icon { font-size: 48px; }
.empty-main h2   { font-size: var(--fs-xl); color: var(--text); }
.empty-main p    { font-size: var(--fs-base); line-height: 1.6; }

/* ── Editor ── */
.editor { padding: 20px 28px 80px; max-width: 900px; }
.editor-header  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.editor-title   { display: flex; align-items: center; gap: 8px; min-width: 0; }
.editor-emoji   { font-size: 22px; flex-shrink: 0; }
.editor-title h1 { font-size: var(--fs-xl); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor-actions  { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.model-selector { display: flex; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.model-btn      { background: none; border: none; color: var(--text2); padding: 5px 10px; font-family: var(--font); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; transition: all .15s; display: flex; align-items: center; gap: 4px; }
.model-btn:hover  { color: var(--text); background: var(--bg4); }
.model-btn.active { background: var(--accent); color: #fff; }
.model-badge { font-size: 9px; padding: 1px 4px; background: rgba(255,255,255,.15); border-radius: 8px; }

.last-usage { display: flex; align-items: center; gap: 14px; padding: 8px 12px; margin-bottom: 14px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r); font-size: var(--fs-sm); color: var(--text3); flex-wrap: wrap; }
.last-usage span     { display: flex; align-items: center; gap: 4px; }
.last-usage strong   { color: var(--text2); font-family: var(--mono); font-size: var(--fs-xs); font-weight: 400; }
.usage-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); display: inline-block; }

.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab  { background: none; border: none; color: var(--text2); padding: 9px 18px; font-family: var(--font); font-size: var(--fs-base); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s; }
.tab:hover  { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Fields ── */
.fields-section { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 16px; }
.fields-header  { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.fields-title   { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text3); }
.add-field-panel { padding: 10px 14px; background: var(--bg3); border-bottom: 1px solid var(--border); }
.add-field-row   { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.add-field-row input { flex: 1; min-width: 120px; }
#add-field-extra { margin-top: 8px; }
#add-field-extra input, #add-field-extra textarea { padding: 7px 10px; background: var(--bg4); border: 1px solid var(--border); border-radius: var(--r); color: var(--text); font-family: var(--font); font-size: var(--fs-base); }
#add-field-extra textarea { min-height: 60px; resize: vertical; }
.field-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.field-item:last-child { border-bottom: none; }
.field-drag { color: var(--text3); cursor: grab; user-select: none; font-size: 15px; }
.field-info { flex: 1; min-width: 0; }
.field-name { font-size: var(--fs-base); font-weight: 500; }
.field-meta { font-size: var(--fs-xs); color: var(--text3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-type { font-size: 10px; padding: 2px 6px; border-radius: 20px; font-family: var(--mono); white-space: nowrap; flex-shrink: 0; }
.type-ai_text, .type-ai_random { background: rgba(47,129,247,.15); color: #79b8ff; }
.type-text    { background: rgba(63,185,80,.1);  color: #56d364; }
.type-select  { background: rgba(225,167,3,.12); color: #e3b341; }
.type-phone   { background: rgba(248,81,73,.1);  color: #ff7b72; }
.type-address, .type-url { background: rgba(139,148,158,.1); color: #8b949e; }
.field-del { background: none; border: none; color: var(--text3); cursor: pointer; padding: 4px 6px; border-radius: 4px; transition: color .15s; flex-shrink: 0; }
.field-del:hover { color: var(--red); }

/* ── Results ── */
.results-section { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r); }
.results-header  { padding: 11px 14px; font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text3); border-bottom: 1px solid var(--border); }
.result-item     { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.result-item:last-child { border-bottom: none; }
.result-item.filled     { border-left: 2px solid var(--green); }
.result-label { font-size: var(--fs-sm); color: var(--text3); min-width: 130px; padding-top: 2px; flex-shrink: 0; }
.result-value { flex: 1; font-size: var(--fs-base); word-break: break-word; line-height: 1.5; min-width: 0; }
.result-value.placeholder { color: var(--text3); font-style: italic; }
.shimmer { display: inline-block; width: 120px; height: 13px; background: linear-gradient(90deg,var(--bg3) 25%,var(--bg4) 50%,var(--bg3) 75%); background-size: 200%; animation: shim 1.4s infinite; border-radius: 4px; }
@keyframes shim { 0%{background-position:200%} 100%{background-position:-200%} }
.btn-copy { background: none; border: 1px solid var(--border); color: var(--text2); font-size: var(--fs-xs); padding: 3px 8px; border-radius: 5px; cursor: pointer; font-family: var(--font); transition: all .15s; white-space: nowrap; flex-shrink: 0; }
.btn-copy:hover  { background: var(--bg3); color: var(--text); }
.btn-copy.copied { border-color: var(--green); color: var(--green); }

/* ══════════════════════════════════════
   BUTTONS & INPUTS
══════════════════════════════════════ */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--r); border: 1px solid transparent; font-family: var(--font); font-size: var(--fs-base); font-weight: 500; cursor: pointer; transition: all .15s; }
.btn-primary          { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover    { background: var(--accenth); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost            { background: none; color: var(--text2); border-color: var(--border); }
.btn-ghost:hover      { background: var(--bg3); color: var(--text); }
.btn-sm               { padding: 5px 11px; font-size: var(--fs-sm); }

input[type=text], input[type=email], input[type=password], select, textarea {
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r);
  color: var(--text); font-family: var(--font); font-size: var(--fs-base);
  padding: 8px 11px; outline: none; transition: border-color .15s; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select option { background: var(--bg3); }

.badge     { font-size: var(--fs-xs); padding: 2px 7px; background: var(--bg3); border: 1px solid var(--border); border-radius: 20px; color: var(--text3); font-family: var(--mono); flex-shrink: 0; }
.badge-geo { border-color: rgba(47,129,247,.4); color: #79b8ff; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal-overlay.hidden { display: none !important; }
.modal       { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 24px; width: 100%; max-width: 460px; }
.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 18px; }
.form-group  { margin-bottom: 12px; }
.form-group label { display: block; font-size: var(--fs-sm); color: var(--text2); margin-bottom: 4px; }
.form-row    { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }
.label-hint  { color: var(--text3); font-weight: 400; font-size: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ── Sidebar imggen button ── */
.sidebar-imggen-btn {
  margin: 0 8px 6px;
  justify-content: center;
  font-size: var(--fs-sm);
  border-color: rgba(47,129,247,.35);
  color: #79b8ff;
}
.sidebar-imggen-btn:hover { background: rgba(47,129,247,.1); color: var(--accent); }

/* ── Standalone imggen screen ── */
.imggen-screen { padding: 28px 32px; max-width: 760px; }
.imggen-header  { margin-bottom: 24px; }
.imggen-header h2 { font-size: var(--fs-xl); font-weight: 600; margin-bottom: 6px; }
.imggen-sub { font-size: var(--fs-base); color: var(--text2); }
.imggen-form { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r); padding: 20px; margin-bottom: 24px; }
.igform-row  { display: flex; gap: 12px; }
.igform-row .form-group { flex: 1; }

.iggen-results { display: flex; flex-direction: column; gap: 20px; }
.iggen-card    { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.iggen-card-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text2); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.iggen-dim     { font-size: 11px; color: var(--text3); font-family: var(--mono); font-weight: 400; }
.iggen-preview-wrap { margin-bottom: 12px; }
.iggen-spinner-wrap { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--text3); padding: 20px 0; }
.iggen-avatar-img { width: 140px; height: 140px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); display: block; }
.iggen-cover-img  { width: 100%; max-height: 200px; object-fit: cover; border-radius: var(--r); border: 1px solid var(--border); display: block; aspect-ratio: 820/360; }
.iggen-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.img-type-selector { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.img-type-opt      { display: flex; align-items: center; gap: 8px; font-size: var(--fs-base); color: var(--text2); cursor: pointer; }
.img-type-opt input{ width: auto; }
.img-modal-results { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.img-modal-row     { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.img-result-thumb-cover { aspect-ratio: 820/360 !important; max-height: 120px; object-fit: cover; }

/* ── Tpl item image btn ── */
.tpl-img-btn { background: none; border: 1px solid var(--border); color: var(--text3); font-size: 13px; padding: 2px 7px; border-radius: 5px; cursor: pointer; flex-shrink: 0; transition: all .15s; }
.tpl-img-btn:hover { background: var(--bg3); color: var(--text); }
.img-results-block { border-top: 1px solid var(--border); padding: 14px; }
.img-results-row   { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.img-result-card   { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.img-result-label  { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text3); }
.img-result-thumb  { width: 100%; border-radius: 6px; object-fit: cover; max-height: 160px; }
.img-result-status { font-size: var(--fs-sm); color: var(--text3); display: flex; align-items: center; gap: 6px; }
.img-result-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Standalone image panel ── */
.standalone-img-panel { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; margin-bottom: 20px; }
.standalone-img-title { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text3); margin-bottom: 14px; }
.standalone-img-row   { display: grid; grid-template-columns: 1fr 2fr; gap: 14px; }
.standalone-img-card  { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r); padding: 12px; }
.standalone-img-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: var(--fs-sm); font-weight: 500; }
.standalone-preview-wrap    { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.standalone-avatar-preview  { width: 120px; height: 120px; border-radius: 50%; background: var(--bg4); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 28px; overflow: hidden; position: relative; flex-shrink: 0; }
.standalone-avatar-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.standalone-cover-preview {
  position: relative;
  width: 100%;
  height: 110px;
  background: var(--bg4);
  border: 2px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.standalone-cover-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.solo-cover-placeholder {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px; color: var(--text3); font-family: var(--mono);
}

/* ── FB cover image ── */
.fb-cover-bg { position: relative; width: 100%; height: 100%; background: linear-gradient(135deg,#1a1a2e,#0f3460); }
.fb-cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fb-preview  { max-width: 580px; background: #1c1e21; border-radius: 10px; overflow: hidden; border: 1px solid #3a3b3c; }
.fb-cover    { position: relative; height: 180px; }
.fb-cover-bg { width: 100%; height: 100%; background: linear-gradient(135deg,#1a1a2e,#0f3460); }
.fb-avatar-wrap { position: absolute; bottom: -32px; left: 18px; }
.fb-avatar { width: 84px; height: 84px; background: #3a3b3c; border: 3px solid #1c1e21; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 32px; overflow: hidden; position: relative; }
.fb-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fb-info     { padding: 42px 18px 14px; border-bottom: 1px solid #3a3b3c; }
.fb-name     { font-size: 20px; font-weight: 700; color: #e4e6eb; margin-bottom: 3px; }
.fb-category { font-size: var(--fs-base); color: #b0b3b8; margin-bottom: 10px; }
.img-gen-block  { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.img-gen-status { font-size: var(--fs-sm); color: var(--text3); }
.img-actions    { display: flex; gap: 5px; flex-wrap: wrap; }
.img-spinner    { display: inline-block; width: 11px; height: 11px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fb-actions-row { display: flex; gap: 8px; }
.fb-btn  { padding: 7px 16px; border-radius: 7px; border: none; font-weight: 600; font-size: var(--fs-base); cursor: default; font-family: var(--font); }
.fb-btn-like { background: #263951; color: #4599ff; }
.fb-btn-msg  { background: #3a3b3c; color: #e4e6eb; }
.fb-contacts { padding: 10px 18px; }
.fb-contact-row  { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; font-size: var(--fs-base); color: #e4e6eb; border-bottom: 1px solid #3a3b3c; }
.fb-contact-row:last-child { border-bottom: none; }
.fb-contact-icon { font-size: 15px; min-width: 20px; margin-top: 1px; }

/* ══════════════════════════════════════
   MISC
══════════════════════════════════════ */
.hidden { display: none !important; }
.empty-state { text-align: center; color: var(--text3); font-size: var(--fs-base); padding: 20px; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }

/* ══════════════════════════════════════
   RESPONSIVE — MOBILE (≤640px)
══════════════════════════════════════ */
@media (max-width: 640px) {
  .mobile-header { display: flex; }
  .desktop-only  { display: none !important; }
  .app { height: calc(100vh - var(--mobile-h)); }
  .sidebar { position: fixed; top: var(--mobile-h); left: 0; height: calc(100vh - var(--mobile-h)); z-index: 50; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .editor { padding: 14px 14px 80px; }
  .editor-header { flex-direction: column; align-items: flex-start; }
  .editor-actions { width: 100%; }
  .form-row { flex-direction: column; gap: 0; }
  .result-item { flex-wrap: wrap; }
  .result-label { min-width: 100%; margin-bottom: 2px; }
  .fb-preview   { border-radius: 0; border-left: none; border-right: none; max-width: 100%; }
  .modal        { padding: 20px 16px; }
  .model-badge  { display: none; }
}

/* ══════════════════════════════════════
   RESPONSIVE — TABLET (641–1279px)
══════════════════════════════════════ */
@media (min-width: 641px) and (max-width: 1279px) {
  :root { --sidebar-w: 230px; }
  .editor { padding: 18px 24px; }
}

/* ══════════════════════════════════════
   RESPONSIVE — WIDE (≥1280px)
   Увеличиваем ВСЁ на 2px
══════════════════════════════════════ */
@media (min-width: 1280px) {
  :root {
    --sidebar-w: 300px;
    --fs-base:   16px;
    --fs-sm:     14px;
    --fs-xs:     12px;
    --fs-lg:     18px;
    --fs-xl:     22px;
  }

  .main { display: flex; justify-content: center; }

  .editor {
    width: 100%;
    max-width: 1200px;
    padding: 28px 40px 80px;
  }

  #tab-builder {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
  }

  .fields-section,
  .results-section { margin-bottom: 0; }

  .logo { font-size: 17px; }
  .tpl-name { font-size: 15px; }
  .tpl-sub  { font-size: 12px; }
  .badge-type { font-size: 11px; }
  .stat-card-val { font-size: 26px; }
  .admin-table   { font-size: 14px; }
  .admin-table th { font-size: 12px; }
}

@media (min-width: 1600px) {
  :root { --sidebar-w: 320px; }
  .editor { max-width: 1440px; padding: 32px 56px 80px; }
  #tab-builder { gap: 32px; }
}
/* ── Batch generation ── */
.batch-row { display: flex; align-items: center; gap: 8px; margin-top: 20px; }
.batch-label { font-size: 12px; color: var(--text2); }