/* ============ Top bar ============ */
#topbar {
  height: 48px; flex: none;
  display: flex; align-items: center;
  padding: 0 12px 0 16px; gap: 8px;
  background: var(--base-topbar, #166ee1);
  color: #fff;
  position: relative; z-index: 40;
}
.topbar-left { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1; }
.topbar-logo { display: flex; align-items: center; margin-right: 6px; cursor: pointer; opacity: 0.95; }
.topbar-logo:hover { opacity: 1; }
.base-name-btn {
  display: flex; align-items: center; gap: 5px;
  height: 32px; padding: 0 8px; border-radius: var(--radius);
  font-size: 15px; font-weight: 675; color: #fff; max-width: 340px;
}
.base-name-btn:hover { background: rgba(0,0,0,0.1); }
.base-name-btn .icon { opacity: 0.8; }
.topbar-nav { display: flex; align-items: center; gap: 2px; margin-left: 12px; }
.topbar-navitem {
  height: 26px; padding: 0 12px; border-radius: 9999px;
  font-size: 13px; color: rgba(255,255,255,0.85);
  display: inline-flex; align-items: center;
}
.topbar-navitem:hover { background: rgba(0,0,0,0.1); color: #fff; }
.topbar-navitem.active { background: rgba(0,0,0,0.25); color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-iconbtn {
  width: 28px; height: 28px; border-radius: 9999px;
  display: inline-flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.9);
}
.topbar-iconbtn:hover { background: rgba(0,0,0,0.1); color: #fff; }
.topbar-launch {
  height: 28px; padding: 0 12px; border-radius: 9999px;
  background: #fff; color: var(--base-topbar-text, #166ee1);
  font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
}
.topbar-launch:hover { opacity: 0.92; }
.topbar-avatar {
  width: 26px; height: 26px; border-radius: 9999px;
  background: #fcb400; color: #1d1f25; font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.9); cursor: pointer; margin-left: 2px;
}

/* ============ Table tabs strip ============ */
#tabstrip {
  height: 32px; flex: none;
  display: flex; align-items: stretch;
  background: var(--base-strip, #146bd6);
  padding: 0 0 0 12px;
  position: relative; z-index: 30;
}
.tabstrip-scroll { display: flex; align-items: stretch; overflow-x: auto; scrollbar-width: none; }
.tabstrip-scroll::-webkit-scrollbar { display: none; }
.table-tab {
  display: flex; align-items: center; gap: 4px;
  padding: 0 12px; font-size: 13px;
  color: rgba(255,255,255,0.85); white-space: nowrap;
  border-top-left-radius: 4px; border-top-right-radius: 4px;
  position: relative; cursor: pointer; user-select: none;
}
.table-tab:hover { background: rgba(0,0,0,0.1); color: #fff; }
.table-tab.active { background: #fff; color: var(--text); font-weight: 500; }
.table-tab.active:hover { background: #fff; }
.table-tab .tab-caret { display: none; margin-right: -6px; color: var(--text-quiet); border-radius: 3px; padding: 1px; }
.table-tab.active .tab-caret { display: inline-flex; }
.table-tab .tab-caret:hover { background: var(--bg-hover); }
.table-tab.dragging { opacity: 0.5; }
.table-tab input.tab-rename {
  border: none; outline: none; background: transparent; font: inherit; font-weight: 500;
  width: 110px; color: var(--text);
}
.tabstrip-add {
  display: flex; align-items: center; gap: 6px; padding: 0 12px;
  color: rgba(255,255,255,0.8); font-size: 13px; white-space: nowrap; cursor: pointer;
}
.tabstrip-add:hover { color: #fff; background: rgba(0,0,0,0.08); }
.tabstrip-divider { width: 1px; margin: 8px 4px; background: rgba(255,255,255,0.25); flex: none; }
.tab-drop-indicator { position: absolute; top: 4px; bottom: 0; width: 2px; background: #fff; z-index: 5; pointer-events: none; }

/* ============ View toolbar ============ */
#toolbar {
  height: 44px; flex: none;
  display: flex; align-items: center; gap: 2px;
  padding: 0 12px 0 8px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 25;
}
.tb-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 8px; border-radius: var(--radius);
  font-size: 13px; color: var(--text-mid); white-space: nowrap;
}
.tb-btn .icon { color: var(--text-mid); }
.tb-btn:hover { background: var(--bg-hover); }
.tb-btn.active-filter { background: var(--c-greenLight); }
.tb-btn.active-filter:hover { background: #c1efb2; }
.tb-btn.active-sort { background: var(--c-orangeLight); }
.tb-btn.active-sort:hover { background: #fdd3bd; }
.tb-btn.active-group { background: var(--c-blueLight); }
.tb-btn.active-group:hover { background: #bcd3fd; }
.tb-viewname {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 8px; border-radius: var(--radius);
  font-weight: 675; font-size: 13.5px; color: var(--text);
}
.tb-viewname:hover { background: var(--bg-hover); }
.tb-sep { width: 1px; height: 18px; background: var(--border); margin: 0 6px; flex: none; }
.tb-spacer { flex: 1; }
.tb-search-btn {
  width: 28px; height: 28px; border-radius: 9999px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text-mid);
}
.tb-search-btn:hover { background: var(--bg-hover); }
.tb-search-box {
  display: flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 4px 0 10px;
  background: #fff; border: 1px solid var(--border);
  border-top: 2px solid var(--blue-focus);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  position: absolute; right: 8px; top: 43px; width: 300px; z-index: 60;
}
.tb-search-box input { border: none; outline: none; flex: 1; font-size: 13px; height: 100%; }
.tb-search-count { font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.tb-search-box .tb-search-close { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; color: var(--text-quiet); }
.tb-search-box .tb-search-close:hover { background: var(--bg-hover); }

/* ============ View sidebar ============ */
#viewSidebar {
  width: 260px; flex: none;
  background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: relative; z-index: 20;
}
#viewSidebar.collapsed { display: none; }
.vs-create { padding: 8px; border-bottom: 1px solid var(--border-quiet); }
.vs-search { display: flex; align-items: center; gap: 8px; padding: 4px 8px 10px 8px; color: var(--text-quiet); }
.vs-search input { border: none; outline: none; flex: 1; font-size: 13px; }
.vs-list { flex: 1; overflow-y: auto; padding: 8px; }
.vs-item {
  display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 8px; border-radius: var(--radius);
  cursor: pointer; user-select: none; color: var(--text);
}
.vs-item:hover { background: var(--bg-hover-quiet); }
.vs-item.active { background: var(--blue-selected-solid); }
.vs-item.active:hover { background: #dcebfd; }
.vs-item .vs-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-item .vs-more { display: none; color: var(--text-quiet); border-radius: 4px; padding: 2px; }
.vs-item:hover .vs-more { display: inline-flex; }
.vs-item .vs-more:hover { background: var(--bg-hover); }
.vs-item input.vs-rename { border: none; outline: none; background: #fff; box-shadow: 0 0 0 2px var(--blue-focus); border-radius: 3px; font: inherit; flex: 1; min-width: 0; padding: 1px 4px; }
.icon-grid { color: #2d7ff9; }
.icon-kanban { color: #20c933; }
.icon-gallery { color: #8b46ff; }
.icon-calendar { color: #f82b60; }
.icon-form { color: #ff6f2c; }
.vs-footer { border-top: 1px solid var(--border-quiet); padding: 8px; }
.vs-section-label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px 6px 8px; font-size: 13px; font-weight: 675; color: var(--text);
}
.vs-create-item {
  display: flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 8px; border-radius: var(--radius); cursor: pointer;
}
.vs-create-item:hover { background: var(--bg-hover-quiet); }
.vs-create-item .grow { font-size: 13px; }
.vs-create-item .plus { color: var(--text-quiet); }

/* sidebar toggle in toolbar */
.tb-views-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; color: var(--text-mid);
}
.tb-views-toggle:hover { background: var(--bg-hover); }
.tb-views-toggle.on { background: var(--bg-hover); }
