:root {
  --color-light-blue:                  #cae6ff;
  --color-dark-blue:                   #0072f5;
  --color-widget-button:               var(--color-dark-blue);
  --color-widget-button-active:        #003473;
  --color-widget-button-text:          #ffffff;
  --color-widget-button-disabled:      #d5d5d5;
  --color-widget-button-disabled-text: #737373;
  --color-widget-accessories:          var(--color-dark-blue);
  --color-widget-accessories-neutral:  #afafaf;
  --color-widget-background:           var(--color-light-blue);
  --color-widget-plot-background:      #eeeeee;
  --color-widget-plot-border:          #bcbcbc;
  --color-widget-select-border:        #459ef9;
  --color-widget-input-border:         #0070f6;
  --color-widget-switch-primary:       var(--color-dark-blue);
  --color-widget-switch-off:           #d5d5d5;
  --color-widget-switch-primary-hover: #00aaff;
  --color-widget-switch-off-hover:     #e5e5e5;
  --color-tab-background:              #eff5fc;
  --color-tab-hover:                   var(--color-light-blue);
  --color-tab-active-background:       var(--color-light-blue);
  --color-tab-active-hover:            #98cbf8;
  --color-tab-border:                  #999999;
  --widget-padding-x:                  0.5rem;
  --widget-padding-y:                  0.3rem;
  --font-widget:                       'Open Sans', sans-serif;
  --checkerboard:                      url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAADFJREFUOE9jZGBgEGHAD97gk2YcNYBhmIQBgWSAP52AwoAQwJvQRg1gACckQoC2gQgAIF8IscwEtKYAAAAASUVORK5CYII=);

  --color-ui-button-bg:                white;
  --color-ui-button-border:            gray;
  --color-ui-button-hover-bg:          #eee;
  --color-ui-button-active-bg:         #d5d5d5;
  --color-ui-button-selected-bg:       lightblue;
  --color-ui-button-disabled-opacity:  0.4;
}

/* ── NLW UI Buttons (toolbar, menus, command center — not model widgets) ── */
.nlw-ui-button {
  display:       inline-block;
  padding:       0.5em;
  border:        1px solid var(--color-ui-button-border);
  border-radius: 4px;
  background:    var(--color-ui-button-bg);
  color:         inherit;
  cursor:        pointer;
  font:          inherit;
  font-family:   var(--font-widget);
  line-height:   1;
}
.nlw-ui-button:hover:not(:disabled):not([aria-disabled="true"]) {
  background: var(--color-ui-button-hover-bg);
}
.nlw-ui-button:active:not(:disabled):not([aria-disabled="true"]) {
  background: var(--color-ui-button-active-bg);
}
.nlw-ui-button:disabled,
.nlw-ui-button[disabled],
.nlw-ui-button[aria-disabled="true"] {
  opacity:        var(--color-ui-button-disabled-opacity);
  cursor:         default;
  pointer-events: none;
}
.nlw-ui-button.selected {
  background: var(--color-ui-button-selected-bg);
}

/* ── NLW UI Select (native select with custom caret) ── */
.nlw-ui-select {
  appearance:        none;
  -webkit-appearance: none;
  padding:           0.5em 1.5em 0.5em 0.5em;
  border:            1px solid var(--color-ui-button-border);
  border-radius:     4px;
  background-color:  var(--color-ui-button-bg);
  background-image:  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 0 L10 0 L5 6 Z' fill='rgba(0%2C0%2C0%2C0.55)'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5em center;
  background-size:   0.55em;
  font-family:       var(--font-widget);
  font-size:         12px;
  line-height:       1;
  cursor:            pointer;
  color:             inherit;
}
.nlw-ui-select:hover {
  background-color: var(--color-ui-button-hover-bg);
}

/* ── Searchable Select ── */
.searchable-select {
  position: relative;
  display:  inline-block;
  width:    100%;
}

.ss-overlay {
  position: fixed;
  inset:    0;
  z-index:  99;
}

.ss-trigger {
  display:       inline-flex;
  align-items:   center;
  gap:           0.4em;
  padding:       0.5em;
  background:    var(--color-ui-button-bg);
  border:        1px solid var(--color-ui-button-border);
  border-radius: 4px;
  font-family:   var(--font-widget);
  font-size:     12px;
  line-height:   1;
  cursor:        pointer;
  white-space:   nowrap;
  width:         100%;
  min-width:     4em;
  text-align:    left;
  box-sizing:    border-box;
}

