:root {
  --planilha-grid-color: #e0e0e0;
  --planilha-outline-color: #1890ff;
  --planilha-font-color: #262626;
  --planilha-header-bg: #f5f5f5;
  --planilha-header-text: #595959;
  --planilha-header-border: #d9d9d9;
}

.visual-builder-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #fff;
  overflow: hidden;
}

.vb-toolbar {
  height: 48px;
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  flex-shrink: 0;
}

.vb-toolbar .toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.vb-toolbar .toolbar-group button {
  border: none;
  background: transparent;
  box-shadow: none;
  color: #595959;
  cursor: pointer;
  padding: 4px 8px;
}

.vb-toolbar .toolbar-group button:hover {
  background: #e6e6e6;
  color: #000;
  border-radius: 4px;
}

.vb-toolbar .toolbar-divider {
  width: 1px;
  height: 24px;
  background: #d9d9d9;
  margin: 0 12px;
}

.vb-formula-bar {
  height: 32px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e0e0e0;
  background: #fff;
  padding: 0 8px;
  flex-shrink: 0;
}

.vb-formula-bar .cell-address {
  width: 40px;
  font-size: 12px;
  font-weight: 600;
  color: #595959;
  text-align: center;
  border-right: 1px solid #e0e0e0;
  margin-right: 8px;
  user-select: none;
}

.vb-formula-bar .formula-icon {
  color: #8c8c8c;
  font-style: italic;
  font-weight: bold;
  margin-right: 8px;
  user-select: none;
}

.vb-formula-bar .formula-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  height: 100%;
  color: #000;
  width: 100%;
}

.vb-grid {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.vb-grid .spreadsheet-wrapper {
  width: 100%;
  height: 100%;
  overflow: auto;
}

.vb-grid table {
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 100%;
}

.vb-grid th, .vb-grid td {
  border: 1px solid var(--planilha-grid-color);
  padding: 0;
  min-width: 100px;
  height: 24px;
  box-sizing: border-box;
}

.vb-grid thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--planilha-header-bg);
  user-select: none;
}

.vb-grid thead th {
  background: var(--planilha-header-bg);
  font-weight: 600;
  color: var(--planilha-header-text);
  font-size: 12px;
  text-align: center;
  border-bottom: 2px solid var(--planilha-header-border);
  cursor: pointer;
  position: relative;
}

.vb-grid thead th:hover {
  background: #e6e6e6;
}

.vb-grid thead .row-header-corner {
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  background: var(--planilha-header-bg);
  position: sticky;
  left: 0;
  z-index: 20;
  cursor: default;
}

.vb-grid .row-header {
  background: var(--planilha-header-bg);
  font-weight: 600;
  color: var(--planilha-header-text);
  font-size: 12px;
  text-align: center;
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  position: sticky;
  left: 0;
  z-index: 5;
  border-right: 2px solid var(--planilha-header-border);
  cursor: pointer;
  user-select: none;
}

.vb-grid .row-header:hover {
  background: #e6e6e6;
}

.vb-grid td:not(.row-header) {
  background: #fff;
  font-size: 13px;
  color: var(--planilha-font-color);
  padding: 2px 4px;
  white-space: nowrap;
  overflow: hidden;
  cursor: cell;
  user-select: none;
  position: relative;
}

.vb-grid td:not(.row-header).selected {
  outline: 2px solid var(--planilha-outline-color);
  z-index: 2;
}

.vb-grid td:not(.row-header).in-range {
  border: none !important;
  box-shadow: inset 0 0 0 1px var(--planilha-outline-color) !important;
  z-index: 1;
}

.vb-grid td .cell-editor {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  background: transparent;
  color: inherit;
  position: absolute;
  top: 0;
  left: 0;
  padding: 2px 4px;
}

.resize-handle-col {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 20;
}

.resize-handle-col:hover {
  background-color: var(--planilha-outline-color);
}

.resize-handle-row {
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 6px;
  cursor: row-resize;
  z-index: 20;
}

.resize-handle-row:hover {
  background-color: var(--planilha-outline-color);
}
