/* =====================================================
   FORMULÁRIO
   ===================================================== */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  height: 46px;
  background: var(--ink-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--ink-3);
}

.password-wrapper { position: relative; }

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  transition: color var(--t);
}
.password-toggle:hover { color: var(--text-accent); }

/* =====================================================
   BOTÕES
   ===================================================== */
.btn {
  height: 44px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 18px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background var(--t), transform var(--t), box-shadow var(--t), filter var(--t), border-color var(--t);
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.97);
  box-shadow: none;
  transition-duration: 0.08s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: #2563eb;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border-2);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--text-primary);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.btn-success {
  background: rgba(52, 211, 153, 0.1);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.22);
}
.btn-success:hover:not(:disabled) {
  background: rgba(52, 211, 153, 0.18);
  border-color: rgba(52, 211, 153, 0.38);
  box-shadow: 0 6px 20px rgba(52, 211, 153, 0.12);
}

.full-width { width: 100%; }

.btn-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.btn-secondary .btn-spinner {
  border-color: rgba(143, 163, 192, 0.2);
  border-top-color: currentColor;
}

/* =====================================================
   ALERTAS
   ===================================================== */
.alert {
  display: none;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
}
.alert.show { display: block; }

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

/* =====================================================
   LOADER
   ===================================================== */
.loader {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

.table-loading-state {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================
   UI SINGLE SELECT (custom dropdown, mesmo estilo do multi-select)
   ===================================================== */
.ui-sel { position: relative; }

.ui-sel-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px;
  min-height: 34px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: border-color var(--t);
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  user-select: none;
}

.ui-sel-trigger:hover,
.ui-sel--open .ui-sel-trigger { border-color: var(--border-2); }

.ui-sel-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--t);
}

.ui-sel--open .ui-sel-arrow { transform: rotate(180deg); }

.ui-sel-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 13px;
}

.ui-sel-value--selected { color: var(--text-primary); }

.ui-sel-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xs);
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  overflow: hidden;
}

.ui-sel-search-wrap {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.ui-sel-search {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
  font-family: var(--font-body);
}

.ui-sel-search:focus { border-color: var(--accent); }

.ui-sel-list {
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.ui-sel-list::-webkit-scrollbar { width: 4px; }
.ui-sel-list::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }

.ui-sel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background var(--t), color var(--t);
}

.ui-sel-item:hover { background: var(--surface); color: var(--text-primary); }
.ui-sel-item--selected { color: var(--text-primary); }

.ui-sel-check {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--t), border-color var(--t);
}

.ui-sel-item--selected .ui-sel-check {
  background: var(--accent);
  border-color: var(--accent);
}

.ui-sel-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* =====================================================
   UTILITIES
   ===================================================== */
.hidden { display: none !important; }
.center { text-align: center; }
