/* Shared Home-shell upper toolbar band (Ghost Chat / StarMessenger / File Manager). */
:root {
  --gc-toolbar-row-pad-top: 6px;
  --gc-toolbar-row-pad-bottom: 5px;
  --gc-toolbar-btn-h: 28px;
  --gc-toolbar-row-border: 1px;
  --gc-toolbar-scroll-h: 15px;
  --gc-toolbar-band-h: calc(
    var(--gc-toolbar-row-pad-top) +
    var(--gc-toolbar-btn-h) +
    var(--gc-toolbar-row-pad-bottom) +
    var(--gc-toolbar-row-border) +
    var(--gc-toolbar-scroll-h)
  );
  --ccp-toolbar-scroll-track: #B0B0B0;
  --ccp-toolbar-scroll-thumb: #2A2A2A;
  --ccp-toolbar-scroll-thumb-hover: #3A3A3A;
}

html.ccp-embedded-in-shell {
  --gc-toolbar-row-pad-top: 8px;
  --gc-shell-menu-clearance-w: calc(56px * 1.25);
  --gc-shell-menu-gap: 0.125in;
  --gc-top-toolbar-pad-left: calc(8px + var(--gc-shell-menu-clearance-w) + var(--gc-shell-menu-gap));
  --gc-toolbar-band-h: calc(
    var(--gc-toolbar-row-pad-top) +
    var(--gc-toolbar-btn-h) +
    var(--gc-toolbar-row-pad-bottom) +
    var(--gc-toolbar-row-border) +
    var(--gc-toolbar-scroll-h)
  );
}