.ss-trigger:hover {
  background: var(--color-ui-button-hover-bg);
}

.ss-trigger-label {
  flex:          1;
  overflow:      hidden;
  text-overflow: ellipsis;
  white-space:   nowrap;
}

.ss-caret {
  font-size:   0.7em;
  opacity:     0.6;
  flex-shrink: 0;
}

.ss-native {
  position:       absolute;
  top:            0;
  left:           0;
  width:          100%;
  height:         100%;
  opacity:        0;
  pointer-events: none;
  z-index:        1;
  cursor:         pointer;
}

@media (pointer: coarse) {
  .ss-native {
    pointer-events: auto;
  }
  .ss-trigger {
    pointer-events: none;
  }
}

.ss-dropdown {
  position:       absolute;
  top:            100%;
  left:           0;
  min-width:      100%;
  background:     white;
  border:         1px solid #ccc;
  border-radius:  8px;
  box-shadow:     0 2px 8px rgba(0, 0, 0, 0.15);
  z-index:        100;
  display:        flex;
  flex-direction: column;
  padding:        4px;
}

.ss-search {
  padding:       0.4em 0.5em;
  border:        none;
  border-bottom: 1px solid #e8e8e8;
  font-family:   var(--font-widget);
  font-size:     12px;
  outline:       none;
  flex-shrink:   0;
  box-sizing:    border-box;
  width:         100%;
}

.ss-list {
  list-style: none;
  margin:     0;
  padding:    0;
  overflow-y: auto;
  max-height: 240px;
}

.ss-option {
  padding:     0.35em 0.6em;
  cursor:      pointer;
  font-family: var(--font-widget);
  font-size:   12px;
  white-space: nowrap;
}

.ss-option:hover:not(.ss-disabled) {
  background: #e8f0fe;
}

.ss-option.ss-highlighted {
  background: #d0e4fd;
}

.ss-option.ss-disabled {
  color:          #aaa;
  cursor:         default;
  pointer-events: none;
}

.ss-option[aria-selected="true"] {
  background:  #f0f5ff;
  font-weight: 500;
}

.netlogo-tab-area {
  border-color: var(--color-tab-border);
}

.netlogo-tab {
  background-color: var(--color-tab-background);
  border-color:     var(--color-tab-border);
  font-size:        16px;
}

.netlogo-tab.netlogo-active {
  background-color: var(--color-tab-active-background);
}

.netlogo-tab:active {
  background-color: var(--color-tab-active-background);
}

.netlogo-tab:hover {
  background-color: var(--color-tab-hover);
}

.netlogo-tab.netlogo-active:hover {
  background-color: var(--color-tab-active-hover);
}

/* Toast */

.toaster {
  position:       absolute;
  top:            20px;
  right:          20px;
  z-index:        1000;
  display:        flex;
  flex-direction: column;
  align-items:    flex-end;
}

.toast {
  position:      relative;
  background:    var(--color-widget-button);
  color:         var(--color-widget-button-text);
  padding:       10px 20px;
  margin:        10px;
  border-radius: 5px;
  box-shadow:    0 2px 6px rgba(0, 0, 0, 0.3);
  overflow:      hidden;
  font-family:   var(--font-widget);
  font-size:     14px;
  display:       flex;
  align-items:   center;
  max-width:     800px;
}

.toast-message {
  margin-right:  20px;
  margin-bottom: 3px;
  flex:          1;
}

.toast-close {
  cursor:         pointer;
  font-weight:    bold;
  vertical-align: middle;
  transform:      translateY(-2px);
}

.toast-progress-bar {
  position:   absolute;
  bottom:     0;
  left:       0;
  width:      100%;
  height:     4px;
  background: var(--color-widget-button-disabled);
}

.toast-progress {
  height:     100%;
  background: var(--color-widget-button-active);
  transition: width 0.1s linear;
}

.toast-success {
  background: #4caf50;
}

.toast-success .toast-progress {
  background: #388e3c;
}

.toast-error {
  background: #f44336;
}

.toast-error .toast-progress {
  background: #d32f2f;
}

.toast-warning {
  background: #ff9800;
}

.toast-warning .toast-progress {
  background: #f57c00;
}
