:root {
  --bg: #0f172a; --panel: #1e293b; --card: #0f172a; --border: #334155;
  --accent: #38bdf8; --primary: #2271b1; --green: #10b981; --red: #ef4444;
  --text: #f8fafc; --muted: #94a3b8;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }

.b-login-overlay { position: fixed; inset: 0; z-index: 2000; background: radial-gradient(circle at top, #102a4c, #020617 70%); display: flex; align-items: center; justify-content: center; padding: 20px; }
.b-login-overlay.hidden { display: none; }
.b-login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 28px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,0.45); }
.b-login-card img { height: 50px; background: #fff; padding: 6px 12px; border-radius: 8px; margin: 0 auto 14px; display: block; }
.b-login-card input { width: 100%; background: var(--card); border: 1px solid var(--border); color: #fff; padding: 11px 12px; border-radius: 8px; margin: 14px 0 12px; }

.b-topbar { height: 52px; background: #1d2327; border-bottom: 1px solid #2c3338; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; gap: 8px; overflow-x: auto; }
.b-top-group { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.b-brand { font-weight: 700; font-size: 0.9rem; color: #38bdf8; padding-right: 8px; border-right: 1px solid #334155; }
.b-select, .b-input { background: #0f172a; border: 1px solid #334155; color: #f8fafc; padding: 5px 8px; border-radius: 5px; font-size: 0.78rem; font-family: inherit; }
.b-btn { border: 1px solid transparent; border-radius: 5px; padding: 6px 10px; font-size: 0.76rem; font-weight: 600; cursor: pointer; color: #fff; background: #334155; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; text-decoration: none; }
.b-btn:hover { filter: brightness(1.12); }
.b-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.b-btn.active { background: var(--primary); border-color: #72aee6; }
.b-btn-primary { background: var(--primary); }
.b-btn-green { background: var(--green); }
.b-btn-red { background: var(--red); }
.b-status { font-size: 0.76rem; color: #34d399; font-weight: 600; }
.b-unsaved { display: none; background: #f59e0b; color: #111827; padding: 2px 7px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; }
.b-unsaved.show { display: inline-block; }

.b-workspace { height: calc(100vh - 52px); display: grid; grid-template-columns: 270px 1fr 310px; }
.b-left, .b-right { background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.b-right { border-right: none; border-left: 1px solid var(--border); }
.b-panel-head { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.82rem; font-weight: 700; color: #e2e8f0; display: flex; justify-content: space-between; align-items: center; }
.b-panel-body { flex: 1; overflow-y: auto; padding: 10px 12px; }

.b-cat-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin: 12px 0 6px; font-weight: 700; }
.b-widget-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.b-widget-tile { background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 9px 6px; text-align: center; font-size: 0.74rem; color: #e2e8f0; cursor: grab; user-select: none; transition: border-color 0.15s, transform 0.1s; }
.b-widget-tile:hover { border-color: var(--accent); transform: translateY(-1px); }

.b-center { background: #0b1120; overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 18px; }
.b-canvas-frame { width: 100%; max-width: 100%; background: #ffffff; color: #0f172a; min-height: 760px; border-radius: 8px; box-shadow: 0 20px 50px rgba(0,0,0,0.45); transition: width 0.2s ease; overflow-x: hidden; padding: 16px; position: relative; }
.b-canvas-frame.dev-tablet { width: 768px; max-width: 100%; }
.b-canvas-frame.dev-mobile { width: 390px; max-width: 100%; }
.b-canvas-frame.dev-mobile .b-type-columns,
.b-canvas-frame.dev-mobile .b-type-grid,
.b-canvas-frame.dev-mobile .grid-2,
.b-canvas-frame.dev-mobile .grid-3,
.b-canvas-frame.dev-mobile .hero-grid { grid-template-columns: 1fr !important; }
.b-add-section-bar { margin-top: 14px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.b-el { position: relative; transition: outline 0.1s; }
.b-el:hover { outline: 1px dashed #38bdf8; }
.b-el.b-selected { outline: 2px solid #2271b1; }
.b-container { min-height: 54px; padding: 10px; border: 1px dashed rgba(148,163,184,0.45); }
.b-empty-drop { padding: 20px; text-align: center; color: #64748b; font-size: 0.82rem; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 6px; }
.b-el-bar { display: none; position: absolute; top: -24px; right: 0; z-index: 30; background: #2271b1; color: #fff; border-radius: 4px 4px 0 0; padding: 2px 4px; gap: 3px; align-items: center; font-size: 0.7rem; }
.b-el:hover > .b-el-bar, .b-el.b-selected > .b-el-bar { display: inline-flex; }
.b-el-bar button { background: rgba(255,255,255,0.16); border: none; color: #fff; cursor: pointer; padding: 1px 5px; border-radius: 3px; font-size: 0.7rem; }
.b-el-tag { padding: 0 4px; font-weight: 700; text-transform: uppercase; font-size: 0.64rem; }

.b-tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--border); }
.b-tab { background: none; border: none; color: var(--muted); padding: 9px 4px; font-size: 0.75rem; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; }
.b-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.b-field { margin-bottom: 10px; }
.b-field label { display: block; font-size: 0.74rem; color: #cbd5e1; margin-bottom: 4px; font-weight: 600; }
.b-field input, .b-field select, .b-field textarea { width: 100%; background: var(--card); border: 1px solid var(--border); color: #fff; padding: 7px 9px; border-radius: 5px; font-size: 0.8rem; font-family: inherit; }
.b-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.b-modal-backdrop { position: fixed; inset: 0; z-index: 1500; background: rgba(2,6,23,0.75); display: none; align-items: center; justify-content: center; padding: 16px; }
.b-modal-backdrop.open { display: flex; }
.b-modal { width: 100%; max-width: 680px; max-height: 85vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px; }
.b-modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.b-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 10px; }
.b-media-card { background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 6px; cursor: pointer; text-align: center; font-size: 0.72rem; }
.b-media-card img { width: 100%; height: 80px; object-fit: cover; border-radius: 4px; margin-bottom: 4px; }

@media (max-width: 1024px) {
  .b-workspace { grid-template-columns: 220px 1fr 260px; }
}
@media (max-width: 820px) {
  html, body { overflow: auto; }
  .b-workspace { height: auto; grid-template-columns: 1fr; }
  .b-left, .b-right { max-height: 360px; border: none; border-bottom: 1px solid var(--border); }
}