html.ccp-embedded-in-shell body {
  padding-top: var(--gc-toolbar-band-h);
  padding-bottom: 0;
  background: var(--ccp-toolbar-bg, #111111);
}

.gc-top-toolbar-shell {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-sizing: border-box;
  background: var(--ccp-toolbar-bg, #111111);
  border-bottom: none;
  margin: 0;
  padding: 0;
  height: var(--gc-toolbar-band-h);
  min-height: var(--gc-toolbar-band-h);
  max-height: var(--gc-toolbar-band-h);
}

html.ccp-embedded-in-shell .gc-top-toolbar-shell {
  display: none !important;
}

html.ccp-embedded-in-shell #verticalMidline,
html.ccp-embedded-in-shell .right-panels-casing,
html.ccp-embedded-in-shell .panels-hscroll {
  display: none !important;
}

html.ccp-embedded-in-shell body {
  padding-top: 0 !important;
}

html.ccp-embedded-in-shell .outer-wrap {
  padding-top: 0 !important;
}

html.ccp-embedded-in-shell .gc-top-toolbar {
  padding-top: 6px;
  padding-left: var(--gc-top-toolbar-pad-left);
}

.gc-top-toolbar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: scroll;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: auto;
  scrollbar-gutter: stable;
  scrollbar-color: var(--ccp-toolbar-scroll-thumb, #2A2A2A) var(--ccp-toolbar-scroll-track, #B0B0B0);
  background: var(--ccp-toolbar-bg, #111111);
  box-sizing: border-box;
  height: 100%;
}

.gc-top-toolbar-scroll::-webkit-scrollbar {
  height: 15px;
}

.gc-top-toolbar-scroll::-webkit-scrollbar-track {
  background: var(--ccp-toolbar-scroll-track, #B0B0B0);
}

.gc-top-toolbar-scroll::-webkit-scrollbar-thumb {
  background: var(--ccp-toolbar-scroll-thumb, #2A2A2A);
  border-radius: 2px;
}

.gc-top-toolbar-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--ccp-toolbar-scroll-thumb-hover, #3A3A3A);
}

.gc-top-toolbar {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 4.5px;
  padding: 6px 8px 5px 8px;
  width: max-content;
  min-width: 100%;
  background: transparent;
  border-bottom: none;
  box-sizing: border-box;
}

.gc-top-toolbar .ccp-ctrl-reorder-toolbar {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  padding: 0;
  background: transparent;
  position: static;
  gap: 0;
}

.gc-top-toolbar .ccp-ctrl-reorder-controls {
  flex: 0 0 auto;
  display: flex;
  gap: 4.5px;
}

/* Hand + home + < > match Ghost Chat: 75% of pane button width */
.gc-top-toolbar .ccp-ctrl-reorder-home,
.gc-top-toolbar .ccp-ctrl-reorder-hand,
.gc-top-toolbar .ccp-ctrl-reorder-arrow {
  flex: 0 0 calc(119px * 0.75);
  min-width: calc(119px * 0.75);
  width: calc(119px * 0.75);
  height: 28px;
  font-family: 'Consolas', monospace;
  font-size: 10px;
  font-weight: bold;
  padding: 0 6px;
  margin: 0;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  box-sizing: border-box;
  overflow: visible;
  text-overflow: clip;
  -webkit-appearance: none;
  appearance: none;
  background: var(--ccp-shuffle-btn-bg, #245038);
  color: var(--ccp-shuffle-btn-text, #a8ffcc);
  border: 1px solid var(--ccp-shuffle-btn-border, #3a8060);
}

.gc-top-toolbar .ccp-ctrl-reorder-home {
  font-size: 11px;
}

.gc-top-toolbar .ccp-ctrl-reorder-home:hover,
.gc-top-toolbar .ccp-ctrl-reorder-hand:hover,
.gc-top-toolbar .ccp-ctrl-reorder-arrow:hover {
  background: var(--ccp-shuffle-btn-hover-bg, #2d6a45);
  color: var(--ccp-shuffle-btn-hover-text, #ffffff);
  border-color: var(--ccp-shuffle-btn-hover-border, #00AEEF);
}

.gc-top-toolbar .ccp-ctrl-reorder-hand.active {
  background: var(--ccp-shuffle-btn-active-bg, #2d6a45);
  color: var(--ccp-shuffle-btn-active-text, #ffffff);
  border-color: var(--ccp-shuffle-btn-active-border, #00AEEF);
}

.gc-horz-button-bar {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  gap: 4.5px;
}

.gc-horz-button-bar .ctrl-btn {
  flex: 0 0 119px;
  min-width: 119px;
  width: 119px;
  height: 28px;
  font-family: 'Consolas', monospace;
  font-size: 10px;
  font-weight: bold;
  padding: 0 8px;
  margin: 0;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  box-sizing: border-box;
  overflow: visible;
  text-overflow: clip;
  border: none;
  -webkit-appearance: none;
  appearance: none;
}

/* Pane toolbar buttons — SHOW (pane closed, .showing) vs HIDE (pane open). */
.gc-horz-button-bar .ctrl-btn.showing:not(.ctrl-placeholder-btn):not(.gc-ctrl-is-hidden) {
  background: var(--ccp-btn-bg, #245038);
  color: var(--ccp-btn-text, #a8ffcc);
  border: 1px solid var(--ccp-btn-border, #3a8060);
}

.gc-horz-button-bar .ctrl-btn:not(.showing):not(.ctrl-placeholder-btn):not(.gc-ctrl-is-hidden) {
  background: #00529B;
  color: #ffffff;
  border: 1px solid #0077cc;
}

.gc-horz-button-bar .ctrl-btn.showing:not(.ctrl-placeholder-btn):not(.gc-ctrl-is-hidden):hover {
  background: var(--ccp-btn-hover-bg, #2d6a45);
  color: var(--ccp-btn-hover-text, #ffffff);
  border-color: var(--ccp-btn-hover-border, #00AEEF);
}

.gc-horz-button-bar .ctrl-btn:not(.showing):not(.ctrl-placeholder-btn):not(.gc-ctrl-is-hidden):hover {
  background: #0066b3;
  color: #ffffff;
  border-color: #00AEEF;
}

.gc-horz-button-bar .ctrl-btn.ctrl-placeholder-btn {
  background: #1a3024;
  color: #4a6a54;
  border: 1px solid #2a4a34;
}

@media (max-width: 1024px) {
  .gc-top-toolbar .ccp-ctrl-reorder-home,
  .gc-top-toolbar .ccp-ctrl-reorder-hand,
  .gc-top-toolbar .ccp-ctrl-reorder-arrow {
    flex-basis: calc(107px * 0.75);
    min-width: calc(107px * 0.75);
    width: calc(107px * 0.75);
    font-size: 9px;
    height: 24px;
    padding: 0 4px;
  }
  .gc-horz-button-bar .ctrl-btn {
    flex-basis: 107px;
    min-width: 107px;
    width: 107px;
    font-size: 9px;
    height: 24px;
    padding: 0 6px;
  }
}

html.ccp-embedded-in-shell .gc-top-toolbar-scroll {
  overflow-x: scroll;
  scrollbar-gutter: stable;
}

/* Toolbar right-click customize menu (Ghost Chat parity). */
.gc-horz-button-bar .ctrl-placeholder-btn,
.gc-horz-button-bar .ctrl-btn.gc-ctrl-is-hidden {
  background: #141414;
  border: 1px solid #2a2a2a;
  color: transparent;
  cursor: context-menu;
}

.gc-toolbar-ctx-menu {
  position: fixed;
  z-index: 650;
  display: none;
  min-width: 200px;
  max-width: 280px;
  background: #1a1a1a;
  border: 2px ridge #00AEEF;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  font-family: 'Consolas', monospace;
  font-size: 11px;
  color: #CCCCCC;
}

.gc-toolbar-ctx-menu.visible {
  display: block;
}

.gc-toolbar-ctx-label {
  padding: 5px 12px 3px;
  font-size: 9px;
  font-weight: bold;
  color: #888888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gc-toolbar-ctx-item {
  padding: 6px 12px;
  cursor: pointer;
  color: #CCCCCC;
}

.gc-toolbar-ctx-item:hover:not(.disabled) {
  background: #00529B;
  color: #ffffff;
}

.gc-toolbar-ctx-item.disabled {
  color: #666666;
  cursor: default;
  font-style: italic;
}

.gc-toolbar-ctx-separator {
  height: 1px;
  background: #333333;
  margin: 2px 0;
}
