.topbar{display:flex;align-items:center;gap:12px;padding:12px 14px;background:linear-gradient(180deg,#111827 0%,#0b1220 58%,#09111f 100%);border-bottom:1px solid var(--line);box-shadow:0 14px 34px rgba(2,6,23,.32)}
    .toolbar-scroll-shell{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;align-items:end;flex:1;min-width:0}
    .toolbar-scroll-wrap{position:relative;min-width:0}
    .toolbar-scroll-wrap::before,.toolbar-scroll-wrap::after{content:"";position:absolute;top:0;bottom:0;width:28px;pointer-events:none;z-index:2}
    .toolbar-scroll-wrap::before{left:0;background:linear-gradient(90deg,#0b1220 15%,rgba(11,18,32,0))}
    .toolbar-scroll-wrap::after{right:0;background:linear-gradient(270deg,#0b1220 15%,rgba(11,18,32,0))}
    .toolbar-scroll{display:flex;gap:12px;overflow-x:auto;overflow-y:hidden;padding:4px 2px 6px;scrollbar-width:none;scroll-behavior:smooth}
    .toolbar-scroll::-webkit-scrollbar{display:none}

.toolbar-scroll::-webkit-scrollbar{display:none}
    .toolbar-group{display:flex;flex-direction:column;gap:8px;min-width:max-content;padding:12px;border:1px solid #22314a;border-radius:14px;background:linear-gradient(180deg,rgba(17,24,39,.94),rgba(9,17,31,.94));box-shadow:inset 0 1px 0 rgba(148,163,184,.08),0 12px 24px rgba(2,6,23,.18)}
    .toolbar-group-label{font-size:11px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:#93a7c7}
    .toolbar-group-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
    .toolbar-group-actions.compact{gap:6px}
    .toolbar-divider{width:1px;height:30px;background:linear-gradient(180deg,rgba(148,163,184,.1),rgba(148,163,184,.45),rgba(148,163,184,.1))}
    .btn,.select{height:38px;border-radius:10px;border:1px solid #32415f;background:#13203a;color:var(--text);padding:0 12px;cursor:pointer;font-size:13px;transition:background .18s ease,border-color .18s ease,transform .18s ease,box-shadow .18s ease}
    .btn:hover,.select:hover{background:#17284a;transform:translateY(-1px);box-shadow:0 8px 18px rgba(37,99,235,.12)}
    .btn.primary{background:var(--accent);border-color:var(--accent)}
    .btn.primary:hover{background:var(--accent2)}
    .btn.is-active{background:#1d4ed8;border-color:#93c5fd;color:#f8fafc;box-shadow:0 0 0 1px rgba(191,219,254,.18) inset}
    .btn.good{background:#065f46;border-color:#065f46}
    .btn.warn{background:#7c5200;border-color:#7c5200}
    .btn.danger{background:#7f1d1d;border-color:#7f1d1d}
    .btn.wp-theme{background:#7e22ce;border-color:#a855f7;color:#f3e8ff}
    .btn.wp-theme:hover{background:#6b21a8}
    .btn.toolbar-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-width:44px;padding-inline:14px;font-weight:700;white-space:nowrap}
    .btn.toolbar-btn.slim{padding-inline:10px;min-width:38px}
    .btn.toolbar-btn[data-kind="ghost"]{background:#0f1a2c;border-color:#2d3f5f}
    .btn.toolbar-btn[data-kind="soft"]{background:#12233d;border-color:#35527d}
    .toolbar-segment{display:inline-flex;align-items:center;gap:6px;padding:4px;border:1px solid #31415d;border-radius:12px;background:#0d1828;box-shadow:inset 0 1px 0 rgba(148,163,184,.08)}
    .toolbar-segment .btn{margin:0}

/* Top toolbar panel-card button update: mirrors the left/right panel thumbnail tabs. */
.topbar .toolbar-group-actions {
  align-items: stretch;
}

.topbar .toolbar-divider {
  height: 58px;
  align-self: center;
}

.topbar .btn.toolbar-btn {
  min-height: 58px;
  min-width: 118px;
  max-width: 132px;
  flex: 0 0 118px;
  height: auto;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #cbd5e1;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  text-align: left;
  white-space: normal;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: none;
  box-shadow: none;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.topbar .btn.toolbar-btn:hover {
  background: #111c34;
  border-color: #64748b;
  transform: translateY(-1px);
  box-shadow: 0 14px 22px rgba(2, 6, 23, .28);
}

.topbar .btn.toolbar-btn:focus-visible {
  outline: 2px solid #bfdbfe;
  outline-offset: 2px;
}

.topbar .btn.toolbar-btn.is-active,
.topbar .btn.toolbar-btn[aria-pressed="true"] {
  background: #111c34;
  border-color: #93c5fd;
  color: #f8fafc;
  box-shadow: 0 0 0 1px rgba(147, 197, 253, .16) inset, 0 16px 26px rgba(29, 78, 216, .22);
}

.topbar .btn.toolbar-btn.slim {
  min-width: 94px;
  max-width: 106px;
  flex-basis: 94px;
  padding-inline: 0;
}

.topbar .toolbar-btn-thumb {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 28px;
  padding: 4px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, .14);
  background: linear-gradient(135deg, #1e293b, #334155);
}

.topbar .toolbar-btn-icon {
  font-size: 15px;
  line-height: 1;
}

.topbar .toolbar-btn-kicker {
  overflow: hidden;
  color: rgba(255, 255, 255, .86);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .06em;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar .toolbar-btn-body {
  display: grid;
  gap: 1px;
  padding: 6px 8px;
}

.topbar .toolbar-btn-title {
  overflow: hidden;
  color: #f8fafc;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  text-overflow: ellipsis;
}

.topbar .toolbar-btn-note {
  overflow: hidden;
  color: #94a3b8;
  font-size: 10px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar .btn.toolbar-btn.is-active .toolbar-btn-title,
.topbar .btn.toolbar-btn[aria-pressed="true"] .toolbar-btn-title {
  color: #eff6ff;
}

.topbar .btn.toolbar-btn.is-active .toolbar-btn-note,
.topbar .btn.toolbar-btn[aria-pressed="true"] .toolbar-btn-note {
  color: #dbeafe;
}

.topbar .btn.toolbar-btn.is-active .toolbar-btn-thumb,
.topbar .btn.toolbar-btn[aria-pressed="true"] .toolbar-btn-thumb {
  border-bottom-color: rgba(191, 219, 254, .28);
}

#btnSave .toolbar-btn-thumb,
#btnLoad .toolbar-btn-thumb,
#btnImportHtml .toolbar-btn-thumb,
#btnImportHtmlCss .toolbar-btn-thumb {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
}

#btnPreview .toolbar-btn-thumb,
#btnBrowserPreview .toolbar-btn-thumb,
#btnToggleOutline .toolbar-btn-thumb,
#btnCanvasFullscreen .toolbar-btn-thumb {
  background: linear-gradient(135deg, #0f766e, #14b8a6);
}

#btnShowBlocks .toolbar-btn-thumb,
#btnShowStyles .toolbar-btn-thumb,
#btnShowLogic .toolbar-btn-thumb,
#btnShowNavbarTools .toolbar-btn-thumb,
#btnShowAssetsPanel .toolbar-btn-thumb {
  background: linear-gradient(135deg, #1d4ed8, #6366f1);
}

#btnUndo .toolbar-btn-thumb,
#btnRedo .toolbar-btn-thumb,
#btnClearCanvasTop .toolbar-btn-thumb {
  background: linear-gradient(135deg, #475569, #0f172a);
}

#btnDesktop .toolbar-btn-thumb,
#btnTablet .toolbar-btn-thumb,
#btnMobile .toolbar-btn-thumb {
  background: linear-gradient(135deg, #0369a1, #0284c7);
}

#btnExportZip .toolbar-btn-thumb,
#btnExportWpTheme .toolbar-btn-thumb,
#btnPublishPanel .toolbar-btn-thumb {
  background: linear-gradient(135deg, #b45309, #f59e0b);
}

#btnPublishPanel .toolbar-btn-thumb {
  background: linear-gradient(135deg, #15803d, #65a30d);
}

#btnClearCanvasTop .toolbar-btn-thumb {
  background: linear-gradient(135deg, #991b1b, #ef4444);
}

#btnExportWpTheme .toolbar-btn-thumb {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
}

@media (max-width: 760px) {
  .topbar .btn.toolbar-btn {
    min-width: 104px;
    flex-basis: 104px;
  }

  .topbar .btn.toolbar-btn.slim {
    min-width: 88px;
    flex-basis: 88px;
  }
}

/* Dedicated Theme Thumbnail card in the top toolbar. */
#btnShowThemeThumbnailPanel .toolbar-btn-thumb {
  background: linear-gradient(135deg, #be185d, #f97316);
}

.topbar .toolbar-group-thumbnail .toolbar-group-actions {
  justify-content: stretch;
}

.topbar .toolbar-group-thumbnail .btn.toolbar-btn {
  min-width: 132px;
  flex-basis: 132px;
}

/* Top toolbar horizontal collapse/expand controls. */
.topbar .toolbar-group {
  position: relative;
  transition: min-width .22s ease, max-width .22s ease, padding .22s ease, border-color .18s ease, background .18s ease, transform .18s ease, opacity .18s ease;
}

.topbar .toolbar-group-top-controls {
  border-color: #334155;
  background: linear-gradient(180deg, rgba(15, 23, 42, .98), rgba(30, 41, 59, .9));
}

#btnCollapseTopPanels .toolbar-btn-thumb,
#btnExpandTopPanels .toolbar-btn-thumb {
  background: linear-gradient(135deg, #334155, #64748b);
}

.topbar .toolbar-group.is-toolbar-collapsed {
  min-width: 84px;
  max-width: 84px;
  padding: 9px 8px;
  gap: 7px;
  cursor: pointer;
  border-color: #334155;
  background: linear-gradient(180deg, rgba(15, 23, 42, .95), rgba(2, 6, 23, .94));
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, .08), 0 10px 20px rgba(2, 6, 23, .2);
}

.topbar .toolbar-group.is-toolbar-collapsed:hover {
  border-color: #64748b;
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, .12), 0 14px 24px rgba(2, 6, 23, .28);
}

.topbar .toolbar-group.is-toolbar-collapsed .toolbar-group-actions {
  display: none;
}

.topbar .toolbar-group.is-toolbar-collapsed .toolbar-group-label {
  display: block;
  overflow: hidden;
  color: #e2e8f0;
  font-size: 10px;
  line-height: 1.05;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar .toolbar-group.is-toolbar-collapsed::after {
  content: attr(data-toolbar-icon);
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid rgba(148, 163, 184, .2);
  border-radius: 11px;
  background: linear-gradient(135deg, #1e293b, #334155);
  color: #f8fafc;
  font-size: 21px;
  line-height: 1;
}

.topbar .toolbar-group.is-toolbar-collapsed::before {
  content: "Open";
  display: block;
  color: #94a3b8;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.topbar .toolbar-group.is-toolbar-sweeping {
  opacity: .86;
}
